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.GeneralizableElementFacade;
12 import org.andromda.metafacades.uml.GeneralizationFacade;
13 import org.apache.log4j.Logger;
14 import org.omg.uml.foundation.core.GeneralizableElement;
15
16
17
18
19
20
21
22 public abstract class GeneralizableElementFacadeLogic
23 extends ModelElementFacadeLogicImpl
24 implements GeneralizableElementFacade
25 {
26
27
28
29
30 protected GeneralizableElement metaObject;
31
32
33
34
35
36 protected GeneralizableElementFacadeLogic(GeneralizableElement 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(GeneralizableElementFacadeLogic.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.GeneralizableElementFacade";
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 isGeneralizableElementFacadeMetaType()
79 {
80 return true;
81 }
82
83
84
85
86
87
88
89 protected abstract String handleGetGeneralizationList();
90
91 private String __generalizationList1a;
92 private boolean __generalizationList1aSet = false;
93
94
95
96
97
98 public final String getGeneralizationList()
99 {
100 String generalizationList1a = this.__generalizationList1a;
101 if (!this.__generalizationList1aSet)
102 {
103
104 generalizationList1a = handleGetGeneralizationList();
105
106 this.__generalizationList1a = generalizationList1a;
107 if (isMetafacadePropertyCachingEnabled())
108 {
109 this.__generalizationList1aSet = true;
110 }
111 }
112 return generalizationList1a;
113 }
114
115
116
117
118
119
120
121
122
123
124
125 protected abstract Object handleFindTaggedValue(String tagName, boolean follow);
126
127
128
129
130
131
132
133
134
135
136 public Object findTaggedValue(String tagName, boolean follow)
137 {
138
139 Object returnValue = handleFindTaggedValue(tagName, follow);
140
141 return returnValue;
142 }
143
144
145
146
147
148
149
150 public final Collection<GeneralizationFacade> getGeneralizationLinks()
151 {
152 Collection<GeneralizationFacade> getGeneralizationLinks1r = null;
153
154 Collection result = handleGetGeneralizationLinks();
155 List shieldedResult = this.shieldedElements(result);
156 try
157 {
158 getGeneralizationLinks1r = (Collection<GeneralizationFacade>)shieldedResult;
159 }
160 catch (ClassCastException ex)
161 {
162
163 GeneralizableElementFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizableElementFacadeLogic.getGeneralizationLinks Collection<GeneralizationFacade> " + result + ": " + shieldedResult);
164 }
165
166 return getGeneralizationLinks1r;
167 }
168
169
170
171
172
173 protected abstract Collection handleGetGeneralizationLinks();
174
175
176
177
178
179 public final Collection<GeneralizableElementFacade> getAllGeneralizations()
180 {
181 Collection<GeneralizableElementFacade> getAllGeneralizations2r = null;
182
183 Collection result = handleGetAllGeneralizations();
184 List shieldedResult = this.shieldedElements(result);
185 try
186 {
187 getAllGeneralizations2r = (Collection<GeneralizableElementFacade>)shieldedResult;
188 }
189 catch (ClassCastException ex)
190 {
191
192 GeneralizableElementFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizableElementFacadeLogic.getAllGeneralizations Collection<GeneralizableElementFacade> " + result + ": " + shieldedResult);
193 }
194
195 return getAllGeneralizations2r;
196 }
197
198
199
200
201
202 protected abstract Collection handleGetAllGeneralizations();
203
204
205
206
207
208 public final Collection<GeneralizableElementFacade> getGeneralizations()
209 {
210 Collection<GeneralizableElementFacade> getGeneralizations3r = null;
211
212 Collection result = handleGetGeneralizations();
213 List shieldedResult = this.shieldedElements(result);
214 try
215 {
216 getGeneralizations3r = (Collection<GeneralizableElementFacade>)shieldedResult;
217 }
218 catch (ClassCastException ex)
219 {
220
221 GeneralizableElementFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizableElementFacadeLogic.getGeneralizations Collection<GeneralizableElementFacade> " + result + ": " + shieldedResult);
222 }
223
224 return getGeneralizations3r;
225 }
226
227
228
229
230
231 protected abstract Collection handleGetGeneralizations();
232
233 private Collection<GeneralizableElementFacade> __getSpecializations4r;
234 private boolean __getSpecializations4rSet = false;
235
236
237
238
239
240 public final Collection<GeneralizableElementFacade> getSpecializations()
241 {
242 Collection<GeneralizableElementFacade> getSpecializations4r = this.__getSpecializations4r;
243 if (!this.__getSpecializations4rSet)
244 {
245
246 Collection result = handleGetSpecializations();
247 List shieldedResult = this.shieldedElements(result);
248 try
249 {
250 getSpecializations4r = (Collection<GeneralizableElementFacade>)shieldedResult;
251 }
252 catch (ClassCastException ex)
253 {
254
255 GeneralizableElementFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizableElementFacadeLogic.getSpecializations Collection<GeneralizableElementFacade> " + result + ": " + shieldedResult);
256 }
257
258 this.__getSpecializations4r = getSpecializations4r;
259 if (isMetafacadePropertyCachingEnabled())
260 {
261 this.__getSpecializations4rSet = true;
262 }
263 }
264 return getSpecializations4r;
265 }
266
267
268
269
270
271 protected abstract Collection handleGetSpecializations();
272
273
274
275
276
277 public final Collection<GeneralizableElementFacade> getAllSpecializations()
278 {
279 Collection<GeneralizableElementFacade> getAllSpecializations5r = null;
280
281 Collection result = handleGetAllSpecializations();
282 List shieldedResult = this.shieldedElements(result);
283 try
284 {
285 getAllSpecializations5r = (Collection<GeneralizableElementFacade>)shieldedResult;
286 }
287 catch (ClassCastException ex)
288 {
289
290 GeneralizableElementFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizableElementFacadeLogic.getAllSpecializations Collection<GeneralizableElementFacade> " + result + ": " + shieldedResult);
291 }
292
293 return getAllSpecializations5r;
294 }
295
296
297
298
299
300 protected abstract Collection handleGetAllSpecializations();
301
302
303
304
305
306 public final GeneralizableElementFacade getGeneralization()
307 {
308 GeneralizableElementFacade getGeneralization6r = null;
309
310 Object result = handleGetGeneralization();
311 MetafacadeBase shieldedResult = this.shieldedElement(result);
312 try
313 {
314 getGeneralization6r = (GeneralizableElementFacade)shieldedResult;
315 }
316 catch (ClassCastException ex)
317 {
318
319 GeneralizableElementFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizableElementFacadeLogic.getGeneralization GeneralizableElementFacade " + result + ": " + shieldedResult);
320 }
321
322 return getGeneralization6r;
323 }
324
325
326
327
328
329 protected abstract Object handleGetGeneralization();
330
331 private GeneralizableElementFacade __getGeneralizationRoot7r;
332 private boolean __getGeneralizationRoot7rSet = false;
333
334
335
336
337
338 public final GeneralizableElementFacade getGeneralizationRoot()
339 {
340 GeneralizableElementFacade getGeneralizationRoot7r = this.__getGeneralizationRoot7r;
341 if (!this.__getGeneralizationRoot7rSet)
342 {
343
344 Object result = handleGetGeneralizationRoot();
345 MetafacadeBase shieldedResult = this.shieldedElement(result);
346 try
347 {
348 getGeneralizationRoot7r = (GeneralizableElementFacade)shieldedResult;
349 }
350 catch (ClassCastException ex)
351 {
352
353 GeneralizableElementFacadeLogic.logger.warn("incorrect metafacade cast for GeneralizableElementFacadeLogic.getGeneralizationRoot GeneralizableElementFacade " + result + ": " + shieldedResult);
354 }
355
356 this.__getGeneralizationRoot7r = getGeneralizationRoot7r;
357 if (isMetafacadePropertyCachingEnabled())
358 {
359 this.__getGeneralizationRoot7rSet = true;
360 }
361 }
362 return getGeneralizationRoot7r;
363 }
364
365
366
367
368
369 protected abstract Object handleGetGeneralizationRoot();
370
371
372
373
374
375 @Override
376 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
377 {
378 super.validateInvariants(validationMessages);
379 }
380 }