use of org.hisp.dhis.reporttable.ReportTable in project dhis2-core by dhis2.
the class ReportTableController method getReportTableGrid.
private Grid getReportTableGrid(String uid, String organisationUnitUid, Date date) throws Exception {
ReportTable reportTable = reportTableService.getReportTableNoAcl(uid);
if (organisationUnitUid == null && reportTable.hasReportParams() && reportTable.getReportParams().isOrganisationUnitSet()) {
organisationUnitUid = organisationUnitService.getRootOrganisationUnits().iterator().next().getUid();
}
date = date != null ? date : new Date();
return reportTableService.getReportTableGrid(uid, date, organisationUnitUid);
}
use of org.hisp.dhis.reporttable.ReportTable in project dhis2-core by dhis2.
the class AddReportAction method execute.
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@Override
public String execute() throws Exception {
// ---------------------------------------------------------------------
// New report or update existing object?
// ---------------------------------------------------------------------
boolean isNewReport = id == null;
if (fileName == null && currentDesign != null) {
fileName = currentDesign;
}
if (id == null && (fileName == null || fileName.trim().length() == 0)) {
return ERROR;
}
// ---------------------------------------------------------------------
// Create report
// ---------------------------------------------------------------------
Report report = isNewReport ? new Report() : reportService.getReport(id);
ReportTable reportTable = reportTableService.getReportTable(reportTableId);
ReportParams reportParams = new ReportParams(paramReportingMonth, false, false, paramOrganisationUnit);
report.setName(name);
report.setType(type);
report.setReportTable(reportTable);
report.setRelatives(getRelativePeriods());
report.setReportParams(reportParams);
log.info("Upload file name: " + fileName + ", content type: " + contentType);
if (file != null) {
report.setDesignContent(FileUtils.readFileToString(file));
}
if (cacheStrategy != null) {
CacheStrategy strategy = EnumUtils.getEnum(CacheStrategy.class, cacheStrategy);
report.setCacheStrategy(strategy != null ? strategy : Report.DEFAULT_CACHE_STRATEGY);
} else if (isNewReport) {
report.setCacheStrategy(CacheStrategy.RESPECT_SYSTEM_SETTING);
}
reportService.saveReport(report);
return SUCCESS;
}
use of org.hisp.dhis.reporttable.ReportTable in project dhis2-core by dhis2.
the class AclServiceTest method testVerifyReportTableCantExternalize.
@Test
public void testVerifyReportTableCantExternalize() {
User user = createAdminUser("F_REPORTTABLE_PUBLIC_ADD");
ReportTable reportTable = new ReportTable();
reportTable.setAutoFields();
reportTable.setPublicAccess(AccessStringHelper.DEFAULT);
reportTable.setExternalAccess(true);
assertFalse(aclService.verifySharing(reportTable, user).isEmpty());
}
Aggregations