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.EventFacade; 012import org.andromda.metafacades.uml.ParameterFacade; 013import org.andromda.metafacades.uml.StateFacade; 014import org.andromda.metafacades.uml.TransitionFacade; 015import org.apache.log4j.Logger; 016import org.omg.uml.behavioralelements.statemachines.Event; 017 018/** 019 * A representation of the model object 'Activity'. The specification of parameterized behavior as 020 * the coordinated sequencing of subordinate units whose individual elements are actions. 021 * MetafacadeLogic for EventFacade 022 * 023 * @see EventFacade 024 */ 025public abstract class EventFacadeLogic 026 extends ModelElementFacadeLogicImpl 027 implements EventFacade 028{ 029 /** 030 * The underlying UML object 031 * @see Event 032 */ 033 protected Event metaObject; 034 035 /** Create Metafacade implementation instance using the MetafacadeFactory from the context 036 * @param metaObjectIn 037 * @param context 038 */ 039 protected EventFacadeLogic(Event metaObjectIn, String context) 040 { 041 super(metaObjectIn, getContext(context)); 042 this.metaObject = metaObjectIn; 043 } 044 045 /** 046 * The logger instance. 047 */ 048 private static final Logger logger = Logger.getLogger(EventFacadeLogic.class); 049 050 /** 051 * Gets the context for this metafacade logic instance. 052 * @param context String. Set to EventFacade if null 053 * @return context String 054 */ 055 private static String getContext(String context) 056 { 057 if (context == null) 058 { 059 context = "org.andromda.metafacades.uml.EventFacade"; 060 } 061 return context; 062 } 063 064 /** Reset context only for non-root metafacades 065 * @param context 066 */ 067 @Override 068 public void resetMetafacadeContext(String context) 069 { 070 if (!this.contextRoot) // reset context only for non-root metafacades 071 { 072 context = getContext(context); // to have same value as in original constructor call 073 setMetafacadeContext (context); 074 } 075 } 076 077 /** 078 * @return boolean true always 079 * @see EventFacade 080 */ 081 public boolean isEventFacadeMetaType() 082 { 083 return true; 084 } 085 086 // ------------- associations ------------------ 087 088 /** 089 * If this parameter is located on an event, this will represent that event. 090 * @return (Collection<ParameterFacade>)handleGetParameters() 091 */ 092 public final Collection<ParameterFacade> getParameters() 093 { 094 Collection<ParameterFacade> getParameters1r = null; 095 // event has no pre constraints 096 Collection result = handleGetParameters(); 097 List shieldedResult = this.shieldedElements(result); 098 try 099 { 100 getParameters1r = (Collection<ParameterFacade>)shieldedResult; 101 } 102 catch (ClassCastException ex) 103 { 104 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 105 EventFacadeLogic.logger.warn("incorrect metafacade cast for EventFacadeLogic.getParameters Collection<ParameterFacade> " + result + ": " + shieldedResult); 106 } 107 // event has no post constraints 108 return getParameters1r; 109 } 110 111 /** 112 * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type 113 * @return Collection 114 */ 115 protected abstract Collection handleGetParameters(); 116 117 /** 118 * If a trigger is present on this transition, this event represents that trigger. 119 * @return (TransitionFacade)handleGetTransition() 120 */ 121 public final TransitionFacade getTransition() 122 { 123 TransitionFacade getTransition2r = null; 124 // trigger has no pre constraints 125 Object result = handleGetTransition(); 126 MetafacadeBase shieldedResult = this.shieldedElement(result); 127 try 128 { 129 getTransition2r = (TransitionFacade)shieldedResult; 130 } 131 catch (ClassCastException ex) 132 { 133 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 134 EventFacadeLogic.logger.warn("incorrect metafacade cast for EventFacadeLogic.getTransition TransitionFacade " + result + ": " + shieldedResult); 135 } 136 // trigger has no post constraints 137 return getTransition2r; 138 } 139 140 /** 141 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 142 * @return Object 143 */ 144 protected abstract Object handleGetTransition(); 145 146 /** 147 * Events to which is being deferred in this action state. 148 * @return (StateFacade)handleGetState() 149 */ 150 public final StateFacade getState() 151 { 152 StateFacade getState3r = null; 153 // deferrableEvents has no pre constraints 154 Object result = handleGetState(); 155 MetafacadeBase shieldedResult = this.shieldedElement(result); 156 try 157 { 158 getState3r = (StateFacade)shieldedResult; 159 } 160 catch (ClassCastException ex) 161 { 162 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn 163 EventFacadeLogic.logger.warn("incorrect metafacade cast for EventFacadeLogic.getState StateFacade " + result + ": " + shieldedResult); 164 } 165 // deferrableEvents has no post constraints 166 return getState3r; 167 } 168 169 /** 170 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type 171 * @return Object 172 */ 173 protected abstract Object handleGetState(); 174 175 /** 176 * @param validationMessages Collection<ModelValidationMessage> 177 * @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages) 178 */ 179 @Override 180 public void validateInvariants(Collection<ModelValidationMessage> validationMessages) 181 { 182 super.validateInvariants(validationMessages); 183 } 184}