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.CallEventFacade;
12  import org.andromda.metafacades.uml.OperationFacade;
13  import org.apache.log4j.Logger;
14  import org.omg.uml.behavioralelements.statemachines.CallEvent;
15  
16  /**
17   * A representation of the model object 'Activity'. The specification of parameterized behavior as
18   * the coordinated sequencing of subordinate units whose individual elements are actions.
19   * MetafacadeLogic for CallEventFacade
20   *
21   * @see CallEventFacade
22   */
23  public abstract class CallEventFacadeLogic
24      extends EventFacadeLogicImpl
25      implements CallEventFacade
26  {
27      /**
28       * The underlying UML object
29       * @see CallEvent
30       */
31      protected CallEvent metaObject;
32  
33      /** Create Metafacade implementation instance using the MetafacadeFactory from the context
34       * @param metaObjectIn
35       * @param context
36       */
37      protected CallEventFacadeLogic(CallEvent metaObjectIn, String context)
38      {
39          super(metaObjectIn, getContext(context));
40          this.metaObject = metaObjectIn;
41      }
42  
43      /**
44       * The logger instance.
45       */
46      private static final Logger logger = Logger.getLogger(CallEventFacadeLogic.class);
47  
48      /**
49       * Gets the context for this metafacade logic instance.
50       * @param context String. Set to CallEventFacade 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.CallEventFacade";
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 CallEventFacade
78       */
79      public boolean isCallEventFacadeMetaType()
80      {
81          return true;
82      }
83  
84      // ------------- associations ------------------
85  
86      /**
87       * A representation of the model object 'Activity'. The specification of parameterized behavior
88       * as the
89       * coordinated sequencing of subordinate units whose individual elements are actions.
90       * @return (OperationFacade)handleGetOperation()
91       */
92      public final OperationFacade getOperation()
93      {
94          OperationFacade getOperation1r = null;
95          // callEventFacade has no pre constraints
96          Object result = handleGetOperation();
97          MetafacadeBase shieldedResult = this.shieldedElement(result);
98          try
99          {
100             getOperation1r = (OperationFacade)shieldedResult;
101         }
102         catch (ClassCastException ex)
103         {
104             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
105             CallEventFacadeLogic.logger.warn("incorrect metafacade cast for CallEventFacadeLogic.getOperation OperationFacade " + result + ": " + shieldedResult);
106         }
107         // callEventFacade has no post constraints
108         return getOperation1r;
109     }
110 
111     /**
112      * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
113      * @return Object
114      */
115     protected abstract Object handleGetOperation();
116 
117     /**
118      * A representation of the model object 'Activity'. The specification of parameterized behavior
119      * as the
120      * coordinated sequencing of subordinate units whose individual elements are actions.
121      * @return (Collection<OperationFacade>)handleGetOperations()
122      */
123     public final Collection<OperationFacade> getOperations()
124     {
125         Collection<OperationFacade> getOperations2r = null;
126         // callEventFacade has no pre constraints
127         Collection result = handleGetOperations();
128         List shieldedResult = this.shieldedElements(result);
129         try
130         {
131             getOperations2r = (Collection<OperationFacade>)shieldedResult;
132         }
133         catch (ClassCastException ex)
134         {
135             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
136             CallEventFacadeLogic.logger.warn("incorrect metafacade cast for CallEventFacadeLogic.getOperations Collection<OperationFacade> " + result + ": " + shieldedResult);
137         }
138         // callEventFacade has no post constraints
139         return getOperations2r;
140     }
141 
142     /**
143      * UML Specific type is returned in Collection, transformed by shieldedElements to AndroMDA Metafacade type
144      * @return  Collection
145      */
146     protected abstract Collection handleGetOperations();
147 
148     /**
149      * @param validationMessages Collection<ModelValidationMessage>
150      * @see EventFacadeLogicImpl#validateInvariants(Collection validationMessages)
151      */
152     @Override
153     public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
154     {
155         super.validateInvariants(validationMessages);
156     }
157 }