use of org.activityinfo.legacy.shared.reports.model.PivotReportElement in project activityinfo by bedatadriven.
the class PivotTestResource method get.
@GET
@Path("report")
@Produces(MediaType.APPLICATION_JSON)
public List<PivotSites.PivotResult> get(@QueryParam("reportId") int reportId, @QueryParam("userId") int userId, @QueryParam("new") boolean newEngine, @QueryParam("details") boolean showDetails) {
assertRunningInLocalDevelopmentEnvironment();
authProvider.set(new AuthenticatedUser("XYZ", userId, "user@user.org"));
ReportDTO report = dispatcher.execute(new GetReportModel(reportId));
Report model = report.getReport();
List<PivotSites.PivotResult> results = Lists.newArrayList();
for (ReportElement element : model.getElements()) {
if (element instanceof PivotReportElement) {
PivotSites command = command(model, (PivotReportElement) element, newEngine, showDetails);
if (!command.isTooBroad()) {
results.add(dispatcher.execute(command));
} else {
results.add(new PivotSites.PivotResult());
}
}
}
return results;
}
use of org.activityinfo.legacy.shared.reports.model.PivotReportElement in project activityinfo by bedatadriven.
the class PivotTestResource method show.
@GET
@Path("show")
@Produces(MediaType.TEXT_PLAIN)
public String show(@QueryParam("reportId") int reportId) {
assertRunningInLocalDevelopmentEnvironment();
ReportDTO report = dispatcher.execute(new GetReportModel(reportId));
Report model = report.getReport();
StringBuilder text = new StringBuilder();
text.append(model.getTitle()).append("\n");
text.append("Filter: " + model.getFilter()).append("\n");
for (ReportElement element : model.getElements()) {
text.append("-- " + element.getClass().getSimpleName() + ": " + element.getTitle()).append("\n");
text.append(" Filter: " + element.getFilter()).append("\n");
if (element instanceof PivotReportElement) {
text.append(" Dimensions: " + ((PivotReportElement) element).allDimensions()).append("\n");
}
}
return text.toString();
}
Aggregations