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.FrontEndAction;
011import org.andromda.metafacades.uml.FrontEndActivityGraph;
012import org.andromda.metafacades.uml.FrontEndController;
013import org.apache.log4j.Logger;
014import org.omg.uml.behavioralelements.activitygraphs.ActivityGraph;
015
016/**
017 * Represents the activity graph describing the details of a presentation tier or "front end" use
018 * case.
019 * MetafacadeLogic for FrontEndActivityGraph
020 *
021 * @see FrontEndActivityGraph
022 */
023public abstract class FrontEndActivityGraphLogic
024    extends ActivityGraphFacadeLogicImpl
025    implements FrontEndActivityGraph
026{
027    /**
028     * The underlying UML object
029     * @see Object
030     */
031    protected Object metaObject;
032
033    /** Create Metafacade implementation instance using the MetafacadeFactory from the context
034     * @param metaObjectIn
035     * @param context
036     */
037    protected FrontEndActivityGraphLogic(Object metaObjectIn, String context)
038    {
039        super((ActivityGraph)metaObjectIn, getContext(context));
040        this.metaObject = metaObjectIn;
041    }
042
043    /**
044     * The logger instance.
045     */
046    private static final Logger logger = Logger.getLogger(FrontEndActivityGraphLogic.class);
047
048    /**
049     * Gets the context for this metafacade logic instance.
050     * @param context String. Set to FrontEndActivityGraph if null
051     * @return context String
052     */
053    private static String getContext(String context)
054    {
055        if (context == null)
056        {
057            context = "org.andromda.metafacades.uml.FrontEndActivityGraph";
058        }
059        return context;
060    }
061
062    /** Reset context only for non-root metafacades
063     * @param context
064     */
065    @Override
066    public void resetMetafacadeContext(String context)
067    {
068        if (!this.contextRoot) // reset context only for non-root metafacades
069        {
070            context = getContext(context);  // to have same value as in original constructor call
071            setMetafacadeContext (context);
072        }
073    }
074
075    /**
076     * @return boolean true always
077     * @see FrontEndActivityGraph
078     */
079    public boolean isFrontEndActivityGraphMetaType()
080    {
081        return true;
082    }
083
084    // --------------- attributes ---------------------
085
086   /**
087    * @see FrontEndActivityGraph#isContainedInFrontEndUseCase()
088    * @return boolean
089    */
090    protected abstract boolean handleIsContainedInFrontEndUseCase();
091
092    private boolean __containedInFrontEndUseCase1a;
093    private boolean __containedInFrontEndUseCase1aSet = false;
094
095    /**
096     * True if this element is contained in a FrontEndUseCase.
097     * @return (boolean)handleIsContainedInFrontEndUseCase()
098     */
099    public final boolean isContainedInFrontEndUseCase()
100    {
101        boolean containedInFrontEndUseCase1a = this.__containedInFrontEndUseCase1a;
102        if (!this.__containedInFrontEndUseCase1aSet)
103        {
104            // containedInFrontEndUseCase has no pre constraints
105            containedInFrontEndUseCase1a = handleIsContainedInFrontEndUseCase();
106            // containedInFrontEndUseCase has no post constraints
107            this.__containedInFrontEndUseCase1a = containedInFrontEndUseCase1a;
108            if (isMetafacadePropertyCachingEnabled())
109            {
110                this.__containedInFrontEndUseCase1aSet = true;
111            }
112        }
113        return containedInFrontEndUseCase1a;
114    }
115
116    // ------------- associations ------------------
117
118    private FrontEndController __getController1r;
119    private boolean __getController1rSet = false;
120
121    /**
122     * Represents the activity graph describing the details of a presentation tier or "front end"
123     * use case.
124     * @return (FrontEndController)handleGetController()
125     */
126    public final FrontEndController getController()
127    {
128        FrontEndController getController1r = this.__getController1r;
129        if (!this.__getController1rSet)
130        {
131            // frontEndActivityGraph has no pre constraints
132            Object result = handleGetController();
133            MetafacadeBase shieldedResult = this.shieldedElement(result);
134            try
135            {
136                getController1r = (FrontEndController)shieldedResult;
137            }
138            catch (ClassCastException ex)
139            {
140                // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
141                FrontEndActivityGraphLogic.logger.warn("incorrect metafacade cast for FrontEndActivityGraphLogic.getController FrontEndController " + result + ": " + shieldedResult);
142            }
143            // frontEndActivityGraph has no post constraints
144            this.__getController1r = getController1r;
145            if (isMetafacadePropertyCachingEnabled())
146            {
147                this.__getController1rSet = true;
148            }
149        }
150        return getController1r;
151    }
152
153    /**
154     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
155     * @return Object
156     */
157    protected abstract Object handleGetController();
158
159    private FrontEndAction __getInitialAction2r;
160    private boolean __getInitialAction2rSet = false;
161
162    /**
163     * Represents the activity graph describing the details of a presentation tier or "front end"
164     * use case.
165     * @return (FrontEndAction)handleGetInitialAction()
166     */
167    public final FrontEndAction getInitialAction()
168    {
169        FrontEndAction getInitialAction2r = this.__getInitialAction2r;
170        if (!this.__getInitialAction2rSet)
171        {
172            // frontEndActivityGraph has no pre constraints
173            Object result = handleGetInitialAction();
174            MetafacadeBase shieldedResult = this.shieldedElement(result);
175            try
176            {
177                getInitialAction2r = (FrontEndAction)shieldedResult;
178            }
179            catch (ClassCastException ex)
180            {
181                // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
182                FrontEndActivityGraphLogic.logger.warn("incorrect metafacade cast for FrontEndActivityGraphLogic.getInitialAction FrontEndAction " + result + ": " + shieldedResult);
183            }
184            // frontEndActivityGraph has no post constraints
185            this.__getInitialAction2r = getInitialAction2r;
186            if (isMetafacadePropertyCachingEnabled())
187            {
188                this.__getInitialAction2rSet = true;
189            }
190        }
191        return getInitialAction2r;
192    }
193
194    /**
195     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
196     * @return Object
197     */
198    protected abstract Object handleGetInitialAction();
199
200    /**
201     * @param validationMessages Collection<ModelValidationMessage>
202     * @see ActivityGraphFacadeLogicImpl#validateInvariants(Collection validationMessages)
203     */
204    @Override
205    public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
206    {
207        super.validateInvariants(validationMessages);
208    }
209}