use of org.entando.entando.web.common.model.RestResponse in project entando-core by entando.
the class PageModelController method deletePageModel.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/{code}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> deletePageModel(@PathVariable String code) throws ApsSystemException {
logger.debug("deleting {}", code);
this.getPageModelService().removePageModel(code);
Map<String, String> result = new HashMap<>();
result.put("code", code);
return new ResponseEntity<>(new RestResponse(result), HttpStatus.OK);
}
use of org.entando.entando.web.common.model.RestResponse in project entando-core by entando.
the class PageModelController method updatePageModel.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/{code}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, name = "roleGroup")
public ResponseEntity<RestResponse> updatePageModel(@PathVariable String code, @Valid @RequestBody PageModelRequest pageModelRequest, BindingResult bindingResult) {
// field validations
if (bindingResult.hasErrors()) {
throw new ValidationGenericException(bindingResult);
}
this.getPagemModelValidator().validateBodyName(code, pageModelRequest, bindingResult);
if (bindingResult.hasErrors()) {
throw new ValidationGenericException(bindingResult);
}
PageModelDto pageModel = this.getPageModelService().updatePageModel(pageModelRequest);
return new ResponseEntity<>(new RestResponse(pageModel), HttpStatus.OK);
}
use of org.entando.entando.web.common.model.RestResponse in project entando-core by entando.
the class PermissionController method getPermissions.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getPermissions(RestListRequest requestList) throws JsonProcessingException {
this.getPermissionValidator().validateRestListRequest(requestList);
PagedMetadata<PermissionDto> result = this.getRoleService().getPermissions(requestList);
this.getPermissionValidator().validateRestListResult(requestList, result);
logger.debug("Main Response -> {}", 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 RoleController method getRole.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/{roleCode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getRole(@PathVariable String roleCode) {
logger.debug("loading role {}", roleCode);
RoleDto role = this.getRoleService().getRole(roleCode);
return new ResponseEntity<>(new RestResponse(role), HttpStatus.OK);
}
use of org.entando.entando.web.common.model.RestResponse in project entando-core by entando.
the class RoleController method deleteRole.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/{roleCode}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> deleteRole(@PathVariable String roleCode) throws ApsSystemException {
logger.info("deleting {}", roleCode);
this.getRoleService().removeRole(roleCode);
Map<String, String> result = new HashMap<>();
result.put("code", roleCode);
return new ResponseEntity<>(new RestResponse(result), HttpStatus.OK);
}
Aggregations