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 org.andromda.core.metafacade.MetafacadeBase;
9   import org.andromda.core.metafacade.ModelValidationMessage;
10  import org.andromda.metafacades.uml.StateMachineFacade;
11  import org.andromda.metafacades.uml.SubactivityStateFacade;
12  import org.apache.log4j.Logger;
13  import org.omg.uml.behavioralelements.activitygraphs.SubactivityState;
14  
15  /**
16   * State machines can be used to express the behavior of part of a system. Behavior is modeled as a
17   * traversal of a graph of state nodes interconnected by one or more joined transition arcs that are
18   * triggered by the dispatching of series of (event) occurrences. During this traversal, the state
19   * machine executes a series of activities associated with various elements of the state machine.
20   * Not implmented for UML2.
21   * MetafacadeLogic for SubactivityStateFacade
22   *
23   * @see SubactivityStateFacade
24   */
25  public abstract class SubactivityStateFacadeLogic
26      extends StateFacadeLogicImpl
27      implements SubactivityStateFacade
28  {
29      /**
30       * The underlying UML object
31       * @see SubactivityState
32       */
33      protected SubactivityState metaObject;
34  
35      /** Create Metafacade implementation instance using the MetafacadeFactory from the context
36       * @param metaObjectIn
37       * @param context
38       */
39      protected SubactivityStateFacadeLogic(SubactivityState metaObjectIn, String context)
40      {
41          super(metaObjectIn, getContext(context));
42          this.metaObject = metaObjectIn;
43      }
44  
45      /**
46       * The logger instance.
47       */
48      private static final Logger logger = Logger.getLogger(SubactivityStateFacadeLogic.class);
49  
50      /**
51       * Gets the context for this metafacade logic instance.
52       * @param context String. Set to SubactivityStateFacade if null
53       * @return context String
54       */
55      private static String getContext(String context)
56      {
57          if (context == null)
58          {
59              context = "org.andromda.metafacades.uml.SubactivityStateFacade";
60          }
61          return context;
62      }
63  
64      /** Reset context only for non-root metafacades
65       * @param context
66       */
67      @Override
68      public void resetMetafacadeContext(String context)
69      {
70          if (!this.contextRoot) // reset context only for non-root metafacades
71          {
72              context = getContext(context);  // to have same value as in original constructor call
73              setMetafacadeContext (context);
74          }
75      }
76  
77      /**
78       * @return boolean true always
79       * @see SubactivityStateFacade
80       */
81      public boolean isSubactivityStateFacadeMetaType()
82      {
83          return true;
84      }
85  
86      // --------------- attributes ---------------------
87  
88     /**
89      * @see SubactivityStateFacade#isDynamic()
90      * @return boolean
91      */
92      protected abstract boolean handleIsDynamic();
93  
94      private boolean __dynamic1a;
95      private boolean __dynamic1aSet = false;
96  
97      /**
98       * TODO: Model Documentation for SubactivityStateFacade.dynamic
99       * @return (boolean)handleIsDynamic()
100      */
101     public final boolean isDynamic()
102     {
103         boolean dynamic1a = this.__dynamic1a;
104         if (!this.__dynamic1aSet)
105         {
106             // dynamic has no pre constraints
107             dynamic1a = handleIsDynamic();
108             // dynamic has no post constraints
109             this.__dynamic1a = dynamic1a;
110             if (isMetafacadePropertyCachingEnabled())
111             {
112                 this.__dynamic1aSet = true;
113             }
114         }
115         return dynamic1a;
116     }
117 
118     // ------------- associations ------------------
119 
120     /**
121      * State machines can be used to express the behavior of part of a system. Behavior is modeled
122      * as a
123      * traversal of a graph of state nodes interconnected by one or more joined transition arcs that
124      * are
125      * triggered by the dispatching of series of (event) occurrences. During this traversal, the
126      * state
127      * machine executes a series of activities associated with various elements of the state
128      * machine. Not
129      * implmented for UML2.
130      * @return (StateMachineFacade)handleGetSubmachine()
131      */
132     public final StateMachineFacade getSubmachine()
133     {
134         StateMachineFacade getSubmachine1r = null;
135         // subactivityStateFacade has no pre constraints
136         Object result = handleGetSubmachine();
137         MetafacadeBase shieldedResult = this.shieldedElement(result);
138         try
139         {
140             getSubmachine1r = (StateMachineFacade)shieldedResult;
141         }
142         catch (ClassCastException ex)
143         {
144             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
145             SubactivityStateFacadeLogic.logger.warn("incorrect metafacade cast for SubactivityStateFacadeLogic.getSubmachine StateMachineFacade " + result + ": " + shieldedResult);
146         }
147         // subactivityStateFacade has no post constraints
148         return getSubmachine1r;
149     }
150 
151     /**
152      * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
153      * @return Object
154      */
155     protected abstract Object handleGetSubmachine();
156 
157     /**
158      * @param validationMessages Collection<ModelValidationMessage>
159      * @see StateFacadeLogicImpl#validateInvariants(Collection validationMessages)
160      */
161     @Override
162     public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
163     {
164         super.validateInvariants(validationMessages);
165     }
166 }