Search in sources :

Example 6 with CaseFileHateoas

use of nikita.common.model.noark5.v4.hateoas.casehandling.CaseFileHateoas in project nikita-noark5-core by HiOA-ABI.

the class SeriesHateoasController method findAllCaseFileAssociatedWithCaseFile.

// Retrieve all CaseFiles associated with a Series (paginated)
// GET [contextPath][api]/arkivstruktur/arkivdel/{systemId}/saksmappe/
// GET [contextPath][api]/arkivstruktur/arkivdel/{systemId}/saksmappe/?top=5&skip=1
@ApiOperation(value = "Retrieves a list of CaseFiles associated with a Series", notes = "The field skip" + "tells how many CaseFile rows of the result set to ignore (starting at 0), while  top tells how many rows" + " after skip to return. Note if the value of top is greater than system value " + " nikita-noark5-core.pagination.maxPageSize, then nikita-noark5-core.pagination.maxPageSize is used. ", response = CaseFileHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "CaseFile list found", response = CaseFileHateoas.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
@RequestMapping(value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + CASE_FILE, method = RequestMethod.GET)
public ResponseEntity<CaseFileHateoas> findAllCaseFileAssociatedWithCaseFile(HttpServletRequest request, @ApiParam(name = "systemID", value = "systemID of the series to retrieve", required = true) @PathVariable("systemID") final String systemID) {
    seriesService.findAllCaseFileBySeries(systemID);
    CaseFileHateoas caseFileHateoas = new CaseFileHateoas((List<INikitaEntity>) (List) seriesService.findAllCaseFileBySeries(systemID));
    caseFileHateoasHandler.addLinksOnRead(caseFileHateoas, new Authorisation());
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(caseFileHateoas);
}
Also used : CaseFileHateoas(nikita.common.model.noark5.v4.hateoas.casehandling.CaseFileHateoas) INikitaEntity(nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity) Authorisation(nikita.webapp.security.Authorisation) List(java.util.List) Counted(com.codahale.metrics.annotation.Counted)

Example 7 with CaseFileHateoas

use of nikita.common.model.noark5.v4.hateoas.casehandling.CaseFileHateoas in project nikita-noark5-core by HiOA-ABI.

the class SeriesHateoasController method createDefaultCaseFile.

// Create a CaseFile object with default values
// GET [contextPath][api]/arkivstruktur/arkivdel/{systemId}/ny-saksmappe/
@ApiOperation(value = "Create a CaseFile with default values", response = CaseFile.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "CaseFile returned", response = CaseFile.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
@RequestMapping(value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + NEW_CASE_FILE, method = RequestMethod.GET)
public ResponseEntity<CaseFileHateoas> createDefaultCaseFile(HttpServletRequest request, final HttpServletResponse response) {
    CaseFile defaultCaseFile = new CaseFile();
    defaultCaseFile = setCaseFileDefaults(defaultCaseFile);
    CaseFileHateoas caseFileHateoas = new CaseFileHateoas(defaultCaseFile);
    caseFileHateoasHandler.addLinksOnNew(caseFileHateoas, new Authorisation());
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(caseFileHateoas);
}
Also used : CaseFileHateoas(nikita.common.model.noark5.v4.hateoas.casehandling.CaseFileHateoas) CaseFile(nikita.common.model.noark5.v4.casehandling.CaseFile) Authorisation(nikita.webapp.security.Authorisation) Counted(com.codahale.metrics.annotation.Counted)

Example 8 with CaseFileHateoas

use of nikita.common.model.noark5.v4.hateoas.casehandling.CaseFileHateoas in project nikita-noark5-core by HiOA-ABI.

the class CaseFileHateoasController method findOneCaseFilebySystemId.

// Retrieve a single casefile identified by systemId
// GET [contextPath][api]/casehandling/saksmappe/{systemID}
@ApiOperation(value = "Retrieves a single CaseFile entity given a systemId", response = CaseFile.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "CaseFile returned", response = CaseFile.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
@RequestMapping(value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS, method = RequestMethod.GET)
public ResponseEntity<CaseFileHateoas> findOneCaseFilebySystemId(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response, @ApiParam(name = "systemID", value = "systemID of the caseFile to retrieve", required = true) @PathVariable("systemID") final String caseFileSystemId) {
    CaseFile caseFile = caseFileService.findBySystemId(caseFileSystemId);
    if (caseFile == null) {
        throw new NoarkEntityNotFoundException(caseFileSystemId);
    }
    CaseFileHateoas caseFileHateoas = new CaseFileHateoas(caseFile);
    caseFileHateoasHandler.addLinks(caseFileHateoas, new Authorisation());
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(caseFile.getVersion().toString()).body(caseFileHateoas);
}
Also used : CaseFileHateoas(nikita.common.model.noark5.v4.hateoas.casehandling.CaseFileHateoas) CaseFile(nikita.common.model.noark5.v4.casehandling.CaseFile) Authorisation(nikita.webapp.security.Authorisation) NoarkEntityNotFoundException(nikita.common.util.exceptions.NoarkEntityNotFoundException) Counted(com.codahale.metrics.annotation.Counted) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 9 with CaseFileHateoas

use of nikita.common.model.noark5.v4.hateoas.casehandling.CaseFileHateoas in project nikita-noark5-core by HiOA-ABI.

the class CaseFileHateoasController method findAllCaseFile.

@ApiOperation(value = "Retrieves multiple CaseFile entities limited by ownership rights", notes = "The field skip" + "tells how many CaseFile rows of the result set to ignore (starting at 0), while  top tells how many rows" + " after skip to return. Note if the value of top is greater than system value " + " nikita-noark5-core.pagination.maxPageSize, then nikita-noark5-core.pagination.maxPageSize is used. ", response = CaseFileHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "CaseFile list found", response = CaseFileHateoas.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
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<CaseFileHateoas> findAllCaseFile(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response, @RequestParam(name = "top", required = false) Integer top, @RequestParam(name = "skip", required = false) Integer skip) {
    CaseFileHateoas caseFileHateoas = new CaseFileHateoas((List<INikitaEntity>) (List) caseFileService.findCaseFileByOwnerPaginated(top, skip));
    caseFileHateoasHandler.addLinks(caseFileHateoas, new Authorisation());
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(caseFileHateoas);
}
Also used : CaseFileHateoas(nikita.common.model.noark5.v4.hateoas.casehandling.CaseFileHateoas) INikitaEntity(nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity) Authorisation(nikita.webapp.security.Authorisation) List(java.util.List) Counted(com.codahale.metrics.annotation.Counted) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 10 with CaseFileHateoas

use of nikita.common.model.noark5.v4.hateoas.casehandling.CaseFileHateoas in project nikita-noark5-core by HiOA-ABI.

the class SeriesHateoasController method createDefaultCaseFile.

// Create a CaseFile object with default values
// GET [contextPath][api]/arkivstruktur/arkivdel/{systemId}/ny-saksmappe/
@ApiOperation(value = "Create a CaseFile with default values", response = CaseFile.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "CaseFile returned", response = CaseFile.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 + NEW_CASE_FILE, method = RequestMethod.GET)
public ResponseEntity<CaseFileHateoas> createDefaultCaseFile(HttpServletRequest request, final HttpServletResponse response) {
    CaseFile defaultCaseFile = new CaseFile();
    defaultCaseFile.setTitle(TEST_TITLE);
    defaultCaseFile.setOfficialTitle(TEST_TITLE);
    defaultCaseFile.setFileId("2017/01");
    defaultCaseFile.setDescription(TEST_DESCRIPTION);
    defaultCaseFile.setDocumentMedium(DOCUMENT_MEDIUM_ELECTRONIC);
    defaultCaseFile.setTitle(TEST_TITLE);
    defaultCaseFile.setDescription(TEST_DESCRIPTION);
    defaultCaseFile.setDocumentMedium(DOCUMENT_MEDIUM_ELECTRONIC);
    defaultCaseFile.setCaseResponsible(TEST_USER_CASE_HANDLER_1);
    defaultCaseFile.setAdministrativeUnit(TEST_ADMINISTRATIVE_UNIT);
    defaultCaseFile.setCaseDate(new Date());
    defaultCaseFile.setCaseStatus(STATUS_OPEN);
    CaseFileHateoas caseFileHateoas = new CaseFileHateoas(defaultCaseFile);
    caseFileHateoasHandler.addLinksOnNew(caseFileHateoas, request, new Authorisation());
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(caseFileHateoas);
}
Also used : CaseFileHateoas(nikita.model.noark5.v4.hateoas.casehandling.CaseFileHateoas) CaseFile(nikita.model.noark5.v4.casehandling.CaseFile) Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) Date(java.util.Date) Counted(com.codahale.metrics.annotation.Counted) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

Counted (com.codahale.metrics.annotation.Counted)12 Timed (com.codahale.metrics.annotation.Timed)6 ApiOperation (io.swagger.annotations.ApiOperation)6 ApiResponses (io.swagger.annotations.ApiResponses)6 CaseFileHateoas (nikita.common.model.noark5.v4.hateoas.casehandling.CaseFileHateoas)6 CaseFileHateoas (nikita.model.noark5.v4.hateoas.casehandling.CaseFileHateoas)6 Authorisation (nikita.webapp.security.Authorisation)6 Authorisation (no.arkivlab.hioa.nikita.webapp.security.Authorisation)6 CaseFile (nikita.common.model.noark5.v4.casehandling.CaseFile)5 CaseFile (nikita.model.noark5.v4.casehandling.CaseFile)5 ArrayList (java.util.ArrayList)2 List (java.util.List)2 INikitaEntity (nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity)2 INikitaEntity (nikita.model.noark5.v4.interfaces.entities.INikitaEntity)2 Date (java.util.Date)1 NoarkEntityNotFoundException (nikita.common.util.exceptions.NoarkEntityNotFoundException)1 NoarkEntityNotFoundException (nikita.util.exceptions.NoarkEntityNotFoundException)1 AfterNoarkEntityCreatedEvent (nikita.webapp.web.events.AfterNoarkEntityCreatedEvent)1 AfterNoarkEntityUpdatedEvent (nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent)1 AfterNoarkEntityCreatedEvent (no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityCreatedEvent)1