1
2
3
4
5 package org.andromda.cartridges.hibernate.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.ClassifierFacade;
13 import org.andromda.metafacades.uml.ConstraintFacade;
14 import org.andromda.metafacades.uml.DependencyFacade;
15 import org.andromda.metafacades.uml.EntityAttribute;
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 HibernateEntityAttributeLogic
33 extends MetafacadeBase
34 implements HibernateEntityAttribute
35 {
36
37
38
39
40 protected Object metaObject;
41
42
43
44
45
46 protected HibernateEntityAttributeLogic(Object metaObjectIn, String context)
47 {
48 super(metaObjectIn, getContext(context));
49 this.superEntityAttribute =
50 (EntityAttribute)
51 MetafacadeFactory.getInstance().createFacadeImpl(
52 "org.andromda.metafacades.uml.EntityAttribute",
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.hibernate.metafacades.HibernateEntityAttribute";
68 }
69 return context;
70 }
71
72 private EntityAttribute superEntityAttribute;
73 private boolean superEntityAttributeInitialized = false;
74
75
76
77
78
79 private EntityAttribute getSuperEntityAttribute()
80 {
81 if (!this.superEntityAttributeInitialized)
82 {
83 ((MetafacadeBase)this.superEntityAttribute).setMetafacadeContext(this.getMetafacadeContext());
84 this.superEntityAttributeInitialized = true;
85 }
86 return this.superEntityAttribute;
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.superEntityAttributeInitialized)
101 {
102 ((MetafacadeBase)this.superEntityAttribute).resetMetafacadeContext(context);
103 }
104 }
105 }
106
107
108
109
110
111 public boolean isHibernateEntityAttributeMetaType()
112 {
113 return true;
114 }
115
116
117
118
119
120
121
122 protected abstract boolean handleIsContainsEmbeddedObject();
123
124 private boolean __containsEmbeddedObject1a;
125 private boolean __containsEmbeddedObject1aSet = false;
126
127
128
129
130
131
132 public final boolean isContainsEmbeddedObject()
133 {
134 boolean containsEmbeddedObject1a = this.__containsEmbeddedObject1a;
135 if (!this.__containsEmbeddedObject1aSet)
136 {
137
138 containsEmbeddedObject1a = handleIsContainsEmbeddedObject();
139
140 this.__containsEmbeddedObject1a = containsEmbeddedObject1a;
141 if (isMetafacadePropertyCachingEnabled())
142 {
143 this.__containsEmbeddedObject1aSet = true;
144 }
145 }
146 return containsEmbeddedObject1a;
147 }
148
149
150
151
152
153 protected abstract String handleGetFormula();
154
155 private String __formula2a;
156 private boolean __formula2aSet = false;
157
158
159
160
161
162
163 public final String getFormula()
164 {
165 String formula2a = this.__formula2a;
166 if (!this.__formula2aSet)
167 {
168
169 formula2a = handleGetFormula();
170
171 this.__formula2a = formula2a;
172 if (isMetafacadePropertyCachingEnabled())
173 {
174 this.__formula2aSet = true;
175 }
176 }
177 return formula2a;
178 }
179
180
181
182
183
184 protected abstract boolean handleIsLazy();
185
186 private boolean __lazy3a;
187 private boolean __lazy3aSet = false;
188
189
190
191
192
193 public final boolean isLazy()
194 {
195 boolean lazy3a = this.__lazy3a;
196 if (!this.__lazy3aSet)
197 {
198
199 lazy3a = handleIsLazy();
200
201 this.__lazy3a = lazy3a;
202 if (isMetafacadePropertyCachingEnabled())
203 {
204 this.__lazy3aSet = true;
205 }
206 }
207 return lazy3a;
208 }
209
210
211
212
213
214 protected abstract boolean handleIsInsertEnabled();
215
216 private boolean __insertEnabled4a;
217 private boolean __insertEnabled4aSet = false;
218
219
220
221
222
223 public final boolean isInsertEnabled()
224 {
225 boolean insertEnabled4a = this.__insertEnabled4a;
226 if (!this.__insertEnabled4aSet)
227 {
228
229 insertEnabled4a = handleIsInsertEnabled();
230
231 this.__insertEnabled4a = insertEnabled4a;
232 if (isMetafacadePropertyCachingEnabled())
233 {
234 this.__insertEnabled4aSet = true;
235 }
236 }
237 return insertEnabled4a;
238 }
239
240
241
242
243
244 protected abstract boolean handleIsUpdateEnabled();
245
246 private boolean __updateEnabled5a;
247 private boolean __updateEnabled5aSet = false;
248
249
250
251
252
253 public final boolean isUpdateEnabled()
254 {
255 boolean updateEnabled5a = this.__updateEnabled5a;
256 if (!this.__updateEnabled5aSet)
257 {
258
259 updateEnabled5a = handleIsUpdateEnabled();
260
261 this.__updateEnabled5a = updateEnabled5a;
262 if (isMetafacadePropertyCachingEnabled())
263 {
264 this.__updateEnabled5aSet = true;
265 }
266 }
267 return updateEnabled5a;
268 }
269
270
271
272
273
274 protected abstract String handleGetXmlTagName();
275
276 private String __xmlTagName6a;
277 private boolean __xmlTagName6aSet = false;
278
279
280
281
282
283
284 public final String getXmlTagName()
285 {
286 String xmlTagName6a = this.__xmlTagName6a;
287 if (!this.__xmlTagName6aSet)
288 {
289
290 xmlTagName6a = handleGetXmlTagName();
291
292 this.__xmlTagName6a = xmlTagName6a;
293 if (isMetafacadePropertyCachingEnabled())
294 {
295 this.__xmlTagName6aSet = true;
296 }
297 }
298 return xmlTagName6a;
299 }
300
301
302
303
304
305 protected abstract String handleGetFullyQualifiedHibernateType();
306
307 private String __fullyQualifiedHibernateType7a;
308 private boolean __fullyQualifiedHibernateType7aSet = false;
309
310
311
312
313
314
315 public final String getFullyQualifiedHibernateType()
316 {
317 String fullyQualifiedHibernateType7a = this.__fullyQualifiedHibernateType7a;
318 if (!this.__fullyQualifiedHibernateType7aSet)
319 {
320
321 fullyQualifiedHibernateType7a = handleGetFullyQualifiedHibernateType();
322
323 this.__fullyQualifiedHibernateType7a = fullyQualifiedHibernateType7a;
324 if (isMetafacadePropertyCachingEnabled())
325 {
326 this.__fullyQualifiedHibernateType7aSet = true;
327 }
328 }
329 return fullyQualifiedHibernateType7a;
330 }
331
332
333
334
335
336
337
338
339
340
341
342 protected abstract String handleConcatColumnName(String prefix, String name);
343
344
345
346
347
348
349
350
351
352
353
354
355 public String concatColumnName(String prefix, String name)
356 {
357
358 String returnValue = handleConcatColumnName(prefix, name);
359
360 return returnValue;
361 }
362
363
364
365
366
367 public boolean isEntityAttributeMetaType()
368 {
369 return true;
370 }
371
372
373
374
375
376 public boolean isAttributeFacadeMetaType()
377 {
378 return true;
379 }
380
381
382
383
384
385 public boolean isModelElementFacadeMetaType()
386 {
387 return true;
388 }
389
390
391
392
393
394
395
396
397 public Object findTaggedValue(String name, boolean follow)
398 {
399 return this.getSuperEntityAttribute().findTaggedValue(name, follow);
400 }
401
402
403
404
405
406 public String getDefaultValue()
407 {
408 return this.getSuperEntityAttribute().getDefaultValue();
409 }
410
411
412
413
414
415
416 public EnumerationFacade getEnumeration()
417 {
418 return this.getSuperEntityAttribute().getEnumeration();
419 }
420
421
422
423
424
425 public String getEnumerationLiteralParameters()
426 {
427 return this.getSuperEntityAttribute().getEnumerationLiteralParameters();
428 }
429
430
431
432
433
434
435
436 public String getEnumerationValue()
437 {
438 return this.getSuperEntityAttribute().getEnumerationValue();
439 }
440
441
442
443
444
445 public String getGetterName()
446 {
447 return this.getSuperEntityAttribute().getGetterName();
448 }
449
450
451
452
453
454
455 public String getGetterSetterTypeName()
456 {
457 return this.getSuperEntityAttribute().getGetterSetterTypeName();
458 }
459
460
461
462
463
464
465 public int getLower()
466 {
467 return this.getSuperEntityAttribute().getLower();
468 }
469
470
471
472
473
474 public ClassifierFacade getOwner()
475 {
476 return this.getSuperEntityAttribute().getOwner();
477 }
478
479
480
481
482
483 public String getSetterName()
484 {
485 return this.getSuperEntityAttribute().getSetterName();
486 }
487
488
489
490
491
492 public ClassifierFacade getType()
493 {
494 return this.getSuperEntityAttribute().getType();
495 }
496
497
498
499
500
501
502 public int getUpper()
503 {
504 return this.getSuperEntityAttribute().getUpper();
505 }
506
507
508
509
510
511 public boolean isAddOnly()
512 {
513 return this.getSuperEntityAttribute().isAddOnly();
514 }
515
516
517
518
519
520 public boolean isChangeable()
521 {
522 return this.getSuperEntityAttribute().isChangeable();
523 }
524
525
526
527
528
529 public boolean isDefaultValuePresent()
530 {
531 return this.getSuperEntityAttribute().isDefaultValuePresent();
532 }
533
534
535
536
537
538
539 public boolean isDerived()
540 {
541 return this.getSuperEntityAttribute().isDerived();
542 }
543
544
545
546
547
548 public boolean isEnumerationLiteral()
549 {
550 return this.getSuperEntityAttribute().isEnumerationLiteral();
551 }
552
553
554
555
556
557
558 public boolean isEnumerationLiteralParametersExist()
559 {
560 return this.getSuperEntityAttribute().isEnumerationLiteralParametersExist();
561 }
562
563
564
565
566
567
568 public boolean isEnumerationMember()
569 {
570 return this.getSuperEntityAttribute().isEnumerationMember();
571 }
572
573
574
575
576
577
578 public boolean isLeaf()
579 {
580 return this.getSuperEntityAttribute().isLeaf();
581 }
582
583
584
585
586
587 public boolean isMany()
588 {
589 return this.getSuperEntityAttribute().isMany();
590 }
591
592
593
594
595
596 public boolean isOrdered()
597 {
598 return this.getSuperEntityAttribute().isOrdered();
599 }
600
601
602
603
604
605 public boolean isReadOnly()
606 {
607 return this.getSuperEntityAttribute().isReadOnly();
608 }
609
610
611
612
613
614 public boolean isRequired()
615 {
616 return this.getSuperEntityAttribute().isRequired();
617 }
618
619
620
621
622
623 public boolean isStatic()
624 {
625 return this.getSuperEntityAttribute().isStatic();
626 }
627
628
629
630
631
632
633 public boolean isUnique()
634 {
635 return this.getSuperEntityAttribute().isUnique();
636 }
637
638
639
640
641
642 public String getColumnIndex()
643 {
644 return this.getSuperEntityAttribute().getColumnIndex();
645 }
646
647
648
649
650
651 public String getColumnLength()
652 {
653 return this.getSuperEntityAttribute().getColumnLength();
654 }
655
656
657
658
659
660 public String getColumnName()
661 {
662 return this.getSuperEntityAttribute().getColumnName();
663 }
664
665
666
667
668
669 public TypeMappings getJdbcMappings()
670 {
671 return this.getSuperEntityAttribute().getJdbcMappings();
672 }
673
674
675
676
677
678 public String getJdbcType()
679 {
680 return this.getSuperEntityAttribute().getJdbcType();
681 }
682
683
684
685
686
687 public TypeMappings getSqlMappings()
688 {
689 return this.getSuperEntityAttribute().getSqlMappings();
690 }
691
692
693
694
695
696 public String getSqlType()
697 {
698 return this.getSuperEntityAttribute().getSqlType();
699 }
700
701
702
703
704
705 public String getUniqueGroup()
706 {
707 return this.getSuperEntityAttribute().getUniqueGroup();
708 }
709
710
711
712
713
714 public boolean isIdentifier()
715 {
716 return this.getSuperEntityAttribute().isIdentifier();
717 }
718
719
720
721
722
723 public boolean isTransient()
724 {
725 return this.getSuperEntityAttribute().isTransient();
726 }
727
728
729
730
731
732 public void copyTaggedValues(ModelElementFacade element)
733 {
734 this.getSuperEntityAttribute().copyTaggedValues(element);
735 }
736
737
738
739
740
741
742 public Object findTaggedValue(String tagName)
743 {
744 return this.getSuperEntityAttribute().findTaggedValue(tagName);
745 }
746
747
748
749
750
751
752 public Collection<Object> findTaggedValues(String tagName)
753 {
754 return this.getSuperEntityAttribute().findTaggedValues(tagName);
755 }
756
757
758
759
760
761
762
763 public String getBindedFullyQualifiedName(ModelElementFacade bindedElement)
764 {
765 return this.getSuperEntityAttribute().getBindedFullyQualifiedName(bindedElement);
766 }
767
768
769
770
771
772 public Collection<ConstraintFacade> getConstraints()
773 {
774 return this.getSuperEntityAttribute().getConstraints();
775 }
776
777
778
779
780
781
782 public Collection<ConstraintFacade> getConstraints(String kind)
783 {
784 return this.getSuperEntityAttribute().getConstraints(kind);
785 }
786
787
788
789
790
791
792
793 public String getDocumentation(String indent)
794 {
795 return this.getSuperEntityAttribute().getDocumentation(indent);
796 }
797
798
799
800
801
802
803
804
805 public String getDocumentation(String indent, int lineLength)
806 {
807 return this.getSuperEntityAttribute().getDocumentation(indent, lineLength);
808 }
809
810
811
812
813
814
815
816 public String getDocumentation(String indent, int lineLength, boolean htmlStyle)
817 {
818 return this.getSuperEntityAttribute().getDocumentation(indent, lineLength, htmlStyle);
819 }
820
821
822
823
824
825 public String getFullyQualifiedName()
826 {
827 return this.getSuperEntityAttribute().getFullyQualifiedName();
828 }
829
830
831
832
833
834
835
836
837 public String getFullyQualifiedName(boolean modelName)
838 {
839 return this.getSuperEntityAttribute().getFullyQualifiedName(modelName);
840 }
841
842
843
844
845
846
847 public String getFullyQualifiedNamePath()
848 {
849 return this.getSuperEntityAttribute().getFullyQualifiedNamePath();
850 }
851
852
853
854
855
856 public String getId()
857 {
858 return this.getSuperEntityAttribute().getId();
859 }
860
861
862
863
864
865
866
867
868
869 public Collection<String> getKeywords()
870 {
871 return this.getSuperEntityAttribute().getKeywords();
872 }
873
874
875
876
877
878 public String getLabel()
879 {
880 return this.getSuperEntityAttribute().getLabel();
881 }
882
883
884
885
886
887 public TypeMappings getLanguageMappings()
888 {
889 return this.getSuperEntityAttribute().getLanguageMappings();
890 }
891
892
893
894
895
896
897 public ModelFacade getModel()
898 {
899 return this.getSuperEntityAttribute().getModel();
900 }
901
902
903
904
905
906 public String getName()
907 {
908 return this.getSuperEntityAttribute().getName();
909 }
910
911
912
913
914
915 public ModelElementFacade getPackage()
916 {
917 return this.getSuperEntityAttribute().getPackage();
918 }
919
920
921
922
923
924 public String getPackageName()
925 {
926 return this.getSuperEntityAttribute().getPackageName();
927 }
928
929
930
931
932
933
934 public String getPackageName(boolean modelName)
935 {
936 return this.getSuperEntityAttribute().getPackageName(modelName);
937 }
938
939
940
941
942
943 public String getPackagePath()
944 {
945 return this.getSuperEntityAttribute().getPackagePath();
946 }
947
948
949
950
951
952
953
954
955 public String getQualifiedName()
956 {
957 return this.getSuperEntityAttribute().getQualifiedName();
958 }
959
960
961
962
963
964 public PackageFacade getRootPackage()
965 {
966 return this.getSuperEntityAttribute().getRootPackage();
967 }
968
969
970
971
972
973 public Collection<DependencyFacade> getSourceDependencies()
974 {
975 return this.getSuperEntityAttribute().getSourceDependencies();
976 }
977
978
979
980
981
982
983 public StateMachineFacade getStateMachineContext()
984 {
985 return this.getSuperEntityAttribute().getStateMachineContext();
986 }
987
988
989
990
991
992 public Collection<String> getStereotypeNames()
993 {
994 return this.getSuperEntityAttribute().getStereotypeNames();
995 }
996
997
998
999
1000
1001 public Collection<StereotypeFacade> getStereotypes()
1002 {
1003 return this.getSuperEntityAttribute().getStereotypes();
1004 }
1005
1006
1007
1008
1009
1010 public Collection<TaggedValueFacade> getTaggedValues()
1011 {
1012 return this.getSuperEntityAttribute().getTaggedValues();
1013 }
1014
1015
1016
1017
1018
1019 public Collection<DependencyFacade> getTargetDependencies()
1020 {
1021 return this.getSuperEntityAttribute().getTargetDependencies();
1022 }
1023
1024
1025
1026
1027
1028 public Object getTemplateParameter(String parameterName)
1029 {
1030 return this.getSuperEntityAttribute().getTemplateParameter(parameterName);
1031 }
1032
1033
1034
1035
1036
1037 public Collection<TemplateParameterFacade> getTemplateParameters()
1038 {
1039 return this.getSuperEntityAttribute().getTemplateParameters();
1040 }
1041
1042
1043
1044
1045
1046
1047 public String getVisibility()
1048 {
1049 return this.getSuperEntityAttribute().getVisibility();
1050 }
1051
1052
1053
1054
1055
1056
1057 public boolean hasExactStereotype(String stereotypeName)
1058 {
1059 return this.getSuperEntityAttribute().hasExactStereotype(stereotypeName);
1060 }
1061
1062
1063
1064
1065
1066
1067 public boolean hasKeyword(String keywordName)
1068 {
1069 return this.getSuperEntityAttribute().hasKeyword(keywordName);
1070 }
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084 public boolean hasStereotype(String stereotypeName)
1085 {
1086 return this.getSuperEntityAttribute().hasStereotype(stereotypeName);
1087 }
1088
1089
1090
1091
1092
1093
1094 public boolean isBindingDependenciesPresent()
1095 {
1096 return this.getSuperEntityAttribute().isBindingDependenciesPresent();
1097 }
1098
1099
1100
1101
1102
1103 public boolean isConstraintsPresent()
1104 {
1105 return this.getSuperEntityAttribute().isConstraintsPresent();
1106 }
1107
1108
1109
1110
1111
1112 public boolean isDocumentationPresent()
1113 {
1114 return this.getSuperEntityAttribute().isDocumentationPresent();
1115 }
1116
1117
1118
1119
1120
1121 public boolean isReservedWord()
1122 {
1123 return this.getSuperEntityAttribute().isReservedWord();
1124 }
1125
1126
1127
1128
1129
1130
1131 public boolean isTemplateParametersPresent()
1132 {
1133 return this.getSuperEntityAttribute().isTemplateParametersPresent();
1134 }
1135
1136
1137
1138
1139
1140
1141
1142 public boolean isValidIdentifierName()
1143 {
1144 return this.getSuperEntityAttribute().isValidIdentifierName();
1145 }
1146
1147
1148
1149
1150
1151
1152
1153 public String translateConstraint(String name, String translation)
1154 {
1155 return this.getSuperEntityAttribute().translateConstraint(name, translation);
1156 }
1157
1158
1159
1160
1161
1162 public String[] translateConstraints(String translation)
1163 {
1164 return this.getSuperEntityAttribute().translateConstraints(translation);
1165 }
1166
1167
1168
1169
1170
1171 public String[] translateConstraints(String kind, String translation)
1172 {
1173 return this.getSuperEntityAttribute().translateConstraints(kind, translation);
1174 }
1175
1176
1177
1178
1179 @Override
1180 public void initialize()
1181 {
1182 this.getSuperEntityAttribute().initialize();
1183 }
1184
1185
1186
1187
1188
1189 @Override
1190 public Object getValidationOwner()
1191 {
1192 Object owner = this.getSuperEntityAttribute().getValidationOwner();
1193 return owner;
1194 }
1195
1196
1197
1198
1199
1200 @Override
1201 public String getValidationName()
1202 {
1203 String name = this.getSuperEntityAttribute().getValidationName();
1204 return name;
1205 }
1206
1207
1208
1209
1210
1211 @Override
1212 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
1213 {
1214 this.getSuperEntityAttribute().validateInvariants(validationMessages);
1215 }
1216
1217
1218
1219
1220 private static final String NAME_PROPERTY = "name";
1221 private static final String FQNAME_PROPERTY = "fullyQualifiedName";
1222
1223
1224
1225
1226 @Override
1227 public String toString()
1228 {
1229 final StringBuilder toString = new StringBuilder(this.getClass().getName());
1230 toString.append("[");
1231 try
1232 {
1233 toString.append(Introspector.instance().getProperty(this, FQNAME_PROPERTY));
1234 }
1235 catch (final Throwable tryAgain)
1236 {
1237 try
1238 {
1239 toString.append(Introspector.instance().getProperty(this, NAME_PROPERTY));
1240 }
1241 catch (final Throwable ignore)
1242 {
1243
1244 }
1245 }
1246 toString.append("]");
1247 return toString.toString();
1248 }
1249 }