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