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