use of org.activityinfo.legacy.shared.reports.model.ReportElement in project activityinfo by bedatadriven.
the class RenderReportHtmlHandler method execute.
@Override
public CommandResult execute(RenderReportHtml cmd, User user) throws CommandException {
ReportElement model = cmd.getModel();
LOGGER.fine("Model: " + model);
// don't show the title: it will be rendered by the container
model.setTitle(null);
generator.generateElement(user, model, new Filter(), new DateRange());
StringWriter writer = new StringWriter();
try {
renderer.render(model, writer);
} catch (IOException e) {
throw new CommandException(e);
}
return new HtmlResult(writer.toString());
}
use of org.activityinfo.legacy.shared.reports.model.ReportElement 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.ReportElement 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();
}
use of org.activityinfo.legacy.shared.reports.model.ReportElement in project activityinfo by bedatadriven.
the class CompositeEditor2 method bind.
@Override
public void bind(Report model) {
this.model = model;
for (Component child : page.getItems()) {
if (child != addPanel) {
page.remove(child);
}
}
for (ReportElement element : model.getElements()) {
addElementWidget(element);
}
page.layout();
}
use of org.activityinfo.legacy.shared.reports.model.ReportElement in project activityinfo by bedatadriven.
the class GenerateDashboardElementHandler method execute.
@Override
public CommandResult execute(GenerateDashboardElement cmd, User user) throws CommandException {
ReportDTO report = dispatcher.execute(new GetReportModel(cmd.getReportId()));
if (report.getReport().getElements().isEmpty()) {
return new TextReportElement("The report is empty");
} else {
ReportElement element = report.getReport().getElements().get(0);
element.setContent(generator.generateElement(user, element, null, new DateRange()));
return element;
}
}
Aggregations