Search in sources :

Example 61 with RestAccessControl

use of org.entando.entando.web.common.annotation.RestAccessControl in project entando-core by entando.

the class GroupController method deleteGroup.

@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/{groupName}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> deleteGroup(@PathVariable String groupName) throws ApsSystemException {
    logger.info("deleting {}", groupName);
    this.getGroupService().removeGroup(groupName);
    Map<String, String> result = new HashMap<>();
    result.put("code", groupName);
    return new ResponseEntity<>(new RestResponse(result), HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) HashMap(java.util.HashMap) RestResponse(org.entando.entando.web.common.model.RestResponse) RestAccessControl(org.entando.entando.web.common.annotation.RestAccessControl) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 62 with RestAccessControl

use of org.entando.entando.web.common.annotation.RestAccessControl in project entando-core by entando.

the class LabelController method deleteLabelGroup.

@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/{labelCode}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> deleteLabelGroup(@PathVariable String labelCode) throws ApsSystemException {
    logger.debug("deleting label {}", labelCode);
    this.getLabelService().removeLabelGroup(labelCode);
    Map<String, String> result = new HashMap<>();
    result.put("key", labelCode);
    return new ResponseEntity<>(new RestResponse(result), HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) HashMap(java.util.HashMap) RestResponse(org.entando.entando.web.common.model.RestResponse) RestAccessControl(org.entando.entando.web.common.annotation.RestAccessControl) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 63 with RestAccessControl

use of org.entando.entando.web.common.annotation.RestAccessControl in project entando-core by entando.

the class LabelController method getLables.

@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getLables(RestListRequest requestList) {
    logger.debug("loading labels");
    this.getLabelValidator().validateRestListRequest(requestList);
    PagedMetadata<LabelDto> result = this.getLabelService().getLabelGroups(requestList);
    this.getLabelValidator().validateRestListResult(requestList, result);
    return new ResponseEntity<>(new RestResponse(result.getBody(), null, result), HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) RestResponse(org.entando.entando.web.common.model.RestResponse) LabelDto(org.entando.entando.aps.system.services.label.model.LabelDto) RestAccessControl(org.entando.entando.web.common.annotation.RestAccessControl) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 64 with RestAccessControl

use of org.entando.entando.web.common.annotation.RestAccessControl in project entando-core by entando.

the class LanguageController method getLanguages.

@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getLanguages(RestListRequest requestList) {
    logger.trace("loading languages list");
    this.getLanguageValidator().validateRestListRequest(requestList);
    PagedMetadata<LanguageDto> result = this.getLanguageService().getLanguages(requestList);
    this.getLanguageValidator().validateRestListResult(requestList, result);
    return new ResponseEntity<>(new RestResponse(result.getBody(), null, result), HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) LanguageDto(org.entando.entando.aps.system.services.language.LanguageDto) RestResponse(org.entando.entando.web.common.model.RestResponse) RestAccessControl(org.entando.entando.web.common.annotation.RestAccessControl) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 65 with RestAccessControl

use of org.entando.entando.web.common.annotation.RestAccessControl in project entando-core by entando.

the class PageConfigurationController method updatePageWidget.

@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/pages/{pageCode}/widgets/{frameId}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> updatePageWidget(@PathVariable String pageCode, @PathVariable int frameId, @Valid @RequestBody WidgetConfigurationRequest widget, BindingResult bindingResult) {
    logger.trace("updating widget configuration in page {} and frame {}", pageCode, frameId);
    WidgetConfigurationDto widgetConfiguration = this.getPageService().updateWidgetConfiguration(pageCode, frameId, widget);
    Map<String, String> metadata = new HashMap<>();
    metadata.put("status", IPageService.STATUS_DRAFT);
    return new ResponseEntity<>(new RestResponse(widgetConfiguration, null, metadata), HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) WidgetConfigurationDto(org.entando.entando.aps.system.services.page.model.WidgetConfigurationDto) HashMap(java.util.HashMap) RestResponse(org.entando.entando.web.common.model.RestResponse) RestAccessControl(org.entando.entando.web.common.annotation.RestAccessControl) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

RestAccessControl (org.entando.entando.web.common.annotation.RestAccessControl)118 ResponseEntity (org.springframework.http.ResponseEntity)108 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)84 ValidationGenericException (org.entando.entando.web.common.exceptions.ValidationGenericException)45 RestResponse (org.entando.entando.web.common.model.RestResponse)42 HashMap (java.util.HashMap)36 ResourceNotFoundException (org.entando.entando.aps.system.exception.ResourceNotFoundException)9 ActivityStreamAuditable (org.entando.entando.web.common.annotation.ActivityStreamAuditable)9 PageDto (org.entando.entando.aps.system.services.page.model.PageDto)8 UserDto (org.entando.entando.aps.system.services.user.model.UserDto)7 ArrayList (java.util.ArrayList)6 DataModelDto (org.entando.entando.aps.system.services.dataobjectmodel.model.DataModelDto)6 WidgetConfigurationDto (org.entando.entando.aps.system.services.page.model.WidgetConfigurationDto)5 RoleDto (org.entando.entando.aps.system.services.role.model.RoleDto)5 ActionLogRecordDto (org.entando.entando.aps.system.services.actionlog.model.ActionLogRecordDto)4 CategoryDto (org.entando.entando.aps.system.services.category.model.CategoryDto)4 LabelDto (org.entando.entando.aps.system.services.label.model.LabelDto)4 PageConfigurationDto (org.entando.entando.aps.system.services.page.model.PageConfigurationDto)4 ValidationConflictException (org.entando.entando.web.common.exceptions.ValidationConflictException)4 DataTypeDto (org.entando.entando.aps.system.services.dataobject.model.DataTypeDto)3