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 org.andromda.core.metafacade.MetafacadeBase;
9 import org.andromda.core.metafacade.ModelValidationMessage;
10 import org.andromda.metafacades.uml.ClassifierFacade;
11 import org.andromda.metafacades.uml.ObjectFlowStateFacade;
12 import org.apache.log4j.Logger;
13 import org.omg.uml.behavioralelements.activitygraphs.ObjectFlowState;
14
15 /**
16 * A representation of the model object 'Object Flow'. An object flow is an activity edge that can
17 * have objects or data passing along it. Object flows have support for multicast/receive, token
18 * selection from object nodes, and transformation of tokens. Not implemented in UML2.
19 * MetafacadeLogic for ObjectFlowStateFacade
20 *
21 * @see ObjectFlowStateFacade
22 */
23 public abstract class ObjectFlowStateFacadeLogic
24 extends StateFacadeLogicImpl
25 implements ObjectFlowStateFacade
26 {
27 /**
28 * The underlying UML object
29 * @see ObjectFlowState
30 */
31 protected ObjectFlowState metaObject;
32
33 /** Create Metafacade implementation instance using the MetafacadeFactory from the context
34 * @param metaObjectIn
35 * @param context
36 */
37 protected ObjectFlowStateFacadeLogic(ObjectFlowState 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(ObjectFlowStateFacadeLogic.class);
47
48 /**
49 * Gets the context for this metafacade logic instance.
50 * @param context String. Set to ObjectFlowStateFacade 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.ObjectFlowStateFacade";
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 ObjectFlowStateFacade
78 */
79 public boolean isObjectFlowStateFacadeMetaType()
80 {
81 return true;
82 }
83
84 // ------------- associations ------------------
85
86 /**
87 * A representation of the model object 'Object Flow'. An object flow is an activity edge that
88 * can have
89 * objects or data passing along it. Object flows have support for multicast/receive, token
90 * selection
91 * from object nodes, and transformation of tokens. Not implemented in UML2.
92 * @return (ClassifierFacade)handleGetType()
93 */
94 public final ClassifierFacade getType()
95 {
96 ClassifierFacade getType1r = null;
97 // objectFlowStateFacade has no pre constraints
98 Object result = handleGetType();
99 MetafacadeBase shieldedResult = this.shieldedElement(result);
100 try
101 {
102 getType1r = (ClassifierFacade)shieldedResult;
103 }
104 catch (ClassCastException ex)
105 {
106 // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
107 ObjectFlowStateFacadeLogic.logger.warn("incorrect metafacade cast for ObjectFlowStateFacadeLogic.getType ClassifierFacade " + result + ": " + shieldedResult);
108 }
109 // objectFlowStateFacade has no post constraints
110 return getType1r;
111 }
112
113 /**
114 * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
115 * @return Object
116 */
117 protected abstract Object handleGetType();
118
119 /**
120 * @param validationMessages Collection<ModelValidationMessage>
121 * @see StateFacadeLogicImpl#validateInvariants(Collection validationMessages)
122 */
123 @Override
124 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
125 {
126 super.validateInvariants(validationMessages);
127 }
128 }