use of org.activityinfo.shared.dto.ReportDTO in project activityinfo by bedatadriven.
the class ShareReportDialog method show.
public void show(ReportMetadataDTO metadata) {
super.show();
BatchCommand batch = new BatchCommand();
batch.add(new GetReportModel(metadata.getId()));
batch.add(new GetSchema());
batch.add(new GetReportVisibility(metadata.getId()));
dispatcher.execute(batch, new MaskingAsyncMonitor(grid, I18N.CONSTANTS.loading()), new AsyncCallback<BatchResult>() {
@Override
public void onFailure(Throwable caught) {
// TODO Auto-generated method stub
}
@Override
public void onSuccess(BatchResult batch) {
currentReport = ((ReportDTO) batch.getResult(0)).getReport();
populateGrid((SchemaDTO) batch.getResult(1), (ReportVisibilityResult) batch.getResult(2));
}
});
}
use of org.activityinfo.shared.dto.ReportDTO in project activityinfo by bedatadriven.
the class GetReportModelHandler method execute.
@Override
public void execute(final GetReportModel cmd, final ExecutionContext context, final AsyncCallback<ReportDTO> callback) {
ReportDTO reportDTO = null;
Integer reportId = cmd.getReportId();
LOGGER.finest("Loading model for report id = " + reportId);
if (reportId != null) {
// always load report
ReportDefinition entity = em.find(ReportDefinition.class, reportId);
Report report = new Report();
try {
LOGGER.finest("Starting to parse xml (size = " + entity.getXml().length() + ")");
report = ReportParserJaxb.parseXml(entity.getXml());
LOGGER.finest("Parsing complete");
} catch (JAXBException e) {
throw new UnexpectedCommandException(e);
}
report.setId(reportId);
reportDTO = new ReportDTO(report);
if (cmd.isLoadMetadata()) {
// load metadata if specified
loadMetadata(reportId, context, reportDTO, callback);
} else {
// exit handler with only the report object filled
callback.onSuccess(reportDTO);
}
}
}
use of org.activityinfo.shared.dto.ReportDTO in project activityinfo by bedatadriven.
the class GetReportModelTest method selectReportWithMetadata.
@Test
public void selectReportWithMetadata() {
setUser(1);
ReportDTO result = execute(new GetReportModel(3, true));
assertNotNull(result.getReport());
assertEquals("Report 3", result.getReport().getTitle());
assertNotNull(result.getReportMetadataDTO());
assertEquals("Alex", result.getReportMetadataDTO().getOwnerName());
}
use of org.activityinfo.shared.dto.ReportDTO in project activityinfo by bedatadriven.
the class GetReportModelTest method selectReportOnly2.
@Test
public void selectReportOnly2() {
setUser(1);
ReportDTO result = execute(new GetReportModel(3, false));
assertNotNull(result.getReport());
assertEquals("Report 3", result.getReport().getTitle());
assertNull(result.getReportMetadataDTO());
}
use of org.activityinfo.shared.dto.ReportDTO in project activityinfo by bedatadriven.
the class GetReportModelTest method selectReportOnly.
@Test
public void selectReportOnly() {
setUser(1);
ReportDTO result = execute(new GetReportModel(3));
assertNotNull(result.getReport());
assertEquals("Report 3", result.getReport().getTitle());
assertNull(result.getReportMetadataDTO());
}
Aggregations