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.EntityAttribute;
011import org.andromda.metafacades.uml.ManageableEntityAssociationEnd;
012import org.apache.log4j.Logger;
013
014/**
015 * TODO: Model Documentation for ManageableEntityAssociationEnd
016 * MetafacadeLogic for ManageableEntityAssociationEnd
017 *
018 * @see ManageableEntityAssociationEnd
019 */
020public abstract class ManageableEntityAssociationEndLogic
021    extends EntityAssociationEndLogicImpl
022    implements ManageableEntityAssociationEnd
023{
024    /**
025     * The underlying UML object
026     * @see Object
027     */
028    protected Object metaObject;
029
030    /** Create Metafacade implementation instance using the MetafacadeFactory from the context
031     * @param metaObjectIn
032     * @param context
033     */
034    protected ManageableEntityAssociationEndLogic(Object metaObjectIn, String context)
035    {
036        super(metaObjectIn, getContext(context));
037        this.metaObject = metaObjectIn;
038    }
039
040    /**
041     * The logger instance.
042     */
043    private static final Logger logger = Logger.getLogger(ManageableEntityAssociationEndLogic.class);
044
045    /**
046     * Gets the context for this metafacade logic instance.
047     * @param context String. Set to ManageableEntityAssociationEnd if null
048     * @return context String
049     */
050    private static String getContext(String context)
051    {
052        if (context == null)
053        {
054            context = "org.andromda.metafacades.uml.ManageableEntityAssociationEnd";
055        }
056        return context;
057    }
058
059    /** Reset context only for non-root metafacades
060     * @param context
061     */
062    @Override
063    public void resetMetafacadeContext(String context)
064    {
065        if (!this.contextRoot) // reset context only for non-root metafacades
066        {
067            context = getContext(context);  // to have same value as in original constructor call
068            setMetafacadeContext (context);
069        }
070    }
071
072    /**
073     * @return boolean true always
074     * @see ManageableEntityAssociationEnd
075     */
076    public boolean isManageableEntityAssociationEndMetaType()
077    {
078        return true;
079    }
080
081    // --------------- attributes ---------------------
082
083   /**
084    * @see ManageableEntityAssociationEnd#isDisplay()
085    * @return boolean
086    */
087    protected abstract boolean handleIsDisplay();
088
089    private boolean __display1a;
090    private boolean __display1aSet = false;
091
092    /**
093     * Whether or not this association end should be displayed.
094     * @return (boolean)handleIsDisplay()
095     */
096    public final boolean isDisplay()
097    {
098        boolean display1a = this.__display1a;
099        if (!this.__display1aSet)
100        {
101            // display has no pre constraints
102            display1a = handleIsDisplay();
103            // display has no post constraints
104            this.__display1a = display1a;
105            if (isMetafacadePropertyCachingEnabled())
106            {
107                this.__display1aSet = true;
108            }
109        }
110        return display1a;
111    }
112
113    // ------------- associations ------------------
114
115    private EntityAttribute __getManageableIdentifier1r;
116    private boolean __getManageableIdentifier1rSet = false;
117
118    /**
119     * TODO: Model Documentation for ManageableEntityAssociationEnd
120     * @return (EntityAttribute)handleGetManageableIdentifier()
121     */
122    public final EntityAttribute getManageableIdentifier()
123    {
124        EntityAttribute getManageableIdentifier1r = this.__getManageableIdentifier1r;
125        if (!this.__getManageableIdentifier1rSet)
126        {
127            // manageableEntityAssociationEnd has no pre constraints
128            Object result = handleGetManageableIdentifier();
129            MetafacadeBase shieldedResult = this.shieldedElement(result);
130            try
131            {
132                getManageableIdentifier1r = (EntityAttribute)shieldedResult;
133            }
134            catch (ClassCastException ex)
135            {
136                // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
137                ManageableEntityAssociationEndLogic.logger.warn("incorrect metafacade cast for ManageableEntityAssociationEndLogic.getManageableIdentifier EntityAttribute " + result + ": " + shieldedResult);
138            }
139            // manageableEntityAssociationEnd has no post constraints
140            this.__getManageableIdentifier1r = getManageableIdentifier1r;
141            if (isMetafacadePropertyCachingEnabled())
142            {
143                this.__getManageableIdentifier1rSet = true;
144            }
145        }
146        return getManageableIdentifier1r;
147    }
148
149    /**
150     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
151     * @return Object
152     */
153    protected abstract Object handleGetManageableIdentifier();
154
155    /**
156     * @param validationMessages Collection<ModelValidationMessage>
157     * @see EntityAssociationEndLogicImpl#validateInvariants(Collection validationMessages)
158     */
159    @Override
160    public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
161    {
162        super.validateInvariants(validationMessages);
163    }
164}