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