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 org.andromda.core.common.Introspector;
009import org.andromda.core.metafacade.MetafacadeBase;
010import org.andromda.core.metafacade.MetafacadeFactory;
011import org.andromda.core.metafacade.ModelValidationMessage;
012import org.andromda.metafacades.uml.ConstraintFacade;
013import org.andromda.metafacades.uml.DependencyFacade;
014import org.andromda.metafacades.uml.ModelElementFacade;
015import org.andromda.metafacades.uml.ModelFacade;
016import org.andromda.metafacades.uml.PackageFacade;
017import org.andromda.metafacades.uml.PartitionFacade;
018import org.andromda.metafacades.uml.PseudostateFacade;
019import org.andromda.metafacades.uml.StateFacade;
020import org.andromda.metafacades.uml.StateMachineFacade;
021import org.andromda.metafacades.uml.StereotypeFacade;
022import org.andromda.metafacades.uml.TaggedValueFacade;
023import org.andromda.metafacades.uml.TemplateParameterFacade;
024import org.andromda.metafacades.uml.TransitionFacade;
025import org.andromda.metafacades.uml.TypeMappings;
026import org.andromda.translation.ocl.validation.OCLCollections;
027import org.andromda.translation.ocl.validation.OCLIntrospector;
028import org.andromda.translation.ocl.validation.OCLResultEnsurer;
029import org.apache.commons.collections.Predicate;
030import org.apache.log4j.Logger;
031
032/**
033 * TODO: Model Documentation for org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate
034 * MetafacadeLogic for JBpmPseudostate
035 *
036 * @see JBpmPseudostate
037 */
038public abstract class JBpmPseudostateLogic
039    extends MetafacadeBase
040    implements JBpmPseudostate
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 JBpmPseudostateLogic(Object metaObjectIn, String context)
053    {
054        super(metaObjectIn, getContext(context));
055        this.superJBpmStateVertex =
056           (JBpmStateVertex)
057            MetafacadeFactory.getInstance().createFacadeImpl(
058                    "org.andromda.cartridges.jbpm.metafacades.JBpmStateVertex",
059                    metaObjectIn,
060                    getContext(context));
061        this.superPseudostateFacade =
062           (PseudostateFacade)
063            MetafacadeFactory.getInstance().createFacadeImpl(
064                    "org.andromda.metafacades.uml.PseudostateFacade",
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(JBpmPseudostateLogic.class);
074
075    /**
076     * Gets the context for this metafacade logic instance.
077     * @param context String. Set to JBpmPseudostate 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.JBpmPseudostate";
085        }
086        return context;
087    }
088
089    private JBpmStateVertex superJBpmStateVertex;
090    private boolean superJBpmStateVertexInitialized = false;
091
092    /**
093     * Gets the JBpmStateVertex parent instance.
094     * @return this.superJBpmStateVertex JBpmStateVertex
095     */
096    protected JBpmStateVertex getSuperJBpmStateVertex()
097    {
098        if (!this.superJBpmStateVertexInitialized)
099        {
100            ((MetafacadeBase)this.superJBpmStateVertex).setMetafacadeContext(this.getMetafacadeContext());
101            this.superJBpmStateVertexInitialized = true;
102        }
103        return this.superJBpmStateVertex;
104    }
105
106    private PseudostateFacade superPseudostateFacade;
107    private boolean superPseudostateFacadeInitialized = false;
108
109    /**
110     * Gets the PseudostateFacade parent instance.
111     * @return this.superPseudostateFacade PseudostateFacade
112     */
113    protected PseudostateFacade getSuperPseudostateFacade()
114    {
115        if (!this.superPseudostateFacadeInitialized)
116        {
117            ((MetafacadeBase)this.superPseudostateFacade).setMetafacadeContext(this.getMetafacadeContext());
118            this.superPseudostateFacadeInitialized = true;
119        }
120        return this.superPseudostateFacade;
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.superJBpmStateVertexInitialized)
135            {
136                ((MetafacadeBase)this.superJBpmStateVertex).resetMetafacadeContext(context);
137            }
138            if (this.superPseudostateFacadeInitialized)
139            {
140                ((MetafacadeBase)this.superPseudostateFacade).resetMetafacadeContext(context);
141            }
142        }
143    }
144
145    /**
146     * @return boolean true always
147     * @see JBpmPseudostate
148     */
149    public boolean isJBpmPseudostateMetaType()
150    {
151        return true;
152    }
153
154    // --------------- attributes ---------------------
155
156   /**
157    * @see org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate#getClazz()
158    * @return String
159    */
160    protected abstract String handleGetClazz();
161
162    private String __clazz1a;
163    private boolean __clazz1aSet = false;
164
165    /**
166     * TODO: Model Documentation for org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate.clazz
167     * @return (String)handleGetClazz()
168     */
169    public final String getClazz()
170    {
171        String clazz1a = this.__clazz1a;
172        if (!this.__clazz1aSet)
173        {
174            // clazz has no pre constraints
175            clazz1a = handleGetClazz();
176            // clazz has no post constraints
177            this.__clazz1a = clazz1a;
178            if (isMetafacadePropertyCachingEnabled())
179            {
180                this.__clazz1aSet = true;
181            }
182        }
183        return clazz1a;
184    }
185
186   /**
187    * @see org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate#getClassName()
188    * @return String
189    */
190    protected abstract String handleGetClassName();
191
192    private String __className2a;
193    private boolean __className2aSet = false;
194
195    /**
196     * TODO: Model Documentation for
197     * org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate.className
198     * @return (String)handleGetClassName()
199     */
200    public final String getClassName()
201    {
202        String className2a = this.__className2a;
203        if (!this.__className2aSet)
204        {
205            // className has no pre constraints
206            className2a = handleGetClassName();
207            // className has no post constraints
208            this.__className2a = className2a;
209            if (isMetafacadePropertyCachingEnabled())
210            {
211                this.__className2aSet = true;
212            }
213        }
214        return className2a;
215    }
216
217   /**
218    * @see org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate#getDecisionHandlerPackageName()
219    * @return String
220    */
221    protected abstract String handleGetDecisionHandlerPackageName();
222
223    private String __decisionHandlerPackageName3a;
224    private boolean __decisionHandlerPackageName3aSet = false;
225
226    /**
227     * TODO: Model Documentation for
228     * org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate.decisionHandlerPackageName
229     * @return (String)handleGetDecisionHandlerPackageName()
230     */
231    public final String getDecisionHandlerPackageName()
232    {
233        String decisionHandlerPackageName3a = this.__decisionHandlerPackageName3a;
234        if (!this.__decisionHandlerPackageName3aSet)
235        {
236            // decisionHandlerPackageName has no pre constraints
237            decisionHandlerPackageName3a = handleGetDecisionHandlerPackageName();
238            // decisionHandlerPackageName has no post constraints
239            this.__decisionHandlerPackageName3a = decisionHandlerPackageName3a;
240            if (isMetafacadePropertyCachingEnabled())
241            {
242                this.__decisionHandlerPackageName3aSet = true;
243            }
244        }
245        return decisionHandlerPackageName3a;
246    }
247
248   /**
249    * @see org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate#getDecisionHandlerFullPath()
250    * @return String
251    */
252    protected abstract String handleGetDecisionHandlerFullPath();
253
254    private String __decisionHandlerFullPath4a;
255    private boolean __decisionHandlerFullPath4aSet = false;
256
257    /**
258     * TODO: Model Documentation for
259     * org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate.decisionHandlerFullPath
260     * @return (String)handleGetDecisionHandlerFullPath()
261     */
262    public final String getDecisionHandlerFullPath()
263    {
264        String decisionHandlerFullPath4a = this.__decisionHandlerFullPath4a;
265        if (!this.__decisionHandlerFullPath4aSet)
266        {
267            // decisionHandlerFullPath has no pre constraints
268            decisionHandlerFullPath4a = handleGetDecisionHandlerFullPath();
269            // decisionHandlerFullPath has no post constraints
270            this.__decisionHandlerFullPath4a = decisionHandlerFullPath4a;
271            if (isMetafacadePropertyCachingEnabled())
272            {
273                this.__decisionHandlerFullPath4aSet = true;
274            }
275        }
276        return decisionHandlerFullPath4a;
277    }
278
279   /**
280    * @see org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate#getDecisionHandlerClassName()
281    * @return String
282    */
283    protected abstract String handleGetDecisionHandlerClassName();
284
285    private String __decisionHandlerClassName5a;
286    private boolean __decisionHandlerClassName5aSet = false;
287
288    /**
289     * TODO: Model Documentation for
290     * org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate.decisionHandlerClassName
291     * @return (String)handleGetDecisionHandlerClassName()
292     */
293    public final String getDecisionHandlerClassName()
294    {
295        String decisionHandlerClassName5a = this.__decisionHandlerClassName5a;
296        if (!this.__decisionHandlerClassName5aSet)
297        {
298            // decisionHandlerClassName has no pre constraints
299            decisionHandlerClassName5a = handleGetDecisionHandlerClassName();
300            // decisionHandlerClassName has no post constraints
301            this.__decisionHandlerClassName5a = decisionHandlerClassName5a;
302            if (isMetafacadePropertyCachingEnabled())
303            {
304                this.__decisionHandlerClassName5aSet = true;
305            }
306        }
307        return decisionHandlerClassName5a;
308    }
309
310    // ------------- associations ------------------
311
312    private JBpmSwimlane __getSwimlane1r;
313    private boolean __getSwimlane1rSet = false;
314
315    /**
316     * TODO: Model Documentation for org.andromda.cartridges.jbpm.metafacades.JBpmPseudostate
317     * @return (JBpmSwimlane)handleGetSwimlane()
318     */
319    public final JBpmSwimlane getSwimlane()
320    {
321        JBpmSwimlane getSwimlane1r = this.__getSwimlane1r;
322        if (!this.__getSwimlane1rSet)
323        {
324            // jBpmPseudostate has no pre constraints
325            Object result = handleGetSwimlane();
326            MetafacadeBase shieldedResult = this.shieldedElement(result);
327            try
328            {
329                getSwimlane1r = (JBpmSwimlane)shieldedResult;
330            }
331            catch (ClassCastException ex)
332            {
333                // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
334                JBpmPseudostateLogic.logger.warn("incorrect metafacade cast for JBpmPseudostateLogic.getSwimlane JBpmSwimlane " + result + ": " + shieldedResult);
335            }
336            // jBpmPseudostate has no post constraints
337            this.__getSwimlane1r = getSwimlane1r;
338            if (isMetafacadePropertyCachingEnabled())
339            {
340                this.__getSwimlane1rSet = true;
341            }
342        }
343        return getSwimlane1r;
344    }
345
346    /**
347     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
348     * @return Object
349     */
350    protected abstract Object handleGetSwimlane();
351
352    /**
353     * @return true
354     * @see JBpmStateVertex
355     */
356    public boolean isJBpmStateVertexMetaType()
357    {
358        return true;
359    }
360
361    /**
362     * @return true
363     * @see PseudostateFacade
364     */
365    public boolean isPseudostateFacadeMetaType()
366    {
367        return true;
368    }
369
370    /**
371     * @return true
372     * @see org.andromda.metafacades.uml.StateVertexFacade
373     */
374    public boolean isStateVertexFacadeMetaType()
375    {
376        return true;
377    }
378
379    /**
380     * @return true
381     * @see ModelElementFacade
382     */
383    public boolean isModelElementFacadeMetaType()
384    {
385        return true;
386    }
387
388    // ----------- delegates to JBpmStateVertex ------------
389    /**
390     * TODO: Model Documentation for
391     * JBpmStateVertex.nodeClassName
392     * @see JBpmStateVertex#getNodeClassName()
393     */
394    public String getNodeClassName()
395    {
396        return this.getSuperJBpmStateVertex().getNodeClassName();
397    }
398
399    /**
400     * TODO: Model Documentation for
401     * JBpmStateVertex.nodePackageName
402     * @see JBpmStateVertex#getNodePackageName()
403     */
404    public String getNodePackageName()
405    {
406        return this.getSuperJBpmStateVertex().getNodePackageName();
407    }
408
409    /**
410     * TODO: Model Documentation for JBpmProcessDefinition
411     * @see JBpmStateVertex#getProcessDefinition()
412     */
413    public JBpmProcessDefinition getProcessDefinition()
414    {
415        return this.getSuperJBpmStateVertex().getProcessDefinition();
416    }
417
418    /**
419     * True if this element is part of a business process usecase.
420     * @see JBpmStateVertex#isContainedInBusinessProcess()
421     */
422    public boolean isContainedInBusinessProcess()
423    {
424        return this.getSuperJBpmStateVertex().isContainedInBusinessProcess();
425    }
426
427    /**
428     * Copies all tagged values from the given ModelElementFacade to this model element facade.
429     * @see ModelElementFacade#copyTaggedValues(ModelElementFacade element)
430     */
431    public void copyTaggedValues(ModelElementFacade element)
432    {
433        this.getSuperJBpmStateVertex().copyTaggedValues(element);
434    }
435
436    /**
437     * Finds the tagged value with the specified 'tagName'. In case there are more values the first
438     * one found will be returned.
439     * @see ModelElementFacade#findTaggedValue(String tagName)
440     */
441    public Object findTaggedValue(String tagName)
442    {
443        return this.getSuperJBpmStateVertex().findTaggedValue(tagName);
444    }
445
446    /**
447     * Returns all the values for the tagged value with the specified name. The returned collection
448     * will contains only String instances, or will be empty. Never null.
449     * @see ModelElementFacade#findTaggedValues(String tagName)
450     */
451    public Collection<Object> findTaggedValues(String tagName)
452    {
453        return this.getSuperJBpmStateVertex().findTaggedValues(tagName);
454    }
455
456    /**
457     * Returns the fully qualified name of the model element. The fully qualified name includes
458     * complete package qualified name of the underlying model element. The templates parameter will
459     * be replaced by the correct one given the binding relation of the parameter to this element.
460     * @see ModelElementFacade#getBindedFullyQualifiedName(ModelElementFacade bindedElement)
461     */
462    public String getBindedFullyQualifiedName(ModelElementFacade bindedElement)
463    {
464        return this.getSuperJBpmStateVertex().getBindedFullyQualifiedName(bindedElement);
465    }
466
467    /**
468     * Gets all constraints belonging to the model element.
469     * @see ModelElementFacade#getConstraints()
470     */
471    public Collection<ConstraintFacade> getConstraints()
472    {
473        return this.getSuperJBpmStateVertex().getConstraints();
474    }
475
476    /**
477     * Returns the constraints of the argument kind that have been placed onto this model. Typical
478     * kinds are "inv", "pre" and "post". Other kinds are possible.
479     * @see ModelElementFacade#getConstraints(String kind)
480     */
481    public Collection<ConstraintFacade> getConstraints(String kind)
482    {
483        return this.getSuperJBpmStateVertex().getConstraints(kind);
484    }
485
486    /**
487     * Gets the documentation for the model element, The indent argument is prefixed to each line.
488     * By default this method wraps lines after 64 characters.
489     * This method is equivalent to <code>getDocumentation(indent, 64)</code>.
490     * @see ModelElementFacade#getDocumentation(String indent)
491     */
492    public String getDocumentation(String indent)
493    {
494        return this.getSuperJBpmStateVertex().getDocumentation(indent);
495    }
496
497    /**
498     * This method returns the documentation for this model element, with the lines wrapped after
499     * the specified number of characters, values of less than 1 will indicate no line wrapping is
500     * required. By default paragraphs are returned as HTML.
501     * This method is equivalent to <code>getDocumentation(indent, lineLength, true)</code>.
502     * @see ModelElementFacade#getDocumentation(String indent, int lineLength)
503     */
504    public String getDocumentation(String indent, int lineLength)
505    {
506        return this.getSuperJBpmStateVertex().getDocumentation(indent, lineLength);
507    }
508
509    /**
510     * This method returns the documentation for this model element, with the lines wrapped after
511     * the specified number of characters, values of less than 1 will indicate no line wrapping is
512     * required. HTML style determines if HTML Escaping is applied.
513     * @see ModelElementFacade#getDocumentation(String indent, int lineLength, boolean htmlStyle)
514     */
515    public String getDocumentation(String indent, int lineLength, boolean htmlStyle)
516    {
517        return this.getSuperJBpmStateVertex().getDocumentation(indent, lineLength, htmlStyle);
518    }
519
520    /**
521     * The fully qualified name of this model element.
522     * @see ModelElementFacade#getFullyQualifiedName()
523     */
524    public String getFullyQualifiedName()
525    {
526        return this.getSuperJBpmStateVertex().getFullyQualifiedName();
527    }
528
529    /**
530     * Returns the fully qualified name of the model element. The fully qualified name includes
531     * complete package qualified name of the underlying model element.  If modelName is true, then
532     * the original name of the model element (the name contained within the model) will be the name
533     * returned, otherwise a name from a language mapping will be returned.
534     * @see ModelElementFacade#getFullyQualifiedName(boolean modelName)
535     */
536    public String getFullyQualifiedName(boolean modelName)
537    {
538        return this.getSuperJBpmStateVertex().getFullyQualifiedName(modelName);
539    }
540
541    /**
542     * Returns the fully qualified name as a path, the returned value always starts with out a slash
543     * '/'.
544     * @see ModelElementFacade#getFullyQualifiedNamePath()
545     */
546    public String getFullyQualifiedNamePath()
547    {
548        return this.getSuperJBpmStateVertex().getFullyQualifiedNamePath();
549    }
550
551    /**
552     * Gets the unique identifier of the underlying model element.
553     * @see ModelElementFacade#getId()
554     */
555    public String getId()
556    {
557        return this.getSuperJBpmStateVertex().getId();
558    }
559
560    /**
561     * UML2: Retrieves the keywords for this element. Used to modify implementation properties which
562     * are not represented by other properties, i.e. native, transient, volatile, synchronized,
563     * (added annotations) override, deprecated. Can also be used to suppress compiler warnings:
564     * (added annotations) unchecked, fallthrough, path, serial, finally, all. Annotations require
565     * JDK5 compiler level.
566     * @see ModelElementFacade#getKeywords()
567     */
568    public Collection<String> getKeywords()
569    {
570        return this.getSuperJBpmStateVertex().getKeywords();
571    }
572
573    /**
574     * UML2: Retrieves a localized label for this named element.
575     * @see ModelElementFacade#getLabel()
576     */
577    public String getLabel()
578    {
579        return this.getSuperJBpmStateVertex().getLabel();
580    }
581
582    /**
583     * The language mappings that have been set for this model element.
584     * @see ModelElementFacade#getLanguageMappings()
585     */
586    public TypeMappings getLanguageMappings()
587    {
588        return this.getSuperJBpmStateVertex().getLanguageMappings();
589    }
590
591    /**
592     * Return the model containing this model element (multiple models may be loaded and processed
593     * at the same time).
594     * @see ModelElementFacade#getModel()
595     */
596    public ModelFacade getModel()
597    {
598        return this.getSuperJBpmStateVertex().getModel();
599    }
600
601    /**
602     * The name of the model element.
603     * @see ModelElementFacade#getName()
604     */
605    public String getName()
606    {
607        return this.getSuperJBpmStateVertex().getName();
608    }
609
610    /**
611     * Gets the package to which this model element belongs.
612     * @see ModelElementFacade#getPackage()
613     */
614    public ModelElementFacade getPackage()
615    {
616        return this.getSuperJBpmStateVertex().getPackage();
617    }
618
619    /**
620     * The name of this model element's package.
621     * @see ModelElementFacade#getPackageName()
622     */
623    public String getPackageName()
624    {
625        return this.getSuperJBpmStateVertex().getPackageName();
626    }
627
628    /**
629     * Gets the package name (optionally providing the ability to retrieve the model name and not
630     * the mapped name).
631     * @see ModelElementFacade#getPackageName(boolean modelName)
632     */
633    public String getPackageName(boolean modelName)
634    {
635        return this.getSuperJBpmStateVertex().getPackageName(modelName);
636    }
637
638    /**
639     * Returns the package as a path, the returned value always starts with out a slash '/'.
640     * @see ModelElementFacade#getPackagePath()
641     */
642    public String getPackagePath()
643    {
644        return this.getSuperJBpmStateVertex().getPackagePath();
645    }
646
647    /**
648     * UML2: Returns the value of the 'Qualified Name' attribute. A name which allows the
649     * NamedElement to be identified within a hierarchy of nested Namespaces. It is constructed from
650     * the names of the containing namespaces starting at the root of the hierarchy and ending with
651     * the name of the NamedElement itself.
652     * @see ModelElementFacade#getQualifiedName()
653     */
654    public String getQualifiedName()
655    {
656        return this.getSuperJBpmStateVertex().getQualifiedName();
657    }
658
659    /**
660     * Gets the root package for the model element.
661     * @see ModelElementFacade#getRootPackage()
662     */
663    public PackageFacade getRootPackage()
664    {
665        return this.getSuperJBpmStateVertex().getRootPackage();
666    }
667
668    /**
669     * Gets the dependencies for which this model element is the source.
670     * @see ModelElementFacade#getSourceDependencies()
671     */
672    public Collection<DependencyFacade> getSourceDependencies()
673    {
674        return this.getSuperJBpmStateVertex().getSourceDependencies();
675    }
676
677    /**
678     * If this model element is the context of an activity graph, this represents that activity
679     * graph.
680     * @see ModelElementFacade#getStateMachineContext()
681     */
682    public StateMachineFacade getStateMachineContext()
683    {
684        return this.getSuperJBpmStateVertex().getStateMachineContext();
685    }
686
687    /**
688     * The collection of ALL stereotype names for this model element.
689     * @see ModelElementFacade#getStereotypeNames()
690     */
691    public Collection<String> getStereotypeNames()
692    {
693        return this.getSuperJBpmStateVertex().getStereotypeNames();
694    }
695
696    /**
697     * Gets all stereotypes for this model element.
698     * @see ModelElementFacade#getStereotypes()
699     */
700    public Collection<StereotypeFacade> getStereotypes()
701    {
702        return this.getSuperJBpmStateVertex().getStereotypes();
703    }
704
705    /**
706     * Return the TaggedValues associated with this model element, under all stereotypes.
707     * @see ModelElementFacade#getTaggedValues()
708     */
709    public Collection<TaggedValueFacade> getTaggedValues()
710    {
711        return this.getSuperJBpmStateVertex().getTaggedValues();
712    }
713
714    /**
715     * Gets the dependencies for which this model element is the target.
716     * @see ModelElementFacade#getTargetDependencies()
717     */
718    public Collection<DependencyFacade> getTargetDependencies()
719    {
720        return this.getSuperJBpmStateVertex().getTargetDependencies();
721    }
722
723    /**
724     * Get the template parameter for this model element having the parameterName
725     * @see ModelElementFacade#getTemplateParameter(String parameterName)
726     */
727    public Object getTemplateParameter(String parameterName)
728    {
729        return this.getSuperJBpmStateVertex().getTemplateParameter(parameterName);
730    }
731
732    /**
733     * Get the template parameters for this model element
734     * @see ModelElementFacade#getTemplateParameters()
735     */
736    public Collection<TemplateParameterFacade> getTemplateParameters()
737    {
738        return this.getSuperJBpmStateVertex().getTemplateParameters();
739    }
740
741    /**
742     * The visibility (i.e. public, private, protected or package) of the model element, will
743     * attempt a lookup for these values in the language mappings (if any).
744     * @see ModelElementFacade#getVisibility()
745     */
746    public String getVisibility()
747    {
748        return this.getSuperJBpmStateVertex().getVisibility();
749    }
750
751    /**
752     * Returns true if the model element has the exact stereotype (meaning no stereotype inheritance
753     * is taken into account when searching for the stereotype), false otherwise.
754     * @see ModelElementFacade#hasExactStereotype(String stereotypeName)
755     */
756    public boolean hasExactStereotype(String stereotypeName)
757    {
758        return this.getSuperJBpmStateVertex().hasExactStereotype(stereotypeName);
759    }
760
761    /**
762     * Does the UML Element contain the named Keyword? Keywords can be separated by space, comma,
763     * pipe, semicolon, or << >>
764     * @see ModelElementFacade#hasKeyword(String keywordName)
765     */
766    public boolean hasKeyword(String keywordName)
767    {
768        return this.getSuperJBpmStateVertex().hasKeyword(keywordName);
769    }
770
771    /**
772     * Returns true if the model element has the specified stereotype.  If the stereotype itself
773     * does not match, then a search will be made up the stereotype inheritance hierarchy, and if
774     * one of the stereotype's ancestors has a matching name this method will return true, false
775     * otherwise.
776     * For example, if we have a certain stereotype called <<exception>> and a model element has a
777     * stereotype called <<applicationException>> which extends <<exception>>, when calling this
778     * method with 'stereotypeName' defined as 'exception' the method would return true since
779     * <<applicationException>> inherits from <<exception>>.  If you want to check if the model
780     * element has the exact stereotype, then use the method 'hasExactStereotype' instead.
781     * @see ModelElementFacade#hasStereotype(String stereotypeName)
782     */
783    public boolean hasStereotype(String stereotypeName)
784    {
785        return this.getSuperJBpmStateVertex().hasStereotype(stereotypeName);
786    }
787
788    /**
789     * True if there are target dependencies from this element that are instances of BindingFacade.
790     * Deprecated in UML2: Use TemplateBinding parameters instead of dependencies.
791     * @see ModelElementFacade#isBindingDependenciesPresent()
792     */
793    public boolean isBindingDependenciesPresent()
794    {
795        return this.getSuperJBpmStateVertex().isBindingDependenciesPresent();
796    }
797
798    /**
799     * Indicates if any constraints are present on this model element.
800     * @see ModelElementFacade#isConstraintsPresent()
801     */
802    public boolean isConstraintsPresent()
803    {
804        return this.getSuperJBpmStateVertex().isConstraintsPresent();
805    }
806
807    /**
808     * Indicates if any documentation is present on this model element.
809     * @see ModelElementFacade#isDocumentationPresent()
810     */
811    public boolean isDocumentationPresent()
812    {
813        return this.getSuperJBpmStateVertex().isDocumentationPresent();
814    }
815
816    /**
817     * True if this element name is a reserved word in Java, C#, ANSI or ISO C, C++, JavaScript.
818     * @see ModelElementFacade#isReservedWord()
819     */
820    public boolean isReservedWord()
821    {
822        return this.getSuperJBpmStateVertex().isReservedWord();
823    }
824
825    /**
826     * True is there are template parameters on this model element. For UML2, applies to Class,
827     * Operation, Property, and Parameter.
828     * @see ModelElementFacade#isTemplateParametersPresent()
829     */
830    public boolean isTemplateParametersPresent()
831    {
832        return this.getSuperJBpmStateVertex().isTemplateParametersPresent();
833    }
834
835    /**
836     * True if this element name is a valid identifier name in Java, C#, ANSI or ISO C, C++,
837     * JavaScript. Contains no spaces, special characters etc. Constraint always applied on
838     * Enumerations and Interfaces, optionally applies on other model elements.
839     * @see ModelElementFacade#isValidIdentifierName()
840     */
841    public boolean isValidIdentifierName()
842    {
843        return this.getSuperJBpmStateVertex().isValidIdentifierName();
844    }
845
846    /**
847     * Searches for the constraint with the specified 'name' on this model element, and if found
848     * translates it using the specified 'translation' from a translation library discovered by the
849     * framework.
850     * @see ModelElementFacade#translateConstraint(String name, String translation)
851     */
852    public String translateConstraint(String name, String translation)
853    {
854        return this.getSuperJBpmStateVertex().translateConstraint(name, translation);
855    }
856
857    /**
858     * Translates all constraints belonging to this model element with the given 'translation'.
859     * @see ModelElementFacade#translateConstraints(String translation)
860     */
861    public String[] translateConstraints(String translation)
862    {
863        return this.getSuperJBpmStateVertex().translateConstraints(translation);
864    }
865
866    /**
867     * Translates the constraints of the specified 'kind' belonging to this model element.
868     * @see ModelElementFacade#translateConstraints(String kind, String translation)
869     */
870    public String[] translateConstraints(String kind, String translation)
871    {
872        return this.getSuperJBpmStateVertex().translateConstraints(kind, translation);
873    }
874
875    /**
876     * Models a situation during which some (usually implicit) invariant condition holds. The states
877     * of
878     * protocol state machines are exposed to the users of their context classifiers. A protocol
879     * state
880     * represents an exposed stable situation of its context classifier: when an instance of the
881     * classifier
882     * is not processing any operation, users of this instance can always know its state
883     * configuration.
884     * @see org.andromda.metafacades.uml.StateVertexFacade#getContainer()
885     */
886    public StateFacade getContainer()
887    {
888        return this.getSuperJBpmStateVertex().getContainer();
889    }
890
891    /**
892     * A directed relationship between a source vertex and a target vertex. It may be part of a
893     * compound
894     * transition, which takes the state machine from one state configuration to another,
895     * representing the
896     * complete response of the state machine to an occurrence of an event of a particular type.
897     * @see org.andromda.metafacades.uml.StateVertexFacade#getIncomings()
898     */
899    public Collection<TransitionFacade> getIncomings()
900    {
901        return this.getSuperJBpmStateVertex().getIncomings();
902    }
903
904    /**
905     * A directed relationship between a source vertex and a target vertex. It may be part of a
906     * compound
907     * transition, which takes the state machine from one state configuration to another,
908     * representing the
909     * complete response of the state machine to an occurrence of an event of a particular type.
910     * @see org.andromda.metafacades.uml.StateVertexFacade#getOutgoings()
911     */
912    public Collection<TransitionFacade> getOutgoings()
913    {
914        return this.getSuperJBpmStateVertex().getOutgoings();
915    }
916
917    /**
918     * The partition (if any) to which this vertex belongs.
919     * @see org.andromda.metafacades.uml.StateVertexFacade#getPartition()
920     */
921    public PartitionFacade getPartition()
922    {
923        return this.getSuperJBpmStateVertex().getPartition();
924    }
925
926    /**
927     * State machines can be used to express the behavior of part of a system. Behavior is modeled
928     * as a
929     * traversal of a graph of state nodes interconnected by one or more joined transition arcs that
930     * are
931     * triggered by the dispatching of series of (event) occurrences. During this traversal, the
932     * state
933     * machine executes a series of activities associated with various elements of the state
934     * machine.
935     * @see org.andromda.metafacades.uml.StateVertexFacade#getStateMachine()
936     */
937    public StateMachineFacade getStateMachine()
938    {
939        return this.getSuperJBpmStateVertex().getStateMachine();
940    }
941
942    // ----------- delegates to PseudostateFacade ------------
943    /**
944     * TODO: Model Documentation for PseudostateFacade.choice
945     * @see PseudostateFacade#isChoice()
946     */
947    public boolean isChoice()
948    {
949        return this.getSuperPseudostateFacade().isChoice();
950    }
951
952    /**
953     * Denotes this pseudostate to be either a join or a fork with a single outgoing transition and
954     * more than one incoming transition.
955     * @see PseudostateFacade#isCollect()
956     */
957    public boolean isCollect()
958    {
959        return this.getSuperPseudostateFacade().isCollect();
960    }
961
962    /**
963     * TODO: Model Documentation for PseudostateFacade.decisionPoint
964     * @see PseudostateFacade#isDecisionPoint()
965     */
966    public boolean isDecisionPoint()
967    {
968        return this.getSuperPseudostateFacade().isDecisionPoint();
969    }
970
971    /**
972     * TODO: Model Documentation for PseudostateFacade.deepHistory
973     * @see PseudostateFacade#isDeepHistory()
974     */
975    public boolean isDeepHistory()
976    {
977        return this.getSuperPseudostateFacade().isDeepHistory();
978    }
979
980    /**
981     * TODO: Model Documentation for PseudostateFacade.fork
982     * @see PseudostateFacade#isFork()
983     */
984    public boolean isFork()
985    {
986        return this.getSuperPseudostateFacade().isFork();
987    }
988
989    /**
990     * TODO: Model Documentation for PseudostateFacade.initialState
991     * @see PseudostateFacade#isInitialState()
992     */
993    public boolean isInitialState()
994    {
995        return this.getSuperPseudostateFacade().isInitialState();
996    }
997
998    /**
999     * TODO: Model Documentation for PseudostateFacade.join
1000     * @see PseudostateFacade#isJoin()
1001     */
1002    public boolean isJoin()
1003    {
1004        return this.getSuperPseudostateFacade().isJoin();
1005    }
1006
1007    /**
1008     * TODO: Model Documentation for PseudostateFacade.junction
1009     * @see PseudostateFacade#isJunction()
1010     */
1011    public boolean isJunction()
1012    {
1013        return this.getSuperPseudostateFacade().isJunction();
1014    }
1015
1016    /**
1017     * TODO: Model Documentation for PseudostateFacade.mergePoint
1018     * @see PseudostateFacade#isMergePoint()
1019     */
1020    public boolean isMergePoint()
1021    {
1022        return this.getSuperPseudostateFacade().isMergePoint();
1023    }
1024
1025    /**
1026     * TODO: Model Documentation for PseudostateFacade.shallowHistory
1027     * @see PseudostateFacade#isShallowHistory()
1028     */
1029    public boolean isShallowHistory()
1030    {
1031        return this.getSuperPseudostateFacade().isShallowHistory();
1032    }
1033
1034    /**
1035     * Denotes this pseudostate to be either a join or a fork with a single incoming transition and
1036     * more than one outgoing transition.
1037     * @see PseudostateFacade#isSplit()
1038     */
1039    public boolean isSplit()
1040    {
1041        return this.getSuperPseudostateFacade().isSplit();
1042    }
1043
1044    /**
1045     * @see MetafacadeBase#initialize()
1046     */
1047    @Override
1048    public void initialize()
1049    {
1050        this.getSuperJBpmStateVertex().initialize();
1051        this.getSuperPseudostateFacade().initialize();
1052    }
1053
1054    /**
1055     * @return Object getSuperJBpmStateVertex().getValidationOwner()
1056     * @see MetafacadeBase#getValidationOwner()
1057     */
1058    @Override
1059    public Object getValidationOwner()
1060    {
1061        Object owner = this.getSuperJBpmStateVertex().getValidationOwner();
1062        if (owner == null)
1063        {
1064            owner = this.getSuperPseudostateFacade().getValidationOwner();
1065        }
1066        return owner;
1067    }
1068
1069    /**
1070     * @return String getSuperJBpmStateVertex().getValidationName()
1071     * @see MetafacadeBase#getValidationName()
1072     */
1073    @Override
1074    public String getValidationName()
1075    {
1076        String name = this.getSuperJBpmStateVertex().getValidationName();
1077        if (name == null)
1078        {
1079            name = this.getSuperPseudostateFacade().getValidationName();
1080        }
1081        return name;
1082    }
1083
1084    /**
1085     * <p><b>Constraint:</b> org::andromda::cartridges::jbpm::metafacades::JBpmPseudostate::fork needs a name</p>
1086     * <p><b>Error:</b> When you model a fork you must give it a (non-empty) name.</p>
1087     * <p><b>OCL:</b> context JBpmPseudostate inv: split implies name->notEmpty()</p>
1088     * <p><b>Constraint:</b> org::andromda::cartridges::jbpm::metafacades::JBpmPseudostate::decision needs a name</p>
1089     * <p><b>Error:</b> When you model a decision point you must give it a (non-empty) name.</p>
1090     * <p><b>OCL:</b> context JBpmPseudostate inv: decisionPoint implies name->notEmpty()</p>
1091     * <p><b>Constraint:</b> org::andromda::cartridges::jbpm::metafacades::JBpmPseudostate::join needs a name</p>
1092     * <p><b>Error:</b> When you model a join you must give it a (non-empty) name.</p>
1093     * <p><b>OCL:</b> context JBpmPseudostate inv: collect implies name->notEmpty()</p>
1094     * <p><b>Constraint:</b> org::andromda::cartridges::jbpm::metafacades::JBpmPseudostate::outgoing transitions need guards when exiting a pseudostate</p>
1095     * <p><b>Error:</b> Transitions exiting a decision point each need a guard.</p>
1096     * <p><b>OCL:</b> context JBpmPseudostate inv: decisionPoint implies outgoings->forAll(guard->notEmpty())</p>
1097     * <p><b>Constraint:</b> org::andromda::cartridges::jbpm::metafacades::JBpmPseudostate::split needs names on all outgoing transitions</p>
1098     * <p><b>Error:</b> All fork-nodes require their outgoing transitions to have a non-empty name, otherwise jBpm will not be able to distinguish between them when creating child tokens.</p>
1099     * <p><b>OCL:</b> context JBpmPseudostate inv: split implies outgoings->forAll(name|name->notEmpty())</p>
1100     * @param validationMessages Collection<ModelValidationMessage>
1101     * @see MetafacadeBase#validateInvariants(Collection validationMessages)
1102     */
1103    @Override
1104    public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
1105    {
1106        this.getSuperJBpmStateVertex().validateInvariants(validationMessages);
1107        this.getSuperPseudostateFacade().validateInvariants(validationMessages);
1108        try
1109        {
1110            final Object contextElement = this.THIS();
1111            boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"split"))).booleanValue()?OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"name")):true));
1112            if (!constraintValid)
1113            {
1114                validationMessages.add(
1115                    new ModelValidationMessage(
1116                        (MetafacadeBase)contextElement ,
1117                        "org::andromda::cartridges::jbpm::metafacades::JBpmPseudostate::fork needs a name",
1118                        "When you model a fork you must give it a (non-empty) name."));
1119            }
1120        }
1121        catch (Throwable th)
1122        {
1123            Throwable cause = th.getCause();
1124            int depth = 0; // Some throwables have infinite recursion
1125            while (cause != null && depth < 7)
1126            {
1127                th = cause;
1128                depth++;
1129            }
1130            logger.error("Error validating constraint 'org::andromda::cartridges::jbpm::metafacades::JBpmPseudostate::fork needs a name' ON "
1131                + this.THIS().toString() + ": " + th.getMessage(), th);
1132        }
1133        try
1134        {
1135            final Object contextElement = this.THIS();
1136            boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"decisionPoint"))).booleanValue()?OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"name")):true));
1137            if (!constraintValid)
1138            {
1139                validationMessages.add(
1140                    new ModelValidationMessage(
1141                        (MetafacadeBase)contextElement ,
1142                        "org::andromda::cartridges::jbpm::metafacades::JBpmPseudostate::decision needs a name",
1143                        "When you model a decision point you must give it a (non-empty) name."));
1144            }
1145        }
1146        catch (Throwable th)
1147        {
1148            Throwable cause = th.getCause();
1149            int depth = 0; // Some throwables have infinite recursion
1150            while (cause != null && depth < 7)
1151            {
1152                th = cause;
1153                depth++;
1154            }
1155            logger.error("Error validating constraint 'org::andromda::cartridges::jbpm::metafacades::JBpmPseudostate::decision needs a name' ON "
1156                + this.THIS().toString() + ": " + th.getMessage(), th);
1157        }
1158        try
1159        {
1160            final Object contextElement = this.THIS();
1161            boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"collect"))).booleanValue()?OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"name")):true));
1162            if (!constraintValid)
1163            {
1164                validationMessages.add(
1165                    new ModelValidationMessage(
1166                        (MetafacadeBase)contextElement ,
1167                        "org::andromda::cartridges::jbpm::metafacades::JBpmPseudostate::join needs a name",
1168                        "When you model a join you must give it a (non-empty) name."));
1169            }
1170        }
1171        catch (Throwable th)
1172        {
1173            Throwable cause = th.getCause();
1174            int depth = 0; // Some throwables have infinite recursion
1175            while (cause != null && depth < 7)
1176            {
1177                th = cause;
1178                depth++;
1179            }
1180            logger.error("Error validating constraint 'org::andromda::cartridges::jbpm::metafacades::JBpmPseudostate::join needs a name' ON "
1181                + this.THIS().toString() + ": " + th.getMessage(), th);
1182        }
1183        try
1184        {
1185            final Object contextElement = this.THIS();
1186            boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"decisionPoint"))).booleanValue()?OCLCollections.forAll(OCLIntrospector.invoke(contextElement,"outgoings"),new Predicate(){public boolean evaluate(Object object){return Boolean.valueOf(String.valueOf(OCLCollections.notEmpty(OCLIntrospector.invoke(object,"guard")))).booleanValue();}}):true));
1187            if (!constraintValid)
1188            {
1189                validationMessages.add(
1190                    new ModelValidationMessage(
1191                        (MetafacadeBase)contextElement ,
1192                        "org::andromda::cartridges::jbpm::metafacades::JBpmPseudostate::outgoing transitions need guards when exiting a pseudostate",
1193                        "Transitions exiting a decision point each need a guard."));
1194            }
1195        }
1196        catch (Throwable th)
1197        {
1198            Throwable cause = th.getCause();
1199            int depth = 0; // Some throwables have infinite recursion
1200            while (cause != null && depth < 7)
1201            {
1202                th = cause;
1203                depth++;
1204            }
1205            logger.error("Error validating constraint 'org::andromda::cartridges::jbpm::metafacades::JBpmPseudostate::outgoing transitions need guards when exiting a pseudostate' ON "
1206                + this.THIS().toString() + ": " + th.getMessage(), th);
1207        }
1208        try
1209        {
1210            final Object contextElement = this.THIS();
1211            boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"split"))).booleanValue()?OCLCollections.forAll(OCLIntrospector.invoke(contextElement,"outgoings"),new Predicate(){public boolean evaluate(Object object){return Boolean.valueOf(String.valueOf(OCLCollections.notEmpty(OCLIntrospector.invoke(object,"name")))).booleanValue();}}):true));
1212            if (!constraintValid)
1213            {
1214                validationMessages.add(
1215                    new ModelValidationMessage(
1216                        (MetafacadeBase)contextElement ,
1217                        "org::andromda::cartridges::jbpm::metafacades::JBpmPseudostate::split needs names on all outgoing transitions",
1218                        "All fork-nodes require their outgoing transitions to have a non-empty name, otherwise jBpm will not be able to distinguish between them when creating child tokens."));
1219            }
1220        }
1221        catch (Throwable th)
1222        {
1223            Throwable cause = th.getCause();
1224            int depth = 0; // Some throwables have infinite recursion
1225            while (cause != null && depth < 7)
1226            {
1227                th = cause;
1228                depth++;
1229            }
1230            logger.error("Error validating constraint 'org::andromda::cartridges::jbpm::metafacades::JBpmPseudostate::split needs names on all outgoing transitions' ON "
1231                + this.THIS().toString() + ": " + th.getMessage(), th);
1232        }
1233    }
1234
1235    /**
1236     * The property that stores the name of the metafacade.
1237     */
1238    private static final String NAME_PROPERTY = "name";
1239    private static final String FQNAME_PROPERTY = "fullyQualifiedName";
1240
1241    /**
1242     * @see Object#toString()
1243     */
1244    @Override
1245    public String toString()
1246    {
1247        final StringBuilder toString = new StringBuilder(this.getClass().getName());
1248        toString.append("[");
1249        try
1250        {
1251            toString.append(Introspector.instance().getProperty(this, FQNAME_PROPERTY));
1252        }
1253        catch (final Throwable tryAgain)
1254        {
1255            try
1256            {
1257                toString.append(Introspector.instance().getProperty(this, NAME_PROPERTY));
1258            }
1259            catch (final Throwable ignore)
1260            {
1261                // - just ignore when the metafacade doesn't have a name or fullyQualifiedName property
1262            }
1263        }
1264        toString.append("]");
1265        return toString.toString();
1266    }
1267}