1 // license-header java merge-point
2 //
3 // Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
4 //
5 package org.andromda.cartridges.bpm4struts.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.EventFacade;
16 import org.andromda.metafacades.uml.FinalStateFacade;
17 import org.andromda.metafacades.uml.FrontEndFinalState;
18 import org.andromda.metafacades.uml.FrontEndParameter;
19 import org.andromda.metafacades.uml.FrontEndUseCase;
20 import org.andromda.metafacades.uml.ModelElementFacade;
21 import org.andromda.metafacades.uml.ModelFacade;
22 import org.andromda.metafacades.uml.PackageFacade;
23 import org.andromda.metafacades.uml.PartitionFacade;
24 import org.andromda.metafacades.uml.StateFacade;
25 import org.andromda.metafacades.uml.StateMachineFacade;
26 import org.andromda.metafacades.uml.StereotypeFacade;
27 import org.andromda.metafacades.uml.TaggedValueFacade;
28 import org.andromda.metafacades.uml.TemplateParameterFacade;
29 import org.andromda.metafacades.uml.TransitionFacade;
30 import org.andromda.metafacades.uml.TypeMappings;
31 import org.andromda.translation.ocl.validation.OCLCollections;
32 import org.andromda.translation.ocl.validation.OCLIntrospector;
33 import org.andromda.translation.ocl.validation.OCLResultEnsurer;
34 import org.apache.log4j.Logger;
35
36 /**
37 * A final state represents the end of a use-case. In a Struts application this means a transition
38 * into the next use-case.
39 * MetafacadeLogic for StrutsFinalState
40 *
41 * @see StrutsFinalState
42 */
43 public abstract class StrutsFinalStateLogic
44 extends MetafacadeBase
45 implements StrutsFinalState
46 {
47 /**
48 * The underlying UML object
49 * @see Object
50 */
51 protected Object metaObject;
52
53 /** Create Metafacade implementation instance using the MetafacadeFactory from the context
54 * @param metaObjectIn
55 * @param context
56 */
57 protected StrutsFinalStateLogic(Object metaObjectIn, String context)
58 {
59 super(metaObjectIn, getContext(context));
60 this.superFinalStateFacade =
61 (FinalStateFacade)
62 MetafacadeFactory.getInstance().createFacadeImpl(
63 "org.andromda.metafacades.uml.FinalStateFacade",
64 metaObjectIn,
65 getContext(context));
66 this.superFrontEndFinalState =
67 (FrontEndFinalState)
68 MetafacadeFactory.getInstance().createFacadeImpl(
69 "org.andromda.metafacades.uml.FrontEndFinalState",
70 metaObjectIn,
71 getContext(context));
72 this.metaObject = metaObjectIn;
73 }
74
75 /**
76 * The logger instance.
77 */
78 private static final Logger logger = Logger.getLogger(StrutsFinalStateLogic.class);
79
80 /**
81 * Gets the context for this metafacade logic instance.
82 * @param context String. Set to StrutsFinalState if null
83 * @return context String
84 */
85 private static String getContext(String context)
86 {
87 if (context == null)
88 {
89 context = "org.andromda.cartridges.bpm4struts.metafacades.StrutsFinalState";
90 }
91 return context;
92 }
93
94 private FinalStateFacade superFinalStateFacade;
95 private boolean superFinalStateFacadeInitialized = false;
96
97 /**
98 * Gets the FinalStateFacade parent instance.
99 * @return this.superFinalStateFacade FinalStateFacade
100 */
101 protected FinalStateFacade getSuperFinalStateFacade()
102 {
103 if (!this.superFinalStateFacadeInitialized)
104 {
105 ((MetafacadeBase)this.superFinalStateFacade).setMetafacadeContext(this.getMetafacadeContext());
106 this.superFinalStateFacadeInitialized = true;
107 }
108 return this.superFinalStateFacade;
109 }
110
111 private FrontEndFinalState superFrontEndFinalState;
112 private boolean superFrontEndFinalStateInitialized = false;
113
114 /**
115 * Gets the FrontEndFinalState parent instance.
116 * @return this.superFrontEndFinalState FrontEndFinalState
117 */
118 protected FrontEndFinalState getSuperFrontEndFinalState()
119 {
120 if (!this.superFrontEndFinalStateInitialized)
121 {
122 ((MetafacadeBase)this.superFrontEndFinalState).setMetafacadeContext(this.getMetafacadeContext());
123 this.superFrontEndFinalStateInitialized = true;
124 }
125 return this.superFrontEndFinalState;
126 }
127
128 /** Reset context only for non-root metafacades
129 * @param context
130 * @see MetafacadeBase#resetMetafacadeContext(String context)
131 */
132 @Override
133 public void resetMetafacadeContext(String context)
134 {
135 if (!this.contextRoot) // reset context only for non-root metafacades
136 {
137 context = getContext(context); // to have same value as in original constructor call
138 setMetafacadeContext (context);
139 if (this.superFinalStateFacadeInitialized)
140 {
141 ((MetafacadeBase)this.superFinalStateFacade).resetMetafacadeContext(context);
142 }
143 if (this.superFrontEndFinalStateInitialized)
144 {
145 ((MetafacadeBase)this.superFrontEndFinalState).resetMetafacadeContext(context);
146 }
147 }
148 }
149
150 /**
151 * @return boolean true always
152 * @see StrutsFinalState
153 */
154 public boolean isStrutsFinalStateMetaType()
155 {
156 return true;
157 }
158
159 // --------------- attributes ---------------------
160
161 /**
162 * @see org.andromda.cartridges.bpm4struts.metafacades.StrutsFinalState#getFullPath()
163 * @return String
164 */
165 protected abstract String handleGetFullPath();
166
167 private String __fullPath1a;
168 private boolean __fullPath1aSet = false;
169
170 /**
171 * A final state maps onto a use-case. The full path to this use-case is returned here. In case
172 * no name for this final state was specified the use-case with the application's first use-case
173 * path will be returned.
174 * @return (String)handleGetFullPath()
175 */
176 public final String getFullPath()
177 {
178 String fullPath1a = this.__fullPath1a;
179 if (!this.__fullPath1aSet)
180 {
181 // fullPath has no pre constraints
182 fullPath1a = handleGetFullPath();
183 // fullPath has no post constraints
184 this.__fullPath1a = fullPath1a;
185 if (isMetafacadePropertyCachingEnabled())
186 {
187 this.__fullPath1aSet = true;
188 }
189 }
190 return fullPath1a;
191 }
192
193 // ------------- associations ------------------
194
195 /**
196 * @return true
197 * @see FinalStateFacade
198 */
199 public boolean isFinalStateFacadeMetaType()
200 {
201 return true;
202 }
203
204 /**
205 * @return true
206 * @see FrontEndFinalState
207 */
208 public boolean isFrontEndFinalStateMetaType()
209 {
210 return true;
211 }
212
213 /**
214 * @return true
215 * @see StateFacade
216 */
217 public boolean isStateFacadeMetaType()
218 {
219 return true;
220 }
221
222 /**
223 * @return true
224 * @see org.andromda.metafacades.uml.StateVertexFacade
225 */
226 public boolean isStateVertexFacadeMetaType()
227 {
228 return true;
229 }
230
231 /**
232 * @return true
233 * @see ModelElementFacade
234 */
235 public boolean isModelElementFacadeMetaType()
236 {
237 return true;
238 }
239
240 // ----------- delegates to FinalStateFacade ------------
241 /**
242 * Copies all tagged values from the given ModelElementFacade to this model element facade.
243 * @see ModelElementFacade#copyTaggedValues(ModelElementFacade element)
244 */
245 public void copyTaggedValues(ModelElementFacade element)
246 {
247 this.getSuperFinalStateFacade().copyTaggedValues(element);
248 }
249
250 /**
251 * Finds the tagged value with the specified 'tagName'. In case there are more values the first
252 * one found will be returned.
253 * @see ModelElementFacade#findTaggedValue(String tagName)
254 */
255 public Object findTaggedValue(String tagName)
256 {
257 return this.getSuperFinalStateFacade().findTaggedValue(tagName);
258 }
259
260 /**
261 * Returns all the values for the tagged value with the specified name. The returned collection
262 * will contains only String instances, or will be empty. Never null.
263 * @see ModelElementFacade#findTaggedValues(String tagName)
264 */
265 public Collection<Object> findTaggedValues(String tagName)
266 {
267 return this.getSuperFinalStateFacade().findTaggedValues(tagName);
268 }
269
270 /**
271 * Returns the fully qualified name of the model element. The fully qualified name includes
272 * complete package qualified name of the underlying model element. The templates parameter will
273 * be replaced by the correct one given the binding relation of the parameter to this element.
274 * @see ModelElementFacade#getBindedFullyQualifiedName(ModelElementFacade bindedElement)
275 */
276 public String getBindedFullyQualifiedName(ModelElementFacade bindedElement)
277 {
278 return this.getSuperFinalStateFacade().getBindedFullyQualifiedName(bindedElement);
279 }
280
281 /**
282 * Gets all constraints belonging to the model element.
283 * @see ModelElementFacade#getConstraints()
284 */
285 public Collection<ConstraintFacade> getConstraints()
286 {
287 return this.getSuperFinalStateFacade().getConstraints();
288 }
289
290 /**
291 * Returns the constraints of the argument kind that have been placed onto this model. Typical
292 * kinds are "inv", "pre" and "post". Other kinds are possible.
293 * @see ModelElementFacade#getConstraints(String kind)
294 */
295 public Collection<ConstraintFacade> getConstraints(String kind)
296 {
297 return this.getSuperFinalStateFacade().getConstraints(kind);
298 }
299
300 /**
301 * Gets the documentation for the model element, The indent argument is prefixed to each line.
302 * By default this method wraps lines after 64 characters.
303 * This method is equivalent to <code>getDocumentation(indent, 64)</code>.
304 * @see ModelElementFacade#getDocumentation(String indent)
305 */
306 public String getDocumentation(String indent)
307 {
308 return this.getSuperFinalStateFacade().getDocumentation(indent);
309 }
310
311 /**
312 * This method returns the documentation for this model element, with the lines wrapped after
313 * the specified number of characters, values of less than 1 will indicate no line wrapping is
314 * required. By default paragraphs are returned as HTML.
315 * This method is equivalent to <code>getDocumentation(indent, lineLength, true)</code>.
316 * @see ModelElementFacade#getDocumentation(String indent, int lineLength)
317 */
318 public String getDocumentation(String indent, int lineLength)
319 {
320 return this.getSuperFinalStateFacade().getDocumentation(indent, lineLength);
321 }
322
323 /**
324 * This method returns the documentation for this model element, with the lines wrapped after
325 * the specified number of characters, values of less than 1 will indicate no line wrapping is
326 * required. HTML style determines if HTML Escaping is applied.
327 * @see ModelElementFacade#getDocumentation(String indent, int lineLength, boolean htmlStyle)
328 */
329 public String getDocumentation(String indent, int lineLength, boolean htmlStyle)
330 {
331 return this.getSuperFinalStateFacade().getDocumentation(indent, lineLength, htmlStyle);
332 }
333
334 /**
335 * The fully qualified name of this model element.
336 * @see ModelElementFacade#getFullyQualifiedName()
337 */
338 public String getFullyQualifiedName()
339 {
340 return this.getSuperFinalStateFacade().getFullyQualifiedName();
341 }
342
343 /**
344 * Returns the fully qualified name of the model element. The fully qualified name includes
345 * complete package qualified name of the underlying model element. If modelName is true, then
346 * the original name of the model element (the name contained within the model) will be the name
347 * returned, otherwise a name from a language mapping will be returned.
348 * @see ModelElementFacade#getFullyQualifiedName(boolean modelName)
349 */
350 public String getFullyQualifiedName(boolean modelName)
351 {
352 return this.getSuperFinalStateFacade().getFullyQualifiedName(modelName);
353 }
354
355 /**
356 * Returns the fully qualified name as a path, the returned value always starts with out a slash
357 * '/'.
358 * @see ModelElementFacade#getFullyQualifiedNamePath()
359 */
360 public String getFullyQualifiedNamePath()
361 {
362 return this.getSuperFinalStateFacade().getFullyQualifiedNamePath();
363 }
364
365 /**
366 * Gets the unique identifier of the underlying model element.
367 * @see ModelElementFacade#getId()
368 */
369 public String getId()
370 {
371 return this.getSuperFinalStateFacade().getId();
372 }
373
374 /**
375 * UML2: Retrieves the keywords for this element. Used to modify implementation properties which
376 * are not represented by other properties, i.e. native, transient, volatile, synchronized,
377 * (added annotations) override, deprecated. Can also be used to suppress compiler warnings:
378 * (added annotations) unchecked, fallthrough, path, serial, finally, all. Annotations require
379 * JDK5 compiler level.
380 * @see ModelElementFacade#getKeywords()
381 */
382 public Collection<String> getKeywords()
383 {
384 return this.getSuperFinalStateFacade().getKeywords();
385 }
386
387 /**
388 * UML2: Retrieves a localized label for this named element.
389 * @see ModelElementFacade#getLabel()
390 */
391 public String getLabel()
392 {
393 return this.getSuperFinalStateFacade().getLabel();
394 }
395
396 /**
397 * The language mappings that have been set for this model element.
398 * @see ModelElementFacade#getLanguageMappings()
399 */
400 public TypeMappings getLanguageMappings()
401 {
402 return this.getSuperFinalStateFacade().getLanguageMappings();
403 }
404
405 /**
406 * Return the model containing this model element (multiple models may be loaded and processed
407 * at the same time).
408 * @see ModelElementFacade#getModel()
409 */
410 public ModelFacade getModel()
411 {
412 return this.getSuperFinalStateFacade().getModel();
413 }
414
415 /**
416 * The name of the model element.
417 * @see ModelElementFacade#getName()
418 */
419 public String getName()
420 {
421 return this.getSuperFinalStateFacade().getName();
422 }
423
424 /**
425 * Gets the package to which this model element belongs.
426 * @see ModelElementFacade#getPackage()
427 */
428 public ModelElementFacade getPackage()
429 {
430 return this.getSuperFinalStateFacade().getPackage();
431 }
432
433 /**
434 * The name of this model element's package.
435 * @see ModelElementFacade#getPackageName()
436 */
437 public String getPackageName()
438 {
439 return this.getSuperFinalStateFacade().getPackageName();
440 }
441
442 /**
443 * Gets the package name (optionally providing the ability to retrieve the model name and not
444 * the mapped name).
445 * @see ModelElementFacade#getPackageName(boolean modelName)
446 */
447 public String getPackageName(boolean modelName)
448 {
449 return this.getSuperFinalStateFacade().getPackageName(modelName);
450 }
451
452 /**
453 * Returns the package as a path, the returned value always starts with out a slash '/'.
454 * @see ModelElementFacade#getPackagePath()
455 */
456 public String getPackagePath()
457 {
458 return this.getSuperFinalStateFacade().getPackagePath();
459 }
460
461 /**
462 * UML2: Returns the value of the 'Qualified Name' attribute. A name which allows the
463 * NamedElement to be identified within a hierarchy of nested Namespaces. It is constructed from
464 * the names of the containing namespaces starting at the root of the hierarchy and ending with
465 * the name of the NamedElement itself.
466 * @see ModelElementFacade#getQualifiedName()
467 */
468 public String getQualifiedName()
469 {
470 return this.getSuperFinalStateFacade().getQualifiedName();
471 }
472
473 /**
474 * Gets the root package for the model element.
475 * @see ModelElementFacade#getRootPackage()
476 */
477 public PackageFacade getRootPackage()
478 {
479 return this.getSuperFinalStateFacade().getRootPackage();
480 }
481
482 /**
483 * Gets the dependencies for which this model element is the source.
484 * @see ModelElementFacade#getSourceDependencies()
485 */
486 public Collection<DependencyFacade> getSourceDependencies()
487 {
488 return this.getSuperFinalStateFacade().getSourceDependencies();
489 }
490
491 /**
492 * If this model element is the context of an activity graph, this represents that activity
493 * graph.
494 * @see ModelElementFacade#getStateMachineContext()
495 */
496 public StateMachineFacade getStateMachineContext()
497 {
498 return this.getSuperFinalStateFacade().getStateMachineContext();
499 }
500
501 /**
502 * The collection of ALL stereotype names for this model element.
503 * @see ModelElementFacade#getStereotypeNames()
504 */
505 public Collection<String> getStereotypeNames()
506 {
507 return this.getSuperFinalStateFacade().getStereotypeNames();
508 }
509
510 /**
511 * Gets all stereotypes for this model element.
512 * @see ModelElementFacade#getStereotypes()
513 */
514 public Collection<StereotypeFacade> getStereotypes()
515 {
516 return this.getSuperFinalStateFacade().getStereotypes();
517 }
518
519 /**
520 * Return the TaggedValues associated with this model element, under all stereotypes.
521 * @see ModelElementFacade#getTaggedValues()
522 */
523 public Collection<TaggedValueFacade> getTaggedValues()
524 {
525 return this.getSuperFinalStateFacade().getTaggedValues();
526 }
527
528 /**
529 * Gets the dependencies for which this model element is the target.
530 * @see ModelElementFacade#getTargetDependencies()
531 */
532 public Collection<DependencyFacade> getTargetDependencies()
533 {
534 return this.getSuperFinalStateFacade().getTargetDependencies();
535 }
536
537 /**
538 * Get the template parameter for this model element having the parameterName
539 * @see ModelElementFacade#getTemplateParameter(String parameterName)
540 */
541 public Object getTemplateParameter(String parameterName)
542 {
543 return this.getSuperFinalStateFacade().getTemplateParameter(parameterName);
544 }
545
546 /**
547 * Get the template parameters for this model element
548 * @see ModelElementFacade#getTemplateParameters()
549 */
550 public Collection<TemplateParameterFacade> getTemplateParameters()
551 {
552 return this.getSuperFinalStateFacade().getTemplateParameters();
553 }
554
555 /**
556 * The visibility (i.e. public, private, protected or package) of the model element, will
557 * attempt a lookup for these values in the language mappings (if any).
558 * @see ModelElementFacade#getVisibility()
559 */
560 public String getVisibility()
561 {
562 return this.getSuperFinalStateFacade().getVisibility();
563 }
564
565 /**
566 * Returns true if the model element has the exact stereotype (meaning no stereotype inheritance
567 * is taken into account when searching for the stereotype), false otherwise.
568 * @see ModelElementFacade#hasExactStereotype(String stereotypeName)
569 */
570 public boolean hasExactStereotype(String stereotypeName)
571 {
572 return this.getSuperFinalStateFacade().hasExactStereotype(stereotypeName);
573 }
574
575 /**
576 * Does the UML Element contain the named Keyword? Keywords can be separated by space, comma,
577 * pipe, semicolon, or << >>
578 * @see ModelElementFacade#hasKeyword(String keywordName)
579 */
580 public boolean hasKeyword(String keywordName)
581 {
582 return this.getSuperFinalStateFacade().hasKeyword(keywordName);
583 }
584
585 /**
586 * Returns true if the model element has the specified stereotype. If the stereotype itself
587 * does not match, then a search will be made up the stereotype inheritance hierarchy, and if
588 * one of the stereotype's ancestors has a matching name this method will return true, false
589 * otherwise.
590 * For example, if we have a certain stereotype called <<exception>> and a model element has a
591 * stereotype called <<applicationException>> which extends <<exception>>, when calling this
592 * method with 'stereotypeName' defined as 'exception' the method would return true since
593 * <<applicationException>> inherits from <<exception>>. If you want to check if the model
594 * element has the exact stereotype, then use the method 'hasExactStereotype' instead.
595 * @see ModelElementFacade#hasStereotype(String stereotypeName)
596 */
597 public boolean hasStereotype(String stereotypeName)
598 {
599 return this.getSuperFinalStateFacade().hasStereotype(stereotypeName);
600 }
601
602 /**
603 * True if there are target dependencies from this element that are instances of BindingFacade.
604 * Deprecated in UML2: Use TemplateBinding parameters instead of dependencies.
605 * @see ModelElementFacade#isBindingDependenciesPresent()
606 */
607 public boolean isBindingDependenciesPresent()
608 {
609 return this.getSuperFinalStateFacade().isBindingDependenciesPresent();
610 }
611
612 /**
613 * Indicates if any constraints are present on this model element.
614 * @see ModelElementFacade#isConstraintsPresent()
615 */
616 public boolean isConstraintsPresent()
617 {
618 return this.getSuperFinalStateFacade().isConstraintsPresent();
619 }
620
621 /**
622 * Indicates if any documentation is present on this model element.
623 * @see ModelElementFacade#isDocumentationPresent()
624 */
625 public boolean isDocumentationPresent()
626 {
627 return this.getSuperFinalStateFacade().isDocumentationPresent();
628 }
629
630 /**
631 * True if this element name is a reserved word in Java, C#, ANSI or ISO C, C++, JavaScript.
632 * @see ModelElementFacade#isReservedWord()
633 */
634 public boolean isReservedWord()
635 {
636 return this.getSuperFinalStateFacade().isReservedWord();
637 }
638
639 /**
640 * True is there are template parameters on this model element. For UML2, applies to Class,
641 * Operation, Property, and Parameter.
642 * @see ModelElementFacade#isTemplateParametersPresent()
643 */
644 public boolean isTemplateParametersPresent()
645 {
646 return this.getSuperFinalStateFacade().isTemplateParametersPresent();
647 }
648
649 /**
650 * True if this element name is a valid identifier name in Java, C#, ANSI or ISO C, C++,
651 * JavaScript. Contains no spaces, special characters etc. Constraint always applied on
652 * Enumerations and Interfaces, optionally applies on other model elements.
653 * @see ModelElementFacade#isValidIdentifierName()
654 */
655 public boolean isValidIdentifierName()
656 {
657 return this.getSuperFinalStateFacade().isValidIdentifierName();
658 }
659
660 /**
661 * Searches for the constraint with the specified 'name' on this model element, and if found
662 * translates it using the specified 'translation' from a translation library discovered by the
663 * framework.
664 * @see ModelElementFacade#translateConstraint(String name, String translation)
665 */
666 public String translateConstraint(String name, String translation)
667 {
668 return this.getSuperFinalStateFacade().translateConstraint(name, translation);
669 }
670
671 /**
672 * Translates all constraints belonging to this model element with the given 'translation'.
673 * @see ModelElementFacade#translateConstraints(String translation)
674 */
675 public String[] translateConstraints(String translation)
676 {
677 return this.getSuperFinalStateFacade().translateConstraints(translation);
678 }
679
680 /**
681 * Translates the constraints of the specified 'kind' belonging to this model element.
682 * @see ModelElementFacade#translateConstraints(String kind, String translation)
683 */
684 public String[] translateConstraints(String kind, String translation)
685 {
686 return this.getSuperFinalStateFacade().translateConstraints(kind, translation);
687 }
688
689 /**
690 * Events to which is being deferred in this action state.
691 * @see StateFacade#getDeferrableEvents()
692 */
693 public Collection<EventFacade> getDeferrableEvents()
694 {
695 return this.getSuperFinalStateFacade().getDeferrableEvents();
696 }
697
698 /**
699 * Models a situation during which some (usually implicit) invariant condition holds. The states
700 * of
701 * protocol state machines are exposed to the users of their context classifiers. A protocol
702 * state
703 * represents an exposed stable situation of its context classifier: when an instance of the
704 * classifier
705 * is not processing any operation, users of this instance can always know its state
706 * configuration.
707 * @see org.andromda.metafacades.uml.StateVertexFacade#getContainer()
708 */
709 public StateFacade getContainer()
710 {
711 return this.getSuperFinalStateFacade().getContainer();
712 }
713
714 /**
715 * A directed relationship between a source vertex and a target vertex. It may be part of a
716 * compound
717 * transition, which takes the state machine from one state configuration to another,
718 * representing the
719 * complete response of the state machine to an occurrence of an event of a particular type.
720 * @see org.andromda.metafacades.uml.StateVertexFacade#getIncomings()
721 */
722 public Collection<TransitionFacade> getIncomings()
723 {
724 return this.getSuperFinalStateFacade().getIncomings();
725 }
726
727 /**
728 * A directed relationship between a source vertex and a target vertex. It may be part of a
729 * compound
730 * transition, which takes the state machine from one state configuration to another,
731 * representing the
732 * complete response of the state machine to an occurrence of an event of a particular type.
733 * @see org.andromda.metafacades.uml.StateVertexFacade#getOutgoings()
734 */
735 public Collection<TransitionFacade> getOutgoings()
736 {
737 return this.getSuperFinalStateFacade().getOutgoings();
738 }
739
740 /**
741 * The partition (if any) to which this vertex belongs.
742 * @see org.andromda.metafacades.uml.StateVertexFacade#getPartition()
743 */
744 public PartitionFacade getPartition()
745 {
746 return this.getSuperFinalStateFacade().getPartition();
747 }
748
749 /**
750 * State machines can be used to express the behavior of part of a system. Behavior is modeled
751 * as a
752 * traversal of a graph of state nodes interconnected by one or more joined transition arcs that
753 * are
754 * triggered by the dispatching of series of (event) occurrences. During this traversal, the
755 * state
756 * machine executes a series of activities associated with various elements of the state
757 * machine.
758 * @see org.andromda.metafacades.uml.StateVertexFacade#getStateMachine()
759 */
760 public StateMachineFacade getStateMachine()
761 {
762 return this.getSuperFinalStateFacade().getStateMachine();
763 }
764
765 // ----------- delegates to FrontEndFinalState ------------
766 /**
767 * Parameters that are directly entering this final state, they will be able to survive a trip
768 * to the next use-case.
769 * @see FrontEndFinalState#getInterUseCaseParameters()
770 */
771 public List<FrontEndParameter> getInterUseCaseParameters()
772 {
773 return this.getSuperFrontEndFinalState().getInterUseCaseParameters();
774 }
775
776 /**
777 * The use case the final state is "targetting".
778 * @see FrontEndFinalState#getTargetUseCase()
779 */
780 public FrontEndUseCase getTargetUseCase()
781 {
782 return this.getSuperFrontEndFinalState().getTargetUseCase();
783 }
784
785 /**
786 * Indicates if this front end final state is contained within a FrontEndUseCase.
787 * @see FrontEndFinalState#isContainedInFrontEndUseCase()
788 */
789 public boolean isContainedInFrontEndUseCase()
790 {
791 return this.getSuperFrontEndFinalState().isContainedInFrontEndUseCase();
792 }
793
794 /**
795 * @see MetafacadeBase#initialize()
796 */
797 @Override
798 public void initialize()
799 {
800 this.getSuperFinalStateFacade().initialize();
801 this.getSuperFrontEndFinalState().initialize();
802 }
803
804 /**
805 * @return Object getSuperFinalStateFacade().getValidationOwner()
806 * @see MetafacadeBase#getValidationOwner()
807 */
808 @Override
809 public Object getValidationOwner()
810 {
811 Object owner = this.getSuperFinalStateFacade().getValidationOwner();
812 if (owner == null)
813 {
814 owner = this.getSuperFrontEndFinalState().getValidationOwner();
815 }
816 return owner;
817 }
818
819 /**
820 * @return String getSuperFinalStateFacade().getValidationName()
821 * @see MetafacadeBase#getValidationName()
822 */
823 @Override
824 public String getValidationName()
825 {
826 String name = this.getSuperFinalStateFacade().getValidationName();
827 if (name == null)
828 {
829 name = this.getSuperFrontEndFinalState().getValidationName();
830 }
831 return name;
832 }
833
834 /**
835 * <p><b>Constraint:</b> org::andromda::cartridges::bpm4struts::metafacades::StrutsFinalState::name must uniquely match usecase</p>
836 * <p><b>Error:</b> The name of this final state must not be null and exactly match the name of a use-case. Alternatively it is possible to reference a use-case using an hyperlink (some UML tools support this). In both cases that use-case MUST carry the FrontEndUseCase stereotype. Finally you may also specify an actual hyperlink to an external resource, either in the final state's name, or as a webpage link as supported by some UML tools.</p>
837 * <p><b>OCL:</b> context StrutsFinalState inv: fullPath->notEmpty()</p>
838 * @param validationMessages Collection<ModelValidationMessage>
839 * @see MetafacadeBase#validateInvariants(Collection validationMessages)
840 */
841 @Override
842 public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
843 {
844 this.getSuperFinalStateFacade().validateInvariants(validationMessages);
845 this.getSuperFrontEndFinalState().validateInvariants(validationMessages);
846 try
847 {
848 final Object contextElement = this.THIS();
849 boolean constraintValid = OCLResultEnsurer.ensure(OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"fullPath")));
850 if (!constraintValid)
851 {
852 validationMessages.add(
853 new ModelValidationMessage(
854 (MetafacadeBase)contextElement ,
855 "org::andromda::cartridges::bpm4struts::metafacades::StrutsFinalState::name must uniquely match usecase",
856 "The name of this final state must not be null and exactly match the name of a use-case. Alternatively it is possible to reference a use-case using an hyperlink (some UML tools support this). In both cases that use-case MUST carry the FrontEndUseCase stereotype. Finally you may also specify an actual hyperlink to an external resource, either in the final state's name, or as a webpage link as supported by some UML tools."));
857 }
858 }
859 catch (Throwable th)
860 {
861 Throwable cause = th.getCause();
862 int depth = 0; // Some throwables have infinite recursion
863 while (cause != null && depth < 7)
864 {
865 th = cause;
866 depth++;
867 }
868 logger.error("Error validating constraint 'org::andromda::cartridges::bpm4struts::metafacades::StrutsFinalState::name must uniquely match usecase' ON "
869 + this.THIS().toString() + ": " + th.getMessage(), th);
870 }
871 }
872
873 /**
874 * The property that stores the name of the metafacade.
875 */
876 private static final String NAME_PROPERTY = "name";
877 private static final String FQNAME_PROPERTY = "fullyQualifiedName";
878
879 /**
880 * @see Object#toString()
881 */
882 @Override
883 public String toString()
884 {
885 final StringBuilder toString = new StringBuilder(this.getClass().getName());
886 toString.append("[");
887 try
888 {
889 toString.append(Introspector.instance().getProperty(this, FQNAME_PROPERTY));
890 }
891 catch (final Throwable tryAgain)
892 {
893 try
894 {
895 toString.append(Introspector.instance().getProperty(this, NAME_PROPERTY));
896 }
897 catch (final Throwable ignore)
898 {
899 // - just ignore when the metafacade doesn't have a name or fullyQualifiedName property
900 }
901 }
902 toString.append("]");
903 return toString.toString();
904 }
905 }