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.AttributeFacade;
13 import org.andromda.metafacades.uml.ClassifierFacade;
14 import org.andromda.metafacades.uml.ConstraintFacade;
15 import org.andromda.metafacades.uml.DependencyFacade;
16 import org.andromda.metafacades.uml.EnumerationFacade;
17 import org.andromda.metafacades.uml.ModelElementFacade;
18 import org.andromda.metafacades.uml.ModelFacade;
19 import org.andromda.metafacades.uml.PackageFacade;
20 import org.andromda.metafacades.uml.StateMachineFacade;
21 import org.andromda.metafacades.uml.StereotypeFacade;
22 import org.andromda.metafacades.uml.TaggedValueFacade;
23 import org.andromda.metafacades.uml.TemplateParameterFacade;
24 import org.andromda.metafacades.uml.TypeMappings;
25
26
27
28
29
30
31
32 public abstract class MetafacadeAttributeLogic
33 extends MetafacadeBase
34 implements MetafacadeAttribute
35 {
36
37
38
39
40 protected Object metaObject;
41
42
43
44
45
46 protected MetafacadeAttributeLogic(Object metaObjectIn, String context)
47 {
48 super(metaObjectIn, getContext(context));
49 this.superAttributeFacade =
50 (AttributeFacade)
51 MetafacadeFactory.getInstance().createFacadeImpl(
52 "org.andromda.metafacades.uml.AttributeFacade",
53 metaObjectIn,
54 getContext(context));
55 this.metaObject = metaObjectIn;
56 }
57
58
59
60
61
62
63 private static String getContext(String context)
64 {
65 if (context == null)
66 {
67 context = "org.andromda.cartridges.meta.metafacades.MetafacadeAttribute";
68 }
69 return context;
70 }
71
72 private AttributeFacade superAttributeFacade;
73 private boolean superAttributeFacadeInitialized = false;
74
75
76
77
78
79 private AttributeFacade getSuperAttributeFacade()
80 {
81 if (!this.superAttributeFacadeInitialized)
82 {
83 ((MetafacadeBase)this.superAttributeFacade).setMetafacadeContext(this.getMetafacadeContext());
84 this.superAttributeFacadeInitialized = true;
85 }
86 return this.superAttributeFacade;
87 }
88
89
90
91
92
93 @Override
94 public void resetMetafacadeContext(String context)
95 {
96 if (!this.contextRoot)
97 {
98 context = getContext(context);
99 setMetafacadeContext (context);
100 if (this.superAttributeFacadeInitialized)
101 {
102 ((MetafacadeBase)this.superAttributeFacade).resetMetafacadeContext(context);
103 }
104 }
105 }
106
107
108
109
110
111 public boolean isMetafacadeAttributeMetaType()
112 {
113 return true;
114 }
115
116
117
118
119
120
121
122 protected abstract String handleGetImplementationOperationName();
123
124 private String __implementationOperationName1a;
125 private boolean __implementationOperationName1aSet = false;
126
127
128
129
130
131 public final String getImplementationOperationName()
132 {
133 String implementationOperationName1a = this.__implementationOperationName1a;
134 if (!this.__implementationOperationName1aSet)
135 {
136
137 implementationOperationName1a = handleGetImplementationOperationName();
138
139 this.__implementationOperationName1a = implementationOperationName1a;
140 if (isMetafacadePropertyCachingEnabled())
141 {
142 this.__implementationOperationName1aSet = true;
143 }
144 }
145 return implementationOperationName1a;
146 }
147
148
149
150
151
152 public boolean isAttributeFacadeMetaType()
153 {
154 return true;
155 }
156
157
158
159
160
161 public boolean isModelElementFacadeMetaType()
162 {
163 return true;
164 }
165
166
167
168
169
170
171
172
173 public Object findTaggedValue(String name, boolean follow)
174 {
175 return this.getSuperAttributeFacade().findTaggedValue(name, follow);
176 }
177
178
179
180
181
182 public String getDefaultValue()
183 {
184 return this.getSuperAttributeFacade().getDefaultValue();
185 }
186
187
188
189
190
191
192 public EnumerationFacade getEnumeration()
193 {
194 return this.getSuperAttributeFacade().getEnumeration();
195 }
196
197
198
199
200
201 public String getEnumerationLiteralParameters()
202 {
203 return this.getSuperAttributeFacade().getEnumerationLiteralParameters();
204 }
205
206
207
208
209
210
211
212 public String getEnumerationValue()
213 {
214 return this.getSuperAttributeFacade().getEnumerationValue();
215 }
216
217
218
219
220
221 public String getGetterName()
222 {
223 return this.getSuperAttributeFacade().getGetterName();
224 }
225
226
227
228
229
230
231 public String getGetterSetterTypeName()
232 {
233 return this.getSuperAttributeFacade().getGetterSetterTypeName();
234 }
235
236
237
238
239
240
241 public int getLower()
242 {
243 return this.getSuperAttributeFacade().getLower();
244 }
245
246
247
248
249
250 public ClassifierFacade getOwner()
251 {
252 return this.getSuperAttributeFacade().getOwner();
253 }
254
255
256
257
258
259 public String getSetterName()
260 {
261 return this.getSuperAttributeFacade().getSetterName();
262 }
263
264
265
266
267
268 public ClassifierFacade getType()
269 {
270 return this.getSuperAttributeFacade().getType();
271 }
272
273
274
275
276
277
278 public int getUpper()
279 {
280 return this.getSuperAttributeFacade().getUpper();
281 }
282
283
284
285
286
287 public boolean isAddOnly()
288 {
289 return this.getSuperAttributeFacade().isAddOnly();
290 }
291
292
293
294
295
296 public boolean isChangeable()
297 {
298 return this.getSuperAttributeFacade().isChangeable();
299 }
300
301
302
303
304
305 public boolean isDefaultValuePresent()
306 {
307 return this.getSuperAttributeFacade().isDefaultValuePresent();
308 }
309
310
311
312
313
314
315 public boolean isDerived()
316 {
317 return this.getSuperAttributeFacade().isDerived();
318 }
319
320
321
322
323
324 public boolean isEnumerationLiteral()
325 {
326 return this.getSuperAttributeFacade().isEnumerationLiteral();
327 }
328
329
330
331
332
333
334 public boolean isEnumerationLiteralParametersExist()
335 {
336 return this.getSuperAttributeFacade().isEnumerationLiteralParametersExist();
337 }
338
339
340
341
342
343
344 public boolean isEnumerationMember()
345 {
346 return this.getSuperAttributeFacade().isEnumerationMember();
347 }
348
349
350
351
352
353
354 public boolean isLeaf()
355 {
356 return this.getSuperAttributeFacade().isLeaf();
357 }
358
359
360
361
362
363 public boolean isMany()
364 {
365 return this.getSuperAttributeFacade().isMany();
366 }
367
368
369
370
371
372 public boolean isOrdered()
373 {
374 return this.getSuperAttributeFacade().isOrdered();
375 }
376
377
378
379
380
381 public boolean isReadOnly()
382 {
383 return this.getSuperAttributeFacade().isReadOnly();
384 }
385
386
387
388
389
390 public boolean isRequired()
391 {
392 return this.getSuperAttributeFacade().isRequired();
393 }
394
395
396
397
398
399 public boolean isStatic()
400 {
401 return this.getSuperAttributeFacade().isStatic();
402 }
403
404
405
406
407
408
409 public boolean isUnique()
410 {
411 return this.getSuperAttributeFacade().isUnique();
412 }
413
414
415
416
417
418 public void copyTaggedValues(ModelElementFacade element)
419 {
420 this.getSuperAttributeFacade().copyTaggedValues(element);
421 }
422
423
424
425
426
427
428 public Object findTaggedValue(String tagName)
429 {
430 return this.getSuperAttributeFacade().findTaggedValue(tagName);
431 }
432
433
434
435
436
437
438 public Collection<Object> findTaggedValues(String tagName)
439 {
440 return this.getSuperAttributeFacade().findTaggedValues(tagName);
441 }
442
443
444
445
446
447
448
449 public String getBindedFullyQualifiedName(ModelElementFacade bindedElement)
450 {
451 return this.getSuperAttributeFacade().getBindedFullyQualifiedName(bindedElement);
452 }
453
454
455
456
457
458 public Collection<ConstraintFacade> getConstraints()
459 {
460 return this.getSuperAttributeFacade().getConstraints();
461 }
462
463
464
465
466
467
468 public Collection<ConstraintFacade> getConstraints(String kind)
469 {
470 return this.getSuperAttributeFacade().getConstraints(kind);
471 }
472
473
474
475
476
477
478
479 public String getDocumentation(String indent)
480 {
481 return this.getSuperAttributeFacade().getDocumentation(indent);
482 }
483
484
485
486
487
488
489
490
491 public String getDocumentation(String indent, int lineLength)
492 {
493 return this.getSuperAttributeFacade().getDocumentation(indent, lineLength);
494 }
495
496
497
498
499
500
501
502 public String getDocumentation(String indent, int lineLength, boolean htmlStyle)
503 {
504 return this.getSuperAttributeFacade().getDocumentation(indent, lineLength, htmlStyle);
505 }
506
507
508
509
510
511 public String getFullyQualifiedName()
512 {
513 return this.getSuperAttributeFacade().getFullyQualifiedName();
514 }
515
516
517
518
519
520
521
522
523 public String getFullyQualifiedName(boolean modelName)
524 {
525 return this.getSuperAttributeFacade().getFullyQualifiedName(modelName);
526 }
527
528
529
530
531
532
533 public String getFullyQualifiedNamePath()
534 {
535 return this.getSuperAttributeFacade().getFullyQualifiedNamePath();
536 }
537
538
539
540
541
542 public String getId()
543 {
544 return this.getSuperAttributeFacade().getId();
545 }
546
547
548
549
550
551
552
553
554
555 public Collection<String> getKeywords()
556 {
557 return this.getSuperAttributeFacade().getKeywords();
558 }
559
560
561
562
563
564 public String getLabel()
565 {
566 return this.getSuperAttributeFacade().getLabel();
567 }
568
569
570
571
572
573 public TypeMappings getLanguageMappings()
574 {
575 return this.getSuperAttributeFacade().getLanguageMappings();
576 }
577
578
579
580
581
582
583 public ModelFacade getModel()
584 {
585 return this.getSuperAttributeFacade().getModel();
586 }
587
588
589
590
591
592 public String getName()
593 {
594 return this.getSuperAttributeFacade().getName();
595 }
596
597
598
599
600
601 public ModelElementFacade getPackage()
602 {
603 return this.getSuperAttributeFacade().getPackage();
604 }
605
606
607
608
609
610 public String getPackageName()
611 {
612 return this.getSuperAttributeFacade().getPackageName();
613 }
614
615
616
617
618
619
620 public String getPackageName(boolean modelName)
621 {
622 return this.getSuperAttributeFacade().getPackageName(modelName);
623 }
624
625
626
627
628
629 public String getPackagePath()
630 {
631 return this.getSuperAttributeFacade().getPackagePath();
632 }
633
634
635
636
637
638
639
640
641 public String getQualifiedName()
642 {
643 return this.getSuperAttributeFacade().getQualifiedName();
644 }
645
646
647
648
649
650 public PackageFacade getRootPackage()
651 {
652 return this.getSuperAttributeFacade().getRootPackage();
653 }
654
655
656
657
658
659 public Collection<DependencyFacade> getSourceDependencies()
660 {
661 return this.getSuperAttributeFacade().getSourceDependencies();
662 }
663
664
665
666
667
668
669 public StateMachineFacade getStateMachineContext()
670 {
671 return this.getSuperAttributeFacade().getStateMachineContext();
672 }
673
674
675
676
677
678 public Collection<String> getStereotypeNames()
679 {
680 return this.getSuperAttributeFacade().getStereotypeNames();
681 }
682
683
684
685
686
687 public Collection<StereotypeFacade> getStereotypes()
688 {
689 return this.getSuperAttributeFacade().getStereotypes();
690 }
691
692
693
694
695
696 public Collection<TaggedValueFacade> getTaggedValues()
697 {
698 return this.getSuperAttributeFacade().getTaggedValues();
699 }
700
701
702
703
704
705 public Collection<DependencyFacade> getTargetDependencies()
706 {
707 return this.getSuperAttributeFacade().getTargetDependencies();
708 }
709
710
711
712
713
714 public Object getTemplateParameter(String parameterName)
715 {
716 return this.getSuperAttributeFacade().getTemplateParameter(parameterName);
717 }
718
719
720
721
722
723 public Collection<TemplateParameterFacade> getTemplateParameters()
724 {
725 return this.getSuperAttributeFacade().getTemplateParameters();
726 }
727
728
729
730
731
732
733 public String getVisibility()
734 {
735 return this.getSuperAttributeFacade().getVisibility();
736 }
737
738
739
740
741
742
743 public boolean hasExactStereotype(String stereotypeName)
744 {
745 return this.getSuperAttributeFacade().hasExactStereotype(stereotypeName);
746 }
747
748
749
750
751
752
753 public boolean hasKeyword(String keywordName)
754 {
755 return this.getSuperAttributeFacade().hasKeyword(keywordName);
756 }
757
758
759
760
761
762
763
764
765
766
767
768
769
770 public boolean hasStereotype(String stereotypeName)
771 {
772 return this.getSuperAttributeFacade().hasStereotype(stereotypeName);
773 }
774
775
776
777
778
779
780 public boolean isBindingDependenciesPresent()
781 {
782 return this.getSuperAttributeFacade().isBindingDependenciesPresent();
783 }
784
785
786
787
788
789 public boolean isConstraintsPresent()
790 {
791 return this.getSuperAttributeFacade().isConstraintsPresent();
792 }
793
794
795
796
797
798 public boolean isDocumentationPresent()
799 {
800 return this.getSuperAttributeFacade().isDocumentationPresent();
801 }
802
803
804
805
806
807 public boolean isReservedWord()
808 {
809 return this.getSuperAttributeFacade().isReservedWord();
810 }
811
812
813
814
815
816
817 public boolean isTemplateParametersPresent()
818 {
819 return this.getSuperAttributeFacade().isTemplateParametersPresent();
820 }
821
822
823
824
825
826
827
828 public boolean isValidIdentifierName()
829 {
830 return this.getSuperAttributeFacade().isValidIdentifierName();
831 }
832
833
834
835
836
837
838
839 public String translateConstraint(String name, String translation)
840 {
841 return this.getSuperAttributeFacade().translateConstraint(name, translation);
842 }
843
844
845
846
847
848 public String[] translateConstraints(String translation)
849 {
850 return this.getSuperAttributeFacade().translateConstraints(translation);
851 }
852
853
854
855
856
857 public String[] translateConstraints(String kind, String translation)
858 {
859 return this.getSuperAttributeFacade().translateConstraints(kind, translation);
860 }
861
862
863
864
865 @Override
866 public void initialize()
867 {
868 this.getSuperAttributeFacade().initialize();
869 }
870
871
872
873
874
875 @Override
876 public Object getValidationOwner()
877 {
878 Object owner = this.getSuperAttributeFacade().getValidationOwner();
879 return owner;
880 }
881
882
883
884
885
886 @Override
887 public String getValidationName()
888 {
889 String name = this.getSuperAttributeFacade().getValidationName();
890 return name;
891 }
892
893
894
895
896
897 @Override
898 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
899 {
900 this.getSuperAttributeFacade().validateInvariants(validationMessages);
901 }
902
903
904
905
906 private static final String NAME_PROPERTY = "name";
907 private static final String FQNAME_PROPERTY = "fullyQualifiedName";
908
909
910
911
912 @Override
913 public String toString()
914 {
915 final StringBuilder toString = new StringBuilder(this.getClass().getName());
916 toString.append("[");
917 try
918 {
919 toString.append(Introspector.instance().getProperty(this, FQNAME_PROPERTY));
920 }
921 catch (final Throwable tryAgain)
922 {
923 try
924 {
925 toString.append(Introspector.instance().getProperty(this, NAME_PROPERTY));
926 }
927 catch (final Throwable ignore)
928 {
929
930 }
931 }
932 toString.append("]");
933 return toString.toString();
934 }
935 }