Package org.datanucleus.query.expression

Examples of org.datanucleus.query.expression.OrderExpression


            Expression[] orderingExpr = compilation.getExprOrdering();
            SQLExpression[] orderSqlExprs = new SQLExpression[orderingExpr.length];
            boolean[] directions = new boolean[orderingExpr.length];
            for (int i = 0; i < orderingExpr.length; i++)
            {
                OrderExpression orderExpr = (OrderExpression)orderingExpr[i];
                orderSqlExprs[i] = (SQLExpression)orderExpr.getLeft().evaluate(this);
                String orderDir = orderExpr.getSortOrder();
                directions[i] = ((orderDir == null || orderDir.equals("ascending")) ? false : true);
            }
            stmt.setOrdering(orderSqlExprs, directions);
            compileComponent = null;
        }
View Full Code Here


                            candidateAlias));

                    int result = ((Comparable)a).compareTo(b);
                    if (result != 0)
                    {
                        OrderExpression orderExpr = (OrderExpression)ordering[i];
                        if (orderExpr.getSortOrder() == null || orderExpr.getSortOrder().equals("ascending"))
                        {
                            // Ascending
                            return result;
                        }
                        else
View Full Code Here

                Iterator<Order> orderIter = ordering.iterator();
                i=0;
                while (orderIter.hasNext())
                {
                    OrderImpl order = (OrderImpl)orderIter.next();
                    OrderExpression orderExpr = order.getQueryExpression();
                    orderExpr.bind(symtbl);
                    orderExprs[i++] = orderExpr;
                }
            }

            compilation = new QueryCompilation(candidateClass, candidateAlias, symtbl, resultExprs,
View Full Code Here

      return;
    }

    try {
      for (Expression expr : orderBys) {
        OrderExpression orderExpr = (OrderExpression) expr;
        Query.SortDirection dir = getSortDirection(orderExpr);
        String sortProp = getSortProperty(qd, orderExpr);
        qd.primaryDatastoreQuery.addSort(sortProp, dir);
      }
    } catch (NucleusException ne) {
View Full Code Here

    return getMetaDataManager().getMetaDataForClass(sym.getValueType(), getClassLoaderResolver());
  }

  private OrderExpression createJoinOrderExpression(PrimaryExpression expression) {
    PrimaryExpression primaryOrderExpr = new PrimaryExpression(expression.getTuples());
    return new OrderExpression(primaryOrderExpr);
  }
View Full Code Here

  /**
   * @return The name of the sort property that was added to the primary
   * datastore query.
   */
  String getSortProperty(QueryData qd, Expression expr) {
    OrderExpression oe = (OrderExpression) expr;
    PrimaryExpression left = (PrimaryExpression) oe.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);
View Full Code Here

  }

  private OrderExpression createJoinOrderExpression(PrimaryExpression expression) {
    SymbolTable symTable = getSymbolTable();
    PrimaryExpression primaryOrderExpr = new PrimaryExpression(symTable, expression.getTuples());
    return new OrderExpression(symTable, primaryOrderExpr);
  }
View Full Code Here

  /**
   * @return The name of the sort property that was added to the primary
   * datastore query.
   */
  String getSortProperty(QueryData qd, Expression expr) {
    OrderExpression oe = (OrderExpression) expr;
    PrimaryExpression left = (PrimaryExpression) oe.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);
View Full Code Here

  }

  private OrderExpression createJoinOrderExpression(PrimaryExpression expression) {
    SymbolTable symTable = getSymbolTable();
    PrimaryExpression primaryOrderExpr = new PrimaryExpression(symTable, expression.getTuples());
    return new OrderExpression(symTable, primaryOrderExpr);
  }
View Full Code Here

                            candidateAlias));

                    int result = ((Comparable)a).compareTo(b);
                    if (result != 0)
                    {
                        OrderExpression orderExpr = (OrderExpression)ordering[i];
                        if (orderExpr.getSortOrder() == null || orderExpr.getSortOrder().equals("ascending"))
                        {
                            // Ascending
                            return result;
                        }
                        else
View Full Code Here

TOP

Related Classes of org.datanucleus.query.expression.OrderExpression

Copyright © 2018 www.massapicom. 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.