1
2
3
4
5 package org.andromda.cartridges.meta.metafacades;
6
7 import java.util.Collection;
8 import org.andromda.core.common.Introspector;
9 import org.andromda.core.metafacade.MetafacadeBase;
10 import org.andromda.core.metafacade.MetafacadeFactory;
11 import org.andromda.core.metafacade.ModelValidationMessage;
12 import org.andromda.metafacades.uml.ConstraintFacade;
13 import org.andromda.metafacades.uml.DependencyFacade;
14 import org.andromda.metafacades.uml.GeneralizableElementFacade;
15 import org.andromda.metafacades.uml.GeneralizationFacade;
16 import org.andromda.metafacades.uml.ModelElementFacade;
17 import org.andromda.metafacades.uml.ModelFacade;
18 import org.andromda.metafacades.uml.PackageFacade;
19 import org.andromda.metafacades.uml.StateMachineFacade;
20 import org.andromda.metafacades.uml.StereotypeFacade;
21 import org.andromda.metafacades.uml.TaggedValueFacade;
22 import org.andromda.metafacades.uml.TemplateParameterFacade;
23 import org.andromda.metafacades.uml.TypeMappings;
24
25
26
27
28
29
30
31 public abstract class MetafacadeGeneralizationLogic
32 extends MetafacadeBase
33 implements MetafacadeGeneralization
34 {
35
36
37
38
39 protected Object metaObject;
40
41
42
43
44
45 protected MetafacadeGeneralizationLogic(Object metaObjectIn, String context)
46 {
47 super(metaObjectIn, getContext(context));
48 this.superGeneralizationFacade =
49 (GeneralizationFacade)
50 MetafacadeFactory.getInstance().createFacadeImpl(
51 "org.andromda.metafacades.uml.GeneralizationFacade",
52 metaObjectIn,
53 getContext(context));
54 this.metaObject = metaObjectIn;
55 }
56
57
58
59
60
61
62 private static String getContext(String context)
63 {
64 if (context == null)
65 {
66 context = "org.andromda.cartridges.meta.metafacades.MetafacadeGeneralization";
67 }
68 return context;
69 }
70
71 private GeneralizationFacade superGeneralizationFacade;
72 private boolean superGeneralizationFacadeInitialized = false;
73
74
75
76
77
78 private GeneralizationFacade getSuperGeneralizationFacade()
79 {
80 if (!this.superGeneralizationFacadeInitialized)
81 {
82 ((MetafacadeBase)this.superGeneralizationFacade).setMetafacadeContext(this.getMetafacadeContext());
83 this.superGeneralizationFacadeInitialized = true;
84 }
85 return this.superGeneralizationFacade;
86 }
87
88
89
90
91
92 @Override
93 public void resetMetafacadeContext(String context)
94 {
95 if (!this.contextRoot)
96 {
97 context = getContext(context);
98 setMetafacadeContext (context);
99 if (this.superGeneralizationFacadeInitialized)
100 {
101 ((MetafacadeBase)this.superGeneralizationFacade).resetMetafacadeContext(context);
102 }
103 }
104 }
105
106
107
108
109
110 public boolean isMetafacadeGeneralizationMetaType()
111 {
112 return true;
113 }
114
115
116
117
118
119
120
121 protected abstract Integer handleGetPrecedence();
122
123 private Integer __precedence1a;
124 private boolean __precedence1aSet = false;
125
126
127
128
129
130
131 public final Integer getPrecedence()
132 {
133 Integer precedence1a = this.__precedence1a;
134 if (!this.__precedence1aSet)
135 {
136
137 precedence1a = handleGetPrecedence();
138
139 this.__precedence1a = precedence1a;
140 if (isMetafacadePropertyCachingEnabled())
141 {
142 this.__precedence1aSet = true;
143 }
144 }
145 return precedence1a;
146 }
147
148
149
150
151
152 protected abstract String handleGetGetterName();
153
154 private String __getterName2a;
155 private boolean __getterName2aSet = false;
156
157
158
159
160
161 public final String getGetterName()
162 {
163 String getterName2a = this.__getterName2a;
164 if (!this.__getterName2aSet)
165 {
166
167 getterName2a = handleGetGetterName();
168
169 this.__getterName2a = getterName2a;
170 if (isMetafacadePropertyCachingEnabled())
171 {
172 this.__getterName2aSet = true;
173 }
174 }
175 return getterName2a;
176 }
177
178
179
180
181
182 protected abstract String handleGetGetterNameVisibility();
183
184 private String __getterNameVisibility3a;
185 private boolean __getterNameVisibility3aSet = false;
186
187
188
189
190
191 public final String getGetterNameVisibility()
192 {
193 String getterNameVisibility3a = this.__getterNameVisibility3a;
194 if (!this.__getterNameVisibility3aSet)
195 {
196
197 getterNameVisibility3a = handleGetGetterNameVisibility();
198
199 this.__getterNameVisibility3a = getterNameVisibility3a;
200 if (isMetafacadePropertyCachingEnabled())
201 {
202 this.__getterNameVisibility3aSet = true;
203 }
204 }
205 return getterNameVisibility3a;
206 }
207
208
209
210
211
212 public boolean isGeneralizationFacadeMetaType()
213 {
214 return true;
215 }
216
217
218
219
220
221 public boolean isModelElementFacadeMetaType()
222 {
223 return true;
224 }
225
226
227
228
229
230
231 public GeneralizableElementFacade getChild()
232 {
233 return this.getSuperGeneralizationFacade().getChild();
234 }
235
236
237
238
239
240 public GeneralizableElementFacade getParent()
241 {
242 return this.getSuperGeneralizationFacade().getParent();
243 }
244
245
246
247
248
249 public void copyTaggedValues(ModelElementFacade element)
250 {
251 this.getSuperGeneralizationFacade().copyTaggedValues(element);
252 }
253
254
255
256
257
258
259 public Object findTaggedValue(String tagName)
260 {
261 return this.getSuperGeneralizationFacade().findTaggedValue(tagName);
262 }
263
264
265
266
267
268
269 public Collection<Object> findTaggedValues(String tagName)
270 {
271 return this.getSuperGeneralizationFacade().findTaggedValues(tagName);
272 }
273
274
275
276
277
278
279
280 public String getBindedFullyQualifiedName(ModelElementFacade bindedElement)
281 {
282 return this.getSuperGeneralizationFacade().getBindedFullyQualifiedName(bindedElement);
283 }
284
285
286
287
288
289 public Collection<ConstraintFacade> getConstraints()
290 {
291 return this.getSuperGeneralizationFacade().getConstraints();
292 }
293
294
295
296
297
298
299 public Collection<ConstraintFacade> getConstraints(String kind)
300 {
301 return this.getSuperGeneralizationFacade().getConstraints(kind);
302 }
303
304
305
306
307
308
309
310 public String getDocumentation(String indent)
311 {
312 return this.getSuperGeneralizationFacade().getDocumentation(indent);
313 }
314
315
316
317
318
319
320
321
322 public String getDocumentation(String indent, int lineLength)
323 {
324 return this.getSuperGeneralizationFacade().getDocumentation(indent, lineLength);
325 }
326
327
328
329
330
331
332
333 public String getDocumentation(String indent, int lineLength, boolean htmlStyle)
334 {
335 return this.getSuperGeneralizationFacade().getDocumentation(indent, lineLength, htmlStyle);
336 }
337
338
339
340
341
342 public String getFullyQualifiedName()
343 {
344 return this.getSuperGeneralizationFacade().getFullyQualifiedName();
345 }
346
347
348
349
350
351
352
353
354 public String getFullyQualifiedName(boolean modelName)
355 {
356 return this.getSuperGeneralizationFacade().getFullyQualifiedName(modelName);
357 }
358
359
360
361
362
363
364 public String getFullyQualifiedNamePath()
365 {
366 return this.getSuperGeneralizationFacade().getFullyQualifiedNamePath();
367 }
368
369
370
371
372
373 public String getId()
374 {
375 return this.getSuperGeneralizationFacade().getId();
376 }
377
378
379
380
381
382
383
384
385
386 public Collection<String> getKeywords()
387 {
388 return this.getSuperGeneralizationFacade().getKeywords();
389 }
390
391
392
393
394
395 public String getLabel()
396 {
397 return this.getSuperGeneralizationFacade().getLabel();
398 }
399
400
401
402
403
404 public TypeMappings getLanguageMappings()
405 {
406 return this.getSuperGeneralizationFacade().getLanguageMappings();
407 }
408
409
410
411
412
413
414 public ModelFacade getModel()
415 {
416 return this.getSuperGeneralizationFacade().getModel();
417 }
418
419
420
421
422
423 public String getName()
424 {
425 return this.getSuperGeneralizationFacade().getName();
426 }
427
428
429
430
431
432 public ModelElementFacade getPackage()
433 {
434 return this.getSuperGeneralizationFacade().getPackage();
435 }
436
437
438
439
440
441 public String getPackageName()
442 {
443 return this.getSuperGeneralizationFacade().getPackageName();
444 }
445
446
447
448
449
450
451 public String getPackageName(boolean modelName)
452 {
453 return this.getSuperGeneralizationFacade().getPackageName(modelName);
454 }
455
456
457
458
459
460 public String getPackagePath()
461 {
462 return this.getSuperGeneralizationFacade().getPackagePath();
463 }
464
465
466
467
468
469
470
471
472 public String getQualifiedName()
473 {
474 return this.getSuperGeneralizationFacade().getQualifiedName();
475 }
476
477
478
479
480
481 public PackageFacade getRootPackage()
482 {
483 return this.getSuperGeneralizationFacade().getRootPackage();
484 }
485
486
487
488
489
490 public Collection<DependencyFacade> getSourceDependencies()
491 {
492 return this.getSuperGeneralizationFacade().getSourceDependencies();
493 }
494
495
496
497
498
499
500 public StateMachineFacade getStateMachineContext()
501 {
502 return this.getSuperGeneralizationFacade().getStateMachineContext();
503 }
504
505
506
507
508
509 public Collection<String> getStereotypeNames()
510 {
511 return this.getSuperGeneralizationFacade().getStereotypeNames();
512 }
513
514
515
516
517
518 public Collection<StereotypeFacade> getStereotypes()
519 {
520 return this.getSuperGeneralizationFacade().getStereotypes();
521 }
522
523
524
525
526
527 public Collection<TaggedValueFacade> getTaggedValues()
528 {
529 return this.getSuperGeneralizationFacade().getTaggedValues();
530 }
531
532
533
534
535
536 public Collection<DependencyFacade> getTargetDependencies()
537 {
538 return this.getSuperGeneralizationFacade().getTargetDependencies();
539 }
540
541
542
543
544
545 public Object getTemplateParameter(String parameterName)
546 {
547 return this.getSuperGeneralizationFacade().getTemplateParameter(parameterName);
548 }
549
550
551
552
553
554 public Collection<TemplateParameterFacade> getTemplateParameters()
555 {
556 return this.getSuperGeneralizationFacade().getTemplateParameters();
557 }
558
559
560
561
562
563
564 public String getVisibility()
565 {
566 return this.getSuperGeneralizationFacade().getVisibility();
567 }
568
569
570
571
572
573
574 public boolean hasExactStereotype(String stereotypeName)
575 {
576 return this.getSuperGeneralizationFacade().hasExactStereotype(stereotypeName);
577 }
578
579
580
581
582
583
584 public boolean hasKeyword(String keywordName)
585 {
586 return this.getSuperGeneralizationFacade().hasKeyword(keywordName);
587 }
588
589
590
591
592
593
594
595
596
597
598
599
600
601 public boolean hasStereotype(String stereotypeName)
602 {
603 return this.getSuperGeneralizationFacade().hasStereotype(stereotypeName);
604 }
605
606
607
608
609
610
611 public boolean isBindingDependenciesPresent()
612 {
613 return this.getSuperGeneralizationFacade().isBindingDependenciesPresent();
614 }
615
616
617
618
619
620 public boolean isConstraintsPresent()
621 {
622 return this.getSuperGeneralizationFacade().isConstraintsPresent();
623 }
624
625
626
627
628
629 public boolean isDocumentationPresent()
630 {
631 return this.getSuperGeneralizationFacade().isDocumentationPresent();
632 }
633
634
635
636
637
638 public boolean isReservedWord()
639 {
640 return this.getSuperGeneralizationFacade().isReservedWord();
641 }
642
643
644
645
646
647
648 public boolean isTemplateParametersPresent()
649 {
650 return this.getSuperGeneralizationFacade().isTemplateParametersPresent();
651 }
652
653
654
655
656
657
658
659 public boolean isValidIdentifierName()
660 {
661 return this.getSuperGeneralizationFacade().isValidIdentifierName();
662 }
663
664
665
666
667
668
669
670 public String translateConstraint(String name, String translation)
671 {
672 return this.getSuperGeneralizationFacade().translateConstraint(name, translation);
673 }
674
675
676
677
678
679 public String[] translateConstraints(String translation)
680 {
681 return this.getSuperGeneralizationFacade().translateConstraints(translation);
682 }
683
684
685
686
687
688 public String[] translateConstraints(String kind, String translation)
689 {
690 return this.getSuperGeneralizationFacade().translateConstraints(kind, translation);
691 }
692
693
694
695
696 @Override
697 public void initialize()
698 {
699 this.getSuperGeneralizationFacade().initialize();
700 }
701
702
703
704
705
706 @Override
707 public Object getValidationOwner()
708 {
709 Object owner = this.getSuperGeneralizationFacade().getValidationOwner();
710 return owner;
711 }
712
713
714
715
716
717 @Override
718 public String getValidationName()
719 {
720 String name = this.getSuperGeneralizationFacade().getValidationName();
721 return name;
722 }
723
724
725
726
727
728 @Override
729 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
730 {
731 this.getSuperGeneralizationFacade().validateInvariants(validationMessages);
732 }
733
734
735
736
737 private static final String NAME_PROPERTY = "name";
738 private static final String FQNAME_PROPERTY = "fullyQualifiedName";
739
740
741
742
743 @Override
744 public String toString()
745 {
746 final StringBuilder toString = new StringBuilder(this.getClass().getName());
747 toString.append("[");
748 try
749 {
750 toString.append(Introspector.instance().getProperty(this, FQNAME_PROPERTY));
751 }
752 catch (final Throwable tryAgain)
753 {
754 try
755 {
756 toString.append(Introspector.instance().getProperty(this, NAME_PROPERTY));
757 }
758 catch (final Throwable ignore)
759 {
760
761 }
762 }
763 toString.append("]");
764 return toString.toString();
765 }
766 }