001// license-header java merge-point
002//
003// Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
004//
005package org.andromda.metafacades.uml14;
006
007import java.util.Collection;
008import org.andromda.core.metafacade.MetafacadeBase;
009import org.andromda.core.metafacade.ModelValidationMessage;
010import org.andromda.metafacades.uml.ActionFacade;
011import org.andromda.metafacades.uml.EventFacade;
012import org.andromda.metafacades.uml.GuardFacade;
013import org.andromda.metafacades.uml.StateVertexFacade;
014import org.andromda.metafacades.uml.TransitionFacade;
015import org.apache.log4j.Logger;
016import org.omg.uml.behavioralelements.statemachines.Transition;
017
018/**
019 * A directed relationship between a source vertex and a target vertex. It may be part of a compound
020 * transition, which takes the state machine from one state configuration to another, representing
021 * the complete response of the state machine to an occurrence of an event of a particular type.
022 * MetafacadeLogic for TransitionFacade
023 *
024 * @see TransitionFacade
025 */
026public abstract class TransitionFacadeLogic
027    extends ModelElementFacadeLogicImpl
028    implements TransitionFacade
029{
030    /**
031     * The underlying UML object
032     * @see Transition
033     */
034    protected Transition metaObject;
035
036    /** Create Metafacade implementation instance using the MetafacadeFactory from the context
037     * @param metaObjectIn
038     * @param context
039     */
040    protected TransitionFacadeLogic(Transition metaObjectIn, String context)
041    {
042        super(metaObjectIn, getContext(context));
043        this.metaObject = metaObjectIn;
044    }
045
046    /**
047     * The logger instance.
048     */
049    private static final Logger logger = Logger.getLogger(TransitionFacadeLogic.class);
050
051    /**
052     * Gets the context for this metafacade logic instance.
053     * @param context String. Set to TransitionFacade if null
054     * @return context String
055     */
056    private static String getContext(String context)
057    {
058        if (context == null)
059        {
060            context = "org.andromda.metafacades.uml.TransitionFacade";
061        }
062        return context;
063    }
064
065    /** Reset context only for non-root metafacades
066     * @param context
067     */
068    @Override
069    public void resetMetafacadeContext(String context)
070    {
071        if (!this.contextRoot) // reset context only for non-root metafacades
072        {
073            context = getContext(context);  // to have same value as in original constructor call
074            setMetafacadeContext (context);
075        }
076    }
077
078    /**
079     * @return boolean true always
080     * @see TransitionFacade
081     */
082    public boolean isTransitionFacadeMetaType()
083    {
084        return true;
085    }
086
087    // --------------- attributes ---------------------
088
089   /**
090    * @see TransitionFacade#isTriggerPresent()
091    * @return boolean
092    */
093    protected abstract boolean handleIsTriggerPresent();
094
095    private boolean __triggerPresent1a;
096    private boolean __triggerPresent1aSet = false;
097
098    /**
099     * TODO: Model Documentation for TransitionFacade.triggerPresent
100     * @return (boolean)handleIsTriggerPresent()
101     */
102    public final boolean isTriggerPresent()
103    {
104        boolean triggerPresent1a = this.__triggerPresent1a;
105        if (!this.__triggerPresent1aSet)
106        {
107            // triggerPresent has no pre constraints
108            triggerPresent1a = handleIsTriggerPresent();
109            // triggerPresent has no post constraints
110            this.__triggerPresent1a = triggerPresent1a;
111            if (isMetafacadePropertyCachingEnabled())
112            {
113                this.__triggerPresent1aSet = true;
114            }
115        }
116        return triggerPresent1a;
117    }
118
119   /**
120    * @see TransitionFacade#isExitingDecisionPoint()
121    * @return boolean
122    */
123    protected abstract boolean handleIsExitingDecisionPoint();
124
125    private boolean __exitingDecisionPoint2a;
126    private boolean __exitingDecisionPoint2aSet = false;
127
128    /**
129     * TODO: Model Documentation for
130     * TransitionFacade.exitingDecisionPoint
131     * @return (boolean)handleIsExitingDecisionPoint()
132     */
133    public final boolean isExitingDecisionPoint()
134    {
135        boolean exitingDecisionPoint2a = this.__exitingDecisionPoint2a;
136        if (!this.__exitingDecisionPoint2aSet)
137        {
138            // exitingDecisionPoint has no pre constraints
139            exitingDecisionPoint2a = handleIsExitingDecisionPoint();
140            // exitingDecisionPoint has no post constraints
141            this.__exitingDecisionPoint2a = exitingDecisionPoint2a;
142            if (isMetafacadePropertyCachingEnabled())
143            {
144                this.__exitingDecisionPoint2aSet = true;
145            }
146        }
147        return exitingDecisionPoint2a;
148    }
149
150   /**
151    * @see TransitionFacade#isEnteringDecisionPoint()
152    * @return boolean
153    */
154    protected abstract boolean handleIsEnteringDecisionPoint();
155
156    private boolean __enteringDecisionPoint3a;
157    private boolean __enteringDecisionPoint3aSet = false;
158
159    /**
160     * TODO: Model Documentation for
161     * TransitionFacade.enteringDecisionPoint
162     * @return (boolean)handleIsEnteringDecisionPoint()
163     */
164    public final boolean isEnteringDecisionPoint()
165    {
166        boolean enteringDecisionPoint3a = this.__enteringDecisionPoint3a;
167        if (!this.__enteringDecisionPoint3aSet)
168        {
169            // enteringDecisionPoint has no pre constraints
170            enteringDecisionPoint3a = handleIsEnteringDecisionPoint();
171            // enteringDecisionPoint has no post constraints
172            this.__enteringDecisionPoint3a = enteringDecisionPoint3a;
173            if (isMetafacadePropertyCachingEnabled())
174            {
175                this.__enteringDecisionPoint3aSet = true;
176            }
177        }
178        return enteringDecisionPoint3a;
179    }
180
181   /**
182    * @see TransitionFacade#isExitingActionState()
183    * @return boolean
184    */
185    protected abstract boolean handleIsExitingActionState();
186
187    private boolean __exitingActionState4a;
188    private boolean __exitingActionState4aSet = false;
189
190    /**
191     * TODO: Model Documentation for
192     * TransitionFacade.exitingActionState
193     * @return (boolean)handleIsExitingActionState()
194     */
195    public final boolean isExitingActionState()
196    {
197        boolean exitingActionState4a = this.__exitingActionState4a;
198        if (!this.__exitingActionState4aSet)
199        {
200            // exitingActionState has no pre constraints
201            exitingActionState4a = handleIsExitingActionState();
202            // exitingActionState has no post constraints
203            this.__exitingActionState4a = exitingActionState4a;
204            if (isMetafacadePropertyCachingEnabled())
205            {
206                this.__exitingActionState4aSet = true;
207            }
208        }
209        return exitingActionState4a;
210    }
211
212   /**
213    * @see TransitionFacade#isEnteringActionState()
214    * @return boolean
215    */
216    protected abstract boolean handleIsEnteringActionState();
217
218    private boolean __enteringActionState5a;
219    private boolean __enteringActionState5aSet = false;
220
221    /**
222     * TODO: Model Documentation for
223     * TransitionFacade.enteringActionState
224     * @return (boolean)handleIsEnteringActionState()
225     */
226    public final boolean isEnteringActionState()
227    {
228        boolean enteringActionState5a = this.__enteringActionState5a;
229        if (!this.__enteringActionState5aSet)
230        {
231            // enteringActionState has no pre constraints
232            enteringActionState5a = handleIsEnteringActionState();
233            // enteringActionState has no post constraints
234            this.__enteringActionState5a = enteringActionState5a;
235            if (isMetafacadePropertyCachingEnabled())
236            {
237                this.__enteringActionState5aSet = true;
238            }
239        }
240        return enteringActionState5a;
241    }
242
243   /**
244    * @see TransitionFacade#isExitingInitialState()
245    * @return boolean
246    */
247    protected abstract boolean handleIsExitingInitialState();
248
249    private boolean __exitingInitialState6a;
250    private boolean __exitingInitialState6aSet = false;
251
252    /**
253     * TODO: Model Documentation for
254     * TransitionFacade.exitingInitialState
255     * @return (boolean)handleIsExitingInitialState()
256     */
257    public final boolean isExitingInitialState()
258    {
259        boolean exitingInitialState6a = this.__exitingInitialState6a;
260        if (!this.__exitingInitialState6aSet)
261        {
262            // exitingInitialState has no pre constraints
263            exitingInitialState6a = handleIsExitingInitialState();
264            // exitingInitialState has no post constraints
265            this.__exitingInitialState6a = exitingInitialState6a;
266            if (isMetafacadePropertyCachingEnabled())
267            {
268                this.__exitingInitialState6aSet = true;
269            }
270        }
271        return exitingInitialState6a;
272    }
273
274   /**
275    * @see TransitionFacade#isEnteringFinalState()
276    * @return boolean
277    */
278    protected abstract boolean handleIsEnteringFinalState();
279
280    private boolean __enteringFinalState7a;
281    private boolean __enteringFinalState7aSet = false;
282
283    /**
284     * TODO: Model Documentation for
285     * TransitionFacade.enteringFinalState
286     * @return (boolean)handleIsEnteringFinalState()
287     */
288    public final boolean isEnteringFinalState()
289    {
290        boolean enteringFinalState7a = this.__enteringFinalState7a;
291        if (!this.__enteringFinalState7aSet)
292        {
293            // enteringFinalState has no pre constraints
294            enteringFinalState7a = handleIsEnteringFinalState();
295            // enteringFinalState has no post constraints
296            this.__enteringFinalState7a = enteringFinalState7a;
297            if (isMetafacadePropertyCachingEnabled())
298            {
299                this.__enteringFinalState7aSet = true;
300            }
301        }
302        return enteringFinalState7a;
303    }
304
305    // ------------- associations ------------------
306
307    /**
308     * A directed relationship between a source vertex and a target vertex. It may be part of a
309     * compound
310     * transition, which takes the state machine from one state configuration to another,
311     * representing the
312     * complete response of the state machine to an occurrence of an event of a particular type.
313     * @return (GuardFacade)handleGetGuard()
314     */
315    public final GuardFacade getGuard()
316    {
317        GuardFacade getGuard1r = null;
318        // transition has no pre constraints
319        Object result = handleGetGuard();
320        MetafacadeBase shieldedResult = this.shieldedElement(result);
321        try
322        {
323            getGuard1r = (GuardFacade)shieldedResult;
324        }
325        catch (ClassCastException ex)
326        {
327            // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
328            TransitionFacadeLogic.logger.warn("incorrect metafacade cast for TransitionFacadeLogic.getGuard GuardFacade " + result + ": " + shieldedResult);
329        }
330        // transition has no post constraints
331        return getGuard1r;
332    }
333
334    /**
335     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
336     * @return Object
337     */
338    protected abstract Object handleGetGuard();
339
340    /**
341     * If this event is located on a transition, this represents that transition.
342     * @return (EventFacade)handleGetTrigger()
343     */
344    public final EventFacade getTrigger()
345    {
346        EventFacade getTrigger2r = null;
347        // transition has no pre constraints
348        Object result = handleGetTrigger();
349        MetafacadeBase shieldedResult = this.shieldedElement(result);
350        try
351        {
352            getTrigger2r = (EventFacade)shieldedResult;
353        }
354        catch (ClassCastException ex)
355        {
356            // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
357            TransitionFacadeLogic.logger.warn("incorrect metafacade cast for TransitionFacadeLogic.getTrigger EventFacade " + result + ": " + shieldedResult);
358        }
359        // transition has no post constraints
360        return getTrigger2r;
361    }
362
363    /**
364     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
365     * @return Object
366     */
367    protected abstract Object handleGetTrigger();
368
369    /**
370     * A directed relationship between a source vertex and a target vertex. It may be part of a
371     * compound
372     * transition, which takes the state machine from one state configuration to another,
373     * representing the
374     * complete response of the state machine to an occurrence of an event of a particular type.
375     * @return (StateVertexFacade)handleGetSource()
376     */
377    public final StateVertexFacade getSource()
378    {
379        StateVertexFacade getSource3r = null;
380        // incomings has no pre constraints
381        Object result = handleGetSource();
382        MetafacadeBase shieldedResult = this.shieldedElement(result);
383        try
384        {
385            getSource3r = (StateVertexFacade)shieldedResult;
386        }
387        catch (ClassCastException ex)
388        {
389            // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
390            TransitionFacadeLogic.logger.warn("incorrect metafacade cast for TransitionFacadeLogic.getSource StateVertexFacade " + result + ": " + shieldedResult);
391        }
392        // incomings has no post constraints
393        return getSource3r;
394    }
395
396    /**
397     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
398     * @return Object
399     */
400    protected abstract Object handleGetSource();
401
402    /**
403     * A directed relationship between a source vertex and a target vertex. It may be part of a
404     * compound
405     * transition, which takes the state machine from one state configuration to another,
406     * representing the
407     * complete response of the state machine to an occurrence of an event of a particular type.
408     * @return (StateVertexFacade)handleGetTarget()
409     */
410    public final StateVertexFacade getTarget()
411    {
412        StateVertexFacade getTarget4r = null;
413        // outgoings has no pre constraints
414        Object result = handleGetTarget();
415        MetafacadeBase shieldedResult = this.shieldedElement(result);
416        try
417        {
418            getTarget4r = (StateVertexFacade)shieldedResult;
419        }
420        catch (ClassCastException ex)
421        {
422            // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
423            TransitionFacadeLogic.logger.warn("incorrect metafacade cast for TransitionFacadeLogic.getTarget StateVertexFacade " + result + ": " + shieldedResult);
424        }
425        // outgoings has no post constraints
426        return getTarget4r;
427    }
428
429    /**
430     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
431     * @return Object
432     */
433    protected abstract Object handleGetTarget();
434
435    /**
436     * If this action is located on a transition, this represents that transition.
437     * @return (ActionFacade)handleGetEffect()
438     */
439    public final ActionFacade getEffect()
440    {
441        ActionFacade getEffect5r = null;
442        // transition has no pre constraints
443        Object result = handleGetEffect();
444        MetafacadeBase shieldedResult = this.shieldedElement(result);
445        try
446        {
447            getEffect5r = (ActionFacade)shieldedResult;
448        }
449        catch (ClassCastException ex)
450        {
451            // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
452            TransitionFacadeLogic.logger.warn("incorrect metafacade cast for TransitionFacadeLogic.getEffect ActionFacade " + result + ": " + shieldedResult);
453        }
454        // transition has no post constraints
455        return getEffect5r;
456    }
457
458    /**
459     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
460     * @return Object
461     */
462    protected abstract Object handleGetEffect();
463
464    /**
465     * @param validationMessages Collection<ModelValidationMessage>
466     * @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages)
467     */
468    @Override
469    public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
470    {
471        super.validateInvariants(validationMessages);
472    }
473}