1
2
3
4
5 package org.andromda.cartridges.jbpm.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.ConstraintFacade;
13 import org.andromda.metafacades.uml.DependencyFacade;
14 import org.andromda.metafacades.uml.ModelElementFacade;
15 import org.andromda.metafacades.uml.ModelFacade;
16 import org.andromda.metafacades.uml.PackageFacade;
17 import org.andromda.metafacades.uml.PartitionFacade;
18 import org.andromda.metafacades.uml.StateFacade;
19 import org.andromda.metafacades.uml.StateMachineFacade;
20 import org.andromda.metafacades.uml.StateVertexFacade;
21 import org.andromda.metafacades.uml.StereotypeFacade;
22 import org.andromda.metafacades.uml.TaggedValueFacade;
23 import org.andromda.metafacades.uml.TemplateParameterFacade;
24 import org.andromda.metafacades.uml.TransitionFacade;
25 import org.andromda.metafacades.uml.TypeMappings;
26 import org.apache.log4j.Logger;
27
28
29
30
31
32
33
34 public abstract class JBpmStateVertexLogic
35 extends MetafacadeBase
36 implements JBpmStateVertex
37 {
38
39
40
41
42 protected Object metaObject;
43
44
45
46
47
48 protected JBpmStateVertexLogic(Object metaObjectIn, String context)
49 {
50 super(metaObjectIn, getContext(context));
51 this.superStateVertexFacade =
52 (StateVertexFacade)
53 MetafacadeFactory.getInstance().createFacadeImpl(
54 "org.andromda.metafacades.uml.StateVertexFacade",
55 metaObjectIn,
56 getContext(context));
57 this.metaObject = metaObjectIn;
58 }
59
60
61
62
63 private static final Logger logger = Logger.getLogger(JBpmStateVertexLogic.class);
64
65
66
67
68
69
70 private static String getContext(String context)
71 {
72 if (context == null)
73 {
74 context = "org.andromda.cartridges.jbpm.metafacades.JBpmStateVertex";
75 }
76 return context;
77 }
78
79 private StateVertexFacade superStateVertexFacade;
80 private boolean superStateVertexFacadeInitialized = false;
81
82
83
84
85
86 private StateVertexFacade getSuperStateVertexFacade()
87 {
88 if (!this.superStateVertexFacadeInitialized)
89 {
90 ((MetafacadeBase)this.superStateVertexFacade).setMetafacadeContext(this.getMetafacadeContext());
91 this.superStateVertexFacadeInitialized = true;
92 }
93 return this.superStateVertexFacade;
94 }
95
96
97
98
99
100 @Override
101 public void resetMetafacadeContext(String context)
102 {
103 if (!this.contextRoot)
104 {
105 context = getContext(context);
106 setMetafacadeContext (context);
107 if (this.superStateVertexFacadeInitialized)
108 {
109 ((MetafacadeBase)this.superStateVertexFacade).resetMetafacadeContext(context);
110 }
111 }
112 }
113
114
115
116
117
118 public boolean isJBpmStateVertexMetaType()
119 {
120 return true;
121 }
122
123
124
125
126
127
128
129 protected abstract boolean handleIsContainedInBusinessProcess();
130
131 private boolean __containedInBusinessProcess1a;
132 private boolean __containedInBusinessProcess1aSet = false;
133
134
135
136
137
138 public final boolean isContainedInBusinessProcess()
139 {
140 boolean containedInBusinessProcess1a = this.__containedInBusinessProcess1a;
141 if (!this.__containedInBusinessProcess1aSet)
142 {
143
144 containedInBusinessProcess1a = handleIsContainedInBusinessProcess();
145
146 this.__containedInBusinessProcess1a = containedInBusinessProcess1a;
147 if (isMetafacadePropertyCachingEnabled())
148 {
149 this.__containedInBusinessProcess1aSet = true;
150 }
151 }
152 return containedInBusinessProcess1a;
153 }
154
155
156
157
158
159 protected abstract String handleGetNodeClassName();
160
161 private String __nodeClassName2a;
162 private boolean __nodeClassName2aSet = false;
163
164
165
166
167
168
169 public final String getNodeClassName()
170 {
171 String nodeClassName2a = this.__nodeClassName2a;
172 if (!this.__nodeClassName2aSet)
173 {
174
175 nodeClassName2a = handleGetNodeClassName();
176
177 this.__nodeClassName2a = nodeClassName2a;
178 if (isMetafacadePropertyCachingEnabled())
179 {
180 this.__nodeClassName2aSet = true;
181 }
182 }
183 return nodeClassName2a;
184 }
185
186
187
188
189
190 protected abstract String handleGetNodePackageName();
191
192 private String __nodePackageName3a;
193 private boolean __nodePackageName3aSet = false;
194
195
196
197
198
199
200 public final String getNodePackageName()
201 {
202 String nodePackageName3a = this.__nodePackageName3a;
203 if (!this.__nodePackageName3aSet)
204 {
205
206 nodePackageName3a = handleGetNodePackageName();
207
208 this.__nodePackageName3a = nodePackageName3a;
209 if (isMetafacadePropertyCachingEnabled())
210 {
211 this.__nodePackageName3aSet = true;
212 }
213 }
214 return nodePackageName3a;
215 }
216
217
218
219 private JBpmProcessDefinition __getProcessDefinition1r;
220 private boolean __getProcessDefinition1rSet = false;
221
222
223
224
225
226 public final JBpmProcessDefinition getProcessDefinition()
227 {
228 JBpmProcessDefinition getProcessDefinition1r = this.__getProcessDefinition1r;
229 if (!this.__getProcessDefinition1rSet)
230 {
231
232 Object result = handleGetProcessDefinition();
233 MetafacadeBase shieldedResult = this.shieldedElement(result);
234 try
235 {
236 getProcessDefinition1r = (JBpmProcessDefinition)shieldedResult;
237 }
238 catch (ClassCastException ex)
239 {
240
241 JBpmStateVertexLogic.logger.warn("incorrect metafacade cast for JBpmStateVertexLogic.getProcessDefinition JBpmProcessDefinition " + result + ": " + shieldedResult);
242 }
243
244 this.__getProcessDefinition1r = getProcessDefinition1r;
245 if (isMetafacadePropertyCachingEnabled())
246 {
247 this.__getProcessDefinition1rSet = true;
248 }
249 }
250 return getProcessDefinition1r;
251 }
252
253
254
255
256
257 protected abstract Object handleGetProcessDefinition();
258
259
260
261
262
263 public boolean isStateVertexFacadeMetaType()
264 {
265 return true;
266 }
267
268
269
270
271
272 public boolean isModelElementFacadeMetaType()
273 {
274 return true;
275 }
276
277
278
279
280
281
282 public void copyTaggedValues(ModelElementFacade element)
283 {
284 this.getSuperStateVertexFacade().copyTaggedValues(element);
285 }
286
287
288
289
290
291
292 public Object findTaggedValue(String tagName)
293 {
294 return this.getSuperStateVertexFacade().findTaggedValue(tagName);
295 }
296
297
298
299
300
301
302 public Collection<Object> findTaggedValues(String tagName)
303 {
304 return this.getSuperStateVertexFacade().findTaggedValues(tagName);
305 }
306
307
308
309
310
311
312
313 public String getBindedFullyQualifiedName(ModelElementFacade bindedElement)
314 {
315 return this.getSuperStateVertexFacade().getBindedFullyQualifiedName(bindedElement);
316 }
317
318
319
320
321
322 public Collection<ConstraintFacade> getConstraints()
323 {
324 return this.getSuperStateVertexFacade().getConstraints();
325 }
326
327
328
329
330
331
332 public Collection<ConstraintFacade> getConstraints(String kind)
333 {
334 return this.getSuperStateVertexFacade().getConstraints(kind);
335 }
336
337
338
339
340
341
342
343 public String getDocumentation(String indent)
344 {
345 return this.getSuperStateVertexFacade().getDocumentation(indent);
346 }
347
348
349
350
351
352
353
354
355 public String getDocumentation(String indent, int lineLength)
356 {
357 return this.getSuperStateVertexFacade().getDocumentation(indent, lineLength);
358 }
359
360
361
362
363
364
365
366 public String getDocumentation(String indent, int lineLength, boolean htmlStyle)
367 {
368 return this.getSuperStateVertexFacade().getDocumentation(indent, lineLength, htmlStyle);
369 }
370
371
372
373
374
375 public String getFullyQualifiedName()
376 {
377 return this.getSuperStateVertexFacade().getFullyQualifiedName();
378 }
379
380
381
382
383
384
385
386
387 public String getFullyQualifiedName(boolean modelName)
388 {
389 return this.getSuperStateVertexFacade().getFullyQualifiedName(modelName);
390 }
391
392
393
394
395
396
397 public String getFullyQualifiedNamePath()
398 {
399 return this.getSuperStateVertexFacade().getFullyQualifiedNamePath();
400 }
401
402
403
404
405
406 public String getId()
407 {
408 return this.getSuperStateVertexFacade().getId();
409 }
410
411
412
413
414
415
416
417
418
419 public Collection<String> getKeywords()
420 {
421 return this.getSuperStateVertexFacade().getKeywords();
422 }
423
424
425
426
427
428 public String getLabel()
429 {
430 return this.getSuperStateVertexFacade().getLabel();
431 }
432
433
434
435
436
437 public TypeMappings getLanguageMappings()
438 {
439 return this.getSuperStateVertexFacade().getLanguageMappings();
440 }
441
442
443
444
445
446
447 public ModelFacade getModel()
448 {
449 return this.getSuperStateVertexFacade().getModel();
450 }
451
452
453
454
455
456 public String getName()
457 {
458 return this.getSuperStateVertexFacade().getName();
459 }
460
461
462
463
464
465 public ModelElementFacade getPackage()
466 {
467 return this.getSuperStateVertexFacade().getPackage();
468 }
469
470
471
472
473
474 public String getPackageName()
475 {
476 return this.getSuperStateVertexFacade().getPackageName();
477 }
478
479
480
481
482
483
484 public String getPackageName(boolean modelName)
485 {
486 return this.getSuperStateVertexFacade().getPackageName(modelName);
487 }
488
489
490
491
492
493 public String getPackagePath()
494 {
495 return this.getSuperStateVertexFacade().getPackagePath();
496 }
497
498
499
500
501
502
503
504
505 public String getQualifiedName()
506 {
507 return this.getSuperStateVertexFacade().getQualifiedName();
508 }
509
510
511
512
513
514 public PackageFacade getRootPackage()
515 {
516 return this.getSuperStateVertexFacade().getRootPackage();
517 }
518
519
520
521
522
523 public Collection<DependencyFacade> getSourceDependencies()
524 {
525 return this.getSuperStateVertexFacade().getSourceDependencies();
526 }
527
528
529
530
531
532
533 public StateMachineFacade getStateMachineContext()
534 {
535 return this.getSuperStateVertexFacade().getStateMachineContext();
536 }
537
538
539
540
541
542 public Collection<String> getStereotypeNames()
543 {
544 return this.getSuperStateVertexFacade().getStereotypeNames();
545 }
546
547
548
549
550
551 public Collection<StereotypeFacade> getStereotypes()
552 {
553 return this.getSuperStateVertexFacade().getStereotypes();
554 }
555
556
557
558
559
560 public Collection<TaggedValueFacade> getTaggedValues()
561 {
562 return this.getSuperStateVertexFacade().getTaggedValues();
563 }
564
565
566
567
568
569 public Collection<DependencyFacade> getTargetDependencies()
570 {
571 return this.getSuperStateVertexFacade().getTargetDependencies();
572 }
573
574
575
576
577
578 public Object getTemplateParameter(String parameterName)
579 {
580 return this.getSuperStateVertexFacade().getTemplateParameter(parameterName);
581 }
582
583
584
585
586
587 public Collection<TemplateParameterFacade> getTemplateParameters()
588 {
589 return this.getSuperStateVertexFacade().getTemplateParameters();
590 }
591
592
593
594
595
596
597 public String getVisibility()
598 {
599 return this.getSuperStateVertexFacade().getVisibility();
600 }
601
602
603
604
605
606
607 public boolean hasExactStereotype(String stereotypeName)
608 {
609 return this.getSuperStateVertexFacade().hasExactStereotype(stereotypeName);
610 }
611
612
613
614
615
616
617 public boolean hasKeyword(String keywordName)
618 {
619 return this.getSuperStateVertexFacade().hasKeyword(keywordName);
620 }
621
622
623
624
625
626
627
628
629
630
631
632
633
634 public boolean hasStereotype(String stereotypeName)
635 {
636 return this.getSuperStateVertexFacade().hasStereotype(stereotypeName);
637 }
638
639
640
641
642
643
644 public boolean isBindingDependenciesPresent()
645 {
646 return this.getSuperStateVertexFacade().isBindingDependenciesPresent();
647 }
648
649
650
651
652
653 public boolean isConstraintsPresent()
654 {
655 return this.getSuperStateVertexFacade().isConstraintsPresent();
656 }
657
658
659
660
661
662 public boolean isDocumentationPresent()
663 {
664 return this.getSuperStateVertexFacade().isDocumentationPresent();
665 }
666
667
668
669
670
671 public boolean isReservedWord()
672 {
673 return this.getSuperStateVertexFacade().isReservedWord();
674 }
675
676
677
678
679
680
681 public boolean isTemplateParametersPresent()
682 {
683 return this.getSuperStateVertexFacade().isTemplateParametersPresent();
684 }
685
686
687
688
689
690
691
692 public boolean isValidIdentifierName()
693 {
694 return this.getSuperStateVertexFacade().isValidIdentifierName();
695 }
696
697
698
699
700
701
702
703 public String translateConstraint(String name, String translation)
704 {
705 return this.getSuperStateVertexFacade().translateConstraint(name, translation);
706 }
707
708
709
710
711
712 public String[] translateConstraints(String translation)
713 {
714 return this.getSuperStateVertexFacade().translateConstraints(translation);
715 }
716
717
718
719
720
721 public String[] translateConstraints(String kind, String translation)
722 {
723 return this.getSuperStateVertexFacade().translateConstraints(kind, translation);
724 }
725
726
727
728
729
730
731
732
733
734
735
736
737 public StateFacade getContainer()
738 {
739 return this.getSuperStateVertexFacade().getContainer();
740 }
741
742
743
744
745
746
747
748
749
750 public Collection<TransitionFacade> getIncomings()
751 {
752 return this.getSuperStateVertexFacade().getIncomings();
753 }
754
755
756
757
758
759
760
761
762
763 public Collection<TransitionFacade> getOutgoings()
764 {
765 return this.getSuperStateVertexFacade().getOutgoings();
766 }
767
768
769
770
771
772 public PartitionFacade getPartition()
773 {
774 return this.getSuperStateVertexFacade().getPartition();
775 }
776
777
778
779
780
781
782
783
784
785
786
787
788 public StateMachineFacade getStateMachine()
789 {
790 return this.getSuperStateVertexFacade().getStateMachine();
791 }
792
793
794
795
796 @Override
797 public void initialize()
798 {
799 this.getSuperStateVertexFacade().initialize();
800 }
801
802
803
804
805
806 @Override
807 public Object getValidationOwner()
808 {
809 Object owner = this.getSuperStateVertexFacade().getValidationOwner();
810 return owner;
811 }
812
813
814
815
816
817 @Override
818 public String getValidationName()
819 {
820 String name = this.getSuperStateVertexFacade().getValidationName();
821 return name;
822 }
823
824
825
826
827
828 @Override
829 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
830 {
831 this.getSuperStateVertexFacade().validateInvariants(validationMessages);
832 }
833
834
835
836
837 private static final String NAME_PROPERTY = "name";
838 private static final String FQNAME_PROPERTY = "fullyQualifiedName";
839
840
841
842
843 @Override
844 public String toString()
845 {
846 final StringBuilder toString = new StringBuilder(this.getClass().getName());
847 toString.append("[");
848 try
849 {
850 toString.append(Introspector.instance().getProperty(this, FQNAME_PROPERTY));
851 }
852 catch (final Throwable tryAgain)
853 {
854 try
855 {
856 toString.append(Introspector.instance().getProperty(this, NAME_PROPERTY));
857 }
858 catch (final Throwable ignore)
859 {
860
861 }
862 }
863 toString.append("]");
864 return toString.toString();
865 }
866 }