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.ModelValidationMessage;
10 import org.andromda.metafacades.uml.EventFacade;
11 import org.andromda.metafacades.uml.StateFacade;
12 import org.apache.log4j.Logger;
13 import org.omg.uml.behavioralelements.statemachines.State;
14
15
16
17
18
19
20
21
22
23
24
25 public abstract class StateFacadeLogic
26 extends StateVertexFacadeLogicImpl
27 implements StateFacade
28 {
29
30
31
32
33 protected State metaObject;
34
35
36
37
38
39 protected StateFacadeLogic(State 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(StateFacadeLogic.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.StateFacade";
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 isStateFacadeMetaType()
82 {
83 return true;
84 }
85
86
87
88
89
90
91
92 public final Collection<EventFacade> getDeferrableEvents()
93 {
94 Collection<EventFacade> getDeferrableEvents1r = null;
95
96 Collection result = handleGetDeferrableEvents();
97 List shieldedResult = this.shieldedElements(result);
98 try
99 {
100 getDeferrableEvents1r = (Collection<EventFacade>)shieldedResult;
101 }
102 catch (ClassCastException ex)
103 {
104
105 StateFacadeLogic.logger.warn("incorrect metafacade cast for StateFacadeLogic.getDeferrableEvents Collection<EventFacade> " + result + ": " + shieldedResult);
106 }
107
108 return getDeferrableEvents1r;
109 }
110
111
112
113
114
115 protected abstract Collection handleGetDeferrableEvents();
116
117
118
119
120
121 @Override
122 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
123 {
124 super.validateInvariants(validationMessages);
125 }
126 }