001package org.andromda.metafacades.uml14;
002
003import org.andromda.core.common.ExceptionUtils;
004import org.andromda.translation.ocl.ExpressionKinds;
005
006/**
007 * Metaclass facade implementation.
008 * @author Bob Fields
009 */
010public class EntityQueryOperationLogicImpl
011    extends EntityQueryOperationLogic
012{
013    private static final long serialVersionUID = 34L;
014    /**
015     * @param metaObject
016     * @param context
017     */
018    public EntityQueryOperationLogicImpl(
019        Object metaObject,
020        String context)
021    {
022        super(metaObject, context);
023    }
024
025    /**
026     * @see org.andromda.metafacades.uml.EntityQueryOperation#getQuery(String)
027     */
028    @Override
029    protected String handleGetQuery(String translation)
030    {
031        ExceptionUtils.checkEmpty("translation", translation);
032        final String[] translatedExpressions = this.translateConstraints(ExpressionKinds.BODY, translation);
033        String query = null;
034
035        // we just get the first body constraint found
036        if (translatedExpressions != null && translatedExpressions.length > 0)
037        {
038            query = translatedExpressions[0];
039        }
040        return query;
041    }
042}