Search in sources :

Example 6 with IdmRequestItemFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.IdmRequestItemFilter in project CzechIdMng by bcvsolutions.

the class IdmRequestItemController method toFilter.

@Override
protected IdmRequestItemFilter toFilter(MultiValueMap<String, Object> parameters) {
    IdmRequestItemFilter filter = super.toFilter(parameters);
    filter.setStates(getParameterConverter().toEnums(parameters, "states", RequestState.class));
    return filter;
}
Also used : RequestState(eu.bcvsolutions.idm.core.api.domain.RequestState) IdmRequestItemFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRequestItemFilter)

Example 7 with IdmRequestItemFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.IdmRequestItemFilter in project CzechIdMng by bcvsolutions.

the class IdmRequestController method getChanges.

@ResponseBody
@RequestMapping(value = "/{backendId}/entity/{entityId}/changes", method = RequestMethod.GET)
@PreAuthorize("hasAuthority('" + CoreGroupPermission.REQUEST_READ + "')")
@ApiOperation(value = "Request changes of entity", nickname = "getRequestEntityChange", response = IdmRequestItemDto.class, tags = { IdmRequestItemController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = CoreGroupPermission.REQUEST_READ, description = "") }), @Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = { @AuthorizationScope(scope = CoreGroupPermission.REQUEST_READ, description = "") }) })
public ResponseEntity<?> getChanges(@ApiParam(value = "Item's uuid identifier.", required = true) @PathVariable @NotNull String backendId, @ApiParam(value = "Entity's uuid identifier.", required = true) @PathVariable @NotNull String entityId) {
    IdmRequestDto dto = this.getDto(backendId);
    // Find item by entity ID and request ID
    IdmRequestItemFilter itemFilter = new IdmRequestItemFilter();
    itemFilter.setRequestId(dto.getId());
    itemFilter.setOwnerId(UUID.fromString(entityId));
    List<IdmRequestItemDto> items = requestItemService.find(itemFilter, null, IdmBasePermission.READ).getContent();
    if (items.isEmpty()) {
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    IdmRequestItemChangesDto result = requestManager.getChanges(items.get(0));
    if (result == null) {
        return new ResponseEntity<>(HttpStatus.NO_CONTENT);
    }
    // 
    return new ResponseEntity<>(result, HttpStatus.OK);
}
Also used : IdmRequestItemDto(eu.bcvsolutions.idm.core.api.dto.IdmRequestItemDto) ResponseEntity(org.springframework.http.ResponseEntity) IdmRequestItemFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRequestItemFilter) IdmRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRequestDto) IdmRequestItemChangesDto(eu.bcvsolutions.idm.core.api.dto.IdmRequestItemChangesDto) ApiOperation(io.swagger.annotations.ApiOperation) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

IdmRequestItemFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmRequestItemFilter)7 IdmRequestItemDto (eu.bcvsolutions.idm.core.api.dto.IdmRequestItemDto)5 RequestState (eu.bcvsolutions.idm.core.api.domain.RequestState)3 IdmRequestDto (eu.bcvsolutions.idm.core.api.dto.IdmRequestDto)3 Strings (com.google.common.base.Strings)2 ImmutableList (com.google.common.collect.ImmutableList)2 OperationState (eu.bcvsolutions.idm.core.api.domain.OperationState)2 RequestOperationType (eu.bcvsolutions.idm.core.api.domain.RequestOperationType)2 Requestable (eu.bcvsolutions.idm.core.api.domain.Requestable)2 IdmRequestItemChangesDto (eu.bcvsolutions.idm.core.api.dto.IdmRequestItemChangesDto)2 OperationResultDto (eu.bcvsolutions.idm.core.api.dto.OperationResultDto)2 CoreException (eu.bcvsolutions.idm.core.api.exception.CoreException)2 ConfidentialStorage (eu.bcvsolutions.idm.core.api.service.ConfidentialStorage)2 IdmRequestItemService (eu.bcvsolutions.idm.core.api.service.IdmRequestItemService)2 Transactional (org.springframework.transaction.annotation.Transactional)2 JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)1 JsonParseException (com.fasterxml.jackson.core.JsonParseException)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1