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