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.ActionStateFacade;
12  import org.andromda.metafacades.uml.ActivityGraphFacade;
13  import org.andromda.metafacades.uml.ObjectFlowStateFacade;
14  import org.andromda.metafacades.uml.PartitionFacade;
15  import org.andromda.metafacades.uml.UseCaseFacade;
16  import org.apache.log4j.Logger;
17  import org.omg.uml.behavioralelements.activitygraphs.ActivityGraph;
18  
19  /**
20   * State machines can be used to express the behavior of part of a system. Behavior is modeled as a
21   * traversal of a graph of state nodes interconnected by one or more joined transition arcs that are
22   * triggered by the dispatching of series of (event) occurrences. During this traversal, the state
23   * machine executes a series of activities associated with various elements of the state machine.
24   * MetafacadeLogic for ActivityGraphFacade
25   *
26   * @see ActivityGraphFacade
27   */
28  public abstract class ActivityGraphFacadeLogic
29      extends StateMachineFacadeLogicImpl
30      implements ActivityGraphFacade
31  {
32      /**
33       * The underlying UML object
34       * @see ActivityGraph
35       */
36      protected ActivityGraph metaObject;
37  
38      /** Create Metafacade implementation instance using the MetafacadeFactory from the context
39       * @param metaObjectIn
40       * @param context
41       */
42      protected ActivityGraphFacadeLogic(ActivityGraph metaObjectIn, String context)
43      {
44          super(metaObjectIn, getContext(context));
45          this.metaObject = metaObjectIn;
46      }
47  
48      /**
49       * The logger instance.
50       */
51      private static final Logger logger = Logger.getLogger(ActivityGraphFacadeLogic.class);
52  
53      /**
54       * Gets the context for this metafacade logic instance.
55       * @param context String. Set to ActivityGraphFacade if null
56       * @return context String
57       */
58      private static String getContext(String context)
59      {
60          if (context == null)
61          {
62              context = "org.andromda.metafacades.uml.ActivityGraphFacade";
63          }
64          return context;
65      }
66  
67      /** Reset context only for non-root metafacades
68       * @param context
69       */
70      @Override
71      public void resetMetafacadeContext(String context)
72      {
73          if (!this.contextRoot) // reset context only for non-root metafacades
74          {
75              context = getContext(context);  // to have same value as in original constructor call
76              setMetafacadeContext (context);
77          }
78      }
79  
80      /**
81       * @return boolean true always
82       * @see ActivityGraphFacade
83       */
84      public boolean isActivityGraphFacadeMetaType()
85      {
86          return true;
87      }
88  
89      // ------------- associations ------------------
90  
91      /**
92       * State machines can be used to express the behavior of part of a system. Behavior is modeled
93       * as a
94       * traversal of a graph of state nodes interconnected by one or more joined transition arcs that
95       * are
96       * triggered by the dispatching of series of (event) occurrences. During this traversal, the
97       * state
98       * machine executes a series of activities associated with various elements of the state
99       * machine.
100      * @return (Collection<ObjectFlowStateFacade>)handleGetObjectFlowStates()
101      */
102     public final Collection<ObjectFlowStateFacade> getObjectFlowStates()
103     {
104         Collection<ObjectFlowStateFacade> getObjectFlowStates1r = null;
105         // activityGraphFacade has no pre constraints
106         Collection result = handleGetObjectFlowStates();
107         List shieldedResult = this.shieldedElements(result);
108         try
109         {
110             getObjectFlowStates1r = (Collection<ObjectFlowStateFacade>)shieldedResult;
111         }
112         catch (ClassCastException ex)
113         {
114             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
115             ActivityGraphFacadeLogic.logger.warn("incorrect metafacade cast for ActivityGraphFacadeLogic.getObjectFlowStates Collection<ObjectFlowStateFacade> " + result + ": " + shieldedResult);
116         }
117         // activityGraphFacade has no post constraints
118         return getObjectFlowStates1r;
119     }
120 
121     /**
122      * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
123      * @return  Collection
124      */
125     protected abstract Collection handleGetObjectFlowStates();
126 
127     /**
128      * State machines can be used to express the behavior of part of a system. Behavior is modeled
129      * as a
130      * traversal of a graph of state nodes interconnected by one or more joined transition arcs that
131      * are
132      * triggered by the dispatching of series of (event) occurrences. During this traversal, the
133      * state
134      * machine executes a series of activities associated with various elements of the state
135      * machine.
136      * @return (Collection<ActionStateFacade>)handleGetActionStates()
137      */
138     public final Collection<ActionStateFacade> getActionStates()
139     {
140         Collection<ActionStateFacade> getActionStates2r = null;
141         // activityGraphFacade has no pre constraints
142         Collection result = handleGetActionStates();
143         List shieldedResult = this.shieldedElements(result);
144         try
145         {
146             getActionStates2r = (Collection<ActionStateFacade>)shieldedResult;
147         }
148         catch (ClassCastException ex)
149         {
150             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
151             ActivityGraphFacadeLogic.logger.warn("incorrect metafacade cast for ActivityGraphFacadeLogic.getActionStates Collection<ActionStateFacade> " + result + ": " + shieldedResult);
152         }
153         // activityGraphFacade has no post constraints
154         return getActionStates2r;
155     }
156 
157     /**
158      * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
159      * @return  Collection
160      */
161     protected abstract Collection handleGetActionStates();
162 
163     /**
164      * State machines can be used to express the behavior of part of a system. Behavior is modeled
165      * as a
166      * traversal of a graph of state nodes interconnected by one or more joined transition arcs that
167      * are
168      * triggered by the dispatching of series of (event) occurrences. During this traversal, the
169      * state
170      * machine executes a series of activities associated with various elements of the state
171      * machine.
172      * @return (Collection<PartitionFacade>)handleGetPartitions()
173      */
174     public final Collection<PartitionFacade> getPartitions()
175     {
176         Collection<PartitionFacade> getPartitions3r = null;
177         // activityGraph has no pre constraints
178         Collection result = handleGetPartitions();
179         List shieldedResult = this.shieldedElements(result);
180         try
181         {
182             getPartitions3r = (Collection<PartitionFacade>)shieldedResult;
183         }
184         catch (ClassCastException ex)
185         {
186             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
187             ActivityGraphFacadeLogic.logger.warn("incorrect metafacade cast for ActivityGraphFacadeLogic.getPartitions Collection<PartitionFacade> " + result + ": " + shieldedResult);
188         }
189         // activityGraph has no post constraints
190         return getPartitions3r;
191     }
192 
193     /**
194      * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
195      * @return  Collection
196      */
197     protected abstract Collection handleGetPartitions();
198 
199     /**
200      * The first activity graph directly owned by this use-case.
201      * @return (UseCaseFacade)handleGetUseCase()
202      */
203     public final UseCaseFacade getUseCase()
204     {
205         UseCaseFacade getUseCase4r = null;
206         // firstActivityGraph has no pre constraints
207         Object result = handleGetUseCase();
208         MetafacadeBase shieldedResult = this.shieldedElement(result);
209         try
210         {
211             getUseCase4r = (UseCaseFacade)shieldedResult;
212         }
213         catch (ClassCastException ex)
214         {
215             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
216             ActivityGraphFacadeLogic.logger.warn("incorrect metafacade cast for ActivityGraphFacadeLogic.getUseCase UseCaseFacade " + result + ": " + shieldedResult);
217         }
218         // firstActivityGraph has no post constraints
219         return getUseCase4r;
220     }
221 
222     /**
223      * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
224      * @return Object
225      */
226     protected abstract Object handleGetUseCase();
227 
228     /**
229      * @param validationMessages Collection<ModelValidationMessage>
230      * @see StateMachineFacadeLogicImpl#validateInvariants(Collection validationMessages)
231      */
232     @Override
233     public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
234     {
235         super.validateInvariants(validationMessages);
236     }
237 }