use of org.entando.entando.web.common.model.RestResponse in project entando-core by entando.
the class GuiFragmentController method getGuiFragments.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getGuiFragments(RestListRequest requestList) throws JsonProcessingException {
this.getGuiFragmentValidator().validateRestListRequest(requestList);
PagedMetadata<GuiFragmentDtoSmall> result = this.getGuiFragmentService().getGuiFragments(requestList);
this.getGuiFragmentValidator().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 GuiFragmentController method addGuiFragment.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> addGuiFragment(@Valid @RequestBody GuiFragmentRequestBody guiFragmentRequest, BindingResult bindingResult) throws ApsSystemException {
// field validations
if (bindingResult.hasErrors()) {
throw new ValidationGenericException(bindingResult);
}
// business validations
this.getGuiFragmentValidator().validate(guiFragmentRequest, bindingResult);
if (bindingResult.hasErrors()) {
throw new ValidationGenericException(bindingResult);
}
GuiFragmentDto fragment = this.getGuiFragmentService().addGuiFragment(guiFragmentRequest);
return new ResponseEntity<>(new RestResponse(fragment), HttpStatus.OK);
}
use of org.entando.entando.web.common.model.RestResponse in project entando-core by entando.
the class GuiFragmentController method deleteGuiFragment.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/{fragmentCode}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> deleteGuiFragment(@PathVariable String fragmentCode) throws ApsSystemException {
logger.info("deleting {}", fragmentCode);
this.getGuiFragmentService().removeGuiFragment(fragmentCode);
Map<String, String> result = new HashMap<>();
result.put("code", fragmentCode);
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 LabelController method geLabelGroup.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/{labelCode}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> geLabelGroup(@PathVariable String labelCode) {
logger.debug("loading label {}", labelCode);
LabelDto label = this.getLabelService().getLabelGroup(labelCode);
return new ResponseEntity<>(new RestResponse(label, null, new HashMap<>()), HttpStatus.OK);
}
use of org.entando.entando.web.common.model.RestResponse in project entando-core by entando.
the class LabelController method addLabelGroup.
@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> addLabelGroup(@Valid @RequestBody LabelRequest labelRequest) throws ApsSystemException {
logger.debug("adding label {}", labelRequest.getKey());
LabelDto group = this.getLabelService().addLabelGroup(labelRequest);
return new ResponseEntity<>(new RestResponse(group), HttpStatus.OK);
}
Aggregations