1
2
3
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.ActionFacade;
11 import org.andromda.metafacades.uml.ActionStateFacade;
12 import org.andromda.metafacades.uml.TransitionFacade;
13 import org.apache.log4j.Logger;
14 import org.omg.uml.behavioralelements.commonbehavior.Action;
15
16
17
18
19
20
21
22
23
24
25 public abstract class ActionFacadeLogic
26 extends ModelElementFacadeLogicImpl
27 implements ActionFacade
28 {
29
30
31
32
33 protected Action metaObject;
34
35
36
37
38
39 protected ActionFacadeLogic(Action metaObjectIn, String context)
40 {
41 super(metaObjectIn, getContext(context));
42 this.metaObject = metaObjectIn;
43 }
44
45
46
47
48 private static final Logger logger = Logger.getLogger(ActionFacadeLogic.class);
49
50
51
52
53
54
55 private static String getContext(String context)
56 {
57 if (context == null)
58 {
59 context = "org.andromda.metafacades.uml.ActionFacade";
60 }
61 return context;
62 }
63
64
65
66
67 @Override
68 public void resetMetafacadeContext(String context)
69 {
70 if (!this.contextRoot)
71 {
72 context = getContext(context);
73 setMetafacadeContext (context);
74 }
75 }
76
77
78
79
80
81 public boolean isActionFacadeMetaType()
82 {
83 return true;
84 }
85
86
87
88 private ActionStateFacade __getActionState1r;
89 private boolean __getActionState1rSet = false;
90
91
92
93
94
95 public final ActionStateFacade getActionState()
96 {
97 ActionStateFacade getActionState1r = this.__getActionState1r;
98 if (!this.__getActionState1rSet)
99 {
100
101 Object result = handleGetActionState();
102 MetafacadeBase shieldedResult = this.shieldedElement(result);
103 try
104 {
105 getActionState1r = (ActionStateFacade)shieldedResult;
106 }
107 catch (ClassCastException ex)
108 {
109
110 ActionFacadeLogic.logger.warn("incorrect metafacade cast for ActionFacadeLogic.getActionState ActionStateFacade " + result + ": " + shieldedResult);
111 }
112
113 this.__getActionState1r = getActionState1r;
114 if (isMetafacadePropertyCachingEnabled())
115 {
116 this.__getActionState1rSet = true;
117 }
118 }
119 return getActionState1r;
120 }
121
122
123
124
125
126 protected abstract Object handleGetActionState();
127
128
129
130
131
132
133
134
135
136
137
138 public final TransitionFacade getTransition()
139 {
140 TransitionFacade getTransition2r = null;
141
142 Object result = handleGetTransition();
143 MetafacadeBase shieldedResult = this.shieldedElement(result);
144 try
145 {
146 getTransition2r = (TransitionFacade)shieldedResult;
147 }
148 catch (ClassCastException ex)
149 {
150
151 ActionFacadeLogic.logger.warn("incorrect metafacade cast for ActionFacadeLogic.getTransition TransitionFacade " + result + ": " + shieldedResult);
152 }
153
154 return getTransition2r;
155 }
156
157
158
159
160
161 protected abstract Object handleGetTransition();
162
163
164
165
166
167 @Override
168 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
169 {
170 super.validateInvariants(validationMessages);
171 }
172 }