/** * {@inheritDoc} */ @Override protected void visit(org.eclipse.persistence.jpa.jpql.parser.Expression expression) { ((ReportQuery) query).addGrouping(queryContext.buildExpression(expression)); } }
/** * {@inheritDoc} */ @Override protected void visit(org.eclipse.persistence.jpa.jpql.parser.Expression expression) { ((ReportQuery) query).addGrouping(queryContext.buildExpression(expression)); } }
/** * PUBLIC: * Add the attribute to the group by expressions. * This will group the result set on that attribute and is normally used in conjunction with aggregation functions. * Example: reportQuery.addGrouping("lastName") */ public void addGrouping(String attributeName) { addGrouping(getExpressionBuilder().get(attributeName)); }
/** * INTERNAL * Add the grouping expressions to the passed query */ public void addGroupingToQuery(ObjectLevelReadQuery theQuery, GenerationContext context) { if (theQuery.isReportQuery()) { Iterator iter = getGroupByItems().iterator(); while (iter.hasNext()) { Node nextNode = (Node)iter.next(); ((ReportQuery)theQuery).addGrouping(nextNode.generateExpression(context)); } } }
/** * INTERNAL * Add the grouping expressions to the passed query */ public void addGroupingToQuery(ObjectLevelReadQuery theQuery, GenerationContext context) { if (theQuery.isReportQuery()) { Iterator iter = getGroupByItems().iterator(); while (iter.hasNext()) { Node nextNode = (Node)iter.next(); ((ReportQuery)theQuery).addGrouping(nextNode.generateExpression(context)); } } }
/** * PUBLIC: * Add the attribute to the group by expressions. * This will group the result set on that attribute and is normally used in conjunction with aggregation functions. * Example: reportQuery.addGrouping("lastName") */ public void addGrouping(String attributeName) { addGrouping(getExpressionBuilder().get(attributeName)); }
/** * INTERNAL * Add the grouping expressions to the passed query */ public void addGroupingToQuery(ObjectLevelReadQuery theQuery, GenerationContext context) { if (theQuery.isReportQuery()) { Iterator iter = getGroupByItems().iterator(); while (iter.hasNext()) { Node nextNode = (Node)iter.next(); ((ReportQuery)theQuery).addGrouping(nextNode.generateExpression(context)); } } }
/** * PUBLIC: * Add the attribute to the group by expressions. * This will group the result set on that attribute and is normally used in conjunction with aggregation functions. * Example: reportQuery.addGrouping("lastName") */ public void addGrouping(String attributeName) { addGrouping(getExpressionBuilder().get(attributeName)); }
/** * Specify the expressions that are used to form groups over the query * results. Replaces the previous specified grouping expressions, if any. If * no grouping expressions are specified, any previously added grouping * expressions are simply removed. This method only overrides the return * type of the corresponding AbstractQuery method. * * @param grouping * zero or more grouping expressions * @return the modified query */ public Subquery<T> groupBy(List<Expression<?>> grouping){ super.groupBy(grouping); this.subQuery.getGroupByExpressions().clear(); for (Expression groupby: grouping){ this.subQuery.addGrouping(((InternalSelection)groupby).getCurrentNode()); } return this; }
/** * Specify the expressions that are used to form groups over the query * results. Replaces the previous specified grouping expressions, if any. If * no grouping expressions are specified, any previously added grouping * expressions are simply removed. This method only overrides the return * type of the corresponding AbstractQuery method. * * @param grouping * zero or more grouping expressions * @return the modified query */ public Subquery<T> groupBy(Expression<?>... grouping){ super.groupBy(grouping); this.subQuery.getGroupByExpressions().clear(); for (Expression groupby: grouping){ this.subQuery.addGrouping(((InternalSelection)groupby).getCurrentNode()); } return this; }
/** * {@inheritDoc} */ @Override public void visit(SizeExpression expression) { // Add the attribute Expression queryExpression = queryContext.buildExpression(expression.getExpression()); addAttribute("size", queryExpression.count(), Integer.class); // Now add the GROUP BY expression CollectionValuedPathExpression pathExpression = (CollectionValuedPathExpression) expression.getExpression(); queryExpression = queryContext.buildGroupByExpression(pathExpression); query.addGrouping(queryExpression); }
/** * {@inheritDoc} */ @Override public void visit(SizeExpression expression) { // Add the attribute Expression queryExpression = queryContext.buildExpression(expression.getExpression()); addAttribute("size", queryExpression.count(), Integer.class); // Now add the GROUP BY expression CollectionValuedPathExpression pathExpression = (CollectionValuedPathExpression) expression.getExpression(); queryExpression = queryContext.buildGroupByExpression(pathExpression); query.addGrouping(queryExpression); }
/** * INTERNAL * Apply this node to the passed query */ public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext context) { if (theQuery.isReportQuery()) { ReportQuery reportQuery = (ReportQuery)theQuery; reportQuery.addAttribute("size", getLeft().generateExpression(context).count(), (Class)getType()); reportQuery.addGrouping(getLeft().getLeft().generateExpression(context)); } }
/** * INTERNAL * Apply this node to the passed query */ public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext context) { if (theQuery.isReportQuery()) { ReportQuery reportQuery = (ReportQuery)theQuery; reportQuery.addAttribute("size", getLeft().generateExpression(context).count(), (Class)getType()); reportQuery.addGrouping(getLeft().getLeft().generateExpression(context)); } }
/** * INTERNAL * Apply this node to the passed query */ public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext context) { if (theQuery.isReportQuery()) { ReportQuery reportQuery = (ReportQuery)theQuery; reportQuery.addAttribute("size", getLeft().generateExpression(context).count(), (Class)getType()); reportQuery.addGrouping(getLeft().getLeft().generateExpression(context)); } }
ExpressionImpl fromExpression = (ExpressionImpl) collectionExpression.getParentPath(); ((ReportQuery) query).addAttribute(this.selection.getAlias(), collectionExpression.getCurrentNode().count(), ClassConstants.INTEGER); ((ReportQuery) query).addGrouping(fromExpression.getCurrentNode()); ExpressionImpl fromExpression = (ExpressionImpl) collectionExpression.getParentPath(); reportQuery.addAttribute(this.selection.getAlias(), collectionExpression.getCurrentNode().count(), ClassConstants.INTEGER); reportQuery.addGrouping(fromExpression.getCurrentNode()); }else{ reportQuery.addAttribute(this.selection.getAlias(), ((FunctionExpressionImpl)this.selection).getCurrentNode(), this.selection.getJavaType()); if (this.groupBy != null && !this.groupBy.isEmpty()) { for (Expression<?> exp : this.groupBy) { reportQuery.addGrouping(((InternalSelection) exp).getCurrentNode());
ExpressionImpl fromExpression = (ExpressionImpl) collectionExpression.getParentPath(); reportQuery.addAttribute(nested.getAlias(), collectionExpression.getCurrentNode().count(), ClassConstants.INTEGER); reportQuery.addGrouping(fromExpression.getCurrentNode()); } else { reportQuery.addAttribute(nested.getAlias(), ((SelectionImpl) nested).getCurrentNode(), nested.getJavaType()); if (this.groupBy != null && !this.groupBy.isEmpty()) { for (Expression<?> exp : this.groupBy) { reportQuery.addGrouping(((InternalSelection) exp).getCurrentNode());