Package org.eclipse.persistence.jpa.rs.util.list

Examples of org.eclipse.persistence.jpa.rs.util.list.MultiResultQueryList


                // one or more fields in the SingleResultQueryList might be a domain object,
                // so, we need to set the relationshipInfo for those domain objects.
                setRelationshipInfo(fields.get(i).getValue());
            }
        } else if (entity instanceof MultiResultQueryList) {
            MultiResultQueryList list = (MultiResultQueryList) entity;
            List<MultiResultQueryListItem> items = list.getItems();
            for (int i = 0; i < items.size(); i++) {
                MultiResultQueryListItem item = items.get(i);
                List<JAXBElement> fields = item.getFields();
                for (int index = 0; index < fields.size(); index++) {
                    // one or more fields in the MultiResultQueryList might be a domain object,
View Full Code Here


        if (dbQuery instanceof ReportQuery) {
            // simple types selected : select u.name, u.age from employee
            List<ReportItem> reportItems = ((ReportQuery) dbQuery).getItems();
            List<Object[]> queryResults = query.getResultList();
            if ((queryResults != null) && (!queryResults.isEmpty())) {
                MultiResultQueryList list = populateReportQueryResponse(queryResults, reportItems);
                if (list != null) {
                    return Response.ok(new StreamingOutputMarshaller(app, list, hh.getAcceptableMediaTypes())).build();
                } else {
                 // something wrong with the descriptors
                    return Response.status(Status.INTERNAL_SERVER_ERROR).type(StreamingOutputMarshaller.getResponseMediaType(hh)).build();
View Full Code Here

        return Response.ok(new StreamingOutputMarshaller(app, results, hh.getAcceptableMediaTypes())).build();
    }

    @SuppressWarnings({ "rawtypes" })
    private MultiResultQueryList populateReportQueryResponse(List<Object[]> results, List<ReportItem> reportItems) {
        MultiResultQueryList response = new MultiResultQueryList();
        for (Object result : results) {
            MultiResultQueryListItem queryResultListItem = new MultiResultQueryListItem();
            List<JAXBElement> jaxbFields = createShellJAXBElementList(reportItems, result);
           if (jaxbFields == null) {
                return null;
            }
            queryResultListItem.setFields(jaxbFields);
            response.addItem(queryResultListItem);
        }
        return response;
    }
View Full Code Here

                // one or more fields in the SingleResultQueryList might be a domain object,
                // so, we need to set the relationshipInfo for those domain objects.
                setRelationshipInfo(fields.get(i).getValue());
            }
        } else if (entity instanceof MultiResultQueryList) {
            MultiResultQueryList list = (MultiResultQueryList) entity;
            List<MultiResultQueryListItem> items = list.getItems();
            for (int i = 0; i < items.size(); i++) {
                MultiResultQueryListItem item = items.get(i);
                List<JAXBElement> fields = item.getFields();
                for (int index = 0; index < fields.size(); index++) {
                    // one or more fields in the MultiResultQueryList might be a domain object,
View Full Code Here

                // one or more fields in the SingleResultQueryList might be a domain object,
                // so, we need to set the relationshipInfo for those domain objects.
                setRelationshipInfo(fields.get(i).getValue());
            }
        } else if (entity instanceof MultiResultQueryList) {
            MultiResultQueryList list = (MultiResultQueryList) entity;
            List<MultiResultQueryListItem> items = list.getItems();
            for (int i = 0; i < items.size(); i++) {
                MultiResultQueryListItem item = items.get(i);
                List<JAXBElement> fields = item.getFields();
                for (int index = 0; index < fields.size(); index++) {
                    // one or more fields in the MultiResultQueryList might be a domain object,
View Full Code Here

        if (dbQuery instanceof ReportQuery) {
            // simple types selected : select u.name, u.age from employee
            List<ReportItem> reportItems = ((ReportQuery) dbQuery).getItems();
            List<Object[]> queryResults = query.getResultList();
            if ((queryResults != null) && (!queryResults.isEmpty())) {
                MultiResultQueryList list = populateReportQueryResponse(queryResults, reportItems);
                if (list != null) {
                    return Response.ok(new StreamingOutputMarshaller(app, list, hh.getAcceptableMediaTypes())).build();
                } else {
                 // something wrong with the descriptors
                    return Response.status(Status.INTERNAL_SERVER_ERROR).type(StreamingOutputMarshaller.getResponseMediaType(hh)).build();
View Full Code Here

        return Response.ok(new StreamingOutputMarshaller(app, results, hh.getAcceptableMediaTypes())).build();
    }

    @SuppressWarnings({ "rawtypes" })
    private MultiResultQueryList populateReportQueryResponse(List<Object[]> results, List<ReportItem> reportItems) {
        MultiResultQueryList response = new MultiResultQueryList();
        for (Object result : results) {
            MultiResultQueryListItem queryResultListItem = new MultiResultQueryListItem();
            List<JAXBElement> jaxbFields = createShellJAXBElementList(reportItems, result);
           if (jaxbFields == null) {
                return null;
            }
            queryResultListItem.setFields(jaxbFields);
            response.addItem(queryResultListItem);
        }
        return response;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.jpa.rs.util.list.MultiResultQueryList

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.