Search in sources :

Example 51 with NoarkEntityNotFoundException

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);
}
Also used : RegistryEntryHateoas(nikita.model.noark5.v4.hateoas.casehandling.RegistryEntryHateoas) CaseFile(nikita.model.noark5.v4.casehandling.CaseFile) Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) NoarkEntityNotFoundException(nikita.util.exceptions.NoarkEntityNotFoundException) Counted(com.codahale.metrics.annotation.Counted) Timed(com.codahale.metrics.annotation.Timed) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

NoarkEntityNotFoundException (nikita.util.exceptions.NoarkEntityNotFoundException)51 Authorisation (no.arkivlab.hioa.nikita.webapp.security.Authorisation)15 Counted (com.codahale.metrics.annotation.Counted)14 Timed (com.codahale.metrics.annotation.Timed)14 ApiOperation (io.swagger.annotations.ApiOperation)12 ApiResponses (io.swagger.annotations.ApiResponses)12 Fonds (nikita.model.noark5.v4.Fonds)8 CaseFile (nikita.model.noark5.v4.casehandling.CaseFile)8 DocumentDescription (nikita.model.noark5.v4.DocumentDescription)7 File (nikita.model.noark5.v4.File)7 Record (nikita.model.noark5.v4.Record)7 Series (nikita.model.noark5.v4.Series)7 NoarkEntityEditWhenClosedException (nikita.util.exceptions.NoarkEntityEditWhenClosedException)7 BasicRecord (nikita.model.noark5.v4.BasicRecord)5 DocumentObject (nikita.model.noark5.v4.DocumentObject)5 Class (nikita.model.noark5.v4.Class)4 ClassificationSystem (nikita.model.noark5.v4.ClassificationSystem)3 RegistryEntry (nikita.model.noark5.v4.casehandling.RegistryEntry)3 DocumentObjectHateoas (nikita.model.noark5.v4.hateoas.DocumentObjectHateoas)3 IOException (java.io.IOException)2