filtering reporting (for pretty printing purposes)
This commit is contained in:
@@ -18,6 +18,7 @@ import javax.ws.rs.core.UriInfo;
|
|||||||
|
|
||||||
import org.mifosng.data.reports.GenericResultset;
|
import org.mifosng.data.reports.GenericResultset;
|
||||||
import org.mifosng.platform.ReadExtraDataAndReportingService;
|
import org.mifosng.platform.ReadExtraDataAndReportingService;
|
||||||
|
import org.mifosng.platform.api.infrastructure.ApiJSONFormattingService;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -29,11 +30,18 @@ import org.springframework.stereotype.Component;
|
|||||||
@Scope("singleton")
|
@Scope("singleton")
|
||||||
public class ReportingApiResource {
|
public class ReportingApiResource {
|
||||||
|
|
||||||
private final static Logger logger = LoggerFactory.getLogger(ReportingApiResource.class);
|
private final static Logger logger = LoggerFactory
|
||||||
|
.getLogger(ReportingApiResource.class);
|
||||||
|
|
||||||
|
private String allowedFieldList = "";
|
||||||
|
private String filterName = "myFilter";
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ReadExtraDataAndReportingService ReadExtraDataAndReportingService;
|
private ReadExtraDataAndReportingService ReadExtraDataAndReportingService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApiJSONFormattingService jsonFormattingService;
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||||
@Produces({ MediaType.APPLICATION_JSON, "application/x-msdownload" })
|
@Produces({ MediaType.APPLICATION_JSON, "application/x-msdownload" })
|
||||||
@@ -48,7 +56,11 @@ public class ReportingApiResource {
|
|||||||
if ((exportCSV == null) || (!(exportCSV.equalsIgnoreCase("true")))) {
|
if ((exportCSV == null) || (!(exportCSV.equalsIgnoreCase("true")))) {
|
||||||
GenericResultset result = this.ReadExtraDataAndReportingService
|
GenericResultset result = this.ReadExtraDataAndReportingService
|
||||||
.retrieveGenericResultset(".", ".", extractedQueryParams);
|
.retrieveGenericResultset(".", ".", extractedQueryParams);
|
||||||
return Response.ok().entity(result).build();
|
String selectedFields = "";
|
||||||
|
String json = this.jsonFormattingService.convertRequest(result,
|
||||||
|
filterName, allowedFieldList, selectedFields,
|
||||||
|
uriInfo.getQueryParameters());
|
||||||
|
return Response.ok().entity(json).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamingOutput result = this.ReadExtraDataAndReportingService
|
StreamingOutput result = this.ReadExtraDataAndReportingService
|
||||||
@@ -100,7 +112,11 @@ public class ReportingApiResource {
|
|||||||
.retrieveGenericResultset(reportName, parameterType,
|
.retrieveGenericResultset(reportName, parameterType,
|
||||||
extractedQueryParams);
|
extractedQueryParams);
|
||||||
|
|
||||||
return Response.ok().entity(result).build();
|
String selectedFields = "";
|
||||||
|
String json = this.jsonFormattingService.convertRequest(result,
|
||||||
|
filterName, allowedFieldList, selectedFields,
|
||||||
|
uriInfo.getQueryParameters());
|
||||||
|
return Response.ok().entity(json).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
StreamingOutput result = this.ReadExtraDataAndReportingService
|
StreamingOutput result = this.ReadExtraDataAndReportingService
|
||||||
|
|||||||
Reference in New Issue
Block a user