View Javadoc
1   package org.andromda.metafacades.emf.uml22;
2   
3   import org.andromda.core.common.ExceptionUtils;
4   import org.andromda.translation.ocl.ExpressionKinds;
5   
6   /**
7    * MetafacadeLogic implementation for
8    * org.andromda.metafacades.uml.EntityQueryOperation.
9    *
10   * @see org.andromda.metafacades.uml.EntityQueryOperation
11   */
12  public class EntityQueryOperationLogicImpl
13      extends EntityQueryOperationLogic
14  {
15      private static final long serialVersionUID = 34L;
16      /**
17       * @param metaObject
18       * @param context
19       */
20      public EntityQueryOperationLogicImpl(
21          final Object metaObject,
22          final String context)
23      {
24          super(metaObject, context);
25      }
26  
27      /**
28       * @see org.andromda.metafacades.uml.EntityQueryOperation#getQuery(String)
29       */
30      @Override
31      protected String handleGetQuery(final String translation)
32      {
33          ExceptionUtils.checkEmpty(
34              "translation",
35              translation);
36          final String[] translatedExpressions = this.translateConstraints(
37                  ExpressionKinds.BODY,
38                  translation);
39          String query = null;
40  
41          // we just get the first body constraint found
42          if (translatedExpressions != null && translatedExpressions.length > 0)
43          {
44              query = translatedExpressions[0];
45          }
46          return query;
47      }
48  }