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.ModelValidationMessage;
009import org.andromda.metafacades.uml.EntityAssociation;
010import org.omg.uml.foundation.core.UmlAssociation;
011
012/**
013 * Represents an association between entities.
014 * MetafacadeLogic for EntityAssociation
015 *
016 * @see EntityAssociation
017 */
018public abstract class EntityAssociationLogic
019    extends AssociationFacadeLogicImpl
020    implements EntityAssociation
021{
022    /**
023     * The underlying UML object
024     * @see Object
025     */
026    protected Object metaObject;
027
028    /** Create Metafacade implementation instance using the MetafacadeFactory from the context
029     * @param metaObjectIn
030     * @param context
031     */
032    protected EntityAssociationLogic(Object metaObjectIn, String context)
033    {
034        super((UmlAssociation)metaObjectIn, getContext(context));
035        this.metaObject = metaObjectIn;
036    }
037
038    /**
039     * Gets the context for this metafacade logic instance.
040     * @param context String. Set to EntityAssociation if null
041     * @return context String
042     */
043    private static String getContext(String context)
044    {
045        if (context == null)
046        {
047            context = "org.andromda.metafacades.uml.EntityAssociation";
048        }
049        return context;
050    }
051
052    /** Reset context only for non-root metafacades
053     * @param context
054     */
055    @Override
056    public void resetMetafacadeContext(String context)
057    {
058        if (!this.contextRoot) // reset context only for non-root metafacades
059        {
060            context = getContext(context);  // to have same value as in original constructor call
061            setMetafacadeContext (context);
062        }
063    }
064
065    /**
066     * @return boolean true always
067     * @see EntityAssociation
068     */
069    public boolean isEntityAssociationMetaType()
070    {
071        return true;
072    }
073
074    // --------------- attributes ---------------------
075
076   /**
077    * @see EntityAssociation#getTableName()
078    * @return String
079    */
080    protected abstract String handleGetTableName();
081
082    private String __tableName1a;
083    private boolean __tableName1aSet = false;
084
085    /**
086     * The name of the table if this is a many-to-many association.  Otherwise it just returns null
087     * if not part of a many-to-many association.
088     * @return (String)handleGetTableName()
089     */
090    public final String getTableName()
091    {
092        String tableName1a = this.__tableName1a;
093        if (!this.__tableName1aSet)
094        {
095            // tableName has no pre constraints
096            tableName1a = handleGetTableName();
097            // tableName has no post constraints
098            this.__tableName1a = tableName1a;
099            if (isMetafacadePropertyCachingEnabled())
100            {
101                this.__tableName1aSet = true;
102            }
103        }
104        return tableName1a;
105    }
106
107   /**
108    * @see EntityAssociation#getSchema()
109    * @return String
110    */
111    protected abstract String handleGetSchema();
112
113    private String __schema2a;
114    private boolean __schema2aSet = false;
115
116    /**
117     * The name of the schema that contains the database table
118     * @return (String)handleGetSchema()
119     */
120    public final String getSchema()
121    {
122        String schema2a = this.__schema2a;
123        if (!this.__schema2aSet)
124        {
125            // schema has no pre constraints
126            schema2a = handleGetSchema();
127            // schema has no post constraints
128            this.__schema2a = schema2a;
129            if (isMetafacadePropertyCachingEnabled())
130            {
131                this.__schema2aSet = true;
132            }
133        }
134        return schema2a;
135    }
136
137   /**
138    * @see EntityAssociation#isEntityAssociation()
139    * @return boolean
140    */
141    protected abstract boolean handleIsEntityAssociation();
142
143    private boolean __entityAssociation3a;
144    private boolean __entityAssociation3aSet = false;
145
146    /**
147     * is this an EntityAssociation?
148     * @return (boolean)handleIsEntityAssociation()
149     */
150    public final boolean isEntityAssociation()
151    {
152        boolean entityAssociation3a = this.__entityAssociation3a;
153        if (!this.__entityAssociation3aSet)
154        {
155            // entityAssociation has no pre constraints
156            entityAssociation3a = handleIsEntityAssociation();
157            // entityAssociation has no post constraints
158            this.__entityAssociation3a = entityAssociation3a;
159            if (isMetafacadePropertyCachingEnabled())
160            {
161                this.__entityAssociation3aSet = true;
162            }
163        }
164        return entityAssociation3a;
165    }
166
167    /**
168     * @param validationMessages Collection<ModelValidationMessage>
169     * @see AssociationFacadeLogicImpl#validateInvariants(Collection validationMessages)
170     */
171    @Override
172    public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
173    {
174        super.validateInvariants(validationMessages);
175    }
176}