ParameterFacadeLogic.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.ClassifierFacade;
import org.andromda.metafacades.uml.EventFacade;
import org.andromda.metafacades.uml.OperationFacade;
import org.andromda.metafacades.uml.ParameterFacade;
import org.andromda.translation.ocl.validation.OCLCollections;
import org.andromda.translation.ocl.validation.OCLExpressions;
import org.andromda.translation.ocl.validation.OCLIntrospector;
import org.andromda.translation.ocl.validation.OCLResultEnsurer;
import org.apache.log4j.Logger;
import org.eclipse.uml2.uml.Parameter;

/**
 * Specification of an argument used to pass information into or out of an invocation of a
 * behavioral feature. Parameters are allowed to be treated as connectable elements. Parameters have
 * support for streaming, exceptions, and parameter sets.
 * MetafacadeLogic for ParameterFacade
 *
 * @see ParameterFacade
 */
public abstract class ParameterFacadeLogic
    extends ModelElementFacadeLogicImpl
    implements ParameterFacade
{
    /**
     * The underlying UML object
     * @see Parameter
     */
    protected Parameter metaObject;

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

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

    /**
     * Gets the context for this metafacade logic instance.
     * @param context String. Set to ParameterFacade if null
     * @return context String
     */
    private static String getContext(String context)
    {
        if (context == null)
        {
            context = "org.andromda.metafacades.uml.ParameterFacade";
        }
        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 ParameterFacade
     */
    public boolean isParameterFacadeMetaType()
    {
        return true;
    }

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

   /**
    * @see ParameterFacade#getDefaultValue()
    * @return String
    */
    protected abstract String handleGetDefaultValue();

    private String __defaultValue1a;
    private boolean __defaultValue1aSet = false;

    /**
     * TODO: Model Documentation for ParameterFacade.defaultValue
     * @return (String)handleGetDefaultValue()
     */
    public final String getDefaultValue()
    {
        String defaultValue1a = this.__defaultValue1a;
        if (!this.__defaultValue1aSet)
        {
            // defaultValue has no pre constraints
            defaultValue1a = handleGetDefaultValue();
            // defaultValue has no post constraints
            this.__defaultValue1a = defaultValue1a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__defaultValue1aSet = true;
            }
        }
        return defaultValue1a;
    }

   /**
    * @see ParameterFacade#isDefaultValuePresent()
    * @return boolean
    */
    protected abstract boolean handleIsDefaultValuePresent();

    private boolean __defaultValuePresent2a;
    private boolean __defaultValuePresent2aSet = false;

    /**
     * Indicates if the default value is present.
     * @return (boolean)handleIsDefaultValuePresent()
     */
    public final boolean isDefaultValuePresent()
    {
        boolean defaultValuePresent2a = this.__defaultValuePresent2a;
        if (!this.__defaultValuePresent2aSet)
        {
            // defaultValuePresent has no pre constraints
            defaultValuePresent2a = handleIsDefaultValuePresent();
            // defaultValuePresent has no post constraints
            this.__defaultValuePresent2a = defaultValuePresent2a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__defaultValuePresent2aSet = true;
            }
        }
        return defaultValuePresent2a;
    }

   /**
    * @see ParameterFacade#getGetterName()
    * @return String
    */
    protected abstract String handleGetGetterName();

    private String __getterName3a;
    private boolean __getterName3aSet = false;

    /**
     * The name to use for accessors getting this parameter from a bean.
     * @return (String)handleGetGetterName()
     */
    public final String getGetterName()
    {
        String getterName3a = this.__getterName3a;
        if (!this.__getterName3aSet)
        {
            // getterName has no pre constraints
            getterName3a = handleGetGetterName();
            // getterName has no post constraints
            this.__getterName3a = getterName3a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__getterName3aSet = true;
            }
        }
        return getterName3a;
    }

   /**
    * @see ParameterFacade#getGetterSetterTypeName()
    * @return String
    */
    protected abstract String handleGetGetterSetterTypeName();

    private String __getterSetterTypeName4a;
    private boolean __getterSetterTypeName4aSet = false;

    /**
     * Fully Qualified TypeName, determined in part by multiplicity (for UML2). For UML14, same as
     * getterName.
     * @return (String)handleGetGetterSetterTypeName()
     */
    public final String getGetterSetterTypeName()
    {
        String getterSetterTypeName4a = this.__getterSetterTypeName4a;
        if (!this.__getterSetterTypeName4aSet)
        {
            // getterSetterTypeName has no pre constraints
            getterSetterTypeName4a = handleGetGetterSetterTypeName();
            // getterSetterTypeName has no post constraints
            this.__getterSetterTypeName4a = getterSetterTypeName4a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__getterSetterTypeName4aSet = true;
            }
        }
        return getterSetterTypeName4a;
    }

   /**
    * @see ParameterFacade#getGetterSetterTypeNameImpl()
    * @return String
    */
    protected abstract String handleGetGetterSetterTypeNameImpl();

    private String __getterSetterTypeNameImpl5a;
    private boolean __getterSetterTypeNameImpl5aSet = false;

    /**
     * Fully Qualified implementation class of TypeName, determined in part by multiplicity (for
     * UML2). If upper multiplicity =1, same as getterSetterTypeName.
     * @return (String)handleGetGetterSetterTypeNameImpl()
     */
    public final String getGetterSetterTypeNameImpl()
    {
        String getterSetterTypeNameImpl5a = this.__getterSetterTypeNameImpl5a;
        if (!this.__getterSetterTypeNameImpl5aSet)
        {
            // getterSetterTypeNameImpl has no pre constraints
            getterSetterTypeNameImpl5a = handleGetGetterSetterTypeNameImpl();
            // getterSetterTypeNameImpl has no post constraints
            this.__getterSetterTypeNameImpl5a = getterSetterTypeNameImpl5a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__getterSetterTypeNameImpl5aSet = true;
            }
        }
        return getterSetterTypeNameImpl5a;
    }

   /**
    * @see ParameterFacade#isRequired()
    * @return boolean
    */
    protected abstract boolean handleIsRequired();

    private boolean __required6a;
    private boolean __required6aSet = false;

    /**
     * Whether or not this parameter is considered required (i.e must a non-empty value).
     * @return (boolean)handleIsRequired()
     */
    public final boolean isRequired()
    {
        boolean required6a = this.__required6a;
        if (!this.__required6aSet)
        {
            // required has no pre constraints
            required6a = handleIsRequired();
            // required has no post constraints
            this.__required6a = required6a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__required6aSet = true;
            }
        }
        return required6a;
    }

   /**
    * @see ParameterFacade#isReturn()
    * @return boolean
    */
    protected abstract boolean handleIsReturn();

    private boolean __return7a;
    private boolean __return7aSet = false;

    /**
     * Whether or not this parameter represents a return parameter.
     * @return (boolean)handleIsReturn()
     */
    public final boolean isReturn()
    {
        boolean return7a = this.__return7a;
        if (!this.__return7aSet)
        {
            // return has no pre constraints
            return7a = handleIsReturn();
            // return has no post constraints
            this.__return7a = return7a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__return7aSet = true;
            }
        }
        return return7a;
    }

   /**
    * @see ParameterFacade#getSetterName()
    * @return String
    */
    protected abstract String handleGetSetterName();

    private String __setterName8a;
    private boolean __setterName8aSet = false;

    /**
     * The name to use for accessors getting this parameter in a bean.
     * @return (String)handleGetSetterName()
     */
    public final String getSetterName()
    {
        String setterName8a = this.__setterName8a;
        if (!this.__setterName8aSet)
        {
            // setterName has no pre constraints
            setterName8a = handleGetSetterName();
            // setterName has no post constraints
            this.__setterName8a = setterName8a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__setterName8aSet = true;
            }
        }
        return setterName8a;
    }

   /**
    * @see ParameterFacade#isReadable()
    * @return boolean
    */
    protected abstract boolean handleIsReadable();

    private boolean __readable9a;
    private boolean __readable9aSet = false;

    /**
     * True if this parameter is readable, aka an in-parameter, or this feature is unspecified.
     * @return (boolean)handleIsReadable()
     */
    public final boolean isReadable()
    {
        boolean readable9a = this.__readable9a;
        if (!this.__readable9aSet)
        {
            // readable has no pre constraints
            readable9a = handleIsReadable();
            // readable has no post constraints
            this.__readable9a = readable9a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__readable9aSet = true;
            }
        }
        return readable9a;
    }

   /**
    * @see ParameterFacade#isWritable()
    * @return boolean
    */
    protected abstract boolean handleIsWritable();

    private boolean __writable10a;
    private boolean __writable10aSet = false;

    /**
     * True if this parameter is writable, aka an out-parameter, or this feature is unspecified.
     * @return (boolean)handleIsWritable()
     */
    public final boolean isWritable()
    {
        boolean writable10a = this.__writable10a;
        if (!this.__writable10aSet)
        {
            // writable has no pre constraints
            writable10a = handleIsWritable();
            // writable has no post constraints
            this.__writable10a = writable10a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__writable10aSet = true;
            }
        }
        return writable10a;
    }

   /**
    * @see ParameterFacade#isInParameter()
    * @return boolean
    */
    protected abstract boolean handleIsInParameter();

    private boolean __inParameter11a;
    private boolean __inParameter11aSet = false;

    /**
     * True if this parameter is an 'in' parameter.
     * @return (boolean)handleIsInParameter()
     */
    public final boolean isInParameter()
    {
        boolean inParameter11a = this.__inParameter11a;
        if (!this.__inParameter11aSet)
        {
            // inParameter has no pre constraints
            inParameter11a = handleIsInParameter();
            // inParameter has no post constraints
            this.__inParameter11a = inParameter11a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__inParameter11aSet = true;
            }
        }
        return inParameter11a;
    }

   /**
    * @see ParameterFacade#isOutParameter()
    * @return boolean
    */
    protected abstract boolean handleIsOutParameter();

    private boolean __outParameter12a;
    private boolean __outParameter12aSet = false;

    /**
     * True if this parameter is an 'out' parameter.
     * @return (boolean)handleIsOutParameter()
     */
    public final boolean isOutParameter()
    {
        boolean outParameter12a = this.__outParameter12a;
        if (!this.__outParameter12aSet)
        {
            // outParameter has no pre constraints
            outParameter12a = handleIsOutParameter();
            // outParameter has no post constraints
            this.__outParameter12a = outParameter12a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__outParameter12aSet = true;
            }
        }
        return outParameter12a;
    }

   /**
    * @see ParameterFacade#isInoutParameter()
    * @return boolean
    */
    protected abstract boolean handleIsInoutParameter();

    private boolean __inoutParameter13a;
    private boolean __inoutParameter13aSet = false;

    /**
     * True if this parameter is an inout parameter.
     * @return (boolean)handleIsInoutParameter()
     */
    public final boolean isInoutParameter()
    {
        boolean inoutParameter13a = this.__inoutParameter13a;
        if (!this.__inoutParameter13aSet)
        {
            // inoutParameter has no pre constraints
            inoutParameter13a = handleIsInoutParameter();
            // inoutParameter has no post constraints
            this.__inoutParameter13a = inoutParameter13a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__inoutParameter13aSet = true;
            }
        }
        return inoutParameter13a;
    }

   /**
    * @see ParameterFacade#getUpper()
    * @return int
    */
    protected abstract int handleGetUpper();

    private int __upper14a;
    private boolean __upper14aSet = false;

    /**
     * the upper value of the multiplicity (will be -1 for *)
     * -only applicable for UML2
     * @return (int)handleGetUpper()
     */
    public final int getUpper()
    {
        int upper14a = this.__upper14a;
        if (!this.__upper14aSet)
        {
            // upper has no pre constraints
            upper14a = handleGetUpper();
            // upper has no post constraints
            this.__upper14a = upper14a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__upper14aSet = true;
            }
        }
        return upper14a;
    }

   /**
    * @see ParameterFacade#getLower()
    * @return int
    */
    protected abstract int handleGetLower();

    private int __lower15a;
    private boolean __lower15aSet = false;

    /**
     * the lower value for the multiplicity
     * -only applicable for UML2
     * @return (int)handleGetLower()
     */
    public final int getLower()
    {
        int lower15a = this.__lower15a;
        if (!this.__lower15aSet)
        {
            // lower has no pre constraints
            lower15a = handleGetLower();
            // lower has no post constraints
            this.__lower15a = lower15a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__lower15aSet = true;
            }
        }
        return lower15a;
    }

   /**
    * @see ParameterFacade#isUnique()
    * @return boolean
    */
    protected abstract boolean handleIsUnique();

    private boolean __unique16a;
    private boolean __unique16aSet = false;

    /**
     * If Parameter type isMany (UML2), is the parameter unique within the Collection. Unique+Sorted
     * determines pareter implementation type. For UML14, always false.
     * @return (boolean)handleIsUnique()
     */
    public final boolean isUnique()
    {
        boolean unique16a = this.__unique16a;
        if (!this.__unique16aSet)
        {
            // unique has no pre constraints
            unique16a = handleIsUnique();
            // unique has no post constraints
            this.__unique16a = unique16a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__unique16aSet = true;
            }
        }
        return unique16a;
    }

   /**
    * @see ParameterFacade#isOrdered()
    * @return boolean
    */
    protected abstract boolean handleIsOrdered();

    private boolean __ordered17a;
    private boolean __ordered17aSet = false;

    /**
     * UML2 Only: Is parameter ordered within the Collection type. Ordered+Unique determines the
     * implementation Collection Type. For UML14, always false.
     * @return (boolean)handleIsOrdered()
     */
    public final boolean isOrdered()
    {
        boolean ordered17a = this.__ordered17a;
        if (!this.__ordered17aSet)
        {
            // ordered has no pre constraints
            ordered17a = handleIsOrdered();
            // ordered has no post constraints
            this.__ordered17a = ordered17a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__ordered17aSet = true;
            }
        }
        return ordered17a;
    }

   /**
    * @see ParameterFacade#isMany()
    * @return boolean
    */
    protected abstract boolean handleIsMany();

    private boolean __many18a;
    private boolean __many18aSet = false;

    /**
     * If upper>1 or upper==unlimited. Only applies to UML2. For UML14, always false.
     * @return (boolean)handleIsMany()
     */
    public final boolean isMany()
    {
        boolean many18a = this.__many18a;
        if (!this.__many18aSet)
        {
            // many has no pre constraints
            many18a = handleIsMany();
            // many has no post constraints
            this.__many18a = many18a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__many18aSet = true;
            }
        }
        return many18a;
    }

   /**
    * @see ParameterFacade#isException()
    * @return boolean
    */
    protected abstract boolean handleIsException();

    private boolean __exception19a;
    private boolean __exception19aSet = false;

    /**
     * UML2: Returns the value of the 'Is Exception' attribute. The default value is "false". Tells
     * whether an output parameter may emit a value to the exclusion of the other outputs.
     * @return (boolean)handleIsException()
     */
    public final boolean isException()
    {
        boolean exception19a = this.__exception19a;
        if (!this.__exception19aSet)
        {
            // exception has no pre constraints
            exception19a = handleIsException();
            // exception has no post constraints
            this.__exception19a = exception19a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__exception19aSet = true;
            }
        }
        return exception19a;
    }

   /**
    * @see ParameterFacade#getEffect()
    * @return String
    */
    protected abstract String handleGetEffect();

    private String __effect20a;
    private boolean __effect20aSet = false;

    /**
     * UML2: A representation of the literals of the enumeration 'Parameter Effect Kind': CREATE,
     * READ, UPDATE, DELETE. The datatype ParameterEffectKind is an enumeration that indicates the
     * effect of a behavior on values passed in or out of its parameters.
     * @return (String)handleGetEffect()
     */
    public final String getEffect()
    {
        String effect20a = this.__effect20a;
        if (!this.__effect20aSet)
        {
            // effect has no pre constraints
            effect20a = handleGetEffect();
            // effect has no post constraints
            this.__effect20a = effect20a;
            if (isMetafacadePropertyCachingEnabled())
            {
                this.__effect20aSet = true;
            }
        }
        return effect20a;
    }

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

    /**
     * Specification of an argument used to pass information into or out of an invocation of a
     * behavioral
     * feature. Parameters are allowed to be treated as connectable elements. Parameters have
     * support for
     * streaming, exceptions, and parameter sets.
     * @return (ClassifierFacade)handleGetType()
     */
    public final ClassifierFacade getType()
    {
        ClassifierFacade getType1r = null;
        // parameterFacade has no pre constraints
        Object result = handleGetType();
        MetafacadeBase shieldedResult = this.shieldedElement(result);
        try
        {
            getType1r = (ClassifierFacade)shieldedResult;
        }
        catch (ClassCastException ex)
        {
            // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
            ParameterFacadeLogic.logger.warn("incorrect metafacade cast for ParameterFacadeLogic.getType ClassifierFacade " + result + ": " + shieldedResult);
        }
        // parameterFacade has no post constraints
        return getType1r;
    }

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

    /**
     * The parameters to this event.
     * @return (EventFacade)handleGetEvent()
     */
    public final EventFacade getEvent()
    {
        EventFacade getEvent2r = null;
        // parameters has no pre constraints
        Object result = handleGetEvent();
        MetafacadeBase shieldedResult = this.shieldedElement(result);
        try
        {
            getEvent2r = (EventFacade)shieldedResult;
        }
        catch (ClassCastException ex)
        {
            // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
            ParameterFacadeLogic.logger.warn("incorrect metafacade cast for ParameterFacadeLogic.getEvent EventFacade " + result + ": " + shieldedResult);
        }
        // parameters has no post constraints
        return getEvent2r;
    }

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

    /**
     * Return all parameters for the operation, including the return parameter.
     * @return (OperationFacade)handleGetOperation()
     */
    public final OperationFacade getOperation()
    {
        OperationFacade getOperation3r = null;
        // parameters has no pre constraints
        Object result = handleGetOperation();
        MetafacadeBase shieldedResult = this.shieldedElement(result);
        try
        {
            getOperation3r = (OperationFacade)shieldedResult;
        }
        catch (ClassCastException ex)
        {
            // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
            ParameterFacadeLogic.logger.warn("incorrect metafacade cast for ParameterFacadeLogic.getOperation OperationFacade " + result + ": " + shieldedResult);
        }
        // parameters has no post constraints
        return getOperation3r;
    }

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

    /**
     * <p><b>Constraint:</b> org::andromda::metafacades::uml::ParameterFacade::parameter needs a type</p>
     * <p><b>Error:</b> Each parameter needs a type, you cannot leave the type unspecified.</p>
     * <p><b>OCL:</b> context ParameterFacade
inv: return = false implies type.name->notEmpty()</p>
     * <p><b>Constraint:</b> org::andromda::metafacades::uml::ParameterFacade::non return type parameters must be named</p>
     * <p><b>Error:</b> Each parameter that is NOT a return parameter must have a non-empty name.</p>
     * <p><b>OCL:</b> context ParameterFacade
inv: return = false 
implies name -> notEmpty()</p>
     * <p><b>Constraint:</b> org::andromda::metafacades::uml::ParameterFacade::primitive parameter cannot be used in Collection</p>
     * <p><b>Error:</b> Primitive parameters cannot be used in Collections (multiplicity > 1). Use the wrapped type instead.</p>
     * <p><b>OCL:</b> context ParameterFacade inv: type.primitive implies (many = false)</p>
     * <p><b>Constraint:</b> org::andromda::metafacades::uml::ParameterFacade::primitive parameter must be required</p>
     * <p><b>Error:</b> Primitive operation parameters must have a multiplicity lower bound > 0 (must be required). Use a wrapped type, or change the multiplicity.</p>
     * <p><b>OCL:</b> context ParameterFacade inv: type.primitive implies (lower > 0)</p>
     * <p><b>Constraint:</b> org::andromda::metafacades::uml::ParameterFacade::wrapped primitive parameter should not be required</p>
     * <p><b>Error:</b> Wrapped primitive operation parameters must have a multiplicity lower bound = 0 (must be optional). Use the unwrapped type, or change the multiplicity.</p>
     * <p><b>OCL:</b> context ParameterFacade inv: type.wrappedPrimitive and many = false implies (lower = 0)</p>
     * @param validationMessages Collection<ModelValidationMessage>
     * @see ModelElementFacadeLogicImpl#validateInvariants(Collection validationMessages)
     */
    @Override
    public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
    {
        super.validateInvariants(validationMessages);
        try
        {
            final Object contextElement = this.THIS();
            boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLExpressions.equal(OCLIntrospector.invoke(contextElement,"return"),false))).booleanValue()?OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"type.name")):true));
            if (!constraintValid)
            {
                validationMessages.add(
                    new ModelValidationMessage(
                        (MetafacadeBase)contextElement ,
                        "org::andromda::metafacades::uml::ParameterFacade::parameter needs a type",
                        "Each parameter needs a type, you cannot leave the type unspecified."));
            }
        }
        catch (Throwable th)
        {
            Throwable cause = th.getCause();
            int depth = 0; // Some throwables have infinite recursion
            while (cause != null && depth < 7)
            {
                th = cause;
                depth++;
            }
            logger.error("Error validating constraint 'org::andromda::metafacades::uml::ParameterFacade::parameter needs a type' ON "
                + this.THIS().toString() + ": " + th.getMessage(), th);
        }
        try
        {
            final Object contextElement = this.THIS();
            boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLExpressions.equal(OCLIntrospector.invoke(contextElement,"return"),false))).booleanValue()?OCLCollections.notEmpty(OCLIntrospector.invoke(contextElement,"name")):true));
            if (!constraintValid)
            {
                validationMessages.add(
                    new ModelValidationMessage(
                        (MetafacadeBase)contextElement ,
                        "org::andromda::metafacades::uml::ParameterFacade::non return type parameters must be named",
                        "Each parameter that is NOT a return parameter must have a non-empty name."));
            }
        }
        catch (Throwable th)
        {
            Throwable cause = th.getCause();
            int depth = 0; // Some throwables have infinite recursion
            while (cause != null && depth < 7)
            {
                th = cause;
                depth++;
            }
            logger.error("Error validating constraint 'org::andromda::metafacades::uml::ParameterFacade::non return type parameters must be named' ON "
                + this.THIS().toString() + ": " + th.getMessage(), th);
        }
        try
        {
            final Object contextElement = this.THIS();
            boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"type.primitive"))).booleanValue()?(OCLExpressions.equal(OCLIntrospector.invoke(contextElement,"many"),false)):true));
            if (!constraintValid)
            {
                validationMessages.add(
                    new ModelValidationMessage(
                        (MetafacadeBase)contextElement ,
                        "org::andromda::metafacades::uml::ParameterFacade::primitive parameter cannot be used in Collection",
                        "Primitive parameters cannot be used in Collections (multiplicity > 1). Use the wrapped type instead."));
            }
        }
        catch (Throwable th)
        {
            Throwable cause = th.getCause();
            int depth = 0; // Some throwables have infinite recursion
            while (cause != null && depth < 7)
            {
                th = cause;
                depth++;
            }
            logger.error("Error validating constraint 'org::andromda::metafacades::uml::ParameterFacade::primitive parameter cannot be used in Collection' ON "
                + this.THIS().toString() + ": " + th.getMessage(), th);
        }
        try
        {
            final Object contextElement = this.THIS();
            boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"type.primitive"))).booleanValue()?(OCLExpressions.greater(OCLIntrospector.invoke(contextElement,"lower"),0)):true));
            if (!constraintValid)
            {
                validationMessages.add(
                    new ModelValidationMessage(
                        (MetafacadeBase)contextElement ,
                        "org::andromda::metafacades::uml::ParameterFacade::primitive parameter must be required",
                        "Primitive operation parameters must have a multiplicity lower bound > 0 (must be required). Use a wrapped type, or change the multiplicity."));
            }
        }
        catch (Throwable th)
        {
            Throwable cause = th.getCause();
            int depth = 0; // Some throwables have infinite recursion
            while (cause != null && depth < 7)
            {
                th = cause;
                depth++;
            }
            logger.error("Error validating constraint 'org::andromda::metafacades::uml::ParameterFacade::primitive parameter must be required' ON "
                + this.THIS().toString() + ": " + th.getMessage(), th);
        }
        try
        {
            final Object contextElement = this.THIS();
            boolean constraintValid = OCLResultEnsurer.ensure((Boolean.valueOf(String.valueOf(Boolean.valueOf(String.valueOf(OCLIntrospector.invoke(contextElement,"type.wrappedPrimitive"))).booleanValue()&&OCLExpressions.equal(OCLIntrospector.invoke(contextElement,"many"),false))).booleanValue()?(OCLExpressions.equal(OCLIntrospector.invoke(contextElement,"lower"),0)):true));
            if (!constraintValid)
            {
                validationMessages.add(
                    new ModelValidationMessage(
                        (MetafacadeBase)contextElement ,
                        "org::andromda::metafacades::uml::ParameterFacade::wrapped primitive parameter should not be required",
                        "Wrapped primitive operation parameters must have a multiplicity lower bound = 0 (must be optional). Use the unwrapped type, or change the multiplicity."));
            }
        }
        catch (Throwable th)
        {
            Throwable cause = th.getCause();
            int depth = 0; // Some throwables have infinite recursion
            while (cause != null && depth < 7)
            {
                th = cause;
                depth++;
            }
            logger.error("Error validating constraint 'org::andromda::metafacades::uml::ParameterFacade::wrapped primitive parameter should not be required' ON "
                + this.THIS().toString() + ": " + th.getMessage(), th);
        }
    }
}