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.EntityQueryOperation;
010import org.omg.uml.foundation.core.Operation;
011
012/**
013 * Represents a persistent entity finder method.
014 * MetafacadeLogic for EntityQueryOperation
015 *
016 * @see EntityQueryOperation
017 */
018public abstract class EntityQueryOperationLogic
019    extends OperationFacadeLogicImpl
020    implements EntityQueryOperation
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 EntityQueryOperationLogic(Object metaObjectIn, String context)
033    {
034        super((Operation)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 EntityQueryOperation 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.EntityQueryOperation";
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 EntityQueryOperation
068     */
069    public boolean isEntityQueryOperationMetaType()
070    {
071        return true;
072    }
073
074    // ---------------- business methods ----------------------
075
076    /**
077     * Method to be implemented in descendants
078     * The query string for this EntityFinderMethod.  The query returned is based on the
079     * 'translation' passed in.  The translation must be one available to AndroMDA found with a
080     * translation-library.
081     * @param translation
082     * @return String
083     */
084    protected abstract String handleGetQuery(String translation);
085
086    /**
087     * The query string for this EntityFinderMethod.  The query returned is based on the
088     * 'translation' passed in.  The translation must be one available to AndroMDA found with a
089     * translation-library.
090     * @param translation String
091     * TODO: Model Documentation for
092     * EntityQueryOperation.getQuery(translation)
093     * @return handleGetQuery(translation)
094     */
095    public String getQuery(String translation)
096    {
097        // getQuery has no pre constraints
098        String returnValue = handleGetQuery(translation);
099        // getQuery has no post constraints
100        return returnValue;
101    }
102
103    // ------------- associations ------------------
104
105    /**
106     * @param validationMessages Collection<ModelValidationMessage>
107     * @see OperationFacadeLogicImpl#validateInvariants(Collection validationMessages)
108     */
109    @Override
110    public void validateInvariants(Collection<ModelValidationMessage> validationMessages)
111    {
112        super.validateInvariants(validationMessages);
113    }
114}