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