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.AssociationEndFacade;
12 import org.andromda.metafacades.uml.AssociationFacade;
13 import org.apache.log4j.Logger;
14 import org.omg.uml.foundation.core.UmlAssociation;
15
16
17
18
19
20
21
22
23 public abstract class AssociationFacadeLogic
24 extends GeneralizableElementFacadeLogicImpl
25 implements AssociationFacade
26 {
27
28
29
30
31 protected UmlAssociation metaObject;
32
33
34
35
36
37 protected AssociationFacadeLogic(UmlAssociation 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(AssociationFacadeLogic.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.AssociationFacade";
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 isAssociationFacadeMetaType()
80 {
81 return true;
82 }
83
84
85
86
87
88
89
90 protected abstract String handleGetRelationName();
91
92 private String __relationName1a;
93 private boolean __relationName1aSet = false;
94
95
96
97
98
99
100 public final String getRelationName()
101 {
102 String relationName1a = this.__relationName1a;
103 if (!this.__relationName1aSet)
104 {
105
106 relationName1a = handleGetRelationName();
107
108 this.__relationName1a = relationName1a;
109 if (isMetafacadePropertyCachingEnabled())
110 {
111 this.__relationName1aSet = true;
112 }
113 }
114 return relationName1a;
115 }
116
117
118
119
120
121 protected abstract boolean handleIsMany2Many();
122
123 private boolean __many2Many2a;
124 private boolean __many2Many2aSet = false;
125
126
127
128
129
130 public final boolean isMany2Many()
131 {
132 boolean many2Many2a = this.__many2Many2a;
133 if (!this.__many2Many2aSet)
134 {
135
136 many2Many2a = handleIsMany2Many();
137
138 this.__many2Many2a = many2Many2a;
139 if (isMetafacadePropertyCachingEnabled())
140 {
141 this.__many2Many2aSet = true;
142 }
143 }
144 return many2Many2a;
145 }
146
147
148
149
150
151 protected abstract boolean handleIsAssociationClass();
152
153 private boolean __associationClass3a;
154 private boolean __associationClass3aSet = false;
155
156
157
158
159
160 public final boolean isAssociationClass()
161 {
162 boolean associationClass3a = this.__associationClass3a;
163 if (!this.__associationClass3aSet)
164 {
165
166 associationClass3a = handleIsAssociationClass();
167
168 this.__associationClass3a = associationClass3a;
169 if (isMetafacadePropertyCachingEnabled())
170 {
171 this.__associationClass3aSet = true;
172 }
173 }
174 return associationClass3a;
175 }
176
177
178
179
180
181 protected abstract boolean handleIsAbstract();
182
183 private boolean __abstract4a;
184 private boolean __abstract4aSet = false;
185
186
187
188
189
190 public final boolean isAbstract()
191 {
192 boolean abstract4a = this.__abstract4a;
193 if (!this.__abstract4aSet)
194 {
195
196 abstract4a = handleIsAbstract();
197
198 this.__abstract4a = abstract4a;
199 if (isMetafacadePropertyCachingEnabled())
200 {
201 this.__abstract4aSet = true;
202 }
203 }
204 return abstract4a;
205 }
206
207
208
209
210
211 protected abstract boolean handleIsLeaf();
212
213 private boolean __leaf5a;
214 private boolean __leaf5aSet = false;
215
216
217
218
219
220 public final boolean isLeaf()
221 {
222 boolean leaf5a = this.__leaf5a;
223 if (!this.__leaf5aSet)
224 {
225
226 leaf5a = handleIsLeaf();
227
228 this.__leaf5a = leaf5a;
229 if (isMetafacadePropertyCachingEnabled())
230 {
231 this.__leaf5aSet = true;
232 }
233 }
234 return leaf5a;
235 }
236
237
238
239
240
241 protected abstract boolean handleIsDerived();
242
243 private boolean __derived6a;
244 private boolean __derived6aSet = false;
245
246
247
248
249
250
251
252
253 public final boolean isDerived()
254 {
255 boolean derived6a = this.__derived6a;
256 if (!this.__derived6aSet)
257 {
258
259 derived6a = handleIsDerived();
260
261 this.__derived6a = derived6a;
262 if (isMetafacadePropertyCachingEnabled())
263 {
264 this.__derived6aSet = true;
265 }
266 }
267 return derived6a;
268 }
269
270
271
272
273
274 protected abstract boolean handleIsBinary();
275
276 private boolean __binary7a;
277 private boolean __binary7aSet = false;
278
279
280
281
282
283
284
285 public final boolean isBinary()
286 {
287 boolean binary7a = this.__binary7a;
288 if (!this.__binary7aSet)
289 {
290
291 binary7a = handleIsBinary();
292
293 this.__binary7a = binary7a;
294 if (isMetafacadePropertyCachingEnabled())
295 {
296 this.__binary7aSet = true;
297 }
298 }
299 return binary7a;
300 }
301
302
303
304
305
306
307
308 public final List<AssociationEndFacade> getAssociationEnds()
309 {
310 List<AssociationEndFacade> getAssociationEnds1r = null;
311
312 List result = handleGetAssociationEnds();
313 List shieldedResult = this.shieldedElements(result);
314 try
315 {
316 getAssociationEnds1r = (List<AssociationEndFacade>)shieldedResult;
317 }
318 catch (ClassCastException ex)
319 {
320
321 AssociationFacadeLogic.logger.warn("incorrect metafacade cast for AssociationFacadeLogic.getAssociationEnds List<AssociationEndFacade> " + result + ": " + shieldedResult);
322 }
323
324 return getAssociationEnds1r;
325 }
326
327
328
329
330
331 protected abstract List handleGetAssociationEnds();
332
333 private AssociationEndFacade __getAssociationEndA2r;
334 private boolean __getAssociationEndA2rSet = false;
335
336
337
338
339
340
341
342 public final AssociationEndFacade getAssociationEndA()
343 {
344 AssociationEndFacade getAssociationEndA2r = this.__getAssociationEndA2r;
345 if (!this.__getAssociationEndA2rSet)
346 {
347
348 Object result = handleGetAssociationEndA();
349 MetafacadeBase shieldedResult = this.shieldedElement(result);
350 try
351 {
352 getAssociationEndA2r = (AssociationEndFacade)shieldedResult;
353 }
354 catch (ClassCastException ex)
355 {
356
357 AssociationFacadeLogic.logger.warn("incorrect metafacade cast for AssociationFacadeLogic.getAssociationEndA AssociationEndFacade " + result + ": " + shieldedResult);
358 }
359
360 this.__getAssociationEndA2r = getAssociationEndA2r;
361 if (isMetafacadePropertyCachingEnabled())
362 {
363 this.__getAssociationEndA2rSet = true;
364 }
365 }
366 return getAssociationEndA2r;
367 }
368
369
370
371
372
373 protected abstract Object handleGetAssociationEndA();
374
375 private AssociationEndFacade __getAssociationEndB3r;
376 private boolean __getAssociationEndB3rSet = false;
377
378
379
380
381
382
383
384 public final AssociationEndFacade getAssociationEndB()
385 {
386 AssociationEndFacade getAssociationEndB3r = this.__getAssociationEndB3r;
387 if (!this.__getAssociationEndB3rSet)
388 {
389
390 Object result = handleGetAssociationEndB();
391 MetafacadeBase shieldedResult = this.shieldedElement(result);
392 try
393 {
394 getAssociationEndB3r = (AssociationEndFacade)shieldedResult;
395 }
396 catch (ClassCastException ex)
397 {
398
399 AssociationFacadeLogic.logger.warn("incorrect metafacade cast for AssociationFacadeLogic.getAssociationEndB AssociationEndFacade " + result + ": " + shieldedResult);
400 }
401
402 this.__getAssociationEndB3r = getAssociationEndB3r;
403 if (isMetafacadePropertyCachingEnabled())
404 {
405 this.__getAssociationEndB3rSet = true;
406 }
407 }
408 return getAssociationEndB3r;
409 }
410
411
412
413
414
415 protected abstract Object handleGetAssociationEndB();
416
417
418
419
420
421 @Override
422 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
423 {
424 super.validateInvariants(validationMessages);
425 }
426 }