View Javadoc
1   // license-header java merge-point
2   //
3   // Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
4   //
5   package org.andromda.metafacades.uml14;
6   
7   import java.util.Collection;
8   import java.util.List;
9   import org.andromda.core.metafacade.MetafacadeBase;
10  import org.andromda.core.metafacade.ModelValidationMessage;
11  import org.andromda.metafacades.uml.PartitionFacade;
12  import org.andromda.metafacades.uml.StateFacade;
13  import org.andromda.metafacades.uml.StateMachineFacade;
14  import org.andromda.metafacades.uml.StateVertexFacade;
15  import org.andromda.metafacades.uml.TransitionFacade;
16  import org.apache.log4j.Logger;
17  import org.omg.uml.behavioralelements.statemachines.StateVertex;
18  
19  /**
20   * A representation of the model object 'Vertex'. An abstraction of a node in a state machine graph.
21   * In general, it can be the source or destination of any number of transitions.
22   * MetafacadeLogic for StateVertexFacade
23   *
24   * @see StateVertexFacade
25   */
26  public abstract class StateVertexFacadeLogic
27      extends ModelElementFacadeLogicImpl
28      implements StateVertexFacade
29  {
30      /**
31       * The underlying UML object
32       * @see StateVertex
33       */
34      protected StateVertex metaObject;
35  
36      /** Create Metafacade implementation instance using the MetafacadeFactory from the context
37       * @param metaObjectIn
38       * @param context
39       */
40      protected StateVertexFacadeLogic(StateVertex metaObjectIn, String context)
41      {
42          super(metaObjectIn, getContext(context));
43          this.metaObject = metaObjectIn;
44      }
45  
46      /**
47       * The logger instance.
48       */
49      private static final Logger logger = Logger.getLogger(StateVertexFacadeLogic.class);
50  
51      /**
52       * Gets the context for this metafacade logic instance.
53       * @param context String. Set to StateVertexFacade if null
54       * @return context String
55       */
56      private static String getContext(String context)
57      {
58          if (context == null)
59          {
60              context = "org.andromda.metafacades.uml.StateVertexFacade";
61          }
62          return context;
63      }
64  
65      /** Reset context only for non-root metafacades
66       * @param context
67       */
68      @Override
69      public void resetMetafacadeContext(String context)
70      {
71          if (!this.contextRoot) // reset context only for non-root metafacades
72          {
73              context = getContext(context);  // to have same value as in original constructor call
74              setMetafacadeContext (context);
75          }
76      }
77  
78      /**
79       * @return boolean true always
80       * @see StateVertexFacade
81       */
82      public boolean isStateVertexFacadeMetaType()
83      {
84          return true;
85      }
86  
87      // ------------- associations ------------------
88  
89      /**
90       * A representation of the model object 'Vertex'. An abstraction of a node in a state machine
91       * graph. In
92       * general, it can be the source or destination of any number of transitions.
93       * @return (Collection<TransitionFacade>)handleGetOutgoings()
94       */
95      public final Collection<TransitionFacade> getOutgoings()
96      {
97          Collection<TransitionFacade> getOutgoings1r = null;
98          // target has no pre constraints
99          Collection result = handleGetOutgoings();
100         List shieldedResult = this.shieldedElements(result);
101         try
102         {
103             getOutgoings1r = (Collection<TransitionFacade>)shieldedResult;
104         }
105         catch (ClassCastException ex)
106         {
107             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
108             StateVertexFacadeLogic.logger.warn("incorrect metafacade cast for StateVertexFacadeLogic.getOutgoings Collection<TransitionFacade> " + result + ": " + shieldedResult);
109         }
110         // target has no post constraints
111         return getOutgoings1r;
112     }
113 
114     /**
115      * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
116      * @return  Collection
117      */
118     protected abstract Collection handleGetOutgoings();
119 
120     private PartitionFacade __getPartition2r;
121     private boolean __getPartition2rSet = false;
122 
123     /**
124      * All vertices enveloped by this partition.
125      * @return (PartitionFacade)handleGetPartition()
126      */
127     public final PartitionFacade getPartition()
128     {
129         PartitionFacade getPartition2r = this.__getPartition2r;
130         if (!this.__getPartition2rSet)
131         {
132             // vertices has no pre constraints
133             Object result = handleGetPartition();
134             MetafacadeBase shieldedResult = this.shieldedElement(result);
135             try
136             {
137                 getPartition2r = (PartitionFacade)shieldedResult;
138             }
139             catch (ClassCastException ex)
140             {
141                 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
142                 StateVertexFacadeLogic.logger.warn("incorrect metafacade cast for StateVertexFacadeLogic.getPartition PartitionFacade " + result + ": " + shieldedResult);
143             }
144             // vertices has no post constraints
145             this.__getPartition2r = getPartition2r;
146             if (isMetafacadePropertyCachingEnabled())
147             {
148                 this.__getPartition2rSet = true;
149             }
150         }
151         return getPartition2r;
152     }
153 
154     /**
155      * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
156      * @return Object
157      */
158     protected abstract Object handleGetPartition();
159 
160     /**
161      * A representation of the model object 'Vertex'. An abstraction of a node in a state machine
162      * graph. In
163      * general, it can be the source or destination of any number of transitions.
164      * @return (Collection<TransitionFacade>)handleGetIncomings()
165      */
166     public final Collection<TransitionFacade> getIncomings()
167     {
168         Collection<TransitionFacade> getIncomings3r = null;
169         // source has no pre constraints
170         Collection result = handleGetIncomings();
171         List shieldedResult = this.shieldedElements(result);
172         try
173         {
174             getIncomings3r = (Collection<TransitionFacade>)shieldedResult;
175         }
176         catch (ClassCastException ex)
177         {
178             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
179             StateVertexFacadeLogic.logger.warn("incorrect metafacade cast for StateVertexFacadeLogic.getIncomings Collection<TransitionFacade> " + result + ": " + shieldedResult);
180         }
181         // source has no post constraints
182         return getIncomings3r;
183     }
184 
185     /**
186      * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
187      * @return  Collection
188      */
189     protected abstract Collection handleGetIncomings();
190 
191     /**
192      * A representation of the model object 'Vertex'. An abstraction of a node in a state machine
193      * graph. In
194      * general, it can be the source or destination of any number of transitions.
195      * @return (StateFacade)handleGetContainer()
196      */
197     public final StateFacade getContainer()
198     {
199         StateFacade getContainer4r = null;
200         // stateVertexFacade has no pre constraints
201         Object result = handleGetContainer();
202         MetafacadeBase shieldedResult = this.shieldedElement(result);
203         try
204         {
205             getContainer4r = (StateFacade)shieldedResult;
206         }
207         catch (ClassCastException ex)
208         {
209             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
210             StateVertexFacadeLogic.logger.warn("incorrect metafacade cast for StateVertexFacadeLogic.getContainer StateFacade " + result + ": " + shieldedResult);
211         }
212         // stateVertexFacade has no post constraints
213         return getContainer4r;
214     }
215 
216     /**
217      * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
218      * @return Object
219      */
220     protected abstract Object handleGetContainer();
221 
222     private StateMachineFacade __getStateMachine5r;
223     private boolean __getStateMachine5rSet = false;
224 
225     /**
226      * A representation of the model object 'Vertex'. An abstraction of a node in a state machine
227      * graph. In
228      * general, it can be the source or destination of any number of transitions.
229      * @return (StateMachineFacade)handleGetStateMachine()
230      */
231     public final StateMachineFacade getStateMachine()
232     {
233         StateMachineFacade getStateMachine5r = this.__getStateMachine5r;
234         if (!this.__getStateMachine5rSet)
235         {
236             // stateVertexFacade has no pre constraints
237             Object result = handleGetStateMachine();
238             MetafacadeBase shieldedResult = this.shieldedElement(result);
239             try
240             {
241                 getStateMachine5r = (StateMachineFacade)shieldedResult;
242             }
243             catch (ClassCastException ex)
244             {
245                 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
246                 StateVertexFacadeLogic.logger.warn("incorrect metafacade cast for StateVertexFacadeLogic.getStateMachine StateMachineFacade " + result + ": " + shieldedResult);
247             }
248             // stateVertexFacade has no post constraints
249             this.__getStateMachine5r = getStateMachine5r;
250             if (isMetafacadePropertyCachingEnabled())
251             {
252                 this.__getStateMachine5rSet = true;
253             }
254         }
255         return getStateMachine5r;
256     }
257 
258     /**
259      * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
260      * @return Object
261      */
262     protected abstract Object handleGetStateMachine();
263 
264     /**
265      * @param validationMessages Collection<ModelValidationMessage>
266      * @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages)
267      */
268     @Override
269     public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
270     {
271         super.validateInvariants(validationMessages);
272     }
273 }