Package org.eclipse.persistence.queries

Examples of org.eclipse.persistence.queries.ReportQuery


       


    public SubQueryImpl(Metamodel metamodel, Class result, QueryBuilderImpl queryBuilder, AbstractQuery parent){
        super(metamodel, ResultType.OTHER, queryBuilder, result);
        this.subQuery = new ReportQuery();
        this.correlatedJoins = new HashSet();
        this.currentNode = new SubSelectExpression(subQuery, new ExpressionBuilder());
        this.parent = parent;
    }
View Full Code Here


                raq.addPartialAttribute(((SelectionImpl)selection).currentNode);
            }
            query = raq;
        }else{
            if (this.roots == null || this.roots.isEmpty()) throw new IllegalStateException(ExceptionLocalization.buildMessage("CRITERIA_NO_ROOT_FOR_COMPOUND_QUERY"));
            ReportQuery reportQuery = null;
            if (this.queryResult.equals(ResultType.CONSTRUCTOR)){
                reportQuery = new ReportQuery();
                reportQuery.addConstructorReportItem(((ConstructorSelectionImpl)this.selection).translate());
                reportQuery.setShouldReturnSingleAttribute(true);
            }else {
                if (this.queryResult.equals(ResultType.TUPLE)){
                    reportQuery = new TupleQuery(this.selection==null?new ArrayList():this.selection.getCompoundSelectionItems());
                }else{
                    reportQuery = new ReportQuery();
                    reportQuery.setShouldReturnWithoutReportQueryResult(true);
                }
                if (this.selection != null){
                    if (this.selection.isCompoundSelection()){
                        for (Selection nested: this.selection.getCompoundSelectionItems()){
                            if (((SelectionImpl)nested).isCompoundSelection()){
                                reportQuery.addConstructorReportItem(((ConstructorSelectionImpl)nested).translate());
                            }else{
                                reportQuery.addItem(nested.getAlias(), ((SelectionImpl)nested).getCurrentNode());
                            }
                        }
                    }else{
                        reportQuery.addAttribute(this.selection.getAlias(), ((SelectionImpl)this.selection).getCurrentNode(), ((SelectionImpl)this.selection).getJavaType());
                    }
                }
            }
            if (this.where != null && ((InternalSelection)this.where).getCurrentNode() != null){
                reportQuery.setReferenceClass(((InternalSelection)this.where).getCurrentNode().getBuilder().getQueryClass());
                reportQuery.setExpressionBuilder(((InternalSelection)this.where).getCurrentNode().getBuilder());
            }else{
                Root root = this.getRoots().iterator().next();
                reportQuery.setReferenceClass(root.getJavaType());
                reportQuery.setExpressionBuilder(((RootImpl)root).getCurrentNode().getBuilder());
            }
            query = reportQuery;
        }
        if (this.where != null){
            query.setSelectionCriteria(((InternalSelection)this.where).getCurrentNode());
View Full Code Here

            if (valueToApply.equals(QueryType.ReadAll)) {
                newQuery = new ReadAllQuery();
            } else if (valueToApply.equals(QueryType.ReadObject)) {
                newQuery = new ReadObjectQuery();
            } else if (valueToApply.equals(QueryType.Report)) {
                newQuery = new ReportQuery();
                if (query.isObjectLevelReadQuery()) {
                    ((ReportQuery)newQuery).addAttribute("root", ((ReportQuery)newQuery).getExpressionBuilder());
                }
            } else if (valueToApply.equals(QueryType.ResultSetMapping)) {
                newQuery = new ResultSetMappingQuery();
View Full Code Here

     * INTERNAL
     * Apply this node to the passed query
     */
    public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext context) {
        if (theQuery.isReportQuery()){
            ReportQuery reportQuery = (ReportQuery)theQuery;
            reportQuery.addAttribute(resolveAttribute(), generateExpression(context));
            reportQuery.dontRetrievePrimaryKeys();
        }
    }
View Full Code Here

     * INTERNAL
     * Apply this node to the passed query
     */
    public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext context) {
        if (theQuery.isReportQuery()) {
            ReportQuery reportQuery = (ReportQuery)theQuery;
            reportQuery.addAttribute("plus", generateExpression(context), (Class)getType());
        }
    }
View Full Code Here

     * 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.addAttribute(left.resolveAttribute() + "Index", expression, Integer.class);
        }
    }
View Full Code Here

     * 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("Coalesce", expression);
        }
    }
View Full Code Here

                // Now the reference class of the query needs to be reversed.
                // See the bug description for an explanation.
                ExpressionBuilder countBuilder = baseExp.getBuilder();
                ExpressionBuilder outerBuilder = new ExpressionBuilder();

                ReportQuery subSelect = new ReportQuery(newDescriptor.getJavaClass(), countBuilder);
                subSelect.setShouldRetrieveFirstPrimaryKey(true);

                // Make sure the outerBuilder does not appear on the left of the
                // subselect.
                // Putting a builder on the left is desirable to trigger an
                // optimization.
                subSelect.setSelectionCriteria(baseExp.equal(outerBuilder));
                SubSelectExpression sub = new SubSelectExpression(subSelect, ((BaseExpression) baseExp).getBaseExpression());
                this.setBaseExpression(outerBuilder);
                this.children.setElementAt(outerBuilder, 0);
            } else {
                // case 4: composite PK, DISTINCT, outer join =>
View Full Code Here

     * INTERNAL
     * Apply this node to the passed query
     */
    public void applyToQuery(ObjectLevelReadQuery theQuery, GenerationContext context) {
        if (theQuery.isReportQuery()) {
            ReportQuery reportQuery = (ReportQuery)theQuery;
            reportQuery.addAttribute("minus", generateExpression(context), (Class)getType());
        }
    }
View Full Code Here

        if (type == null) {
            throw new IllegalArgumentException("DynamicHelper.createQuery: Dynamic type not found: " + typeName);
        }

        return new ReportQuery(type.getJavaClass(), builder);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.queries.ReportQuery

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.