use of org.entando.entando.web.common.model.RestResponse in project entando-core by entando.
the class WidgetController method getWidgets.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/widgets", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getWidgets(RestListRequest requestList) {
logger.trace("get widget list {}", requestList);
this.getWidgetValidator().validateRestListRequest(requestList);
PagedMetadata<WidgetDto> result = this.widgetService.getWidgets(requestList);
this.getWidgetValidator().validateRestListResult(requestList, result);
return new ResponseEntity<>(new RestResponse(result.getBody(), null, result), HttpStatus.OK);
}
use of org.entando.entando.web.common.model.RestResponse in project entando-core by entando.
the class WidgetController method addWidget.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/widgets", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, name = "widget")
public ResponseEntity<RestResponse> addWidget(@Valid @RequestBody WidgetRequest widgetRequest, BindingResult bindingResult) throws ApsSystemException {
logger.trace("add widget. body {}: ", widgetRequest);
// field validations
if (bindingResult.hasErrors()) {
throw new ValidationGenericException(bindingResult);
}
// business validations
this.widgetValidator.validate(widgetRequest, bindingResult);
if (bindingResult.hasErrors()) {
throw new ValidationGenericException(bindingResult);
}
WidgetDto widgetDto = this.widgetService.addWidget(widgetRequest);
return new ResponseEntity<>(new RestResponse(widgetDto), HttpStatus.OK);
}
use of org.entando.entando.web.common.model.RestResponse in project entando-core by entando.
the class DatabaseController method initBackup.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/initBackup", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> initBackup() {
logger.debug("Required actual component configuration");
List<ComponentDto> dtos = this.getDatabaseService().getCurrentComponents();
logger.debug("Actual component configuration -> {}", dtos);
return new ResponseEntity<>(new RestResponse(dtos), HttpStatus.OK);
}
use of org.entando.entando.web.common.model.RestResponse in project entando-core by entando.
the class DatabaseController method getTableDump.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/report/{reportCode}/dump/{dataSource}/{tableName}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getTableDump(@PathVariable String reportCode, @PathVariable String dataSource, @PathVariable String tableName) {
logger.debug("Required dump report -> code {} - database {} - table {}", reportCode, dataSource, tableName);
byte[] base64 = this.getDatabaseService().getTableDump(reportCode, dataSource, tableName);
Map<String, Object> response = new HashMap<>();
response.put("base64", base64);
Map<String, String> metadata = new HashMap<>();
metadata.put("reportCode", reportCode);
metadata.put("dataSource", dataSource);
metadata.put("tableName", tableName);
return new ResponseEntity<>(new RestResponse(response, new ArrayList<>(), metadata), HttpStatus.OK);
}
use of org.entando.entando.web.common.model.RestResponse 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);
}
Aggregations