use of org.entando.entando.aps.system.services.database.model.ShortDumpReportDto in project entando-core by entando.
the class DatabaseController method getDumpReports.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getDumpReports(@Valid RestListRequest requestList) {
this.getDatabaseValidator().validateRestListRequest(requestList);
PagedMetadata<ShortDumpReportDto> result = this.getDatabaseService().getShortDumpReportDtos(requestList);
this.getDatabaseValidator().validateRestListResult(requestList, result);
return new ResponseEntity<>(new RestResponse(result.getBody(), new ArrayList<>(), result), HttpStatus.OK);
}
use of org.entando.entando.aps.system.services.database.model.ShortDumpReportDto in project entando-core by entando.
the class DatabaseService method getShortDumpReportDtos.
@Override
public PagedMetadata<ShortDumpReportDto> getShortDumpReportDtos(RestListRequest requestList) {
PagedMetadata<ShortDumpReportDto> result = null;
List<ShortDumpReportDto> dtos = new ArrayList<>();
try {
List<DataSourceDumpReport> reports = this.getDatabaseManager().getBackupReports();
if (null != reports) {
reports.stream().forEach(report -> dtos.add(new ShortDumpReportDto(report)));
}
List<ShortDumpReportDto> sublist = requestList.getSublist(dtos);
int size = (null != reports) ? reports.size() : 0;
SearcherDaoPaginatedResult searchResult = new SearcherDaoPaginatedResult(size, sublist);
result = new PagedMetadata<>(requestList, searchResult);
result.setBody(sublist);
} catch (Throwable t) {
logger.error("error extracting database reports", t);
throw new RestServerError("error extracting database reports", t);
}
return result;
}
Aggregations