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.CallActionFacade;
011import org.andromda.metafacades.uml.OperationFacade;
012import org.apache.log4j.Logger;
013import org.omg.uml.behavioralelements.commonbehavior.CallAction;
014
015/**
016 * A representation of the model object 'Call Operation Action'. An action that transmits an
017 * operation call request to the target object, where it may cause the invocation of associated
018 * behavior. The argument values of the action are available to the execution of the invoked
019 * behavior. If the action is marked synchronous, the execution of the call operation action waits
020 * until the execution of the invoked behavior completes and a reply transmission is returned to the
021 * caller; otherwise execution of the action is complete when the invocation of the operation is
022 * established and the execution of the invoked operation proceeds concurrently with the execution
023 * of the calling behavior. Any values returned as part of the reply transmission are put on the
024 * result output pins of the call operation action. Upon receipt of the reply transmission,
025 * execution of the call operation action is complete.
026 * MetafacadeLogic for CallActionFacade
027 *
028 * @see CallActionFacade
029 */
030public abstract class CallActionFacadeLogic
031    extends ActionFacadeLogicImpl
032    implements CallActionFacade
033{
034    /**
035     * The underlying UML object
036     * @see CallAction
037     */
038    protected CallAction metaObject;
039
040    /** Create Metafacade implementation instance using the MetafacadeFactory from the context
041     * @param metaObjectIn
042     * @param context
043     */
044    protected CallActionFacadeLogic(CallAction metaObjectIn, String context)
045    {
046        super(metaObjectIn, getContext(context));
047        this.metaObject = metaObjectIn;
048    }
049
050    /**
051     * The logger instance.
052     */
053    private static final Logger logger = Logger.getLogger(CallActionFacadeLogic.class);
054
055    /**
056     * Gets the context for this metafacade logic instance.
057     * @param context String. Set to CallActionFacade if null
058     * @return context String
059     */
060    private static String getContext(String context)
061    {
062        if (context == null)
063        {
064            context = "org.andromda.metafacades.uml.CallActionFacade";
065        }
066        return context;
067    }
068
069    /** Reset context only for non-root metafacades
070     * @param context
071     */
072    @Override
073    public void resetMetafacadeContext(String context)
074    {
075        if (!this.contextRoot) // reset context only for non-root metafacades
076        {
077            context = getContext(context);  // to have same value as in original constructor call
078            setMetafacadeContext (context);
079        }
080    }
081
082    /**
083     * @return boolean true always
084     * @see CallActionFacade
085     */
086    public boolean isCallActionFacadeMetaType()
087    {
088        return true;
089    }
090
091    // ------------- associations ------------------
092
093    /**
094     * A representation of the model object 'Call Operation Action'. An action that transmits an
095     * operation
096     * call request to the target object, where it may cause the invocation of associated behavior.
097     * The
098     * argument values of the action are available to the execution of the invoked behavior. If the
099     * action
100     * is marked synchronous, the execution of the call operation action waits until the execution
101     * of the
102     * invoked behavior completes and a reply transmission is returned to the caller; otherwise
103     * execution
104     * of the action is complete when the invocation of the operation is established and the
105     * execution of
106     * the invoked operation proceeds concurrently with the execution of the calling behavior. Any
107     * values
108     * returned as part of the reply transmission are put on the result output pins of the call
109     * operation
110     * action. Upon receipt of the reply transmission, execution of the call operation action is
111     * complete.
112     * @return (OperationFacade)handleGetOperation()
113     */
114    public final OperationFacade getOperation()
115    {
116        OperationFacade getOperation1r = null;
117        // callActionFacade has no pre constraints
118        Object result = handleGetOperation();
119        MetafacadeBase shieldedResult = this.shieldedElement(result);
120        try
121        {
122            getOperation1r = (OperationFacade)shieldedResult;
123        }
124        catch (ClassCastException ex)
125        {
126            // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
127            CallActionFacadeLogic.logger.warn("incorrect metafacade cast for CallActionFacadeLogic.getOperation OperationFacade " + result + ": " + shieldedResult);
128        }
129        // callActionFacade has no post constraints
130        return getOperation1r;
131    }
132
133    /**
134     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
135     * @return Object
136     */
137    protected abstract Object handleGetOperation();
138
139    /**
140     * @param validationMessages Collection<ModelValidationMessage>
141     * @see ActionFacadeLogicImpl#validateInvariants(Collection validationMessages)
142     */
143    @Override
144    public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
145    {
146        super.validateInvariants(validationMessages);
147    }
148}