001// license-header java merge-point 002// 003// Attention: generated code (by MetafacadeLogic.vsl) - do not modify! 004// 005package org.andromda.metafacades.uml14; 006 007import java.util.Collection; 008import java.util.List; 009import org.andromda.core.metafacade.MetafacadeBase; 010import org.andromda.core.metafacade.ModelValidationMessage; 011import org.andromda.metafacades.uml.FrontEndAction; 012import org.andromda.metafacades.uml.FrontEndControllerOperation; 013import org.andromda.metafacades.uml.FrontEndEvent; 014import org.apache.log4j.Logger; 015import org.omg.uml.behavioralelements.statemachines.Event; 016 017/** 018 * A front-end event is represented by some kind of even on some kind of front-end (hyperlink, 019 * submit button, etc). 020 * MetafacadeLogic for FrontEndEvent 021 * 022 * @see FrontEndEvent 023 */ 024public abstract class FrontEndEventLogic 025 extends EventFacadeLogicImpl 026 implements FrontEndEvent 027{ 028 /** 029 * The underlying UML object 030 * @see Object 031 */ 032 protected Object metaObject; 033 034 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 035 * @param metaObjectIn 036 * @param context 037 */ 038 protected FrontEndEventLogic(Object metaObjectIn, String context) 039 { 040 super((Event)metaObjectIn, getContext(context)); 041 this.metaObject = metaObjectIn; 042 } 043 044 /** 045 * The logger instance. 046 */ 047 private static final Logger logger = Logger.getLogger(FrontEndEventLogic.class); 048 049 /** 050 * Gets the context for this metafacade logic instance. 051 * @param context String. Set to FrontEndEvent if null 052 * @return context String 053 */ 054 private static String getContext(String context) 055 { 056 if (context == null) 057 { 058 context = "org.andromda.metafacades.uml.FrontEndEvent"; 059 } 060 return context; 061 } 062 063 /** Reset context only for non-root metafacades 064 * @param context 065 */ 066 @Override 067 public void resetMetafacadeContext(String context) 068 { 069 if (!this.contextRoot) // reset context only for non-root metafacades 070 { 071 context = getContext(context); // to have same value as in original constructor call 072 setMetafacadeContext (context); 073 } 074 } 075 076 /** 077 * @return boolean true always 078 * @see FrontEndEvent 079 */ 080 public boolean isFrontEndEventMetaType() 081 { 082 return true; 083 } 084 085 // --------------- attributes --------------------- 086 087 /** 088 * @see FrontEndEvent#isContainedInFrontEndUseCase() 089 * @return boolean 090 */ 091 protected abstract boolean handleIsContainedInFrontEndUseCase(); 092 093 private boolean __containedInFrontEndUseCase1a; 094 private boolean __containedInFrontEndUseCase1aSet = false; 095 096 /** 097 * Indicates whether or not this front end event is contained within a FrontEndUseCase. 098 * @return (boolean)handleIsContainedInFrontEndUseCase() 099 */ 100 public final boolean isContainedInFrontEndUseCase() 101 { 102 boolean containedInFrontEndUseCase1a = this.__containedInFrontEndUseCase1a; 103 if (!this.__containedInFrontEndUseCase1aSet) 104 { 105 // containedInFrontEndUseCase has no pre constraints 106 containedInFrontEndUseCase1a = handleIsContainedInFrontEndUseCase(); 107 // containedInFrontEndUseCase has no post constraints 108 this.__containedInFrontEndUseCase1a = containedInFrontEndUseCase1a; 109 if (isMetafacadePropertyCachingEnabled()) 110 { 111 this.__containedInFrontEndUseCase1aSet = true; 112 } 113 } 114 return containedInFrontEndUseCase1a; 115 } 116 117 // ------------- associations ------------------ 118 119 private FrontEndControllerOperation __getControllerCall1r; 120 private boolean __getControllerCall1rSet = false; 121 122 /** 123 * A front-end event is represented by some kind of even on some kind of front-end (hyperlink, 124 * submit 125 * button, etc). 126 * @return (FrontEndControllerOperation)handleGetControllerCall() 127 */ 128 public final FrontEndControllerOperation getControllerCall() 129 { 130 FrontEndControllerOperation getControllerCall1r = this.__getControllerCall1r; 131 if (!this.__getControllerCall1rSet) 132 { 133 // frontEndEvent has no pre constraints 134 Object result = handleGetControllerCall(); 135 MetafacadeBase shieldedResult = this.shieldedElement(result); 136 try 137 { 138 getControllerCall1r = (FrontEndControllerOperation)shieldedResult; 139 } 140 catch (ClassCastException ex) 141 { 142 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 143 FrontEndEventLogic.logger.warn("incorrect metafacade cast for FrontEndEventLogic.getControllerCall FrontEndControllerOperation " + result + ": " + shieldedResult); 144 } 145 // frontEndEvent has no post constraints 146 this.__getControllerCall1r = getControllerCall1r; 147 if (isMetafacadePropertyCachingEnabled()) 148 { 149 this.__getControllerCall1rSet = true; 150 } 151 } 152 return getControllerCall1r; 153 } 154 155 /** 156 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 157 * @return Object 158 */ 159 protected abstract Object handleGetControllerCall(); 160 161 private FrontEndAction __getAction2r; 162 private boolean __getAction2rSet = false; 163 164 /** 165 * A front-end event is represented by some kind of even on some kind of front-end (hyperlink, 166 * submit 167 * button, etc). 168 * @return (FrontEndAction)handleGetAction() 169 */ 170 public final FrontEndAction getAction() 171 { 172 FrontEndAction getAction2r = this.__getAction2r; 173 if (!this.__getAction2rSet) 174 { 175 // frontEndEvent has no pre constraints 176 Object result = handleGetAction(); 177 MetafacadeBase shieldedResult = this.shieldedElement(result); 178 try 179 { 180 getAction2r = (FrontEndAction)shieldedResult; 181 } 182 catch (ClassCastException ex) 183 { 184 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 185 FrontEndEventLogic.logger.warn("incorrect metafacade cast for FrontEndEventLogic.getAction FrontEndAction " + result + ": " + shieldedResult); 186 } 187 // frontEndEvent has no post constraints 188 this.__getAction2r = getAction2r; 189 if (isMetafacadePropertyCachingEnabled()) 190 { 191 this.__getAction2rSet = true; 192 } 193 } 194 return getAction2r; 195 } 196 197 /** 198 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 199 * @return Object 200 */ 201 protected abstract Object handleGetAction(); 202 203 /** 204 * A front-end event is represented by some kind of even on some kind of front-end (hyperlink, 205 * submit 206 * button, etc). 207 * @return (List<FrontEndControllerOperation>)handleGetControllerCalls() 208 */ 209 public final List<FrontEndControllerOperation> getControllerCalls() 210 { 211 List<FrontEndControllerOperation> getControllerCalls3r = null; 212 // frontEndEvent has no pre constraints 213 List result = handleGetControllerCalls(); 214 List shieldedResult = this.shieldedElements(result); 215 try 216 { 217 getControllerCalls3r = (List<FrontEndControllerOperation>)shieldedResult; 218 } 219 catch (ClassCastException ex) 220 { 221 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 222 FrontEndEventLogic.logger.warn("incorrect metafacade cast for FrontEndEventLogic.getControllerCalls List<FrontEndControllerOperation> " + result + ": " + shieldedResult); 223 } 224 // frontEndEvent has no post constraints 225 return getControllerCalls3r; 226 } 227 228 /** 229 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 230 * @return List 231 */ 232 protected abstract List handleGetControllerCalls(); 233 234 /** 235 * @param validationMessages Collection<ModelValidationMessage> 236 * @see EventFacadeLogicImpl#validateInvariants(Collection validationMessages) 237 */ 238 @Override 239 public void validateInvariants(Collection<ModelValidationMessage> validationMessages) 240 { 241 super.validateInvariants(validationMessages); 242 } 243}