use of org.entando.entando.aps.system.services.database.model.DumpReportDto in project entando-core by entando.
the class DatabaseServiceTest method getValidReport.
@Test
public void getValidReport() throws Throwable {
String xml = null;
DataSourceDumpReport report = new DataSourceDumpReport(xml);
when(databaseManager.getBackupReport(ArgumentMatchers.anyString())).thenReturn(report);
DumpReportDto dto = this.databaseService.getDumpReportDto("reportCode");
Assert.assertNotNull(dto);
}
use of org.entando.entando.aps.system.services.database.model.DumpReportDto in project entando-core by entando.
the class DatabaseController method getDumpReport.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/report/{reportCode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getDumpReport(@PathVariable String reportCode) {
logger.debug("Required dump report -> code {}", reportCode);
DumpReportDto result = this.getDatabaseService().getDumpReportDto(reportCode);
logger.debug("Extracted dump report -> {}", result);
return new ResponseEntity<>(new RestResponse(result), HttpStatus.OK);
}
use of org.entando.entando.aps.system.services.database.model.DumpReportDto in project entando-core by entando.
the class DatabaseService method getDumpReportDto.
@Override
public DumpReportDto getDumpReportDto(String reportCode) {
DumpReportDto dtos = null;
try {
DataSourceDumpReport report = this.getDatabaseManager().getBackupReport(reportCode);
if (null == report) {
logger.warn("no dump found with code {}", reportCode);
throw new RestRourceNotFoundException(DatabaseValidator.ERRCODE_NO_DUMP_FOUND, "reportCode", reportCode);
}
dtos = new DumpReportDto(report, this.getComponentManager());
} catch (RestRourceNotFoundException r) {
throw r;
} catch (Throwable t) {
logger.error("error extracting database report {}", reportCode, t);
throw new RestServerError("error extracting database report " + reportCode, t);
}
return dtos;
}
Aggregations