1 // license-header java merge-point
2 //
3 // Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
4 //
5 package org.andromda.metafacades.emf.uml22;
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.CallActionFacade;
11 import org.andromda.metafacades.uml.OperationFacade;
12 import org.apache.log4j.Logger;
13 import org.eclipse.uml2.uml.CallOperationAction;
14
15 /**
16 * A representation of the model object 'Call Operation Action'. An action that transmits an
17 * operation call request to the target object, where it may cause the invocation of associated
18 * behavior. The argument values of the action are available to the execution of the invoked
19 * behavior. If the action is marked synchronous, the execution of the call operation action waits
20 * until the execution of the invoked behavior completes and a reply transmission is returned to the
21 * caller; otherwise execution of the action is complete when the invocation of the operation is
22 * established and the execution of the invoked operation proceeds concurrently with the execution
23 * of the calling behavior. Any values returned as part of the reply transmission are put on the
24 * result output pins of the call operation action. Upon receipt of the reply transmission,
25 * execution of the call operation action is complete.
26 * MetafacadeLogic for CallActionFacade
27 *
28 * @see CallActionFacade
29 */
30 public abstract class CallActionFacadeLogic
31 extends ActionFacadeLogicImpl
32 implements CallActionFacade
33 {
34 /**
35 * The underlying UML object
36 * @see CallOperationAction
37 */
38 protected CallOperationAction metaObject;
39
40 /** Create Metafacade implementation instance using the MetafacadeFactory from the context
41 * @param metaObjectIn
42 * @param context
43 */
44 protected CallActionFacadeLogic(CallOperationAction metaObjectIn, String context)
45 {
46 super(metaObjectIn, getContext(context));
47 this.metaObject = metaObjectIn;
48 }
49
50 /**
51 * The logger instance.
52 */
53 private static final Logger logger = Logger.getLogger(CallActionFacadeLogic.class);
54
55 /**
56 * Gets the context for this metafacade logic instance.
57 * @param context String. Set to CallActionFacade if null
58 * @return context String
59 */
60 private static String getContext(String context)
61 {
62 if (context == null)
63 {
64 context = "org.andromda.metafacades.uml.CallActionFacade";
65 }
66 return context;
67 }
68
69 /** Reset context only for non-root metafacades
70 * @param context
71 */
72 @Override
73 public void resetMetafacadeContext(String context)
74 {
75 if (!this.contextRoot) // reset context only for non-root metafacades
76 {
77 context = getContext(context); // to have same value as in original constructor call
78 setMetafacadeContext (context);
79 }
80 }
81
82 /**
83 * @return boolean true always
84 * @see CallActionFacade
85 */
86 public boolean isCallActionFacadeMetaType()
87 {
88 return true;
89 }
90
91 // ------------- associations ------------------
92
93 /**
94 * A representation of the model object 'Call Operation Action'. An action that transmits an
95 * operation
96 * call request to the target object, where it may cause the invocation of associated behavior.
97 * The
98 * argument values of the action are available to the execution of the invoked behavior. If the
99 * action
100 * is marked synchronous, the execution of the call operation action waits until the execution
101 * of the
102 * invoked behavior completes and a reply transmission is returned to the caller; otherwise
103 * execution
104 * of the action is complete when the invocation of the operation is established and the
105 * execution of
106 * the invoked operation proceeds concurrently with the execution of the calling behavior. Any
107 * values
108 * returned as part of the reply transmission are put on the result output pins of the call
109 * operation
110 * action. Upon receipt of the reply transmission, execution of the call operation action is
111 * complete.
112 * @return (OperationFacade)handleGetOperation()
113 */
114 public final OperationFacade getOperation()
115 {
116 OperationFacade getOperation1r = null;
117 // callActionFacade has no pre constraints
118 Object result = handleGetOperation();
119 MetafacadeBase shieldedResult = this.shieldedElement(result);
120 try
121 {
122 getOperation1r = (OperationFacade)shieldedResult;
123 }
124 catch (ClassCastException ex)
125 {
126 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
127 CallActionFacadeLogic.logger.warn("incorrect metafacade cast for CallActionFacadeLogic.getOperation OperationFacade " + result + ": " + shieldedResult);
128 }
129 // callActionFacade has no post constraints
130 return getOperation1r;
131 }
132
133 /**
134 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
135 * @return Object
136 */
137 protected abstract Object handleGetOperation();
138
139 /**
140 * @param validationMessages Collection<ModelValidationMessage>
141 * @see ActionFacadeLogicImpl#validateInvariants(Collection validationMessages)
142 */
143 @Override
144 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
145 {
146 super.validateInvariants(validationMessages);
147 }
148 }