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.FrontEndAction;
011import org.andromda.metafacades.uml.FrontEndControllerOperation;
012import org.andromda.metafacades.uml.FrontEndParameter;
013import org.andromda.metafacades.uml.FrontEndView;
014import org.apache.log4j.Logger;
015import org.omg.uml.foundation.core.Parameter;
016
017/**
018 * A front-end parameter is a parameter passed between front-end action states.
019 * MetafacadeLogic for FrontEndParameter
020 *
021 * @see FrontEndParameter
022 */
023public abstract class FrontEndParameterLogic
024    extends ParameterFacadeLogicImpl
025    implements FrontEndParameter
026{
027    /**
028     * The underlying UML object
029     * @see Object
030     */
031    protected Object metaObject;
032
033    /** Create Metafacade implementation instance using the MetafacadeFactory from the context
034     * @param metaObjectIn
035     * @param context
036     */
037    protected FrontEndParameterLogic(Object metaObjectIn, String context)
038    {
039        super((Parameter)metaObjectIn, getContext(context));
040        this.metaObject = metaObjectIn;
041    }
042
043    /**
044     * The logger instance.
045     */
046    private static final Logger logger = Logger.getLogger(FrontEndParameterLogic.class);
047
048    /**
049     * Gets the context for this metafacade logic instance.
050     * @param context String. Set to FrontEndParameter if null
051     * @return context String
052     */
053    private static String getContext(String context)
054    {
055        if (context == null)
056        {
057            context = "org.andromda.metafacades.uml.FrontEndParameter";
058        }
059        return context;
060    }
061
062    /** Reset context only for non-root metafacades
063     * @param context
064     */
065    @Override
066    public void resetMetafacadeContext(String context)
067    {
068        if (!this.contextRoot) // reset context only for non-root metafacades
069        {
070            context = getContext(context);  // to have same value as in original constructor call
071            setMetafacadeContext (context);
072        }
073    }
074
075    /**
076     * @return boolean true always
077     * @see FrontEndParameter
078     */
079    public boolean isFrontEndParameterMetaType()
080    {
081        return true;
082    }
083
084    // --------------- attributes ---------------------
085
086   /**
087    * @see FrontEndParameter#isControllerOperationArgument()
088    * @return boolean
089    */
090    protected abstract boolean handleIsControllerOperationArgument();
091
092    private boolean __controllerOperationArgument1a;
093    private boolean __controllerOperationArgument1aSet = false;
094
095    /**
096     * Indicates whether or not this parameter is an argument of a controller operation.
097     * @return (boolean)handleIsControllerOperationArgument()
098     */
099    public final boolean isControllerOperationArgument()
100    {
101        boolean controllerOperationArgument1a = this.__controllerOperationArgument1a;
102        if (!this.__controllerOperationArgument1aSet)
103        {
104            // controllerOperationArgument has no pre constraints
105            controllerOperationArgument1a = handleIsControllerOperationArgument();
106            // controllerOperationArgument has no post constraints
107            this.__controllerOperationArgument1a = controllerOperationArgument1a;
108            if (isMetafacadePropertyCachingEnabled())
109            {
110                this.__controllerOperationArgument1aSet = true;
111            }
112        }
113        return controllerOperationArgument1a;
114    }
115
116   /**
117    * @see FrontEndParameter#isContainedInFrontEndUseCase()
118    * @return boolean
119    */
120    protected abstract boolean handleIsContainedInFrontEndUseCase();
121
122    private boolean __containedInFrontEndUseCase2a;
123    private boolean __containedInFrontEndUseCase2aSet = false;
124
125    /**
126     * Indicates if this parameter is contained in a "front-end" use case.
127     * @return (boolean)handleIsContainedInFrontEndUseCase()
128     */
129    public final boolean isContainedInFrontEndUseCase()
130    {
131        boolean containedInFrontEndUseCase2a = this.__containedInFrontEndUseCase2a;
132        if (!this.__containedInFrontEndUseCase2aSet)
133        {
134            // containedInFrontEndUseCase has no pre constraints
135            containedInFrontEndUseCase2a = handleIsContainedInFrontEndUseCase();
136            // containedInFrontEndUseCase has no post constraints
137            this.__containedInFrontEndUseCase2a = containedInFrontEndUseCase2a;
138            if (isMetafacadePropertyCachingEnabled())
139            {
140                this.__containedInFrontEndUseCase2aSet = true;
141            }
142        }
143        return containedInFrontEndUseCase2a;
144    }
145
146   /**
147    * @see FrontEndParameter#isActionParameter()
148    * @return boolean
149    */
150    protected abstract boolean handleIsActionParameter();
151
152    private boolean __actionParameter3a;
153    private boolean __actionParameter3aSet = false;
154
155    /**
156     * Indicates whether or not this is an action parameter or not.
157     * @return (boolean)handleIsActionParameter()
158     */
159    public final boolean isActionParameter()
160    {
161        boolean actionParameter3a = this.__actionParameter3a;
162        if (!this.__actionParameter3aSet)
163        {
164            // actionParameter has no pre constraints
165            actionParameter3a = handleIsActionParameter();
166            // actionParameter has no post constraints
167            this.__actionParameter3a = actionParameter3a;
168            if (isMetafacadePropertyCachingEnabled())
169            {
170                this.__actionParameter3aSet = true;
171            }
172        }
173        return actionParameter3a;
174    }
175
176   /**
177    * @see FrontEndParameter#isTable()
178    * @return boolean
179    */
180    protected abstract boolean handleIsTable();
181
182    private boolean __table4a;
183    private boolean __table4aSet = false;
184
185    /**
186     * Indicates whether or not this parameter represents a table.
187     * @return (boolean)handleIsTable()
188     */
189    public final boolean isTable()
190    {
191        boolean table4a = this.__table4a;
192        if (!this.__table4aSet)
193        {
194            // table has no pre constraints
195            table4a = handleIsTable();
196            // table has no post constraints
197            this.__table4a = table4a;
198            if (isMetafacadePropertyCachingEnabled())
199            {
200                this.__table4aSet = true;
201            }
202        }
203        return table4a;
204    }
205
206   /**
207    * @see FrontEndParameter#getTableColumnNames()
208    * @return Collection<String>
209    */
210    protected abstract Collection<String> handleGetTableColumnNames();
211
212    private Collection<String> __tableColumnNames5a;
213    private boolean __tableColumnNames5aSet = false;
214
215    /**
216     * All the columns for this parameter if it represents a table variable. If a column is linked
217     * by an event (action) a FrontEndParameter instance is included in the return value, otherwise
218     * a plain String representing the column name.
219     * @return (Collection<String>)handleGetTableColumnNames()
220     */
221    public final Collection<String> getTableColumnNames()
222    {
223        Collection<String> tableColumnNames5a = this.__tableColumnNames5a;
224        if (!this.__tableColumnNames5aSet)
225        {
226            // tableColumnNames has no pre constraints
227            tableColumnNames5a = handleGetTableColumnNames();
228            // tableColumnNames has no post constraints
229            this.__tableColumnNames5a = tableColumnNames5a;
230            if (isMetafacadePropertyCachingEnabled())
231            {
232                this.__tableColumnNames5aSet = true;
233            }
234        }
235        return tableColumnNames5a;
236    }
237
238   /**
239    * @see FrontEndParameter#getTableColumns()
240    * @return Collection<String>
241    */
242    protected abstract Collection<String> handleGetTableColumns();
243
244    private Collection<String> __tableColumns6a;
245    private boolean __tableColumns6aSet = false;
246
247    /**
248     * A list of all attributes which make up the table columns of this table (this only contains
249     * attributes when the table is represented by an array).
250     * @return (Collection<String>)handleGetTableColumns()
251     */
252    public final Collection<String> getTableColumns()
253    {
254        Collection<String> tableColumns6a = this.__tableColumns6a;
255        if (!this.__tableColumns6aSet)
256        {
257            // tableColumns has no pre constraints
258            tableColumns6a = handleGetTableColumns();
259            // tableColumns has no post constraints
260            this.__tableColumns6a = tableColumns6a;
261            if (isMetafacadePropertyCachingEnabled())
262            {
263                this.__tableColumns6aSet = true;
264            }
265        }
266        return tableColumns6a;
267    }
268
269   /**
270    * @see FrontEndParameter#getTableAttributeNames()
271    * @return Collection<String>
272    */
273    protected abstract Collection<String> handleGetTableAttributeNames();
274
275    private Collection<String> __tableAttributeNames7a;
276    private boolean __tableAttributeNames7aSet = false;
277
278    /**
279     * A collection of all possible attribute names of a table (this will only work when your table
280     * is modeled as an array..not a collection).
281     * @return (Collection<String>)handleGetTableAttributeNames()
282     */
283    public final Collection<String> getTableAttributeNames()
284    {
285        Collection<String> tableAttributeNames7a = this.__tableAttributeNames7a;
286        if (!this.__tableAttributeNames7aSet)
287        {
288            // tableAttributeNames has no pre constraints
289            tableAttributeNames7a = handleGetTableAttributeNames();
290            // tableAttributeNames has no post constraints
291            this.__tableAttributeNames7a = tableAttributeNames7a;
292            if (isMetafacadePropertyCachingEnabled())
293            {
294                this.__tableAttributeNames7aSet = true;
295            }
296        }
297        return tableAttributeNames7a;
298    }
299
300    // ------------- associations ------------------
301
302    private FrontEndView __getView1r;
303    private boolean __getView1rSet = false;
304
305    /**
306     * All those variables that will be present as variables in the target view. These are the
307     * trigger parameters on the incoming transitions.
308     * @return (FrontEndView)handleGetView()
309     */
310    public final FrontEndView getView()
311    {
312        FrontEndView getView1r = this.__getView1r;
313        if (!this.__getView1rSet)
314        {
315            // variables has no pre constraints
316            Object result = handleGetView();
317            MetafacadeBase shieldedResult = this.shieldedElement(result);
318            try
319            {
320                getView1r = (FrontEndView)shieldedResult;
321            }
322            catch (ClassCastException ex)
323            {
324                // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
325                FrontEndParameterLogic.logger.warn("incorrect metafacade cast for FrontEndParameterLogic.getView FrontEndView " + result + ": " + shieldedResult);
326            }
327            // variables has no post constraints
328            this.__getView1r = getView1r;
329            if (isMetafacadePropertyCachingEnabled())
330            {
331                this.__getView1rSet = true;
332            }
333        }
334        return getView1r;
335    }
336
337    /**
338     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
339     * @return Object
340     */
341    protected abstract Object handleGetView();
342
343    private FrontEndAction __getAction2r;
344    private boolean __getAction2rSet = false;
345
346    /**
347     * All parameters sent by this "front-end" action.
348     * @return (FrontEndAction)handleGetAction()
349     */
350    public final FrontEndAction getAction()
351    {
352        FrontEndAction getAction2r = this.__getAction2r;
353        if (!this.__getAction2rSet)
354        {
355            // parameters has no pre constraints
356            Object result = handleGetAction();
357            MetafacadeBase shieldedResult = this.shieldedElement(result);
358            try
359            {
360                getAction2r = (FrontEndAction)shieldedResult;
361            }
362            catch (ClassCastException ex)
363            {
364                // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
365                FrontEndParameterLogic.logger.warn("incorrect metafacade cast for FrontEndParameterLogic.getAction FrontEndAction " + result + ": " + shieldedResult);
366            }
367            // parameters has no post constraints
368            this.__getAction2r = getAction2r;
369            if (isMetafacadePropertyCachingEnabled())
370            {
371                this.__getAction2rSet = true;
372            }
373        }
374        return getAction2r;
375    }
376
377    /**
378     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
379     * @return Object
380     */
381    protected abstract Object handleGetAction();
382
383    private FrontEndControllerOperation __getControllerOperation3r;
384    private boolean __getControllerOperation3rSet = false;
385
386    /**
387     * The set of fields in the form made up form this controller operation's parameters.
388     * @return (FrontEndControllerOperation)handleGetControllerOperation()
389     */
390    public final FrontEndControllerOperation getControllerOperation()
391    {
392        FrontEndControllerOperation getControllerOperation3r = this.__getControllerOperation3r;
393        if (!this.__getControllerOperation3rSet)
394        {
395            // formFields has no pre constraints
396            Object result = handleGetControllerOperation();
397            MetafacadeBase shieldedResult = this.shieldedElement(result);
398            try
399            {
400                getControllerOperation3r = (FrontEndControllerOperation)shieldedResult;
401            }
402            catch (ClassCastException ex)
403            {
404                // Bad things happen if the metafacade type mapping in metafacades.xml is wrong - Warn
405                FrontEndParameterLogic.logger.warn("incorrect metafacade cast for FrontEndParameterLogic.getControllerOperation FrontEndControllerOperation " + result + ": " + shieldedResult);
406            }
407            // formFields has no post constraints
408            this.__getControllerOperation3r = getControllerOperation3r;
409            if (isMetafacadePropertyCachingEnabled())
410            {
411                this.__getControllerOperation3rSet = true;
412            }
413        }
414        return getControllerOperation3r;
415    }
416
417    /**
418     * UML Specific type is transformed by shieldedElements to AndroMDA Metafacade type
419     * @return Object
420     */
421    protected abstract Object handleGetControllerOperation();
422
423    /**
424     * @param validationMessages Collection<ModelValidationMessage>
425     * @see ParameterFacadeLogicImpl#validateInvariants(Collection validationMessages)
426     */
427    @Override
428    public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
429    {
430        super.validateInvariants(validationMessages);
431    }
432}