/** * PUBLIC: * Add a ConstructorReportItem to this query's set of return values. * @param item used to specify a class constructor and values to pass in from this query * @see ConstructorReportItem */ public void addConstructorReportItem(ConstructorReportItem item){ addItem(item); }
/** * PUBLIC: * Add the attribute to be included in the result. * EXAMPLE: reportQuery.addAttribute("city", expBuilder.get("address").get("city")); */ public void addAttribute(String itemName, Expression attributeExpression) { addItem(itemName, attributeExpression); }
/** * PUBLIC: * Add a ConstructorReportItem to this query's set of return values. * @param item used to specify a class constructor and values to pass in from this query * @see ConstructorReportItem */ public void addConstructorReportItem(ConstructorReportItem item){ addItem(item); }
/** * PUBLIC: * Add the attribute to be included in the result. Return the result as the provided class * EXAMPLE: reportQuery.addAttribute("city", expBuilder.get("period").get("startTime"), Time.class); */ public void addAttribute(String itemName, Expression attributeExpression, Class type) { addItem(itemName, attributeExpression, type); }
/** * PUBLIC: * Add the average value of the attribute to be included in the result. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: reportQuery.addAverage("managerSalary", expBuilder.get("manager").get("salary")); */ public void addAverage(String itemName, Expression attributeExpression) { addItem(itemName, attributeExpression.average()); }
/** * PUBLIC: * Add the average value of the attribute to be included in the result and * return it as the specified resultType. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: reportQuery.addAverage("managerSalary", expBuilder.get("manager").get("salary"), Double.class); */ public void addAverage(String itemName, Expression attributeExpression, Class resultType) { addItem(itemName, attributeExpression.average(), resultType); }
/** * PUBLIC: * Add the minimum value of the attribute to be included in the result. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: reportQuery.addMinimum("managerSalary", expBuilder.get("manager").get("salary")); */ public void addMinimum(String itemName, Expression attributeExpression) { addItem(itemName, attributeExpression.minimum()); }
/** * PUBLIC: * Add the minimum value of the attribute to be included in the result. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: reportQuery.addMinimum("managerSalary", expBuilder.get("manager").get("salary")); */ public void addMinimum(String itemName, Expression attributeExpression) { addItem(itemName, attributeExpression.minimum()); }
/** * PUBLIC: * Add the average value of the attribute to be included in the result and * return it as the specified resultType. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: reportQuery.addAverage("managerSalary", expBuilder.get("manager").get("salary"), Double.class); */ public void addAverage(String itemName, Expression attributeExpression, Class resultType) { addItem(itemName, attributeExpression.average(), resultType); }
/** * PUBLIC: * Add the standard deviation value of the attribute to be included in the result. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: reportQuery.addStandardDeviation("managerSalary", expBuilder.get("manager").get("salary")); */ public void addStandardDeviation(String itemName, Expression attributeExpression) { addItem(itemName, attributeExpression.standardDeviation()); }
/** * PUBLIC: * Add the sum value of the attribute to be included in the result. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: reportQuery.addSum("managerSalary", expBuilder.get("manager").get("salary")); */ public void addSum(String itemName, Expression attributeExpression) { addItem(itemName, attributeExpression.sum()); }
/** * INTERNAL * Apply this node to the passed query */ public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext generationContext) { if (theQuery instanceof ReportQuery) { ReportQuery reportQuery = (ReportQuery)theQuery; Expression expression = generateExpression(generationContext); reportQuery.addItem("Coalesce", expression); } }
/** * INTERNAL * Apply this node to the passed query */ public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext generationContext) { if (theQuery instanceof ReportQuery) { ReportQuery reportQuery = (ReportQuery)theQuery; Expression expression = generateExpression(generationContext); reportQuery.addItem(left.resolveAttribute() + "MapKey", expression); } }
/** * PUBLIC: * Add the attribute from the reference class to be included in the result. * EXAMPLE: reportQuery.addAttribute("firstName"); */ public void addAttribute(String itemName) { addItem(itemName, getExpressionBuilder().get(itemName)); }
/** * ADVANCED: * Add the expression value to be included in the result. * EXAMPLE: reportQuery.addItem("name", expBuilder.get("firstName").toUpperCase()); */ public void addItem(String itemName, Expression attributeExpression) { ReportItem item = new ReportItem(itemName, attributeExpression); addItem(item); //Bug2804042 Must un-prepare if prepared as the SQL may change. setIsPrepared(false); }
/** * INTERNAL: * Add the expression value to be included in the result. * EXAMPLE: reportQuery.addItem("name", expBuilder.get("firstName").toUpperCase()); * The resultType can be specified to support EJBQL that adheres to the * EJB 3.0 spec. */ protected void addItem(String itemName, Expression attributeExpression, Class resultType) { ReportItem item = new ReportItem(itemName, attributeExpression); item.setResultType(resultType); addItem(item); }
/** * ADVANCED: * Add the expression value to be included in the result. * EXAMPLE: reportQuery.addItem("name", expBuilder.get("firstName").toUpperCase()); */ public void addItem(String itemName, Expression attributeExpression) { ReportItem item = new ReportItem(itemName, attributeExpression); addItem(item); //Bug2804042 Must un-prepare if prepared as the SQL may change. setIsPrepared(false); }
/** * ADVANCED: * Add the expression value to be included in the result. * EXAMPLE: reportQuery.addItem("name", expBuilder.get("firstName").toUpperCase()); */ public void addItem(String itemName, Expression attributeExpression, List joinedExpressions) { ReportItem item = new ReportItem(itemName, attributeExpression); if (joinedExpressions != null && ! joinedExpressions.isEmpty()){ item.getJoinedAttributeManager().setJoinedAttributeExpressions_(joinedExpressions); } addItem(item); }
/** * INTERNAL * Apply this node to the passed query */ public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext generationContext) { ParseTreeContext context = generationContext.getParseTreeContext(); if (theQuery instanceof ReportQuery) { ReportQuery reportQuery = (ReportQuery)theQuery; Expression expression = generateExpression(generationContext); reportQuery.addItem(left.resolveAttribute() + " MapEntry", expression); } }
/** * INTERNAL * Apply this node to the passed query */ public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext generationContext) { ParseTreeContext context = generationContext.getParseTreeContext(); if (theQuery instanceof ReportQuery) { ReportQuery reportQuery = (ReportQuery)theQuery; Expression expression = generateExpression(generationContext); reportQuery.addItem("NullIf(" + getLeft().getAsString() + "," + getRight().getAsString() + ")", expression); } }