wip mifosx-195 add report template ability
This commit is contained in:
+22
@@ -97,6 +97,28 @@ public class ReportsApiResource {
|
|||||||
final ReportData result = this.readExtraDataAndReportingService
|
final ReportData result = this.readExtraDataAndReportingService
|
||||||
.retrieveReport(id);
|
.retrieveReport(id);
|
||||||
|
|
||||||
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper
|
||||||
|
.process(uriInfo.getQueryParameters());
|
||||||
|
|
||||||
|
if (settings.isTemplate()) {
|
||||||
|
result.appendedTemplate();
|
||||||
|
}
|
||||||
|
return this.toApiJsonSerializer.serialize(settings, result,
|
||||||
|
RESPONSE_DATA_PARAMETERS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("template")
|
||||||
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
|
public String retrieveOfficeTemplate(@Context final UriInfo uriInfo) {
|
||||||
|
|
||||||
|
context.authenticatedUser().validateHasReadPermission(
|
||||||
|
resourceNameForPermissions);
|
||||||
|
|
||||||
|
ReportData result = new ReportData();
|
||||||
|
result.appendedTemplate();
|
||||||
|
|
||||||
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper
|
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper
|
||||||
.process(uriInfo.getQueryParameters());
|
.process(uriInfo.getQueryParameters());
|
||||||
return this.toApiJsonSerializer.serialize(settings, result,
|
return this.toApiJsonSerializer.serialize(settings, result,
|
||||||
|
|||||||
+42
-3
@@ -5,7 +5,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.mifosplatform.infrastructure.dataqueries.data;
|
package org.mifosplatform.infrastructure.dataqueries.data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
final public class ReportData {
|
final public class ReportData {
|
||||||
|
|
||||||
@@ -30,10 +32,16 @@ final public class ReportData {
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private final Collection<ReportParameterData> reportParameters;
|
private final Collection<ReportParameterData> reportParameters;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private List<String> allowedReportTypes;
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
private List<String> allowedReportSubTypes;
|
||||||
|
|
||||||
public ReportData(final Long id, final String reportName,
|
public ReportData(final Long id, final String reportName,
|
||||||
final String reportType, final String reportSubType,
|
final String reportType, final String reportSubType,
|
||||||
final String reportCategory, final String description, final String reportSql,
|
final String reportCategory, final String description,
|
||||||
final Boolean coreReport, final Boolean useReport,
|
final String reportSql, final Boolean coreReport,
|
||||||
|
final Boolean useReport,
|
||||||
final Collection<ReportParameterData> reportParameters) {
|
final Collection<ReportParameterData> reportParameters) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.reportName = reportName;
|
this.reportName = reportName;
|
||||||
@@ -45,6 +53,37 @@ final public class ReportData {
|
|||||||
this.reportSql = reportSql;
|
this.reportSql = reportSql;
|
||||||
this.coreReport = coreReport;
|
this.coreReport = coreReport;
|
||||||
this.useReport = useReport;
|
this.useReport = useReport;
|
||||||
|
this.allowedReportTypes = null;
|
||||||
|
this.allowedReportSubTypes = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ReportData() {
|
||||||
|
this.id = null;
|
||||||
|
this.reportName = null;
|
||||||
|
this.reportType = null;
|
||||||
|
this.reportSubType = null;
|
||||||
|
this.reportCategory = null;
|
||||||
|
this.description = null;
|
||||||
|
this.reportParameters = null;
|
||||||
|
this.reportSql = null;
|
||||||
|
this.coreReport = null;
|
||||||
|
this.useReport = null;
|
||||||
|
this.allowedReportTypes = null;
|
||||||
|
this.allowedReportSubTypes = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void appendedTemplate() {
|
||||||
|
|
||||||
|
List<String> reportTypes = new ArrayList<String>();
|
||||||
|
reportTypes.add("Table");
|
||||||
|
reportTypes.add("Pentaho");
|
||||||
|
reportTypes.add("Chart");
|
||||||
|
this.allowedReportTypes = reportTypes;
|
||||||
|
|
||||||
|
List<String> reportSubTypes = new ArrayList<String>();
|
||||||
|
reportSubTypes.add("Bar");
|
||||||
|
reportSubTypes.add("Pie");
|
||||||
|
this.allowedReportSubTypes = reportSubTypes;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user