FrontEndParameterLogic.java

// license-header java merge-point
//
// Attention: generated code (by MetafacadeLogic.vsl) - do not modify!
//
package org.andromda.metafacades.emf.uml22;

import java.util.Collection;
import org.andromda.core.metafacade.MetafacadeBase;
import org.andromda.core.metafacade.ModelValidationMessage;
import org.andromda.metafacades.uml.FrontEndAction;
import org.andromda.metafacades.uml.FrontEndControllerOperation;
import org.andromda.metafacades.uml.FrontEndParameter;
import org.andromda.metafacades.uml.FrontEndView;
import org.apache.log4j.Logger;
import org.eclipse.uml2.uml.Parameter;

/**
 * A front-end parameter is a parameter passed between front-end action states.
 * MetafacadeLogic for FrontEndParameter
 *
 * @see FrontEndParameter
 */
public abstract class FrontEndParameterLogic
    extends ParameterFacadeLogicImpl
    implements FrontEndParameter
{
    /**
     * The underlying UML object
     * @see Object
     */
    protected Object metaObject;

    /** Create Metafacade implementation instance using the MetafacadeFactory from the context
     * @param metaObjectIn
     * @param context
     */
    protected FrontEndParameterLogic(Object metaObjectIn, String context)
    {
        super((Parameter)metaObjectIn, getContext(context));
        this.metaObject = metaObjectIn;
    }

    /**
     * The logger instance.
     */
    private static final Logger logger = Logger.getLogger(FrontEndParameterLogic.class);

    /**
     * Gets the context for this metafacade logic instance.
     * @param context String. Set to FrontEndParameter if null
     * @return context String
     */
    private static String getContext(String context)
    {
        if (context == null)
        {
            context = "org.andromda.metafacades.uml.FrontEndParameter";
        }
        return context;
    }

    /** Reset context only for non-root metafacades
     * @param context
     */
    @Override
    public void resetMetafacadeContext(String context)
    {
        if (!this.contextRoot) // reset context only for non-root metafacades
        {
            context = getContext(context);  // to have same value as in original constructor call
            setMetafacadeContext (context);
        }
    }

    /**
     * @return boolean true always
     * @see FrontEndParameter
     */
    public boolean isFrontEndParameterMetaType()
    {
        return true;
    }

    // --------------- attributes ---------------------

   /**
    * @see FrontEndParameter#isControllerOperationArgument()
    * @return boolean
    */
    protected abstract boolean handleIsControllerOperationArgument();

    private boolean __controllerOperationArgument1a;
    private boolean __controllerOperationArgument1aSet = false;

    /**
     * Indicates whether or not this parameter is an argument of a controller operation.
     * @return (boolean)handleIsControllerOperationArgument()
     */
    public final boolean isControllerOperationArgument()
    {
        boolean controllerOperationArgument1a = this.__controllerOperationArgument1a;
        if (!this.__controllerOperationArgument1aSet)
        {
            // controllerOperationArgument has no pre constraints
            controllerOperationArgument1a = handleIsControllerOperationArgument();
            // controllerOperationArgument has no post constraints
            this.__controllerOperationArgument1a = controllerOperationArgument1a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__controllerOperationArgument1aSet = true;
            }
        }
        return controllerOperationArgument1a;
    }

   /**
    * @see FrontEndParameter#isContainedInFrontEndUseCase()
    * @return boolean
    */
    protected abstract boolean handleIsContainedInFrontEndUseCase();

    private boolean __containedInFrontEndUseCase2a;
    private boolean __containedInFrontEndUseCase2aSet = false;

    /**
     * Indicates if this parameter is contained in a "front-end" use case.
     * @return (boolean)handleIsContainedInFrontEndUseCase()
     */
    public final boolean isContainedInFrontEndUseCase()
    {
        boolean containedInFrontEndUseCase2a = this.__containedInFrontEndUseCase2a;
        if (!this.__containedInFrontEndUseCase2aSet)
        {
            // containedInFrontEndUseCase has no pre constraints
            containedInFrontEndUseCase2a = handleIsContainedInFrontEndUseCase();
            // containedInFrontEndUseCase has no post constraints
            this.__containedInFrontEndUseCase2a = containedInFrontEndUseCase2a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__containedInFrontEndUseCase2aSet = true;
            }
        }
        return containedInFrontEndUseCase2a;
    }

   /**
    * @see FrontEndParameter#isActionParameter()
    * @return boolean
    */
    protected abstract boolean handleIsActionParameter();

    private boolean __actionParameter3a;
    private boolean __actionParameter3aSet = false;

    /**
     * Indicates whether or not this is an action parameter or not.
     * @return (boolean)handleIsActionParameter()
     */
    public final boolean isActionParameter()
    {
        boolean actionParameter3a = this.__actionParameter3a;
        if (!this.__actionParameter3aSet)
        {
            // actionParameter has no pre constraints
            actionParameter3a = handleIsActionParameter();
            // actionParameter has no post constraints
            this.__actionParameter3a = actionParameter3a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__actionParameter3aSet = true;
            }
        }
        return actionParameter3a;
    }

   /**
    * @see FrontEndParameter#isTable()
    * @return boolean
    */
    protected abstract boolean handleIsTable();

    private boolean __table4a;
    private boolean __table4aSet = false;

    /**
     * Indicates whether or not this parameter represents a table.
     * @return (boolean)handleIsTable()
     */
    public final boolean isTable()
    {
        boolean table4a = this.__table4a;
        if (!this.__table4aSet)
        {
            // table has no pre constraints
            table4a = handleIsTable();
            // table has no post constraints
            this.__table4a = table4a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__table4aSet = true;
            }
        }
        return table4a;
    }

   /**
    * @see FrontEndParameter#getTableColumnNames()
    * @return Collection<String>
    */
    protected abstract Collection<String> handleGetTableColumnNames();

    private Collection<String> __tableColumnNames5a;
    private boolean __tableColumnNames5aSet = false;

    /**
     * All the columns for this parameter if it represents a table variable. If a column is linked
     * by an event (action) a FrontEndParameter instance is included in the return value, otherwise
     * a plain String representing the column name.
     * @return (Collection<String>)handleGetTableColumnNames()
     */
    public final Collection<String> getTableColumnNames()
    {
        Collection<String> tableColumnNames5a = this.__tableColumnNames5a;
        if (!this.__tableColumnNames5aSet)
        {
            // tableColumnNames has no pre constraints
            tableColumnNames5a = handleGetTableColumnNames();
            // tableColumnNames has no post constraints
            this.__tableColumnNames5a = tableColumnNames5a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__tableColumnNames5aSet = true;
            }
        }
        return tableColumnNames5a;
    }

   /**
    * @see FrontEndParameter#getTableColumns()
    * @return Collection<String>
    */
    protected abstract Collection<String> handleGetTableColumns();

    private Collection<String> __tableColumns6a;
    private boolean __tableColumns6aSet = false;

    /**
     * A list of all attributes which make up the table columns of this table (this only contains
     * attributes when the table is represented by an array).
     * @return (Collection<String>)handleGetTableColumns()
     */
    public final Collection<String> getTableColumns()
    {
        Collection<String> tableColumns6a = this.__tableColumns6a;
        if (!this.__tableColumns6aSet)
        {
            // tableColumns has no pre constraints
            tableColumns6a = handleGetTableColumns();
            // tableColumns has no post constraints
            this.__tableColumns6a = tableColumns6a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__tableColumns6aSet = true;
            }
        }
        return tableColumns6a;
    }

   /**
    * @see FrontEndParameter#getTableAttributeNames()
    * @return Collection<String>
    */
    protected abstract Collection<String> handleGetTableAttributeNames();

    private Collection<String> __tableAttributeNames7a;
    private boolean __tableAttributeNames7aSet = false;

    /**
     * A collection of all possible attribute names of a table (this will only work when your table
     * is modeled as an array..not a collection).
     * @return (Collection<String>)handleGetTableAttributeNames()
     */
    public final Collection<String> getTableAttributeNames()
    {
        Collection<String> tableAttributeNames7a = this.__tableAttributeNames7a;
        if (!this.__tableAttributeNames7aSet)
        {
            // tableAttributeNames has no pre constraints
            tableAttributeNames7a = handleGetTableAttributeNames();
            // tableAttributeNames has no post constraints
            this.__tableAttributeNames7a = tableAttributeNames7a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__tableAttributeNames7aSet = true;
            }
        }
        return tableAttributeNames7a;
    }

    // ------------- associations ------------------

    private FrontEndView __getView1r;
    private boolean __getView1rSet = false;

    /**
     * All those variables that will be present as variables in the target view. These are the
     * trigger parameters on the incoming transitions.
     * @return (FrontEndView)handleGetView()
     */
    public final FrontEndView getView()
    {
        FrontEndView getView1r = this.__getView1r;
        if (!this.__getView1rSet)
        {
            // variables has no pre constraints
            Object result = handleGetView();
            MetafacadeBase shieldedResult = this.shieldedElement(result);
            try
            {
                getView1r = (FrontEndView)shieldedResult;
            }
            catch (ClassCastException ex)
            {
                // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
                FrontEndParameterLogic.logger.warn("incorrect metafacade cast for FrontEndParameterLogic.getView FrontEndView " + result + ": " + shieldedResult);
            }
            // variables has no post constraints
            this.__getView1r = getView1r;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__getView1rSet = true;
            }
        }
        return getView1r;
    }

    /**
     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
     * @return Object
     */
    protected abstract Object handleGetView();

    private FrontEndAction __getAction2r;
    private boolean __getAction2rSet = false;

    /**
     * All parameters sent by this "front-end" action.
     * @return (FrontEndAction)handleGetAction()
     */
    public final FrontEndAction getAction()
    {
        FrontEndAction getAction2r = this.__getAction2r;
        if (!this.__getAction2rSet)
        {
            // parameters has no pre constraints
            Object result = handleGetAction();
            MetafacadeBase shieldedResult = this.shieldedElement(result);
            try
            {
                getAction2r = (FrontEndAction)shieldedResult;
            }
            catch (ClassCastException ex)
            {
                // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
                FrontEndParameterLogic.logger.warn("incorrect metafacade cast for FrontEndParameterLogic.getAction FrontEndAction " + result + ": " + shieldedResult);
            }
            // parameters has no post constraints
            this.__getAction2r = getAction2r;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__getAction2rSet = true;
            }
        }
        return getAction2r;
    }

    /**
     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
     * @return Object
     */
    protected abstract Object handleGetAction();

    private FrontEndControllerOperation __getControllerOperation3r;
    private boolean __getControllerOperation3rSet = false;

    /**
     * The set of fields in the form made up form this controller operation's parameters.
     * @return (FrontEndControllerOperation)handleGetControllerOperation()
     */
    public final FrontEndControllerOperation getControllerOperation()
    {
        FrontEndControllerOperation getControllerOperation3r = this.__getControllerOperation3r;
        if (!this.__getControllerOperation3rSet)
        {
            // formFields has no pre constraints
            Object result = handleGetControllerOperation();
            MetafacadeBase shieldedResult = this.shieldedElement(result);
            try
            {
                getControllerOperation3r = (FrontEndControllerOperation)shieldedResult;
            }
            catch (ClassCastException ex)
            {
                // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
                FrontEndParameterLogic.logger.warn("incorrect metafacade cast for FrontEndParameterLogic.getControllerOperation FrontEndControllerOperation " + result + ": " + shieldedResult);
            }
            // formFields has no post constraints
            this.__getControllerOperation3r = getControllerOperation3r;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__getControllerOperation3rSet = true;
            }
        }
        return getControllerOperation3r;
    }

    /**
     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
     * @return Object
     */
    protected abstract Object handleGetControllerOperation();

    /**
     * @param validationMessages Collection<ModelValidationMessage>
     * @see ParameterFacadeLogicImpl#validateInvariants(Collection validationMessages)
     */
    @Override
    public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
    {
        super.validateInvariants(validationMessages);
    }
}