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.FrontEndAction;
11  import org.andromda.metafacades.uml.FrontEndActivityGraph;
12  import org.andromda.metafacades.uml.FrontEndController;
13  import org.apache.log4j.Logger;
14  import org.omg.uml.behavioralelements.activitygraphs.ActivityGraph;
15  
16  /**
17   * Represents the activity graph describing the details of a presentation tier or "front end" use
18   * case.
19   * MetafacadeLogic for FrontEndActivityGraph
20   *
21   * @see FrontEndActivityGraph
22   */
23  public abstract class FrontEndActivityGraphLogic
24      extends ActivityGraphFacadeLogicImpl
25      implements FrontEndActivityGraph
26  {
27      /**
28       * The underlying UML object
29       * @see Object
30       */
31      protected Object metaObject;
32  
33      /** Create Metafacade implementation instance using the MetafacadeFactory from the context
34       * @param metaObjectIn
35       * @param context
36       */
37      protected FrontEndActivityGraphLogic(Object metaObjectIn, String context)
38      {
39          super((ActivityGraph)metaObjectIn, getContext(context));
40          this.metaObject = metaObjectIn;
41      }
42  
43      /**
44       * The logger instance.
45       */
46      private static final Logger logger = Logger.getLogger(FrontEndActivityGraphLogic.class);
47  
48      /**
49       * Gets the context for this metafacade logic instance.
50       * @param context String. Set to FrontEndActivityGraph if null
51       * @return context String
52       */
53      private static String getContext(String context)
54      {
55          if (context == null)
56          {
57              context = "org.andromda.metafacades.uml.FrontEndActivityGraph";
58          }
59          return context;
60      }
61  
62      /** Reset context only for non-root metafacades
63       * @param context
64       */
65      @Override
66      public void resetMetafacadeContext(String context)
67      {
68          if (!this.contextRoot) // reset context only for non-root metafacades
69          {
70              context = getContext(context);  // to have same value as in original constructor call
71              setMetafacadeContext (context);
72          }
73      }
74  
75      /**
76       * @return boolean true always
77       * @see FrontEndActivityGraph
78       */
79      public boolean isFrontEndActivityGraphMetaType()
80      {
81          return true;
82      }
83  
84      // --------------- attributes ---------------------
85  
86     /**
87      * @see FrontEndActivityGraph#isContainedInFrontEndUseCase()
88      * @return boolean
89      */
90      protected abstract boolean handleIsContainedInFrontEndUseCase();
91  
92      private boolean __containedInFrontEndUseCase1a;
93      private boolean __containedInFrontEndUseCase1aSet = false;
94  
95      /**
96       * True if this element is contained in a FrontEndUseCase.
97       * @return (boolean)handleIsContainedInFrontEndUseCase()
98       */
99      public final boolean isContainedInFrontEndUseCase()
100     {
101         boolean containedInFrontEndUseCase1a = this.__containedInFrontEndUseCase1a;
102         if (!this.__containedInFrontEndUseCase1aSet)
103         {
104             // containedInFrontEndUseCase has no pre constraints
105             containedInFrontEndUseCase1a = handleIsContainedInFrontEndUseCase();
106             // containedInFrontEndUseCase has no post constraints
107             this.__containedInFrontEndUseCase1a = containedInFrontEndUseCase1a;
108             if (isMetafacadePropertyCachingEnabled())
109             {
110                 this.__containedInFrontEndUseCase1aSet = true;
111             }
112         }
113         return containedInFrontEndUseCase1a;
114     }
115 
116     // ------------- associations ------------------
117 
118     private FrontEndController __getController1r;
119     private boolean __getController1rSet = false;
120 
121     /**
122      * Represents the activity graph describing the details of a presentation tier or "front end"
123      * use case.
124      * @return (FrontEndController)handleGetController()
125      */
126     public final FrontEndController getController()
127     {
128         FrontEndController getController1r = this.__getController1r;
129         if (!this.__getController1rSet)
130         {
131             // frontEndActivityGraph has no pre constraints
132             Object result = handleGetController();
133             MetafacadeBase shieldedResult = this.shieldedElement(result);
134             try
135             {
136                 getController1r = (FrontEndController)shieldedResult;
137             }
138             catch (ClassCastException ex)
139             {
140                 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
141                 FrontEndActivityGraphLogic.logger.warn("incorrect metafacade cast for FrontEndActivityGraphLogic.getController FrontEndController " + result + ": " + shieldedResult);
142             }
143             // frontEndActivityGraph has no post constraints
144             this.__getController1r = getController1r;
145             if (isMetafacadePropertyCachingEnabled())
146             {
147                 this.__getController1rSet = true;
148             }
149         }
150         return getController1r;
151     }
152 
153     /**
154      * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
155      * @return Object
156      */
157     protected abstract Object handleGetController();
158 
159     private FrontEndAction __getInitialAction2r;
160     private boolean __getInitialAction2rSet = false;
161 
162     /**
163      * Represents the activity graph describing the details of a presentation tier or "front end"
164      * use case.
165      * @return (FrontEndAction)handleGetInitialAction()
166      */
167     public final FrontEndAction getInitialAction()
168     {
169         FrontEndAction getInitialAction2r = this.__getInitialAction2r;
170         if (!this.__getInitialAction2rSet)
171         {
172             // frontEndActivityGraph has no pre constraints
173             Object result = handleGetInitialAction();
174             MetafacadeBase shieldedResult = this.shieldedElement(result);
175             try
176             {
177                 getInitialAction2r = (FrontEndAction)shieldedResult;
178             }
179             catch (ClassCastException ex)
180             {
181                 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
182                 FrontEndActivityGraphLogic.logger.warn("incorrect metafacade cast for FrontEndActivityGraphLogic.getInitialAction FrontEndAction " + result + ": " + shieldedResult);
183             }
184             // frontEndActivityGraph has no post constraints
185             this.__getInitialAction2r = getInitialAction2r;
186             if (isMetafacadePropertyCachingEnabled())
187             {
188                 this.__getInitialAction2rSet = true;
189             }
190         }
191         return getInitialAction2r;
192     }
193 
194     /**
195      * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
196      * @return Object
197      */
198     protected abstract Object handleGetInitialAction();
199 
200     /**
201      * @param validationMessages Collection<ModelValidationMessage>
202      * @see ActivityGraphFacadeLogicImpl#validateInvariants(Collection validationMessages)
203      */
204     @Override
205     public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
206     {
207         super.validateInvariants(validationMessages);
208     }
209 }