Search in sources :

Example 1 with ReportVisibilityResult

use of org.activityinfo.shared.command.result.ReportVisibilityResult 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));
        }
    });
}
Also used : ReportVisibilityResult(org.activityinfo.shared.command.result.ReportVisibilityResult) GetReportVisibility(org.activityinfo.shared.command.GetReportVisibility) GetReportModel(org.activityinfo.shared.command.GetReportModel) MaskingAsyncMonitor(org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor) ReportDTO(org.activityinfo.shared.dto.ReportDTO) BatchCommand(org.activityinfo.shared.command.BatchCommand) BatchResult(org.activityinfo.shared.command.result.BatchResult) GetSchema(org.activityinfo.shared.command.GetSchema) SchemaDTO(org.activityinfo.shared.dto.SchemaDTO)

Example 2 with ReportVisibilityResult

use of org.activityinfo.shared.command.result.ReportVisibilityResult in project activityinfo by bedatadriven.

the class ShareReportDialog method show.

public void show(final Report report) {
    super.show();
    this.currentReport = report;
    // we need to combine the databases which already have visiblity with
    // those
    // that could potentially be added
    BatchCommand batch = new BatchCommand();
    batch.add(new GetSchema());
    batch.add(new GetReportVisibility(currentReport.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) {
            populateGrid((SchemaDTO) batch.getResult(0), (ReportVisibilityResult) batch.getResult(1));
        }
    });
}
Also used : ReportVisibilityResult(org.activityinfo.shared.command.result.ReportVisibilityResult) GetReportVisibility(org.activityinfo.shared.command.GetReportVisibility) MaskingAsyncMonitor(org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor) BatchCommand(org.activityinfo.shared.command.BatchCommand) BatchResult(org.activityinfo.shared.command.result.BatchResult) GetSchema(org.activityinfo.shared.command.GetSchema) SchemaDTO(org.activityinfo.shared.dto.SchemaDTO)

Example 3 with ReportVisibilityResult

use of org.activityinfo.shared.command.result.ReportVisibilityResult in project activityinfo by bedatadriven.

the class ReportVisibilityTest method update.

@Test
public void update() {
    setUser(1);
    ReportVisibilityDTO db1 = new ReportVisibilityDTO();
    db1.setDatabaseId(1);
    db1.setVisible(true);
    db1.setDefaultDashboard(true);
    ReportVisibilityDTO db2 = new ReportVisibilityDTO();
    db2.setDatabaseId(2);
    db2.setVisible(false);
    ReportVisibilityDTO db3 = new ReportVisibilityDTO();
    db3.setDatabaseId(3);
    db3.setVisible(true);
    UpdateReportVisibility update = new UpdateReportVisibility(1, Arrays.asList(db1, db2, db3));
    execute(update);
    ReportVisibilityResult result = execute(new GetReportVisibility(1));
    assertThat(result.getList().size(), equalTo(2));
    // make sure we can still see the report
    ReportsResult visibleToMe = execute(new GetReports());
    assertThat(visibleToMe.getData().size(), equalTo(1));
    // Bavon
    setUser(2);
    ReportsResult visibleToBavon = execute(new GetReports());
    assertThat(visibleToBavon.getData().size(), equalTo(2));
    assertThat(getById(visibleToBavon, 1).isDashboard(), equalTo(true));
    assertThat(getById(visibleToBavon, 2).isDashboard(), equalTo(false));
    // Stefan, no access to db
    setUser(3);
    ReportsResult visibleToStefan = execute(new GetReports());
    assertThat(visibleToStefan.getData().size(), equalTo(0));
}
Also used : ReportVisibilityDTO(org.activityinfo.shared.dto.ReportVisibilityDTO) ReportVisibilityResult(org.activityinfo.shared.command.result.ReportVisibilityResult) ReportsResult(org.activityinfo.shared.command.result.ReportsResult) Test(org.junit.Test)

Aggregations

ReportVisibilityResult (org.activityinfo.shared.command.result.ReportVisibilityResult)3 MaskingAsyncMonitor (org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor)2 BatchCommand (org.activityinfo.shared.command.BatchCommand)2 GetReportVisibility (org.activityinfo.shared.command.GetReportVisibility)2 GetSchema (org.activityinfo.shared.command.GetSchema)2 BatchResult (org.activityinfo.shared.command.result.BatchResult)2 SchemaDTO (org.activityinfo.shared.dto.SchemaDTO)2 GetReportModel (org.activityinfo.shared.command.GetReportModel)1 ReportsResult (org.activityinfo.shared.command.result.ReportsResult)1 ReportDTO (org.activityinfo.shared.dto.ReportDTO)1 ReportVisibilityDTO (org.activityinfo.shared.dto.ReportVisibilityDTO)1 Test (org.junit.Test)1