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