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.ActorFacade;
11  import org.apache.log4j.Logger;
12  import org.omg.uml.behavioralelements.usecases.Actor;
13  
14  /**
15   * An actor specifies a role played by a user or any other system that interacts with the subject.
16   * MetafacadeLogic for ActorFacade
17   *
18   * @see ActorFacade
19   */
20  public abstract class ActorFacadeLogic
21      extends ClassifierFacadeLogicImpl
22      implements ActorFacade
23  {
24      /**
25       * The underlying UML object
26       * @see Actor
27       */
28      protected Actor metaObject;
29  
30      /** Create Metafacade implementation instance using the MetafacadeFactory from the context
31       * @param metaObjectIn
32       * @param context
33       */
34      protected ActorFacadeLogic(Actor metaObjectIn, String context)
35      {
36          super(metaObjectIn, getContext(context));
37          this.metaObject = metaObjectIn;
38      }
39  
40      /**
41       * The logger instance.
42       */
43      private static final Logger logger = Logger.getLogger(ActorFacadeLogic.class);
44  
45      /**
46       * Gets the context for this metafacade logic instance.
47       * @param context String. Set to ActorFacade if null
48       * @return context String
49       */
50      private static String getContext(String context)
51      {
52          if (context == null)
53          {
54              context = "org.andromda.metafacades.uml.ActorFacade";
55          }
56          return context;
57      }
58  
59      /** Reset context only for non-root metafacades
60       * @param context
61       */
62      @Override
63      public void resetMetafacadeContext(String context)
64      {
65          if (!this.contextRoot) // reset context only for non-root metafacades
66          {
67              context = getContext(context);  // to have same value as in original constructor call
68              setMetafacadeContext (context);
69          }
70      }
71  
72      /**
73       * @return boolean true always
74       * @see ActorFacade
75       */
76      public boolean isActorFacadeMetaType()
77      {
78          return true;
79      }
80  
81      // ------------- associations ------------------
82  
83      private List<ActorFacade> __getGeneralizedByActors1r;
84      private boolean __getGeneralizedByActors1rSet = false;
85  
86      /**
87       * All actors generalized by this actor.
88       * @return (List<ActorFacade>)handleGetGeneralizedByActors()
89       */
90      public final List<ActorFacade> getGeneralizedByActors()
91      {
92          List<ActorFacade> getGeneralizedByActors1r = this.__getGeneralizedByActors1r;
93          if (!this.__getGeneralizedByActors1rSet)
94          {
95              // generalizedActors has no pre constraints
96              List result = handleGetGeneralizedByActors();
97              List shieldedResult = this.shieldedElements(result);
98              try
99              {
100                 getGeneralizedByActors1r = (List<ActorFacade>)shieldedResult;
101             }
102             catch (ClassCastException ex)
103             {
104                 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
105                 ActorFacadeLogic.logger.warn("incorrect metafacade cast for ActorFacadeLogic.getGeneralizedByActors List<ActorFacade> " + result + ": " + shieldedResult);
106             }
107             // generalizedActors has no post constraints
108             this.__getGeneralizedByActors1r = getGeneralizedByActors1r;
109             if (isMetafacadePropertyCachingEnabled())
110             {
111                 this.__getGeneralizedByActors1rSet = true;
112             }
113         }
114         return getGeneralizedByActors1r;
115     }
116 
117     /**
118      * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
119      * @return  List
120      */
121     protected abstract List handleGetGeneralizedByActors();
122 
123     private List<ActorFacade> __getGeneralizedActors2r;
124     private boolean __getGeneralizedActors2rSet = false;
125 
126     /**
127      * The set of actors that generalize this actor.
128      * @return (List<ActorFacade>)handleGetGeneralizedActors()
129      */
130     public final List<ActorFacade> getGeneralizedActors()
131     {
132         List<ActorFacade> getGeneralizedActors2r = this.__getGeneralizedActors2r;
133         if (!this.__getGeneralizedActors2rSet)
134         {
135             // generalizedByActors has no pre constraints
136             List result = handleGetGeneralizedActors();
137             List shieldedResult = this.shieldedElements(result);
138             try
139             {
140                 getGeneralizedActors2r = (List<ActorFacade>)shieldedResult;
141             }
142             catch (ClassCastException ex)
143             {
144                 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
145                 ActorFacadeLogic.logger.warn("incorrect metafacade cast for ActorFacadeLogic.getGeneralizedActors List<ActorFacade> " + result + ": " + shieldedResult);
146             }
147             // generalizedByActors has no post constraints
148             this.__getGeneralizedActors2r = getGeneralizedActors2r;
149             if (isMetafacadePropertyCachingEnabled())
150             {
151                 this.__getGeneralizedActors2rSet = true;
152             }
153         }
154         return getGeneralizedActors2r;
155     }
156 
157     /**
158      * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
159      * @return  List
160      */
161     protected abstract List handleGetGeneralizedActors();
162 
163     /**
164      * @param validationMessages Collection<ModelValidationMessage>
165      * @see ClassifierFacadeLogicImpl#validateInvariants(Collection validationMessages)
166      */
167     @Override
168     public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
169     {
170         super.validateInvariants(validationMessages);
171     }
172 }