1
2
3
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.FinalStateFacade;
12 import org.andromda.metafacades.uml.ModelElementFacade;
13 import org.andromda.metafacades.uml.PseudostateFacade;
14 import org.andromda.metafacades.uml.StateFacade;
15 import org.andromda.metafacades.uml.StateMachineFacade;
16 import org.andromda.metafacades.uml.TransitionFacade;
17 import org.apache.log4j.Logger;
18 import org.omg.uml.behavioralelements.statemachines.StateMachine;
19
20
21
22
23
24
25
26
27
28
29 public abstract class StateMachineFacadeLogic
30 extends ModelElementFacadeLogicImpl
31 implements StateMachineFacade
32 {
33
34
35
36
37 protected StateMachine metaObject;
38
39
40
41
42
43 protected StateMachineFacadeLogic(StateMachine metaObjectIn, String context)
44 {
45 super(metaObjectIn, getContext(context));
46 this.metaObject = metaObjectIn;
47 }
48
49
50
51
52 private static final Logger logger = Logger.getLogger(StateMachineFacadeLogic.class);
53
54
55
56
57
58
59 private static String getContext(String context)
60 {
61 if (context == null)
62 {
63 context = "org.andromda.metafacades.uml.StateMachineFacade";
64 }
65 return context;
66 }
67
68
69
70
71 @Override
72 public void resetMetafacadeContext(String context)
73 {
74 if (!this.contextRoot)
75 {
76 context = getContext(context);
77 setMetafacadeContext (context);
78 }
79 }
80
81
82
83
84
85 public boolean isStateMachineFacadeMetaType()
86 {
87 return true;
88 }
89
90
91
92 private Collection<StateFacade> __getStates1r;
93 private boolean __getStates1rSet = false;
94
95
96
97
98
99
100
101
102
103
104
105
106 public final Collection<StateFacade> getStates()
107 {
108 Collection<StateFacade> getStates1r = this.__getStates1r;
109 if (!this.__getStates1rSet)
110 {
111
112 Collection result = handleGetStates();
113 List shieldedResult = this.shieldedElements(result);
114 try
115 {
116 getStates1r = (Collection<StateFacade>)shieldedResult;
117 }
118 catch (ClassCastException ex)
119 {
120
121 StateMachineFacadeLogic.logger.warn("incorrect metafacade cast for StateMachineFacadeLogic.getStates Collection<StateFacade> " + result + ": " + shieldedResult);
122 }
123
124 this.__getStates1r = getStates1r;
125 if (isMetafacadePropertyCachingEnabled())
126 {
127 this.__getStates1rSet = true;
128 }
129 }
130 return getStates1r;
131 }
132
133
134
135
136
137 protected abstract Collection handleGetStates();
138
139 private PseudostateFacade __getInitialState2r;
140 private boolean __getInitialState2rSet = false;
141
142
143
144
145
146
147
148
149
150
151
152
153 public final PseudostateFacade getInitialState()
154 {
155 PseudostateFacade getInitialState2r = this.__getInitialState2r;
156 if (!this.__getInitialState2rSet)
157 {
158
159 Object result = handleGetInitialState();
160 MetafacadeBase shieldedResult = this.shieldedElement(result);
161 try
162 {
163 getInitialState2r = (PseudostateFacade)shieldedResult;
164 }
165 catch (ClassCastException ex)
166 {
167
168 StateMachineFacadeLogic.logger.warn("incorrect metafacade cast for StateMachineFacadeLogic.getInitialState PseudostateFacade " + result + ": " + shieldedResult);
169 }
170
171 this.__getInitialState2r = getInitialState2r;
172 if (isMetafacadePropertyCachingEnabled())
173 {
174 this.__getInitialState2rSet = true;
175 }
176 }
177 return getInitialState2r;
178 }
179
180
181
182
183
184 protected abstract Object handleGetInitialState();
185
186
187
188
189
190
191
192
193
194
195
196
197 public final Collection<PseudostateFacade> getInitialStates()
198 {
199 Collection<PseudostateFacade> getInitialStates3r = null;
200
201 Collection result = handleGetInitialStates();
202 List shieldedResult = this.shieldedElements(result);
203 try
204 {
205 getInitialStates3r = (Collection<PseudostateFacade>)shieldedResult;
206 }
207 catch (ClassCastException ex)
208 {
209
210 StateMachineFacadeLogic.logger.warn("incorrect metafacade cast for StateMachineFacadeLogic.getInitialStates Collection<PseudostateFacade> " + result + ": " + shieldedResult);
211 }
212
213 return getInitialStates3r;
214 }
215
216
217
218
219
220 protected abstract Collection handleGetInitialStates();
221
222
223
224
225
226
227
228
229
230
231
232
233 public final Collection<PseudostateFacade> getPseudostates()
234 {
235 Collection<PseudostateFacade> getPseudostates4r = null;
236
237 Collection result = handleGetPseudostates();
238 List shieldedResult = this.shieldedElements(result);
239 try
240 {
241 getPseudostates4r = (Collection<PseudostateFacade>)shieldedResult;
242 }
243 catch (ClassCastException ex)
244 {
245
246 StateMachineFacadeLogic.logger.warn("incorrect metafacade cast for StateMachineFacadeLogic.getPseudostates Collection<PseudostateFacade> " + result + ": " + shieldedResult);
247 }
248
249 return getPseudostates4r;
250 }
251
252
253
254
255
256 protected abstract Collection handleGetPseudostates();
257
258
259
260
261
262
263
264
265
266
267
268
269 public final Collection<TransitionFacade> getTransitions()
270 {
271 Collection<TransitionFacade> getTransitions5r = null;
272
273 Collection result = handleGetTransitions();
274 List shieldedResult = this.shieldedElements(result);
275 try
276 {
277 getTransitions5r = (Collection<TransitionFacade>)shieldedResult;
278 }
279 catch (ClassCastException ex)
280 {
281
282 StateMachineFacadeLogic.logger.warn("incorrect metafacade cast for StateMachineFacadeLogic.getTransitions Collection<TransitionFacade> " + result + ": " + shieldedResult);
283 }
284
285 return getTransitions5r;
286 }
287
288
289
290
291
292 protected abstract Collection handleGetTransitions();
293
294 private TransitionFacade __getInitialTransition6r;
295 private boolean __getInitialTransition6rSet = false;
296
297
298
299
300
301
302
303
304
305
306
307
308 public final TransitionFacade getInitialTransition()
309 {
310 TransitionFacade getInitialTransition6r = this.__getInitialTransition6r;
311 if (!this.__getInitialTransition6rSet)
312 {
313
314 Object result = handleGetInitialTransition();
315 MetafacadeBase shieldedResult = this.shieldedElement(result);
316 try
317 {
318 getInitialTransition6r = (TransitionFacade)shieldedResult;
319 }
320 catch (ClassCastException ex)
321 {
322
323 StateMachineFacadeLogic.logger.warn("incorrect metafacade cast for StateMachineFacadeLogic.getInitialTransition TransitionFacade " + result + ": " + shieldedResult);
324 }
325
326 this.__getInitialTransition6r = getInitialTransition6r;
327 if (isMetafacadePropertyCachingEnabled())
328 {
329 this.__getInitialTransition6rSet = true;
330 }
331 }
332 return getInitialTransition6r;
333 }
334
335
336
337
338
339 protected abstract Object handleGetInitialTransition();
340
341
342
343
344
345
346
347
348
349
350
351
352 public final Collection<FinalStateFacade> getFinalStates()
353 {
354 Collection<FinalStateFacade> getFinalStates7r = null;
355
356 Collection result = handleGetFinalStates();
357 List shieldedResult = this.shieldedElements(result);
358 try
359 {
360 getFinalStates7r = (Collection<FinalStateFacade>)shieldedResult;
361 }
362 catch (ClassCastException ex)
363 {
364
365 StateMachineFacadeLogic.logger.warn("incorrect metafacade cast for StateMachineFacadeLogic.getFinalStates Collection<FinalStateFacade> " + result + ": " + shieldedResult);
366 }
367
368 return getFinalStates7r;
369 }
370
371
372
373
374
375 protected abstract Collection handleGetFinalStates();
376
377
378
379
380
381
382 public final ModelElementFacade getContextElement()
383 {
384 ModelElementFacade getContextElement8r = null;
385
386 Object result = handleGetContextElement();
387 MetafacadeBase shieldedResult = this.shieldedElement(result);
388 try
389 {
390 getContextElement8r = (ModelElementFacade)shieldedResult;
391 }
392 catch (ClassCastException ex)
393 {
394
395 StateMachineFacadeLogic.logger.warn("incorrect metafacade cast for StateMachineFacadeLogic.getContextElement ModelElementFacade " + result + ": " + shieldedResult);
396 }
397
398 return getContextElement8r;
399 }
400
401
402
403
404
405 protected abstract Object handleGetContextElement();
406
407
408
409
410
411 @Override
412 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
413 {
414 super.validateInvariants(validationMessages);
415 }
416 }