1
2
3
4
5 package org.andromda.metafacades.uml14;
6
7 import java.util.Collection;
8 import java.util.List;
9 import org.andromda.core.metafacade.MetafacadeBase;
10 import org.andromda.core.metafacade.ModelValidationMessage;
11 import org.andromda.metafacades.uml.ClassifierFacade;
12 import org.andromda.metafacades.uml.ConstraintFacade;
13 import org.andromda.metafacades.uml.ModelElementFacade;
14 import org.andromda.metafacades.uml.OperationFacade;
15 import org.andromda.metafacades.uml.ParameterFacade;
16 import org.andromda.translation.ocl.validation.OCLCollections;
17 import org.andromda.translation.ocl.validation.OCLExpressions;
18 import org.andromda.translation.ocl.validation.OCLIntrospector;
19 import org.andromda.translation.ocl.validation.OCLResultEnsurer;
20 import org.apache.log4j.Logger;
21 import org.omg.uml.foundation.core.Operation;
22
23
24
25
26
27
28
29
30
31 public abstract class OperationFacadeLogic
32 extends ModelElementFacadeLogicImpl
33 implements OperationFacade
34 {
35
36
37
38
39 protected Operation metaObject;
40
41
42
43
44
45 protected OperationFacadeLogic(Operation metaObjectIn, String context)
46 {
47 super(metaObjectIn, getContext(context));
48 this.metaObject = metaObjectIn;
49 }
50
51
52
53
54 private static final Logger logger = Logger.getLogger(OperationFacadeLogic.class);
55
56
57
58
59
60
61 private static String getContext(String context)
62 {
63 if (context == null)
64 {
65 context = "org.andromda.metafacades.uml.OperationFacade";
66 }
67 return context;
68 }
69
70
71
72
73 @Override
74 public void resetMetafacadeContext(String context)
75 {
76 if (!this.contextRoot)
77 {
78 context = getContext(context);
79 setMetafacadeContext (context);
80 }
81 }
82
83
84
85
86
87 public boolean isOperationFacadeMetaType()
88 {
89 return true;
90 }
91
92
93
94
95
96
97
98 protected abstract String handleGetSignature();
99
100 private String __signature1a;
101 private boolean __signature1aSet = false;
102
103
104
105
106
107
108 public final String getSignature()
109 {
110 String signature1a = this.__signature1a;
111 if (!this.__signature1aSet)
112 {
113
114 signature1a = handleGetSignature();
115
116 this.__signature1a = signature1a;
117 if (isMetafacadePropertyCachingEnabled())
118 {
119 this.__signature1aSet = true;
120 }
121 }
122 return signature1a;
123 }
124
125
126
127
128
129 protected abstract String handleGetCall();
130
131 private String __call2a;
132 private boolean __call2aSet = false;
133
134
135
136
137
138 public final String getCall()
139 {
140 String call2a = this.__call2a;
141 if (!this.__call2aSet)
142 {
143
144 call2a = handleGetCall();
145
146 this.__call2a = call2a;
147 if (isMetafacadePropertyCachingEnabled())
148 {
149 this.__call2aSet = true;
150 }
151 }
152 return call2a;
153 }
154
155
156
157
158
159 protected abstract String handleGetTypedArgumentList();
160
161 private String __typedArgumentList3a;
162 private boolean __typedArgumentList3aSet = false;
163
164
165
166
167
168 public final String getTypedArgumentList()
169 {
170 String typedArgumentList3a = this.__typedArgumentList3a;
171 if (!this.__typedArgumentList3aSet)
172 {
173
174 typedArgumentList3a = handleGetTypedArgumentList();
175
176 this.__typedArgumentList3a = typedArgumentList3a;
177 if (isMetafacadePropertyCachingEnabled())
178 {
179 this.__typedArgumentList3aSet = true;
180 }
181 }
182 return typedArgumentList3a;
183 }
184
185
186
187
188
189 protected abstract boolean handleIsStatic();
190
191 private boolean __static4a;
192 private boolean __static4aSet = false;
193
194
195
196
197
198 public final boolean isStatic()
199 {
200 boolean static4a = this.__static4a;
201 if (!this.__static4aSet)
202 {
203
204 static4a = handleIsStatic();
205
206 this.__static4a = static4a;
207 if (isMetafacadePropertyCachingEnabled())
208 {
209 this.__static4aSet = true;
210 }
211 }
212 return static4a;
213 }
214
215
216
217
218
219 protected abstract boolean handleIsAbstract();
220
221 private boolean __abstract5a;
222 private boolean __abstract5aSet = false;
223
224
225
226
227
228 public final boolean isAbstract()
229 {
230 boolean abstract5a = this.__abstract5a;
231 if (!this.__abstract5aSet)
232 {
233
234 abstract5a = handleIsAbstract();
235
236 this.__abstract5a = abstract5a;
237 if (isMetafacadePropertyCachingEnabled())
238 {
239 this.__abstract5aSet = true;
240 }
241 }
242 return abstract5a;
243 }
244
245
246
247
248
249 protected abstract String handleGetExceptionList();
250
251 private String __exceptionList6a;
252 private boolean __exceptionList6aSet = false;
253
254
255
256
257
258
259 public final String getExceptionList()
260 {
261 String exceptionList6a = this.__exceptionList6a;
262 if (!this.__exceptionList6aSet)
263 {
264
265 exceptionList6a = handleGetExceptionList();
266
267 this.__exceptionList6a = exceptionList6a;
268 if (isMetafacadePropertyCachingEnabled())
269 {
270 this.__exceptionList6aSet = true;
271 }
272 }
273 return exceptionList6a;
274 }
275
276
277
278
279
280 protected abstract Collection<ModelElementFacade> handleGetExceptions();
281
282 private Collection<ModelElementFacade> __exceptions7a;
283 private boolean __exceptions7aSet = false;
284
285
286
287
288
289 public final Collection<ModelElementFacade> getExceptions()
290 {
291 Collection<ModelElementFacade> exceptions7a = this.__exceptions7a;
292 if (!this.__exceptions7aSet)
293 {
294
295 exceptions7a = handleGetExceptions();
296
297 this.__exceptions7a = exceptions7a;
298 if (isMetafacadePropertyCachingEnabled())
299 {
300 this.__exceptions7aSet = true;
301 }
302 }
303 return exceptions7a;
304 }
305
306
307
308
309
310 protected abstract boolean handleIsReturnTypePresent();
311
312 private boolean __returnTypePresent8a;
313 private boolean __returnTypePresent8aSet = false;
314
315
316
317
318
319
320 public final boolean isReturnTypePresent()
321 {
322 boolean returnTypePresent8a = this.__returnTypePresent8a;
323 if (!this.__returnTypePresent8aSet)
324 {
325
326 returnTypePresent8a = handleIsReturnTypePresent();
327
328 this.__returnTypePresent8a = returnTypePresent8a;
329 if (isMetafacadePropertyCachingEnabled())
330 {
331 this.__returnTypePresent8aSet = true;
332 }
333 }
334 return returnTypePresent8a;
335 }
336
337
338
339
340
341 protected abstract boolean handleIsExceptionsPresent();
342
343 private boolean __exceptionsPresent9a;
344 private boolean __exceptionsPresent9aSet = false;
345
346
347
348
349
350 public final boolean isExceptionsPresent()
351 {
352 boolean exceptionsPresent9a = this.__exceptionsPresent9a;
353 if (!this.__exceptionsPresent9aSet)
354 {
355
356 exceptionsPresent9a = handleIsExceptionsPresent();
357
358 this.__exceptionsPresent9a = exceptionsPresent9a;
359 if (isMetafacadePropertyCachingEnabled())
360 {
361 this.__exceptionsPresent9aSet = true;
362 }
363 }
364 return exceptionsPresent9a;
365 }
366
367
368
369
370
371 protected abstract String handleGetArgumentNames();
372
373 private String __argumentNames10a;
374 private boolean __argumentNames10aSet = false;
375
376
377
378
379
380 public final String getArgumentNames()
381 {
382 String argumentNames10a = this.__argumentNames10a;
383 if (!this.__argumentNames10aSet)
384 {
385
386 argumentNames10a = handleGetArgumentNames();
387
388 this.__argumentNames10a = argumentNames10a;
389 if (isMetafacadePropertyCachingEnabled())
390 {
391 this.__argumentNames10aSet = true;
392 }
393 }
394 return argumentNames10a;
395 }
396
397
398
399
400
401 protected abstract String handleGetArgumentTypeNames();
402
403 private String __argumentTypeNames11a;
404 private boolean __argumentTypeNames11aSet = false;
405
406
407
408
409
410 public final String getArgumentTypeNames()
411 {
412 String argumentTypeNames11a = this.__argumentTypeNames11a;
413 if (!this.__argumentTypeNames11aSet)
414 {
415
416 argumentTypeNames11a = handleGetArgumentTypeNames();
417
418 this.__argumentTypeNames11a = argumentTypeNames11a;
419 if (isMetafacadePropertyCachingEnabled())
420 {
421 this.__argumentTypeNames11aSet = true;
422 }
423 }
424 return argumentTypeNames11a;
425 }
426
427
428
429
430
431 protected abstract boolean handleIsQuery();
432
433 private boolean __query12a;
434 private boolean __query12aSet = false;
435
436
437
438
439
440 public final boolean isQuery()
441 {
442 boolean query12a = this.__query12a;
443 if (!this.__query12aSet)
444 {
445
446 query12a = handleIsQuery();
447
448 this.__query12a = query12a;
449 if (isMetafacadePropertyCachingEnabled())
450 {
451 this.__query12aSet = true;
452 }
453 }
454 return query12a;
455 }
456
457
458
459
460
461 protected abstract String handleGetConcurrency();
462
463 private String __concurrency13a;
464 private boolean __concurrency13aSet = false;
465
466
467
468
469
470
471
472 public final String getConcurrency()
473 {
474 String concurrency13a = this.__concurrency13a;
475 if (!this.__concurrency13aSet)
476 {
477
478 concurrency13a = handleGetConcurrency();
479
480 this.__concurrency13a = concurrency13a;
481 if (isMetafacadePropertyCachingEnabled())
482 {
483 this.__concurrency13aSet = true;
484 }
485 }
486 return concurrency13a;
487 }
488
489
490
491
492
493 protected abstract String handleGetPreconditionName();
494
495 private String __preconditionName14a;
496 private boolean __preconditionName14aSet = false;
497
498
499
500
501
502 public final String getPreconditionName()
503 {
504 String preconditionName14a = this.__preconditionName14a;
505 if (!this.__preconditionName14aSet)
506 {
507
508 preconditionName14a = handleGetPreconditionName();
509
510 this.__preconditionName14a = preconditionName14a;
511 if (isMetafacadePropertyCachingEnabled())
512 {
513 this.__preconditionName14aSet = true;
514 }
515 }
516 return preconditionName14a;
517 }
518
519
520
521
522
523 protected abstract String handleGetPostconditionName();
524
525 private String __postconditionName15a;
526 private boolean __postconditionName15aSet = false;
527
528
529
530
531
532 public final String getPostconditionName()
533 {
534 String postconditionName15a = this.__postconditionName15a;
535 if (!this.__postconditionName15aSet)
536 {
537
538 postconditionName15a = handleGetPostconditionName();
539
540 this.__postconditionName15a = postconditionName15a;
541 if (isMetafacadePropertyCachingEnabled())
542 {
543 this.__postconditionName15aSet = true;
544 }
545 }
546 return postconditionName15a;
547 }
548
549
550
551
552
553 protected abstract String handleGetPreconditionSignature();
554
555 private String __preconditionSignature16a;
556 private boolean __preconditionSignature16aSet = false;
557
558
559
560
561
562 public final String getPreconditionSignature()
563 {
564 String preconditionSignature16a = this.__preconditionSignature16a;
565 if (!this.__preconditionSignature16aSet)
566 {
567
568 preconditionSignature16a = handleGetPreconditionSignature();
569
570 this.__preconditionSignature16a = preconditionSignature16a;
571 if (isMetafacadePropertyCachingEnabled())
572 {
573 this.__preconditionSignature16aSet = true;
574 }
575 }
576 return preconditionSignature16a;
577 }
578
579
580
581
582
583 protected abstract String handleGetPreconditionCall();
584
585 private String __preconditionCall17a;
586 private boolean __preconditionCall17aSet = false;
587
588
589
590
591
592 public final String getPreconditionCall()
593 {
594 String preconditionCall17a = this.__preconditionCall17a;
595 if (!this.__preconditionCall17aSet)
596 {
597
598 preconditionCall17a = handleGetPreconditionCall();
599
600 this.__preconditionCall17a = preconditionCall17a;
601 if (isMetafacadePropertyCachingEnabled())
602 {
603 this.__preconditionCall17aSet = true;
604 }
605 }
606 return preconditionCall17a;
607 }
608
609
610
611
612
613 protected abstract boolean handleIsPreconditionsPresent();
614
615 private boolean __preconditionsPresent18a;
616 private boolean __preconditionsPresent18aSet = false;
617
618
619
620
621
622 public final boolean isPreconditionsPresent()
623 {
624 boolean preconditionsPresent18a = this.__preconditionsPresent18a;
625 if (!this.__preconditionsPresent18aSet)
626 {
627
628 preconditionsPresent18a = handleIsPreconditionsPresent();
629
630 this.__preconditionsPresent18a = preconditionsPresent18a;
631 if (isMetafacadePropertyCachingEnabled())
632 {
633 this.__preconditionsPresent18aSet = true;
634 }
635 }
636 return preconditionsPresent18a;
637 }
638
639
640
641
642
643 protected abstract boolean handleIsPostconditionsPresent();
644
645 private boolean __postconditionsPresent19a;
646 private boolean __postconditionsPresent19aSet = false;
647
648
649
650
651
652 public final boolean isPostconditionsPresent()
653 {
654 boolean postconditionsPresent19a = this.__postconditionsPresent19a;
655 if (!this.__postconditionsPresent19aSet)
656 {
657
658 postconditionsPresent19a = handleIsPostconditionsPresent();
659
660 this.__postconditionsPresent19a = postconditionsPresent19a;
661 if (isMetafacadePropertyCachingEnabled())
662 {
663 this.__postconditionsPresent19aSet = true;
664 }
665 }
666 return postconditionsPresent19a;
667 }
668
669
670
671
672
673 protected abstract int handleGetLower();
674
675 private int __lower20a;
676 private boolean __lower20aSet = false;
677
678
679
680
681
682
683 public final int getLower()
684 {
685 int lower20a = this.__lower20a;
686 if (!this.__lower20aSet)
687 {
688
689 lower20a = handleGetLower();
690
691 this.__lower20a = lower20a;
692 if (isMetafacadePropertyCachingEnabled())
693 {
694 this.__lower20aSet = true;
695 }
696 }
697 return lower20a;
698 }
699
700
701
702
703
704 protected abstract int handleGetUpper();
705
706 private int __upper21a;
707 private boolean __upper21aSet = false;
708
709
710
711
712
713
714 public final int getUpper()
715 {
716 int upper21a = this.__upper21a;
717 if (!this.__upper21aSet)
718 {
719
720 upper21a = handleGetUpper();
721
722 this.__upper21a = upper21a;
723 if (isMetafacadePropertyCachingEnabled())
724 {
725 this.__upper21aSet = true;
726 }
727 }
728 return upper21a;
729 }
730
731
732
733
734
735 protected abstract ParameterFacade handleGetReturnParameter();
736
737 private ParameterFacade __returnParameter22a;
738 private boolean __returnParameter22aSet = false;
739
740
741
742
743
744 public final ParameterFacade getReturnParameter()
745 {
746 ParameterFacade returnParameter22a = this.__returnParameter22a;
747 if (!this.__returnParameter22aSet)
748 {
749
750 returnParameter22a = handleGetReturnParameter();
751
752 this.__returnParameter22a = returnParameter22a;
753 if (isMetafacadePropertyCachingEnabled())
754 {
755 this.__returnParameter22aSet = true;
756 }
757 }
758 return returnParameter22a;
759 }
760
761
762
763
764
765 protected abstract boolean handleIsOverriding();
766
767 private boolean __overriding23a;
768 private boolean __overriding23aSet = false;
769
770
771
772
773
774
775
776 public final boolean isOverriding()
777 {
778 boolean overriding23a = this.__overriding23a;
779 if (!this.__overriding23aSet)
780 {
781
782 overriding23a = handleIsOverriding();
783
784 this.__overriding23a = overriding23a;
785 if (isMetafacadePropertyCachingEnabled())
786 {
787 this.__overriding23aSet = true;
788 }
789 }
790 return overriding23a;
791 }
792
793
794
795
796
797 protected abstract boolean handleIsOrdered();
798
799 private boolean __ordered24a;
800 private boolean __ordered24aSet = false;
801
802
803
804
805
806
807 public final boolean isOrdered()
808 {
809 boolean ordered24a = this.__ordered24a;
810 if (!this.__ordered24aSet)
811 {
812
813 ordered24a = handleIsOrdered();
814
815 this.__ordered24a = ordered24a;
816 if (isMetafacadePropertyCachingEnabled())
817 {
818 this.__ordered24aSet = true;
819 }
820 }
821 return ordered24a;
822 }
823
824
825
826
827
828 protected abstract String handleGetGetterSetterReturnTypeName();
829
830 private String __getterSetterReturnTypeName25a;
831 private boolean __getterSetterReturnTypeName25aSet = false;
832
833
834
835
836
837 public final String getGetterSetterReturnTypeName()
838 {
839 String getterSetterReturnTypeName25a = this.__getterSetterReturnTypeName25a;
840 if (!this.__getterSetterReturnTypeName25aSet)
841 {
842
843 getterSetterReturnTypeName25a = handleGetGetterSetterReturnTypeName();
844
845 this.__getterSetterReturnTypeName25a = getterSetterReturnTypeName25a;
846 if (isMetafacadePropertyCachingEnabled())
847 {
848 this.__getterSetterReturnTypeName25aSet = true;
849 }
850 }
851 return getterSetterReturnTypeName25a;
852 }
853
854
855
856
857
858 protected abstract boolean handleIsMany();
859
860 private boolean __many26a;
861 private boolean __many26aSet = false;
862
863
864
865
866
867
868 public final boolean isMany()
869 {
870 boolean many26a = this.__many26a;
871 if (!this.__many26aSet)
872 {
873
874 many26a = handleIsMany();
875
876 this.__many26a = many26a;
877 if (isMetafacadePropertyCachingEnabled())
878 {
879 this.__many26aSet = true;
880 }
881 }
882 return many26a;
883 }
884
885
886
887
888
889 protected abstract boolean handleIsUnique();
890
891 private boolean __unique27a;
892 private boolean __unique27aSet = false;
893
894
895
896
897
898
899 public final boolean isUnique()
900 {
901 boolean unique27a = this.__unique27a;
902 if (!this.__unique27aSet)
903 {
904
905 unique27a = handleIsUnique();
906
907 this.__unique27a = unique27a;
908 if (isMetafacadePropertyCachingEnabled())
909 {
910 this.__unique27aSet = true;
911 }
912 }
913 return unique27a;
914 }
915
916
917
918
919
920 protected abstract boolean handleIsLeaf();
921
922 private boolean __leaf28a;
923 private boolean __leaf28aSet = false;
924
925
926
927
928
929
930 public final boolean isLeaf()
931 {
932 boolean leaf28a = this.__leaf28a;
933 if (!this.__leaf28aSet)
934 {
935
936 leaf28a = handleIsLeaf();
937
938 this.__leaf28a = leaf28a;
939 if (isMetafacadePropertyCachingEnabled())
940 {
941 this.__leaf28aSet = true;
942 }
943 }
944 return leaf28a;
945 }
946
947
948
949
950
951 protected abstract String handleGetMethodBody();
952
953 private String __methodBody29a;
954 private boolean __methodBody29aSet = false;
955
956
957
958
959
960 public final String getMethodBody()
961 {
962 String methodBody29a = this.__methodBody29a;
963 if (!this.__methodBody29aSet)
964 {
965
966 methodBody29a = handleGetMethodBody();
967
968 this.__methodBody29a = methodBody29a;
969 if (isMetafacadePropertyCachingEnabled())
970 {
971 this.__methodBody29aSet = true;
972 }
973 }
974 return methodBody29a;
975 }
976
977
978
979
980
981
982
983
984
985
986
987
988 protected abstract Object handleFindTaggedValue(String name, boolean follow);
989
990
991
992
993
994
995
996
997
998
999
1000
1001 public Object findTaggedValue(String name, boolean follow)
1002 {
1003
1004 Object returnValue = handleFindTaggedValue(name, follow);
1005
1006 return returnValue;
1007 }
1008
1009
1010
1011
1012
1013
1014
1015
1016 protected abstract String handleGetExceptionList(String initialExceptions);
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026 public String getExceptionList(String initialExceptions)
1027 {
1028
1029 String returnValue = handleGetExceptionList(initialExceptions);
1030
1031 return returnValue;
1032 }
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042 protected abstract String handleGetSignature(boolean withArgumentNames);
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053 public String getSignature(boolean withArgumentNames)
1054 {
1055
1056 String returnValue = handleGetSignature(withArgumentNames);
1057
1058 return returnValue;
1059 }
1060
1061
1062
1063
1064
1065
1066
1067
1068 protected abstract String handleGetTypedArgumentList(String modifier);
1069
1070
1071
1072
1073
1074
1075
1076
1077 public String getTypedArgumentList(String modifier)
1078 {
1079
1080 String returnValue = handleGetTypedArgumentList(modifier);
1081
1082 return returnValue;
1083 }
1084
1085
1086
1087
1088
1089
1090
1091
1092 protected abstract String handleGetSignature(String argumentModifier);
1093
1094
1095
1096
1097
1098
1099
1100
1101 public String getSignature(String argumentModifier)
1102 {
1103
1104 String returnValue = handleGetSignature(argumentModifier);
1105
1106 return returnValue;
1107 }
1108
1109
1110
1111
1112
1113
1114
1115
1116 protected abstract ParameterFacade handleFindParameter(String name);
1117
1118
1119
1120
1121
1122
1123
1124
1125 public ParameterFacade findParameter(String name)
1126 {
1127
1128 ParameterFacade returnValue = handleFindParameter(name);
1129
1130 return returnValue;
1131 }
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143 public final Collection<ConstraintFacade> getPostconditions()
1144 {
1145 Collection<ConstraintFacade> getPostconditions1r = null;
1146
1147 Collection result = handleGetPostconditions();
1148 List shieldedResult = this.shieldedElements(result);
1149 try
1150 {
1151 getPostconditions1r = (Collection<ConstraintFacade>)shieldedResult;
1152 }
1153 catch (ClassCastException ex)
1154 {
1155
1156 OperationFacadeLogic.logger.warn("incorrect metafacade cast for OperationFacadeLogic.getPostconditions Collection<ConstraintFacade> " + result + ": " + shieldedResult);
1157 }
1158
1159 return getPostconditions1r;
1160 }
1161
1162
1163
1164
1165
1166 protected abstract Collection handleGetPostconditions();
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176 public final Collection<ParameterFacade> getArguments()
1177 {
1178 Collection<ParameterFacade> getArguments2r = null;
1179
1180 Collection result = handleGetArguments();
1181 List shieldedResult = this.shieldedElements(result);
1182 try
1183 {
1184 getArguments2r = (Collection<ParameterFacade>)shieldedResult;
1185 }
1186 catch (ClassCastException ex)
1187 {
1188
1189 OperationFacadeLogic.logger.warn("incorrect metafacade cast for OperationFacadeLogic.getArguments Collection<ParameterFacade> " + result + ": " + shieldedResult);
1190 }
1191
1192 return getArguments2r;
1193 }
1194
1195
1196
1197
1198
1199 protected abstract Collection handleGetArguments();
1200
1201
1202
1203
1204
1205 public final ClassifierFacade getOwner()
1206 {
1207 ClassifierFacade getOwner3r = null;
1208
1209 Object result = handleGetOwner();
1210 MetafacadeBase shieldedResult = this.shieldedElement(result);
1211 try
1212 {
1213 getOwner3r = (ClassifierFacade)shieldedResult;
1214 }
1215 catch (ClassCastException ex)
1216 {
1217
1218 OperationFacadeLogic.logger.warn("incorrect metafacade cast for OperationFacadeLogic.getOwner ClassifierFacade " + result + ": " + shieldedResult);
1219 }
1220
1221 return getOwner3r;
1222 }
1223
1224
1225
1226
1227
1228 protected abstract Object handleGetOwner();
1229
1230
1231
1232
1233
1234 public final Collection<ParameterFacade> getParameters()
1235 {
1236 Collection<ParameterFacade> getParameters4r = null;
1237
1238 Collection result = handleGetParameters();
1239 List shieldedResult = this.shieldedElements(result);
1240 try
1241 {
1242 getParameters4r = (Collection<ParameterFacade>)shieldedResult;
1243 }
1244 catch (ClassCastException ex)
1245 {
1246
1247 OperationFacadeLogic.logger.warn("incorrect metafacade cast for OperationFacadeLogic.getParameters Collection<ParameterFacade> " + result + ": " + shieldedResult);
1248 }
1249
1250 return getParameters4r;
1251 }
1252
1253
1254
1255
1256
1257 protected abstract Collection handleGetParameters();
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267 public final ClassifierFacade getReturnType()
1268 {
1269 ClassifierFacade getReturnType5r = null;
1270
1271 Object result = handleGetReturnType();
1272 MetafacadeBase shieldedResult = this.shieldedElement(result);
1273 try
1274 {
1275 getReturnType5r = (ClassifierFacade)shieldedResult;
1276 }
1277 catch (ClassCastException ex)
1278 {
1279
1280 OperationFacadeLogic.logger.warn("incorrect metafacade cast for OperationFacadeLogic.getReturnType ClassifierFacade " + result + ": " + shieldedResult);
1281 }
1282
1283 return getReturnType5r;
1284 }
1285
1286
1287
1288
1289
1290 protected abstract Object handleGetReturnType();
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300 public final Collection<ConstraintFacade> getPreconditions()
1301 {
1302 Collection<ConstraintFacade> getPreconditions6r = null;
1303
1304 Collection result = handleGetPreconditions();
1305 List shieldedResult = this.shieldedElements(result);
1306 try
1307 {
1308 getPreconditions6r = (Collection<ConstraintFacade>)shieldedResult;
1309 }
1310 catch (ClassCastException ex)
1311 {
1312
1313 OperationFacadeLogic.logger.warn("incorrect metafacade cast for OperationFacadeLogic.getPreconditions Collection<ConstraintFacade> " + result + ": " + shieldedResult);
1314 }
1315
1316 return getPreconditions6r;
1317 }
1318
1319
1320
1321
1322
1323 protected abstract Collection handleGetPreconditions();
1324
1325 private OperationFacade __getOverriddenOperation7r;
1326 private boolean __getOverriddenOperation7rSet = false;
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336 public final OperationFacade getOverriddenOperation()
1337 {
1338 OperationFacade getOverriddenOperation7r = this.__getOverriddenOperation7r;
1339 if (!this.__getOverriddenOperation7rSet)
1340 {
1341
1342 Object result = handleGetOverriddenOperation();
1343 MetafacadeBase shieldedResult = this.shieldedElement(result);
1344 try
1345 {
1346 getOverriddenOperation7r = (OperationFacade)shieldedResult;
1347 }
1348 catch (ClassCastException ex)
1349 {
1350
1351 OperationFacadeLogic.logger.warn("incorrect metafacade cast for OperationFacadeLogic.getOverriddenOperation OperationFacade " + result + ": " + shieldedResult);
1352 }
1353
1354 this.__getOverriddenOperation7r = getOverriddenOperation7r;
1355 if (isMetafacadePropertyCachingEnabled())
1356 {
1357 this.__getOverriddenOperation7rSet = true;
1358 }
1359 }
1360 return getOverriddenOperation7r;
1361 }
1362
1363
1364
1365
1366
1367 protected abstract Object handleGetOverriddenOperation();
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394 @Override
1395 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
1396 {
1397 super.validateInvariants(validationMessages);
1398 try
1399 {
1400 final Object contextElement = this.THIS();
1401 boolean constraintValid = OCLResultEnsurer.ensure(OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"returnType.name")));
1402 if (!constraintValid)
1403 {
1404 validationMessages.add(
1405 new ModelValidationMessage(
1406 (MetafacadeBase)contextElement ,
1407 "org::andromda::metafacades::uml::OperationFacade::operation needs a return type",
1408 "Each operation needs a return type, you cannot leave the type unspecified, even if you want void you'll need to explicitly specify it."));
1409 }
1410 }
1411 catch (Throwable th)
1412 {
1413 Throwable cause = th.getCause();
1414 int depth = 0;
1415 while (cause != null && depth < 7)
1416 {
1417 th = cause;
1418 depth++;
1419 }
1420 logger.error("Error validating constraint 'org::andromda::metafacades::uml::OperationFacade::operation needs a return type' ON "
1421 + this.THIS().toString() + ": " + th.getMessage(), th);
1422 }
1423 try
1424 {
1425 final Object contextElement = this.THIS();
1426 boolean constraintValid = OCLResultEnsurer.ensure(OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"name")));
1427 if (!constraintValid)
1428 {
1429 validationMessages.add(
1430 new ModelValidationMessage(
1431 (MetafacadeBase)contextElement ,
1432 "org::andromda::metafacades::uml::OperationFacade::operation must have a name",
1433 "Each operation must have a non-empty name."));
1434 }
1435 }
1436 catch (Throwable th)
1437 {
1438 Throwable cause = th.getCause();
1439 int depth = 0;
1440 while (cause != null && depth < 7)
1441 {
1442 th = cause;
1443 depth++;
1444 }
1445 logger.error("Error validating constraint 'org::andromda::metafacades::uml::OperationFacade::operation must have a name' ON "
1446 + this.THIS().toString() + ": " + th.getMessage(), th);
1447 }
1448 try
1449 {
1450 final Object contextElement = this.THIS();
1451 boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"returnParameter.type.primitive"))).booleanValue()?(OCLExpressions.equal(OCLIntrospector.invoke(contextElement,"many"),false)):true));
1452 if (!constraintValid)
1453 {
1454 validationMessages.add(
1455 new ModelValidationMessage(
1456 (MetafacadeBase)contextElement ,
1457 "org::andromda::metafacades::uml::OperationFacade::primitive operation return cannot be used in a Collection",
1458 "Primitive return parameters cannot be used in Collections (multiplicity > 1). Use the wrapped type or Array type instead."));
1459 }
1460 }
1461 catch (Throwable th)
1462 {
1463 Throwable cause = th.getCause();
1464 int depth = 0;
1465 while (cause != null && depth < 7)
1466 {
1467 th = cause;
1468 depth++;
1469 }
1470 logger.error("Error validating constraint 'org::andromda::metafacades::uml::OperationFacade::primitive operation return cannot be used in a Collection' ON "
1471 + this.THIS().toString() + ": " + th.getMessage(), th);
1472 }
1473 try
1474 {
1475 final Object contextElement = this.THIS();
1476 boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"returnParameter.type.wrappedPrimitive"))).booleanValue()&&OCLExpressions.equal(OCLIntrospector.invoke(contextElement,"many"),false))).booleanValue()?(OCLExpressions.equal(OCLIntrospector.invoke(contextElement,"lower"),0)):true));
1477 if (!constraintValid)
1478 {
1479 validationMessages.add(
1480 new ModelValidationMessage(
1481 (MetafacadeBase)contextElement ,
1482 "org::andromda::metafacades::uml::OperationFacade::wrapped primitive operation return should not be required",
1483 "Wrapped primitive operation return must have a multiplicity lower bound = 0 (must be optional). Use the unwrapped type, or change the multiplicity."));
1484 }
1485 }
1486 catch (Throwable th)
1487 {
1488 Throwable cause = th.getCause();
1489 int depth = 0;
1490 while (cause != null && depth < 7)
1491 {
1492 th = cause;
1493 depth++;
1494 }
1495 logger.error("Error validating constraint 'org::andromda::metafacades::uml::OperationFacade::wrapped primitive operation return should not be required' ON "
1496 + this.THIS().toString() + ": " + th.getMessage(), th);
1497 }
1498 try
1499 {
1500 final Object contextElement = this.THIS();
1501 boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"returnParameter.type.primitive"))).booleanValue()?(OCLExpressions.greater(OCLIntrospector.invoke(contextElement,"lower"),0)):true));
1502 if (!constraintValid)
1503 {
1504 validationMessages.add(
1505 new ModelValidationMessage(
1506 (MetafacadeBase)contextElement ,
1507 "org::andromda::metafacades::uml::OperationFacade::primitive operation return must be required",
1508 "Primitive operation return types must have a multiplicity lower bound > 0 (must be required). Use a wrapped type, or change the multiplicity."));
1509 }
1510 }
1511 catch (Throwable th)
1512 {
1513 Throwable cause = th.getCause();
1514 int depth = 0;
1515 while (cause != null && depth < 7)
1516 {
1517 th = cause;
1518 depth++;
1519 }
1520 logger.error("Error validating constraint 'org::andromda::metafacades::uml::OperationFacade::primitive operation return must be required' ON "
1521 + this.THIS().toString() + ": " + th.getMessage(), th);
1522 }
1523 try
1524 {
1525 final Object contextElement = this.THIS();
1526 boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"many"))).booleanValue()?(OCLIntrospector.invoke(contextElement,"returnParameter.many")):true));
1527 if (!constraintValid)
1528 {
1529 validationMessages.add(
1530 new ModelValidationMessage(
1531 (MetafacadeBase)contextElement ,
1532 "org::andromda::metafacades::uml::OperationFacade::operation multiplicity must match return parameter multiplicity",
1533 "Operation return parameter with multiplicity greater than 1 must match the operation multiplicity greater than 1."));
1534 }
1535 }
1536 catch (Throwable th)
1537 {
1538 Throwable cause = th.getCause();
1539 int depth = 0;
1540 while (cause != null && depth < 7)
1541 {
1542 th = cause;
1543 depth++;
1544 }
1545 logger.error("Error validating constraint 'org::andromda::metafacades::uml::OperationFacade::operation multiplicity must match return parameter multiplicity' ON "
1546 + this.THIS().toString() + ": " + th.getMessage(), th);
1547 }
1548 }
1549 }