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