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;
}
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);
}
Aggregations