use of nikita.util.exceptions.NoarkEntityNotFoundException in project nikita-noark5-core by HiOA-ABI.
the class CaseFileHateoasController method findRegistryEntryAssociatedWithCaseFileBySystemId.
// Retrieve all RegistryEntry associated with a casefile identified by systemId
// GET [contextPath][api]/casehandling/saksmappe/{systemID}/journalpost
@ApiOperation(value = "Retrieves all RegistryEntry associated with a CaseFile identified by systemId", response = RegistryEntry.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "RegistryEntry list returned", response = RegistryEntryHateoas.class), @ApiResponse(code = 401, message = API_MESSAGE_UNAUTHENTICATED_USER), @ApiResponse(code = 403, message = API_MESSAGE_UNAUTHORISED_FOR_USER), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR) })
@Counted
@Timed
@RequestMapping(value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + REGISTRY_ENTRY, method = RequestMethod.GET)
public ResponseEntity<RegistryEntryHateoas> findRegistryEntryAssociatedWithCaseFileBySystemId(HttpServletRequest request, @ApiParam(name = "systemID", value = "systemID of the caseFile to retrieve", required = true) @PathVariable("systemID") final String caseFileSystemId) {
CaseFile caseFile = caseFileService.findBySystemIdOrderBySystemId(caseFileSystemId);
if (caseFile == null) {
throw new NoarkEntityNotFoundException(caseFileSystemId);
}
RegistryEntryHateoas registryEntryHateoas = new RegistryEntryHateoas(new ArrayList<>(caseFile.getReferenceRecord()));
registryEntryHateoasHandler.addLinks(registryEntryHateoas, request, new Authorisation());
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(registryEntryHateoas);
}
Aggregations