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.EntityAttribute;
010import org.andromda.metafacades.uml.TypeMappings;
011import org.omg.uml.foundation.core.Attribute;
012
013/**
014 * Represents an attribute of an entity.
015 * MetafacadeLogic for EntityAttribute
016 *
017 * @see EntityAttribute
018 */
019public abstract class EntityAttributeLogic
020    extends AttributeFacadeLogicImpl
021    implements EntityAttribute
022{
023    /**
024     * The underlying UML object
025     * @see Object
026     */
027    protected Object metaObject;
028
029    /** Create Metafacade implementation instance using the MetafacadeFactory from the context
030     * @param metaObjectIn
031     * @param context
032     */
033    protected EntityAttributeLogic(Object metaObjectIn, String context)
034    {
035        super((Attribute)metaObjectIn, getContext(context));
036        this.metaObject = metaObjectIn;
037    }
038
039    /**
040     * Gets the context for this metafacade logic instance.
041     * @param context String. Set to EntityAttribute if null
042     * @return context String
043     */
044    private static String getContext(String context)
045    {
046        if (context == null)
047        {
048            context = "org.andromda.metafacades.uml.EntityAttribute";
049        }
050        return context;
051    }
052
053    /** Reset context only for non-root metafacades
054     * @param context
055     */
056    @Override
057    public void resetMetafacadeContext(String context)
058    {
059        if (!this.contextRoot) // reset context only for non-root metafacades
060        {
061            context = getContext(context);  // to have same value as in original constructor call
062            setMetafacadeContext (context);
063        }
064    }
065
066    /**
067     * @return boolean true always
068     * @see EntityAttribute
069     */
070    public boolean isEntityAttributeMetaType()
071    {
072        return true;
073    }
074
075    // --------------- attributes ---------------------
076
077   /**
078    * @see EntityAttribute#getColumnLength()
079    * @return String
080    */
081    protected abstract String handleGetColumnLength();
082
083    private String __columnLength1a;
084    private boolean __columnLength1aSet = false;
085
086    /**
087     * The length of the column that persists this entity attribute.
088     * @return (String)handleGetColumnLength()
089     */
090    public final String getColumnLength()
091    {
092        String columnLength1a = this.__columnLength1a;
093        if (!this.__columnLength1aSet)
094        {
095            // columnLength has no pre constraints
096            columnLength1a = handleGetColumnLength();
097            // columnLength has no post constraints
098            this.__columnLength1a = columnLength1a;
099            if (isMetafacadePropertyCachingEnabled())
100            {
101                this.__columnLength1aSet = true;
102            }
103        }
104        return columnLength1a;
105    }
106
107   /**
108    * @see EntityAttribute#getColumnName()
109    * @return String
110    */
111    protected abstract String handleGetColumnName();
112
113    private String __columnName2a;
114    private boolean __columnName2aSet = false;
115
116    /**
117     * The name of the table column to which this entity is mapped.
118     * @return (String)handleGetColumnName()
119     */
120    public final String getColumnName()
121    {
122        String columnName2a = this.__columnName2a;
123        if (!this.__columnName2aSet)
124        {
125            // columnName has no pre constraints
126            columnName2a = handleGetColumnName();
127            // columnName has no post constraints
128            this.__columnName2a = columnName2a;
129            if (isMetafacadePropertyCachingEnabled())
130            {
131                this.__columnName2aSet = true;
132            }
133        }
134        return columnName2a;
135    }
136
137   /**
138    * @see EntityAttribute#getJdbcMappings()
139    * @return TypeMappings
140    */
141    protected abstract TypeMappings handleGetJdbcMappings();
142
143    private TypeMappings __jdbcMappings3a;
144    private boolean __jdbcMappings3aSet = false;
145
146    /**
147     * The PIM to language specific mappings for JDBC.
148     * @return (TypeMappings)handleGetJdbcMappings()
149     */
150    public final TypeMappings getJdbcMappings()
151    {
152        TypeMappings jdbcMappings3a = this.__jdbcMappings3a;
153        if (!this.__jdbcMappings3aSet)
154        {
155            // jdbcMappings has no pre constraints
156            jdbcMappings3a = handleGetJdbcMappings();
157            // jdbcMappings has no post constraints
158            this.__jdbcMappings3a = jdbcMappings3a;
159            if (isMetafacadePropertyCachingEnabled())
160            {
161                this.__jdbcMappings3aSet = true;
162            }
163        }
164        return jdbcMappings3a;
165    }
166
167   /**
168    * @see EntityAttribute#getJdbcType()
169    * @return String
170    */
171    protected abstract String handleGetJdbcType();
172
173    private String __jdbcType4a;
174    private boolean __jdbcType4aSet = false;
175
176    /**
177     * The JDBC type for this entity attribute.
178     * @return (String)handleGetJdbcType()
179     */
180    public final String getJdbcType()
181    {
182        String jdbcType4a = this.__jdbcType4a;
183        if (!this.__jdbcType4aSet)
184        {
185            // jdbcType has no pre constraints
186            jdbcType4a = handleGetJdbcType();
187            // jdbcType has no post constraints
188            this.__jdbcType4a = jdbcType4a;
189            if (isMetafacadePropertyCachingEnabled())
190            {
191                this.__jdbcType4aSet = true;
192            }
193        }
194        return jdbcType4a;
195    }
196
197   /**
198    * @see EntityAttribute#getSqlMappings()
199    * @return TypeMappings
200    */
201    protected abstract TypeMappings handleGetSqlMappings();
202
203    private TypeMappings __sqlMappings5a;
204    private boolean __sqlMappings5aSet = false;
205
206    /**
207     * The SQL mappings (i.e. the mappings which provide PIM to SQL mappings).
208     * @return (TypeMappings)handleGetSqlMappings()
209     */
210    public final TypeMappings getSqlMappings()
211    {
212        TypeMappings sqlMappings5a = this.__sqlMappings5a;
213        if (!this.__sqlMappings5aSet)
214        {
215            // sqlMappings has no pre constraints
216            sqlMappings5a = handleGetSqlMappings();
217            // sqlMappings has no post constraints
218            this.__sqlMappings5a = sqlMappings5a;
219            if (isMetafacadePropertyCachingEnabled())
220            {
221                this.__sqlMappings5aSet = true;
222            }
223        }
224        return sqlMappings5a;
225    }
226
227   /**
228    * @see EntityAttribute#getSqlType()
229    * @return String
230    */
231    protected abstract String handleGetSqlType();
232
233    private String __sqlType6a;
234    private boolean __sqlType6aSet = false;
235
236    /**
237     * The SQL type for this attribute.
238     * @return (String)handleGetSqlType()
239     */
240    public final String getSqlType()
241    {
242        String sqlType6a = this.__sqlType6a;
243        if (!this.__sqlType6aSet)
244        {
245            // sqlType has no pre constraints
246            sqlType6a = handleGetSqlType();
247            // sqlType has no post constraints
248            this.__sqlType6a = sqlType6a;
249            if (isMetafacadePropertyCachingEnabled())
250            {
251                this.__sqlType6aSet = true;
252            }
253        }
254        return sqlType6a;
255    }
256
257   /**
258    * @see EntityAttribute#isIdentifier()
259    * @return boolean
260    */
261    protected abstract boolean handleIsIdentifier();
262
263    private boolean __identifier7a;
264    private boolean __identifier7aSet = false;
265
266    /**
267     * True if this attribute is an identifier for its entity.
268     * @return (boolean)handleIsIdentifier()
269     */
270    public final boolean isIdentifier()
271    {
272        boolean identifier7a = this.__identifier7a;
273        if (!this.__identifier7aSet)
274        {
275            // identifier has no pre constraints
276            identifier7a = handleIsIdentifier();
277            // identifier has no post constraints
278            this.__identifier7a = identifier7a;
279            if (isMetafacadePropertyCachingEnabled())
280            {
281                this.__identifier7aSet = true;
282            }
283        }
284        return identifier7a;
285    }
286
287   /**
288    * @see EntityAttribute#getColumnIndex()
289    * @return String
290    */
291    protected abstract String handleGetColumnIndex();
292
293    private String __columnIndex8a;
294    private boolean __columnIndex8aSet = false;
295
296    /**
297     * The name of the index to create on a column that persists the entity attribute.
298     * @return (String)handleGetColumnIndex()
299     */
300    public final String getColumnIndex()
301    {
302        String columnIndex8a = this.__columnIndex8a;
303        if (!this.__columnIndex8aSet)
304        {
305            // columnIndex has no pre constraints
306            columnIndex8a = handleGetColumnIndex();
307            // columnIndex has no post constraints
308            this.__columnIndex8a = columnIndex8a;
309            if (isMetafacadePropertyCachingEnabled())
310            {
311                this.__columnIndex8aSet = true;
312            }
313        }
314        return columnIndex8a;
315    }
316
317   /**
318    * @see EntityAttribute#isTransient()
319    * @return boolean
320    */
321    protected abstract boolean handleIsTransient();
322
323    private boolean __transient9a;
324    private boolean __transient9aSet = false;
325
326    /**
327     * Indicates this attribute should be ignored by the persistence layer.
328     * @return (boolean)handleIsTransient()
329     */
330    public final boolean isTransient()
331    {
332        boolean transient9a = this.__transient9a;
333        if (!this.__transient9aSet)
334        {
335            // transient has no pre constraints
336            transient9a = handleIsTransient();
337            // transient has no post constraints
338            this.__transient9a = transient9a;
339            if (isMetafacadePropertyCachingEnabled())
340            {
341                this.__transient9aSet = true;
342            }
343        }
344        return transient9a;
345    }
346
347   /**
348    * @see EntityAttribute#getUniqueGroup()
349    * @return String
350    */
351    protected abstract String handleGetUniqueGroup();
352
353    private String __uniqueGroup10a;
354    private boolean __uniqueGroup10aSet = false;
355
356    /**
357     * The name of the unique-key that this unique attribute belongs
358     * @return (String)handleGetUniqueGroup()
359     */
360    public final String getUniqueGroup()
361    {
362        String uniqueGroup10a = this.__uniqueGroup10a;
363        if (!this.__uniqueGroup10aSet)
364        {
365            // uniqueGroup has no pre constraints
366            uniqueGroup10a = handleGetUniqueGroup();
367            // uniqueGroup has no post constraints
368            this.__uniqueGroup10a = uniqueGroup10a;
369            if (isMetafacadePropertyCachingEnabled())
370            {
371                this.__uniqueGroup10aSet = true;
372            }
373        }
374        return uniqueGroup10a;
375    }
376
377    // ------------- associations ------------------
378
379    /**
380     * @param validationMessages Collection<ModelValidationMessage>
381     * @see AttributeFacadeLogicImpl#validateInvariants(Collection validationMessages)
382     */
383    @Override
384    public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
385    {
386        super.validateInvariants(validationMessages);
387    }
388}