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