Examples of primaryExpression


Examples of org.datanucleus.query.expression.PrimaryExpression

        String method = expr.getOperation();
        Object param = expr.getArguments().get(0);
        Object paramValue = null;
        if (param instanceof PrimaryExpression)
        {
            PrimaryExpression primExpr = (PrimaryExpression)param;
            paramValue = eval.getValueForPrimaryExpression(primExpr);
        }
        else if (param instanceof ParameterExpression)
        {
            ParameterExpression paramExpr = (ParameterExpression)param;
View Full Code Here

Examples of org.datanucleus.query.expression.PrimaryExpression

     * @see org.datanucleus.query.evaluator.AbstractExpressionEvaluator#processComExpression(org.datanucleus.query.expression.Expression)
     */
    protected Object processComExpression(Expression expr)
    {
        // Bitwise complement - only for integer values
        PrimaryExpression primExpr = (PrimaryExpression)expr.getLeft();
        Object primVal = getValueForPrimaryExpression(primExpr);
        int val = -1;
        if (primVal instanceof Number)
        {
            val = ((Number)primVal).intValue();
View Full Code Here

Examples of org.datanucleus.query.expression.PrimaryExpression

            NucleusLogger.QUERY.info("Please note that any escape character is currently ignored");
            // TODO Cater for optional second argument that is the escape character
        }
        if (param instanceof PrimaryExpression)
        {
            PrimaryExpression primExpr = (PrimaryExpression)param;
            argObj = eval.getValueForPrimaryExpression(primExpr);
        }
        else if (param instanceof ParameterExpression)
        {
            ParameterExpression paramExpr = (ParameterExpression)param;
View Full Code Here

Examples of org.datanucleus.query.expression.PrimaryExpression

     * @see org.datanucleus.query.evaluator.memory.InvocationEvaluator#evaluate(org.datanucleus.query.expression.InvokeExpression, org.datanucleus.query.evaluator.memory.InMemoryExpressionEvaluator)
     */
    public Object evaluate(InvokeExpression expr, Object invokedValue, InMemoryExpressionEvaluator eval)
    {
        // TODO Check whether first param is primary expression?
        PrimaryExpression paramExpr = (PrimaryExpression)expr.getArguments().get(0);
        Object value = eval.getValueForPrimaryExpression(paramExpr);
        return JDOHelper.getObjectId(value);
    }
View Full Code Here

Examples of org.datanucleus.query.expression.PrimaryExpression

                }
            }
        }
        else if (expr instanceof PrimaryExpression)
        {
            PrimaryExpression primExpr = (PrimaryExpression)expr;
            String id = primExpr.getId();
            if (id.equals("this"))
            {
                return true;
            }
            for (int j=0;j<exprGrouping.length;j++)
View Full Code Here

Examples of org.datanucleus.query.expression.PrimaryExpression

            str.append(")");
            return str.toString();
        }
        else if (expr instanceof PrimaryExpression)
        {
            PrimaryExpression primExpr = (PrimaryExpression)expr;
            if (primExpr.getLeft() != null)
            {
                return JDOQLQueryHelper.getJDOQLForExpression(primExpr.getLeft()) + "." + primExpr.getId();
            }
            return primExpr.getId();
        }
        else if (expr instanceof ParameterExpression)
        {
            ParameterExpression paramExpr = (ParameterExpression)expr;
            if (paramExpr.getId() != null)
View Full Code Here

Examples of org.datanucleus.query.expression.PrimaryExpression

                        jt = org.datanucleus.query.expression.JoinExpression.JoinType.JOIN_RIGHT_OUTER;
                    }

                    Attribute attr = join.getAttribute();
                    tuples.add(attr.getName());
                    PrimaryExpression primExpr = new PrimaryExpression(new ArrayList(tuples));
                    JoinExpression joinExpr = new JoinExpression(primExpr, join.getAlias(), jt);
                    if (currentExpr instanceof ClassExpression)
                    {
                        ((ClassExpression)currentExpr).setJoinExpression(joinExpr);
                    }
                    else
                    {
                        ((JoinExpression)currentExpr).setJoinExpression(joinExpr);
                    }

                    currentExpr = joinExpr;
                }
            }

            if (fetchJoins != null && !fetchJoins.isEmpty())
            {
                List tuples = new ArrayList();
                tuples.add(getAlias());

                Iterator<Fetch<X, ?>> iter = fetchJoins.iterator();
                Expression currentExpr = expr;
                while (iter.hasNext())
                {
                    Fetch<X, ?> join = iter.next();
                    org.datanucleus.query.expression.JoinExpression.JoinType jt = org.datanucleus.query.expression.JoinExpression.JoinType.JOIN_INNER;
                    if (join.getJoinType() == JoinType.LEFT)
                    {
                        jt = org.datanucleus.query.expression.JoinExpression.JoinType.JOIN_LEFT_OUTER;
                    }
                    else if (join.getJoinType() == JoinType.RIGHT)
                    {
                        jt = org.datanucleus.query.expression.JoinExpression.JoinType.JOIN_RIGHT_OUTER;
                    }

                    Attribute attr = join.getAttribute();
                    tuples.add(attr.getName());
                    PrimaryExpression primExpr = new PrimaryExpression(new ArrayList(tuples));
                    JoinExpression joinExpr = new JoinExpression(primExpr, null, jt);
                    if (currentExpr instanceof ClassExpression)
                    {
                        ((ClassExpression)currentExpr).setJoinExpression(joinExpr);
                    }
                    else
                    {
                        ((JoinExpression)currentExpr).setJoinExpression(joinExpr);
                    }

                    currentExpr = joinExpr;
                }
            }
            return expr;
        }
        else
        {
            List tuples = new ArrayList();
            String alias = getAlias();
            if (alias != null)
            {
                // Specified with an alias, so just use the alias
                tuples.add(getAlias());
            }
            else
            {
                String fieldName = attribute.getMetadata().getName();
                if (parent != null)
                {
                    // TODO What about multiple field usage "a.b.c" ?
                    tuples.add(parent.getAlias());
                    tuples.add(fieldName);
                    return new PrimaryExpression(tuples);
                }
            }
            return new PrimaryExpression(tuples);
        }
    }
View Full Code Here

Examples of org.datanucleus.query.expression.PrimaryExpression

        } else {
          // May need non-key for this
          keysOnly = false;
        }
      } else if (resultExpr instanceof PrimaryExpression) {
        PrimaryExpression primaryExpr = (PrimaryExpression) resultExpr;
        if (!primaryExpr.getId().equals(compilation.getCandidateAlias())) {
          AbstractMemberMetaData ammd =
            getMemberMetaDataForTuples(acmd, getTuples(primaryExpr, compilation.getCandidateAlias()));
          if (ammd == null) {
            throw noMetaDataException(primaryExpr.getId(), acmd.getFullClassName());
          }
          if (!ammd.isPrimaryKey()) {
            keysOnly = false;
          }
        }
View Full Code Here

Examples of org.datanucleus.query.expression.PrimaryExpression

   * @param qd The QueryData
   * @param orderExpr The OrderExpression
   * @return The name of the sort property that was added to the primary datastore query.
   */
  String getSortProperty(QueryData qd, OrderExpression orderExpr) {
    PrimaryExpression left = (PrimaryExpression) orderExpr.getLeft();
    AbstractClassMetaData acmd = qd.acmd;
    List<String> tuples = getTuples(left, qd.compilation.getCandidateAlias());
    if (isJoin(left.getLeft(), tuples)) {
      // Change the class meta data to the meta-data for the joined class
      acmd = getJoinClassMetaData(left.getLeft(), tuples, qd);
    }

    AbstractMemberMetaData ammd = getMemberMetaDataForTuples(acmd, tuples);
    if (ammd == null) {
      throw noMetaDataException(left.getId(), acmd.getFullClassName());
    }
    if (MetaDataUtils.isParentPKField(ammd)) {
      throw new UnsupportedDatastoreFeatureException("Cannot sort by parent.");
    } else {
      String sortProp;
View Full Code Here

Examples of org.datanucleus.query.expression.PrimaryExpression

      // TODO Support escape syntax
      throw new UnsupportedDatastoreFeatureException("GAE doesn't currently support ESCAPE syntax (" + escapeParam + ")");
    }

    if (invokeExpr.getLeft() instanceof PrimaryExpression) {
      PrimaryExpression leftExpr = (PrimaryExpression)invokeExpr.getLeft();

      // Make sure that the left expression is a String
      List<String> tuples = getTuples(leftExpr, qd.compilation.getCandidateAlias());
      if (tuples.size() == 1) {
        // Handle case of simple field name
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.