1
2
3
4
5 package org.andromda.cartridges.spring.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.ModelElementFacade;
15 import org.andromda.metafacades.uml.ModelFacade;
16 import org.andromda.metafacades.uml.PackageFacade;
17 import org.andromda.metafacades.uml.StateMachineFacade;
18 import org.andromda.metafacades.uml.StereotypeFacade;
19 import org.andromda.metafacades.uml.TaggedValueFacade;
20 import org.andromda.metafacades.uml.TemplateParameterFacade;
21 import org.andromda.metafacades.uml.TypeMappings;
22
23
24
25
26
27
28
29 public abstract class SpringDependencyLogic
30 extends MetafacadeBase
31 implements SpringDependency
32 {
33
34
35
36
37 protected Object metaObject;
38
39
40
41
42
43 protected SpringDependencyLogic(Object metaObjectIn, String context)
44 {
45 super(metaObjectIn, getContext(context));
46 this.superDependencyFacade =
47 (DependencyFacade)
48 MetafacadeFactory.getInstance().createFacadeImpl(
49 "org.andromda.metafacades.uml.DependencyFacade",
50 metaObjectIn,
51 getContext(context));
52 this.metaObject = metaObjectIn;
53 }
54
55
56
57
58
59
60 private static String getContext(String context)
61 {
62 if (context == null)
63 {
64 context = "org.andromda.cartridges.spring.metafacades.SpringDependency";
65 }
66 return context;
67 }
68
69 private DependencyFacade superDependencyFacade;
70 private boolean superDependencyFacadeInitialized = false;
71
72
73
74
75
76 private DependencyFacade getSuperDependencyFacade()
77 {
78 if (!this.superDependencyFacadeInitialized)
79 {
80 ((MetafacadeBase)this.superDependencyFacade).setMetafacadeContext(this.getMetafacadeContext());
81 this.superDependencyFacadeInitialized = true;
82 }
83 return this.superDependencyFacade;
84 }
85
86
87
88
89
90 @Override
91 public void resetMetafacadeContext(String context)
92 {
93 if (!this.contextRoot)
94 {
95 context = getContext(context);
96 setMetafacadeContext (context);
97 if (this.superDependencyFacadeInitialized)
98 {
99 ((MetafacadeBase)this.superDependencyFacade).resetMetafacadeContext(context);
100 }
101 }
102 }
103
104
105
106
107
108 public boolean isSpringDependencyMetaType()
109 {
110 return true;
111 }
112
113
114
115
116
117
118
119 protected abstract String handleGetTransformationConstantName();
120
121 private String __transformationConstantName1a;
122 private boolean __transformationConstantName1aSet = false;
123
124
125
126
127
128
129 public final String getTransformationConstantName()
130 {
131 String transformationConstantName1a = this.__transformationConstantName1a;
132 if (!this.__transformationConstantName1aSet)
133 {
134
135 transformationConstantName1a = handleGetTransformationConstantName();
136
137 this.__transformationConstantName1a = transformationConstantName1a;
138 if (isMetafacadePropertyCachingEnabled())
139 {
140 this.__transformationConstantName1aSet = true;
141 }
142 }
143 return transformationConstantName1a;
144 }
145
146
147
148
149
150 protected abstract String handleGetTransformationMethodName();
151
152 private String __transformationMethodName2a;
153 private boolean __transformationMethodName2aSet = false;
154
155
156
157
158
159
160 public final String getTransformationMethodName()
161 {
162 String transformationMethodName2a = this.__transformationMethodName2a;
163 if (!this.__transformationMethodName2aSet)
164 {
165
166 transformationMethodName2a = handleGetTransformationMethodName();
167
168 this.__transformationMethodName2a = transformationMethodName2a;
169 if (isMetafacadePropertyCachingEnabled())
170 {
171 this.__transformationMethodName2aSet = true;
172 }
173 }
174 return transformationMethodName2a;
175 }
176
177
178
179
180
181 protected abstract String handleGetTransformationAnonymousName();
182
183 private String __transformationAnonymousName3a;
184 private boolean __transformationAnonymousName3aSet = false;
185
186
187
188
189
190
191 public final String getTransformationAnonymousName()
192 {
193 String transformationAnonymousName3a = this.__transformationAnonymousName3a;
194 if (!this.__transformationAnonymousName3aSet)
195 {
196
197 transformationAnonymousName3a = handleGetTransformationAnonymousName();
198
199 this.__transformationAnonymousName3a = transformationAnonymousName3a;
200 if (isMetafacadePropertyCachingEnabled())
201 {
202 this.__transformationAnonymousName3aSet = true;
203 }
204 }
205 return transformationAnonymousName3a;
206 }
207
208
209
210
211
212 protected abstract boolean handleIsCircularReference();
213
214 private boolean __circularReference4a;
215 private boolean __circularReference4aSet = false;
216
217
218
219
220
221
222 public final boolean isCircularReference()
223 {
224 boolean circularReference4a = this.__circularReference4a;
225 if (!this.__circularReference4aSet)
226 {
227
228 circularReference4a = handleIsCircularReference();
229
230 this.__circularReference4a = circularReference4a;
231 if (isMetafacadePropertyCachingEnabled())
232 {
233 this.__circularReference4aSet = true;
234 }
235 }
236 return circularReference4a;
237 }
238
239
240
241
242
243 protected abstract String handleGetTransformationToCollectionMethodName();
244
245 private String __transformationToCollectionMethodName5a;
246 private boolean __transformationToCollectionMethodName5aSet = false;
247
248
249
250
251
252 public final String getTransformationToCollectionMethodName()
253 {
254 String transformationToCollectionMethodName5a = this.__transformationToCollectionMethodName5a;
255 if (!this.__transformationToCollectionMethodName5aSet)
256 {
257
258 transformationToCollectionMethodName5a = handleGetTransformationToCollectionMethodName();
259
260 this.__transformationToCollectionMethodName5a = transformationToCollectionMethodName5a;
261 if (isMetafacadePropertyCachingEnabled())
262 {
263 this.__transformationToCollectionMethodName5aSet = true;
264 }
265 }
266 return transformationToCollectionMethodName5a;
267 }
268
269
270
271
272
273 protected abstract String handleGetDaoName();
274
275 private String __daoName6a;
276 private boolean __daoName6aSet = false;
277
278
279
280
281
282 public final String getDaoName()
283 {
284 String daoName6a = this.__daoName6a;
285 if (!this.__daoName6aSet)
286 {
287
288 daoName6a = handleGetDaoName();
289
290 this.__daoName6a = daoName6a;
291 if (isMetafacadePropertyCachingEnabled())
292 {
293 this.__daoName6aSet = true;
294 }
295 }
296 return daoName6a;
297 }
298
299
300
301
302
303 protected abstract String handleGetDaoGetterName();
304
305 private String __daoGetterName7a;
306 private boolean __daoGetterName7aSet = false;
307
308
309
310
311
312 public final String getDaoGetterName()
313 {
314 String daoGetterName7a = this.__daoGetterName7a;
315 if (!this.__daoGetterName7aSet)
316 {
317
318 daoGetterName7a = handleGetDaoGetterName();
319
320 this.__daoGetterName7a = daoGetterName7a;
321 if (isMetafacadePropertyCachingEnabled())
322 {
323 this.__daoGetterName7aSet = true;
324 }
325 }
326 return daoGetterName7a;
327 }
328
329
330
331
332
333 protected abstract String handleGetDaoSetterName();
334
335 private String __daoSetterName8a;
336 private boolean __daoSetterName8aSet = false;
337
338
339
340
341
342 public final String getDaoSetterName()
343 {
344 String daoSetterName8a = this.__daoSetterName8a;
345 if (!this.__daoSetterName8aSet)
346 {
347
348 daoSetterName8a = handleGetDaoSetterName();
349
350 this.__daoSetterName8a = daoSetterName8a;
351 if (isMetafacadePropertyCachingEnabled())
352 {
353 this.__daoSetterName8aSet = true;
354 }
355 }
356 return daoSetterName8a;
357 }
358
359
360
361
362
363 protected abstract int handleGetTransformationConstantValue();
364
365 private int __transformationConstantValue9a;
366 private boolean __transformationConstantValue9aSet = false;
367
368
369
370
371
372 public final int getTransformationConstantValue()
373 {
374 int transformationConstantValue9a = this.__transformationConstantValue9a;
375 if (!this.__transformationConstantValue9aSet)
376 {
377
378 transformationConstantValue9a = handleGetTransformationConstantValue();
379
380 this.__transformationConstantValue9a = transformationConstantValue9a;
381 if (isMetafacadePropertyCachingEnabled())
382 {
383 this.__transformationConstantValue9aSet = true;
384 }
385 }
386 return transformationConstantValue9a;
387 }
388
389
390
391
392
393 protected abstract String handleGetTransformationToEntityCollectionMethodName();
394
395 private String __transformationToEntityCollectionMethodName10a;
396 private boolean __transformationToEntityCollectionMethodName10aSet = false;
397
398
399
400
401
402
403 public final String getTransformationToEntityCollectionMethodName()
404 {
405 String transformationToEntityCollectionMethodName10a = this.__transformationToEntityCollectionMethodName10a;
406 if (!this.__transformationToEntityCollectionMethodName10aSet)
407 {
408
409 transformationToEntityCollectionMethodName10a = handleGetTransformationToEntityCollectionMethodName();
410
411 this.__transformationToEntityCollectionMethodName10a = transformationToEntityCollectionMethodName10a;
412 if (isMetafacadePropertyCachingEnabled())
413 {
414 this.__transformationToEntityCollectionMethodName10aSet = true;
415 }
416 }
417 return transformationToEntityCollectionMethodName10a;
418 }
419
420
421
422
423
424 protected abstract String handleGetTransformationToEntityMethodName();
425
426 private String __transformationToEntityMethodName11a;
427 private boolean __transformationToEntityMethodName11aSet = false;
428
429
430
431
432
433 public final String getTransformationToEntityMethodName()
434 {
435 String transformationToEntityMethodName11a = this.__transformationToEntityMethodName11a;
436 if (!this.__transformationToEntityMethodName11aSet)
437 {
438
439 transformationToEntityMethodName11a = handleGetTransformationToEntityMethodName();
440
441 this.__transformationToEntityMethodName11a = transformationToEntityMethodName11a;
442 if (isMetafacadePropertyCachingEnabled())
443 {
444 this.__transformationToEntityMethodName11aSet = true;
445 }
446 }
447 return transformationToEntityMethodName11a;
448 }
449
450
451
452
453
454 protected abstract String handleGetValueObjectToEntityTransformerName();
455
456 private String __valueObjectToEntityTransformerName12a;
457 private boolean __valueObjectToEntityTransformerName12aSet = false;
458
459
460
461
462
463 public final String getValueObjectToEntityTransformerName()
464 {
465 String valueObjectToEntityTransformerName12a = this.__valueObjectToEntityTransformerName12a;
466 if (!this.__valueObjectToEntityTransformerName12aSet)
467 {
468
469 valueObjectToEntityTransformerName12a = handleGetValueObjectToEntityTransformerName();
470
471 this.__valueObjectToEntityTransformerName12a = valueObjectToEntityTransformerName12a;
472 if (isMetafacadePropertyCachingEnabled())
473 {
474 this.__valueObjectToEntityTransformerName12aSet = true;
475 }
476 }
477 return valueObjectToEntityTransformerName12a;
478 }
479
480
481
482
483
484 protected abstract String handleGetTransformationToArrayMethodName();
485
486 private String __transformationToArrayMethodName13a;
487 private boolean __transformationToArrayMethodName13aSet = false;
488
489
490
491
492
493 public final String getTransformationToArrayMethodName()
494 {
495 String transformationToArrayMethodName13a = this.__transformationToArrayMethodName13a;
496 if (!this.__transformationToArrayMethodName13aSet)
497 {
498
499 transformationToArrayMethodName13a = handleGetTransformationToArrayMethodName();
500
501 this.__transformationToArrayMethodName13a = transformationToArrayMethodName13a;
502 if (isMetafacadePropertyCachingEnabled())
503 {
504 this.__transformationToArrayMethodName13aSet = true;
505 }
506 }
507 return transformationToArrayMethodName13a;
508 }
509
510
511
512
513
514 public boolean isDependencyFacadeMetaType()
515 {
516 return true;
517 }
518
519
520
521
522
523 public boolean isModelElementFacadeMetaType()
524 {
525 return true;
526 }
527
528
529
530
531
532
533 public String getGetterName()
534 {
535 return this.getSuperDependencyFacade().getGetterName();
536 }
537
538
539
540
541
542 public String getSetterName()
543 {
544 return this.getSuperDependencyFacade().getSetterName();
545 }
546
547
548
549
550
551 public ModelElementFacade getSourceElement()
552 {
553 return this.getSuperDependencyFacade().getSourceElement();
554 }
555
556
557
558
559
560 public ModelElementFacade getTargetElement()
561 {
562 return this.getSuperDependencyFacade().getTargetElement();
563 }
564
565
566
567
568
569 public void copyTaggedValues(ModelElementFacade element)
570 {
571 this.getSuperDependencyFacade().copyTaggedValues(element);
572 }
573
574
575
576
577
578
579 public Object findTaggedValue(String tagName)
580 {
581 return this.getSuperDependencyFacade().findTaggedValue(tagName);
582 }
583
584
585
586
587
588
589 public Collection<Object> findTaggedValues(String tagName)
590 {
591 return this.getSuperDependencyFacade().findTaggedValues(tagName);
592 }
593
594
595
596
597
598
599
600 public String getBindedFullyQualifiedName(ModelElementFacade bindedElement)
601 {
602 return this.getSuperDependencyFacade().getBindedFullyQualifiedName(bindedElement);
603 }
604
605
606
607
608
609 public Collection<ConstraintFacade> getConstraints()
610 {
611 return this.getSuperDependencyFacade().getConstraints();
612 }
613
614
615
616
617
618
619 public Collection<ConstraintFacade> getConstraints(String kind)
620 {
621 return this.getSuperDependencyFacade().getConstraints(kind);
622 }
623
624
625
626
627
628
629
630 public String getDocumentation(String indent)
631 {
632 return this.getSuperDependencyFacade().getDocumentation(indent);
633 }
634
635
636
637
638
639
640
641
642 public String getDocumentation(String indent, int lineLength)
643 {
644 return this.getSuperDependencyFacade().getDocumentation(indent, lineLength);
645 }
646
647
648
649
650
651
652
653 public String getDocumentation(String indent, int lineLength, boolean htmlStyle)
654 {
655 return this.getSuperDependencyFacade().getDocumentation(indent, lineLength, htmlStyle);
656 }
657
658
659
660
661
662 public String getFullyQualifiedName()
663 {
664 return this.getSuperDependencyFacade().getFullyQualifiedName();
665 }
666
667
668
669
670
671
672
673
674 public String getFullyQualifiedName(boolean modelName)
675 {
676 return this.getSuperDependencyFacade().getFullyQualifiedName(modelName);
677 }
678
679
680
681
682
683
684 public String getFullyQualifiedNamePath()
685 {
686 return this.getSuperDependencyFacade().getFullyQualifiedNamePath();
687 }
688
689
690
691
692
693 public String getId()
694 {
695 return this.getSuperDependencyFacade().getId();
696 }
697
698
699
700
701
702
703
704
705
706 public Collection<String> getKeywords()
707 {
708 return this.getSuperDependencyFacade().getKeywords();
709 }
710
711
712
713
714
715 public String getLabel()
716 {
717 return this.getSuperDependencyFacade().getLabel();
718 }
719
720
721
722
723
724 public TypeMappings getLanguageMappings()
725 {
726 return this.getSuperDependencyFacade().getLanguageMappings();
727 }
728
729
730
731
732
733
734 public ModelFacade getModel()
735 {
736 return this.getSuperDependencyFacade().getModel();
737 }
738
739
740
741
742
743 public String getName()
744 {
745 return this.getSuperDependencyFacade().getName();
746 }
747
748
749
750
751
752 public ModelElementFacade getPackage()
753 {
754 return this.getSuperDependencyFacade().getPackage();
755 }
756
757
758
759
760
761 public String getPackageName()
762 {
763 return this.getSuperDependencyFacade().getPackageName();
764 }
765
766
767
768
769
770
771 public String getPackageName(boolean modelName)
772 {
773 return this.getSuperDependencyFacade().getPackageName(modelName);
774 }
775
776
777
778
779
780 public String getPackagePath()
781 {
782 return this.getSuperDependencyFacade().getPackagePath();
783 }
784
785
786
787
788
789
790
791
792 public String getQualifiedName()
793 {
794 return this.getSuperDependencyFacade().getQualifiedName();
795 }
796
797
798
799
800
801 public PackageFacade getRootPackage()
802 {
803 return this.getSuperDependencyFacade().getRootPackage();
804 }
805
806
807
808
809
810 public Collection<DependencyFacade> getSourceDependencies()
811 {
812 return this.getSuperDependencyFacade().getSourceDependencies();
813 }
814
815
816
817
818
819
820 public StateMachineFacade getStateMachineContext()
821 {
822 return this.getSuperDependencyFacade().getStateMachineContext();
823 }
824
825
826
827
828
829 public Collection<String> getStereotypeNames()
830 {
831 return this.getSuperDependencyFacade().getStereotypeNames();
832 }
833
834
835
836
837
838 public Collection<StereotypeFacade> getStereotypes()
839 {
840 return this.getSuperDependencyFacade().getStereotypes();
841 }
842
843
844
845
846
847 public Collection<TaggedValueFacade> getTaggedValues()
848 {
849 return this.getSuperDependencyFacade().getTaggedValues();
850 }
851
852
853
854
855
856 public Collection<DependencyFacade> getTargetDependencies()
857 {
858 return this.getSuperDependencyFacade().getTargetDependencies();
859 }
860
861
862
863
864
865 public Object getTemplateParameter(String parameterName)
866 {
867 return this.getSuperDependencyFacade().getTemplateParameter(parameterName);
868 }
869
870
871
872
873
874 public Collection<TemplateParameterFacade> getTemplateParameters()
875 {
876 return this.getSuperDependencyFacade().getTemplateParameters();
877 }
878
879
880
881
882
883
884 public String getVisibility()
885 {
886 return this.getSuperDependencyFacade().getVisibility();
887 }
888
889
890
891
892
893
894 public boolean hasExactStereotype(String stereotypeName)
895 {
896 return this.getSuperDependencyFacade().hasExactStereotype(stereotypeName);
897 }
898
899
900
901
902
903
904 public boolean hasKeyword(String keywordName)
905 {
906 return this.getSuperDependencyFacade().hasKeyword(keywordName);
907 }
908
909
910
911
912
913
914
915
916
917
918
919
920
921 public boolean hasStereotype(String stereotypeName)
922 {
923 return this.getSuperDependencyFacade().hasStereotype(stereotypeName);
924 }
925
926
927
928
929
930
931 public boolean isBindingDependenciesPresent()
932 {
933 return this.getSuperDependencyFacade().isBindingDependenciesPresent();
934 }
935
936
937
938
939
940 public boolean isConstraintsPresent()
941 {
942 return this.getSuperDependencyFacade().isConstraintsPresent();
943 }
944
945
946
947
948
949 public boolean isDocumentationPresent()
950 {
951 return this.getSuperDependencyFacade().isDocumentationPresent();
952 }
953
954
955
956
957
958 public boolean isReservedWord()
959 {
960 return this.getSuperDependencyFacade().isReservedWord();
961 }
962
963
964
965
966
967
968 public boolean isTemplateParametersPresent()
969 {
970 return this.getSuperDependencyFacade().isTemplateParametersPresent();
971 }
972
973
974
975
976
977
978
979 public boolean isValidIdentifierName()
980 {
981 return this.getSuperDependencyFacade().isValidIdentifierName();
982 }
983
984
985
986
987
988
989
990 public String translateConstraint(String name, String translation)
991 {
992 return this.getSuperDependencyFacade().translateConstraint(name, translation);
993 }
994
995
996
997
998
999 public String[] translateConstraints(String translation)
1000 {
1001 return this.getSuperDependencyFacade().translateConstraints(translation);
1002 }
1003
1004
1005
1006
1007
1008 public String[] translateConstraints(String kind, String translation)
1009 {
1010 return this.getSuperDependencyFacade().translateConstraints(kind, translation);
1011 }
1012
1013
1014
1015
1016 @Override
1017 public void initialize()
1018 {
1019 this.getSuperDependencyFacade().initialize();
1020 }
1021
1022
1023
1024
1025
1026 @Override
1027 public Object getValidationOwner()
1028 {
1029 Object owner = this.getSuperDependencyFacade().getValidationOwner();
1030 return owner;
1031 }
1032
1033
1034
1035
1036
1037 @Override
1038 public String getValidationName()
1039 {
1040 String name = this.getSuperDependencyFacade().getValidationName();
1041 return name;
1042 }
1043
1044
1045
1046
1047
1048 @Override
1049 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
1050 {
1051 this.getSuperDependencyFacade().validateInvariants(validationMessages);
1052 }
1053
1054
1055
1056
1057 private static final String NAME_PROPERTY = "name";
1058 private static final String FQNAME_PROPERTY = "fullyQualifiedName";
1059
1060
1061
1062
1063 @Override
1064 public String toString()
1065 {
1066 final StringBuilder toString = new StringBuilder(this.getClass().getName());
1067 toString.append("[");
1068 try
1069 {
1070 toString.append(Introspector.instance().getProperty(this, FQNAME_PROPERTY));
1071 }
1072 catch (final Throwable tryAgain)
1073 {
1074 try
1075 {
1076 toString.append(Introspector.instance().getProperty(this, NAME_PROPERTY));
1077 }
1078 catch (final Throwable ignore)
1079 {
1080
1081 }
1082 }
1083 toString.append("]");
1084 return toString.toString();
1085 }
1086 }