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