1
2
3
4
5 package org.andromda.metafacades.emf.uml22;
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.ConstraintFacade;
11 import org.andromda.metafacades.uml.ModelElementFacade;
12 import org.apache.log4j.Logger;
13 import org.eclipse.uml2.uml.Constraint;
14
15
16
17
18
19
20
21
22 public abstract class ConstraintFacadeLogic
23 extends ModelElementFacadeLogicImpl
24 implements ConstraintFacade
25 {
26
27
28
29
30 protected Constraint metaObject;
31
32
33
34
35
36 protected ConstraintFacadeLogic(Constraint metaObjectIn, String context)
37 {
38 super(metaObjectIn, getContext(context));
39 this.metaObject = metaObjectIn;
40 }
41
42
43
44
45 private static final Logger logger = Logger.getLogger(ConstraintFacadeLogic.class);
46
47
48
49
50
51
52 private static String getContext(String context)
53 {
54 if (context == null)
55 {
56 context = "org.andromda.metafacades.uml.ConstraintFacade";
57 }
58 return context;
59 }
60
61
62
63
64 @Override
65 public void resetMetafacadeContext(String context)
66 {
67 if (!this.contextRoot)
68 {
69 context = getContext(context);
70 setMetafacadeContext (context);
71 }
72 }
73
74
75
76
77
78 public boolean isConstraintFacadeMetaType()
79 {
80 return true;
81 }
82
83
84
85
86
87
88
89 protected abstract String handleGetBody();
90
91 private String __body1a;
92 private boolean __body1aSet = false;
93
94
95
96
97
98 public final String getBody()
99 {
100 String body1a = this.__body1a;
101 if (!this.__body1aSet)
102 {
103
104 body1a = handleGetBody();
105
106 this.__body1a = body1a;
107 if (isMetafacadePropertyCachingEnabled())
108 {
109 this.__body1aSet = true;
110 }
111 }
112 return body1a;
113 }
114
115
116
117
118
119 protected abstract boolean handleIsInvariant();
120
121 private boolean __invariant2a;
122 private boolean __invariant2aSet = false;
123
124
125
126
127
128
129
130
131
132
133
134 public final boolean isInvariant()
135 {
136 boolean invariant2a = this.__invariant2a;
137 if (!this.__invariant2aSet)
138 {
139
140 invariant2a = handleIsInvariant();
141
142 this.__invariant2a = invariant2a;
143 if (isMetafacadePropertyCachingEnabled())
144 {
145 this.__invariant2aSet = true;
146 }
147 }
148 return invariant2a;
149 }
150
151
152
153
154
155 protected abstract boolean handleIsPreCondition();
156
157 private boolean __preCondition3a;
158 private boolean __preCondition3aSet = false;
159
160
161
162
163
164
165
166
167
168
169
170 public final boolean isPreCondition()
171 {
172 boolean preCondition3a = this.__preCondition3a;
173 if (!this.__preCondition3aSet)
174 {
175
176 preCondition3a = handleIsPreCondition();
177
178 this.__preCondition3a = preCondition3a;
179 if (isMetafacadePropertyCachingEnabled())
180 {
181 this.__preCondition3aSet = true;
182 }
183 }
184 return preCondition3a;
185 }
186
187
188
189
190
191 protected abstract boolean handleIsPostCondition();
192
193 private boolean __postCondition4a;
194 private boolean __postCondition4aSet = false;
195
196
197
198
199
200
201
202
203
204
205
206 public final boolean isPostCondition()
207 {
208 boolean postCondition4a = this.__postCondition4a;
209 if (!this.__postCondition4aSet)
210 {
211
212 postCondition4a = handleIsPostCondition();
213
214 this.__postCondition4a = postCondition4a;
215 if (isMetafacadePropertyCachingEnabled())
216 {
217 this.__postCondition4aSet = true;
218 }
219 }
220 return postCondition4a;
221 }
222
223
224
225
226
227 protected abstract boolean handleIsDefinition();
228
229 private boolean __definition5a;
230 private boolean __definition5aSet = false;
231
232
233
234
235
236
237
238
239
240
241
242 public final boolean isDefinition()
243 {
244 boolean definition5a = this.__definition5a;
245 if (!this.__definition5aSet)
246 {
247
248 definition5a = handleIsDefinition();
249
250 this.__definition5a = definition5a;
251 if (isMetafacadePropertyCachingEnabled())
252 {
253 this.__definition5aSet = true;
254 }
255 }
256 return definition5a;
257 }
258
259
260
261
262
263 protected abstract boolean handleIsBodyExpression();
264
265 private boolean __bodyExpression6a;
266 private boolean __bodyExpression6aSet = false;
267
268
269
270
271
272
273
274
275
276
277
278 public final boolean isBodyExpression()
279 {
280 boolean bodyExpression6a = this.__bodyExpression6a;
281 if (!this.__bodyExpression6aSet)
282 {
283
284 bodyExpression6a = handleIsBodyExpression();
285
286 this.__bodyExpression6a = bodyExpression6a;
287 if (isMetafacadePropertyCachingEnabled())
288 {
289 this.__bodyExpression6aSet = true;
290 }
291 }
292 return bodyExpression6a;
293 }
294
295
296
297
298
299
300
301
302
303 protected abstract String handleGetTranslation(String language);
304
305
306
307
308
309
310
311 public String getTranslation(String language)
312 {
313
314 String returnValue = handleGetTranslation(language);
315
316 return returnValue;
317 }
318
319
320
321
322
323
324
325 public final ModelElementFacade getContextElement()
326 {
327 ModelElementFacade getContextElement1r = null;
328
329 Object result = handleGetContextElement();
330 MetafacadeBase shieldedResult = this.shieldedElement(result);
331 try
332 {
333 getContextElement1r = (ModelElementFacade)shieldedResult;
334 }
335 catch (ClassCastException ex)
336 {
337
338 ConstraintFacadeLogic.logger.warn("incorrect metafacade cast for ConstraintFacadeLogic.getContextElement ModelElementFacade " + result + ": " + shieldedResult);
339 }
340
341 return getContextElement1r;
342 }
343
344
345
346
347
348 protected abstract Object handleGetContextElement();
349
350
351
352
353
354 @Override
355 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
356 {
357 super.validateInvariants(validationMessages);
358 }
359 }