TransitionFacadeLogic.java

  1. // license-header java merge-point
  2. //
  3. // Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
  4. //
  5. package org.andromda.metafacades.uml14;

  6. import java.util.Collection;
  7. import org.andromda.core.metafacade.MetafacadeBase;
  8. import org.andromda.core.metafacade.ModelValidationMessage;
  9. import org.andromda.metafacades.uml.ActionFacade;
  10. import org.andromda.metafacades.uml.EventFacade;
  11. import org.andromda.metafacades.uml.GuardFacade;
  12. import org.andromda.metafacades.uml.StateVertexFacade;
  13. import org.andromda.metafacades.uml.TransitionFacade;
  14. import org.apache.log4j.Logger;
  15. import org.omg.uml.behavioralelements.statemachines.Transition;

  16. /**
  17.  * A directed relationship between a source vertex and a target vertex. It may be part of a compound
  18.  * transition, which takes the state machine from one state configuration to another, representing
  19.  * the complete response of the state machine to an occurrence of an event of a particular type.
  20.  * MetafacadeLogic for TransitionFacade
  21.  *
  22.  * @see TransitionFacade
  23.  */
  24. public abstract class TransitionFacadeLogic
  25.     extends ModelElementFacadeLogicImpl
  26.     implements TransitionFacade
  27. {
  28.     /**
  29.      * The underlying UML object
  30.      * @see Transition
  31.      */
  32.     protected Transition metaObject;

  33.     /** Create Metafacade implementation instance using the MetafacadeFactory from the context
  34.      * @param metaObjectIn
  35.      * @param context
  36.      */
  37.     protected TransitionFacadeLogic(Transition metaObjectIn, String context)
  38.     {
  39.         super(metaObjectIn, getContext(context));
  40.         this.metaObject = metaObjectIn;
  41.     }

  42.     /**
  43.      * The logger instance.
  44.      */
  45.     private static final Logger logger = Logger.getLogger(TransitionFacadeLogic.class);

  46.     /**
  47.      * Gets the context for this metafacade logic instance.
  48.      * @param context String. Set to TransitionFacade if null
  49.      * @return context String
  50.      */
  51.     private static String getContext(String context)
  52.     {
  53.         if (context == null)
  54.         {
  55.             context = "org.andromda.metafacades.uml.TransitionFacade";
  56.         }
  57.         return context;
  58.     }

  59.     /** Reset context only for non-root metafacades
  60.      * @param context
  61.      */
  62.     @Override
  63.     public void resetMetafacadeContext(String context)
  64.     {
  65.         if (!this.contextRoot) // reset context only for non-root metafacades
  66.         {
  67.             context = getContext(context);  // to have same value as in original constructor call
  68.             setMetafacadeContext (context);
  69.         }
  70.     }

  71.     /**
  72.      * @return boolean true always
  73.      * @see TransitionFacade
  74.      */
  75.     public boolean isTransitionFacadeMetaType()
  76.     {
  77.         return true;
  78.     }

  79.     // --------------- attributes ---------------------

  80.    /**
  81.     * @see TransitionFacade#isTriggerPresent()
  82.     * @return boolean
  83.     */
  84.     protected abstract boolean handleIsTriggerPresent();

  85.     private boolean __triggerPresent1a;
  86.     private boolean __triggerPresent1aSet = false;

  87.     /**
  88.      * TODO: Model Documentation for TransitionFacade.triggerPresent
  89.      * @return (boolean)handleIsTriggerPresent()
  90.      */
  91.     public final boolean isTriggerPresent()
  92.     {
  93.         boolean triggerPresent1a = this.__triggerPresent1a;
  94.         if (!this.__triggerPresent1aSet)
  95.         {
  96.             // triggerPresent has no pre constraints
  97.             triggerPresent1a = handleIsTriggerPresent();
  98.             // triggerPresent has no post constraints
  99.             this.__triggerPresent1a = triggerPresent1a;
  100.             if (isMetafacadePropertyCachingEnabled())
  101.             {
  102.                 this.__triggerPresent1aSet = true;
  103.             }
  104.         }
  105.         return triggerPresent1a;
  106.     }

  107.    /**
  108.     * @see TransitionFacade#isExitingDecisionPoint()
  109.     * @return boolean
  110.     */
  111.     protected abstract boolean handleIsExitingDecisionPoint();

  112.     private boolean __exitingDecisionPoint2a;
  113.     private boolean __exitingDecisionPoint2aSet = false;

  114.     /**
  115.      * TODO: Model Documentation for
  116.      * TransitionFacade.exitingDecisionPoint
  117.      * @return (boolean)handleIsExitingDecisionPoint()
  118.      */
  119.     public final boolean isExitingDecisionPoint()
  120.     {
  121.         boolean exitingDecisionPoint2a = this.__exitingDecisionPoint2a;
  122.         if (!this.__exitingDecisionPoint2aSet)
  123.         {
  124.             // exitingDecisionPoint has no pre constraints
  125.             exitingDecisionPoint2a = handleIsExitingDecisionPoint();
  126.             // exitingDecisionPoint has no post constraints
  127.             this.__exitingDecisionPoint2a = exitingDecisionPoint2a;
  128.             if (isMetafacadePropertyCachingEnabled())
  129.             {
  130.                 this.__exitingDecisionPoint2aSet = true;
  131.             }
  132.         }
  133.         return exitingDecisionPoint2a;
  134.     }

  135.    /**
  136.     * @see TransitionFacade#isEnteringDecisionPoint()
  137.     * @return boolean
  138.     */
  139.     protected abstract boolean handleIsEnteringDecisionPoint();

  140.     private boolean __enteringDecisionPoint3a;
  141.     private boolean __enteringDecisionPoint3aSet = false;

  142.     /**
  143.      * TODO: Model Documentation for
  144.      * TransitionFacade.enteringDecisionPoint
  145.      * @return (boolean)handleIsEnteringDecisionPoint()
  146.      */
  147.     public final boolean isEnteringDecisionPoint()
  148.     {
  149.         boolean enteringDecisionPoint3a = this.__enteringDecisionPoint3a;
  150.         if (!this.__enteringDecisionPoint3aSet)
  151.         {
  152.             // enteringDecisionPoint has no pre constraints
  153.             enteringDecisionPoint3a = handleIsEnteringDecisionPoint();
  154.             // enteringDecisionPoint has no post constraints
  155.             this.__enteringDecisionPoint3a = enteringDecisionPoint3a;
  156.             if (isMetafacadePropertyCachingEnabled())
  157.             {
  158.                 this.__enteringDecisionPoint3aSet = true;
  159.             }
  160.         }
  161.         return enteringDecisionPoint3a;
  162.     }

  163.    /**
  164.     * @see TransitionFacade#isExitingActionState()
  165.     * @return boolean
  166.     */
  167.     protected abstract boolean handleIsExitingActionState();

  168.     private boolean __exitingActionState4a;
  169.     private boolean __exitingActionState4aSet = false;

  170.     /**
  171.      * TODO: Model Documentation for
  172.      * TransitionFacade.exitingActionState
  173.      * @return (boolean)handleIsExitingActionState()
  174.      */
  175.     public final boolean isExitingActionState()
  176.     {
  177.         boolean exitingActionState4a = this.__exitingActionState4a;
  178.         if (!this.__exitingActionState4aSet)
  179.         {
  180.             // exitingActionState has no pre constraints
  181.             exitingActionState4a = handleIsExitingActionState();
  182.             // exitingActionState has no post constraints
  183.             this.__exitingActionState4a = exitingActionState4a;
  184.             if (isMetafacadePropertyCachingEnabled())
  185.             {
  186.                 this.__exitingActionState4aSet = true;
  187.             }
  188.         }
  189.         return exitingActionState4a;
  190.     }

  191.    /**
  192.     * @see TransitionFacade#isEnteringActionState()
  193.     * @return boolean
  194.     */
  195.     protected abstract boolean handleIsEnteringActionState();

  196.     private boolean __enteringActionState5a;
  197.     private boolean __enteringActionState5aSet = false;

  198.     /**
  199.      * TODO: Model Documentation for
  200.      * TransitionFacade.enteringActionState
  201.      * @return (boolean)handleIsEnteringActionState()
  202.      */
  203.     public final boolean isEnteringActionState()
  204.     {
  205.         boolean enteringActionState5a = this.__enteringActionState5a;
  206.         if (!this.__enteringActionState5aSet)
  207.         {
  208.             // enteringActionState has no pre constraints
  209.             enteringActionState5a = handleIsEnteringActionState();
  210.             // enteringActionState has no post constraints
  211.             this.__enteringActionState5a = enteringActionState5a;
  212.             if (isMetafacadePropertyCachingEnabled())
  213.             {
  214.                 this.__enteringActionState5aSet = true;
  215.             }
  216.         }
  217.         return enteringActionState5a;
  218.     }

  219.    /**
  220.     * @see TransitionFacade#isExitingInitialState()
  221.     * @return boolean
  222.     */
  223.     protected abstract boolean handleIsExitingInitialState();

  224.     private boolean __exitingInitialState6a;
  225.     private boolean __exitingInitialState6aSet = false;

  226.     /**
  227.      * TODO: Model Documentation for
  228.      * TransitionFacade.exitingInitialState
  229.      * @return (boolean)handleIsExitingInitialState()
  230.      */
  231.     public final boolean isExitingInitialState()
  232.     {
  233.         boolean exitingInitialState6a = this.__exitingInitialState6a;
  234.         if (!this.__exitingInitialState6aSet)
  235.         {
  236.             // exitingInitialState has no pre constraints
  237.             exitingInitialState6a = handleIsExitingInitialState();
  238.             // exitingInitialState has no post constraints
  239.             this.__exitingInitialState6a = exitingInitialState6a;
  240.             if (isMetafacadePropertyCachingEnabled())
  241.             {
  242.                 this.__exitingInitialState6aSet = true;
  243.             }
  244.         }
  245.         return exitingInitialState6a;
  246.     }

  247.    /**
  248.     * @see TransitionFacade#isEnteringFinalState()
  249.     * @return boolean
  250.     */
  251.     protected abstract boolean handleIsEnteringFinalState();

  252.     private boolean __enteringFinalState7a;
  253.     private boolean __enteringFinalState7aSet = false;

  254.     /**
  255.      * TODO: Model Documentation for
  256.      * TransitionFacade.enteringFinalState
  257.      * @return (boolean)handleIsEnteringFinalState()
  258.      */
  259.     public final boolean isEnteringFinalState()
  260.     {
  261.         boolean enteringFinalState7a = this.__enteringFinalState7a;
  262.         if (!this.__enteringFinalState7aSet)
  263.         {
  264.             // enteringFinalState has no pre constraints
  265.             enteringFinalState7a = handleIsEnteringFinalState();
  266.             // enteringFinalState has no post constraints
  267.             this.__enteringFinalState7a = enteringFinalState7a;
  268.             if (isMetafacadePropertyCachingEnabled())
  269.             {
  270.                 this.__enteringFinalState7aSet = true;
  271.             }
  272.         }
  273.         return enteringFinalState7a;
  274.     }

  275.     // ------------- associations ------------------

  276.     /**
  277.      * A directed relationship between a source vertex and a target vertex. It may be part of a
  278.      * compound
  279.      * transition, which takes the state machine from one state configuration to another,
  280.      * representing the
  281.      * complete response of the state machine to an occurrence of an event of a particular type.
  282.      * @return (GuardFacade)handleGetGuard()
  283.      */
  284.     public final GuardFacade getGuard()
  285.     {
  286.         GuardFacade getGuard1r = null;
  287.         // transition has no pre constraints
  288.         Object result = handleGetGuard();
  289.         MetafacadeBase shieldedResult = this.shieldedElement(result);
  290.         try
  291.         {
  292.             getGuard1r = (GuardFacade)shieldedResult;
  293.         }
  294.         catch (ClassCastException ex)
  295.         {
  296.             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
  297.             TransitionFacadeLogic.logger.warn("incorrect metafacade cast for TransitionFacadeLogic.getGuard GuardFacade " + result + ": " + shieldedResult);
  298.         }
  299.         // transition has no post constraints
  300.         return getGuard1r;
  301.     }

  302.     /**
  303.      * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
  304.      * @return Object
  305.      */
  306.     protected abstract Object handleGetGuard();

  307.     /**
  308.      * If this event is located on a transition, this represents that transition.
  309.      * @return (EventFacade)handleGetTrigger()
  310.      */
  311.     public final EventFacade getTrigger()
  312.     {
  313.         EventFacade getTrigger2r = null;
  314.         // transition has no pre constraints
  315.         Object result = handleGetTrigger();
  316.         MetafacadeBase shieldedResult = this.shieldedElement(result);
  317.         try
  318.         {
  319.             getTrigger2r = (EventFacade)shieldedResult;
  320.         }
  321.         catch (ClassCastException ex)
  322.         {
  323.             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
  324.             TransitionFacadeLogic.logger.warn("incorrect metafacade cast for TransitionFacadeLogic.getTrigger EventFacade " + result + ": " + shieldedResult);
  325.         }
  326.         // transition has no post constraints
  327.         return getTrigger2r;
  328.     }

  329.     /**
  330.      * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
  331.      * @return Object
  332.      */
  333.     protected abstract Object handleGetTrigger();

  334.     /**
  335.      * A directed relationship between a source vertex and a target vertex. It may be part of a
  336.      * compound
  337.      * transition, which takes the state machine from one state configuration to another,
  338.      * representing the
  339.      * complete response of the state machine to an occurrence of an event of a particular type.
  340.      * @return (StateVertexFacade)handleGetSource()
  341.      */
  342.     public final StateVertexFacade getSource()
  343.     {
  344.         StateVertexFacade getSource3r = null;
  345.         // incomings has no pre constraints
  346.         Object result = handleGetSource();
  347.         MetafacadeBase shieldedResult = this.shieldedElement(result);
  348.         try
  349.         {
  350.             getSource3r = (StateVertexFacade)shieldedResult;
  351.         }
  352.         catch (ClassCastException ex)
  353.         {
  354.             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
  355.             TransitionFacadeLogic.logger.warn("incorrect metafacade cast for TransitionFacadeLogic.getSource StateVertexFacade " + result + ": " + shieldedResult);
  356.         }
  357.         // incomings has no post constraints
  358.         return getSource3r;
  359.     }

  360.     /**
  361.      * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
  362.      * @return Object
  363.      */
  364.     protected abstract Object handleGetSource();

  365.     /**
  366.      * A directed relationship between a source vertex and a target vertex. It may be part of a
  367.      * compound
  368.      * transition, which takes the state machine from one state configuration to another,
  369.      * representing the
  370.      * complete response of the state machine to an occurrence of an event of a particular type.
  371.      * @return (StateVertexFacade)handleGetTarget()
  372.      */
  373.     public final StateVertexFacade getTarget()
  374.     {
  375.         StateVertexFacade getTarget4r = null;
  376.         // outgoings has no pre constraints
  377.         Object result = handleGetTarget();
  378.         MetafacadeBase shieldedResult = this.shieldedElement(result);
  379.         try
  380.         {
  381.             getTarget4r = (StateVertexFacade)shieldedResult;
  382.         }
  383.         catch (ClassCastException ex)
  384.         {
  385.             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
  386.             TransitionFacadeLogic.logger.warn("incorrect metafacade cast for TransitionFacadeLogic.getTarget StateVertexFacade " + result + ": " + shieldedResult);
  387.         }
  388.         // outgoings has no post constraints
  389.         return getTarget4r;
  390.     }

  391.     /**
  392.      * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
  393.      * @return Object
  394.      */
  395.     protected abstract Object handleGetTarget();

  396.     /**
  397.      * If this action is located on a transition, this represents that transition.
  398.      * @return (ActionFacade)handleGetEffect()
  399.      */
  400.     public final ActionFacade getEffect()
  401.     {
  402.         ActionFacade getEffect5r = null;
  403.         // transition has no pre constraints
  404.         Object result = handleGetEffect();
  405.         MetafacadeBase shieldedResult = this.shieldedElement(result);
  406.         try
  407.         {
  408.             getEffect5r = (ActionFacade)shieldedResult;
  409.         }
  410.         catch (ClassCastException ex)
  411.         {
  412.             // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
  413.             TransitionFacadeLogic.logger.warn("incorrect metafacade cast for TransitionFacadeLogic.getEffect ActionFacade " + result + ": " + shieldedResult);
  414.         }
  415.         // transition has no post constraints
  416.         return getEffect5r;
  417.     }

  418.     /**
  419.      * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
  420.      * @return Object
  421.      */
  422.     protected abstract Object handleGetEffect();

  423.     /**
  424.      * @param validationMessages Collection<ModelValidationMessage>
  425.      * @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages)
  426.      */
  427.     @Override
  428.     public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
  429.     {
  430.         super.validateInvariants(validationMessages);
  431.     }
  432. }