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