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