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.ModelValidationMessage;
10  import org.andromda.metafacades.uml.FrontEndAction;
11  import org.andromda.metafacades.uml.FrontEndPseudostate;
12  import org.apache.log4j.Logger;
13  import org.omg.uml.behavioralelements.statemachines.Pseudostate;
14  
15  /**
16   * Encapsulates a pseudostate and provides specific front-end services. This pseudostate can be a
17   * decision point, junction or initial state.
18   * MetafacadeLogic for FrontEndPseudostate
19   *
20   * @see FrontEndPseudostate
21   */
22  public abstract class FrontEndPseudostateLogic
23      extends PseudostateFacadeLogicImpl
24      implements FrontEndPseudostate
25  {
26      /**
27       * The underlying UML object
28       * @see Object
29       */
30      protected Object metaObject;
31  
32      /** Create Metafacade implementation instance using the MetafacadeFactory from the context
33       * @param metaObjectIn
34       * @param context
35       */
36      protected FrontEndPseudostateLogic(Object metaObjectIn, String context)
37      {
38          super((Pseudostate)metaObjectIn, getContext(context));
39          this.metaObject = metaObjectIn;
40      }
41  
42      /**
43       * The logger instance.
44       */
45      private static final Logger logger = Logger.getLogger(FrontEndPseudostateLogic.class);
46  
47      /**
48       * Gets the context for this metafacade logic instance.
49       * @param context String. Set to FrontEndPseudostate if null
50       * @return context String
51       */
52      private static String getContext(String context)
53      {
54          if (context == null)
55          {
56              context = "org.andromda.metafacades.uml.FrontEndPseudostate";
57          }
58          return context;
59      }
60  
61      /** Reset context only for non-root metafacades
62       * @param context
63       */
64      @Override
65      public void resetMetafacadeContext(String context)
66      {
67          if (!this.contextRoot) // reset context only for non-root metafacades
68          {
69              context = getContext(context);  // to have same value as in original constructor call
70              setMetafacadeContext (context);
71          }
72      }
73  
74      /**
75       * @return boolean true always
76       * @see FrontEndPseudostate
77       */
78      public boolean isFrontEndPseudostateMetaType()
79      {
80          return true;
81      }
82  
83      // --------------- attributes ---------------------
84  
85     /**
86      * @see FrontEndPseudostate#isContainedInFrontEndUseCase()
87      * @return boolean
88      */
89      protected abstract boolean handleIsContainedInFrontEndUseCase();
90  
91      private boolean __containedInFrontEndUseCase1a;
92      private boolean __containedInFrontEndUseCase1aSet = false;
93  
94      /**
95       * Indicates if this "front-end" pseudo date is contained within a "front-end" use case.
96       * @return (boolean)handleIsContainedInFrontEndUseCase()
97       */
98      public final boolean isContainedInFrontEndUseCase()
99      {
100         boolean containedInFrontEndUseCase1a = this.__containedInFrontEndUseCase1a;
101         if (!this.__containedInFrontEndUseCase1aSet)
102         {
103             // containedInFrontEndUseCase has no pre constraints
104             containedInFrontEndUseCase1a = handleIsContainedInFrontEndUseCase();
105             // containedInFrontEndUseCase has no post constraints
106             this.__containedInFrontEndUseCase1a = containedInFrontEndUseCase1a;
107             if (isMetafacadePropertyCachingEnabled())
108             {
109                 this.__containedInFrontEndUseCase1aSet = true;
110             }
111         }
112         return containedInFrontEndUseCase1a;
113     }
114 
115     // ------------- associations ------------------
116 
117     private List<FrontEndAction> __getContainerActions1r;
118     private boolean __getContainerActions1rSet = false;
119 
120     /**
121      * Encapsulates a pseudostate and provides specific front-end services. This pseudostate can be
122      * a
123      * decision point, junction or initial state.
124      * @return (List<FrontEndAction>)handleGetContainerActions()
125      */
126     public final List<FrontEndAction> getContainerActions()
127     {
128         List<FrontEndAction> getContainerActions1r = this.__getContainerActions1r;
129         if (!this.__getContainerActions1rSet)
130         {
131             // frontEndPseudostate has no pre constraints
132             List result = handleGetContainerActions();
133             List shieldedResult = this.shieldedElements(result);
134             try
135             {
136                 getContainerActions1r = (List<FrontEndAction>)shieldedResult;
137             }
138             catch (ClassCastException ex)
139             {
140                 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
141                 FrontEndPseudostateLogic.logger.warn("incorrect metafacade cast for FrontEndPseudostateLogic.getContainerActions List<FrontEndAction> " + result + ": " + shieldedResult);
142             }
143             // frontEndPseudostate has no post constraints
144             this.__getContainerActions1r = getContainerActions1r;
145             if (isMetafacadePropertyCachingEnabled())
146             {
147                 this.__getContainerActions1rSet = true;
148             }
149         }
150         return getContainerActions1r;
151     }
152 
153     /**
154      * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
155      * @return  List
156      */
157     protected abstract List handleGetContainerActions();
158 
159     /**
160      * @param validationMessages Collection<ModelValidationMessage>
161      * @see PseudostateFacadeLogicImpl#validateInvariants(Collection validationMessages)
162      */
163     @Override
164     public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
165     {
166         super.validateInvariants(validationMessages);
167     }
168 }