use of nikita.model.noark5.v4.Series in project nikita-noark5-core by HiOA-ABI.
the class SeriesHateoasController method createCaseFileAssociatedWithSeries.
// Create a new casefile
// POST [contextPath][api]/arkivstruktur/arkivdel/{systemId}/ny-saksmappe/
// This currently is not supported in the standard, but probably will be later
@ApiOperation(value = "Persists a CaseFile object associated with the given Series systemId", notes = "Returns " + "the newly created caseFile object after it was associated with a Series object and persisted to " + "the database", response = CaseFileHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "File " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = CaseFileHateoas.class), @ApiResponse(code = 201, message = "File " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = CaseFileHateoas.class), @ApiResponse(code = 401, message = API_MESSAGE_UNAUTHENTICATED_USER), @ApiResponse(code = 403, message = API_MESSAGE_UNAUTHORISED_FOR_USER), @ApiResponse(code = 404, message = API_MESSAGE_PARENT_DOES_NOT_EXIST + " of type CaseFile"), @ApiResponse(code = 409, message = API_MESSAGE_CONFLICT), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR) })
@Counted
@RequestMapping(method = RequestMethod.POST, value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + NEW_CASE_FILE, consumes = { NOARK5_V4_CONTENT_TYPE_JSON })
public ResponseEntity<CaseFileHateoas> createCaseFileAssociatedWithSeries(HttpServletRequest request, @ApiParam(name = "systemID", value = "systemId of series to associate the caseFile with", required = true) @PathVariable String systemID, @ApiParam(name = "caseFile", value = "Incoming caseFile object", required = true) @RequestBody CaseFile caseFile) throws NikitaException {
validateForCreate(caseFile);
CaseFile createdCaseFile = seriesService.createCaseFileAssociatedWithSeries(systemID, caseFile);
CaseFileHateoas caseFileHateoas = new CaseFileHateoas(createdCaseFile);
caseFileHateoasHandler.addLinks(caseFileHateoas, new Authorisation());
applicationEventPublisher.publishEvent(new AfterNoarkEntityCreatedEvent(this, createdCaseFile));
return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(createdCaseFile.getVersion().toString()).body(caseFileHateoas);
}
use of nikita.model.noark5.v4.Series in project nikita-noark5-core by HiOA-ABI.
the class SeriesHateoasController method findAllRecordAssociatedWithSeries.
// Retrieve all Records associated with a Series (paginated)
// GET [contextPath][api]/arkivstruktur/arkivdel/{systemId}/registrering/
// GET [contextPath][api]/arkivstruktur/arkivdel/{systemId}/registrering/?top=5&skip=1
@ApiOperation(value = "Retrieves a lit of Records associated with a Series", notes = "The field skip" + "tells how many Record 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 = RecordHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Record list found", response = RecordHateoas.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 + REGISTRATION, method = RequestMethod.GET)
public ResponseEntity<RecordHateoas> findAllRecordAssociatedWithSeries(HttpServletRequest request, @RequestParam(name = "top", required = false) Integer top, @RequestParam(name = "skip", required = false) Integer skip, @ApiParam(name = "systemID", value = "systemID of the series to retrieve", required = true) @PathVariable("systemID") final String systemID) {
Series series = seriesService.findBySystemId(systemID);
RecordHateoas recordHateoas = new RecordHateoas((List<INikitaEntity>) (List) series.getReferenceRecord());
recordHateoasHandler.addLinks(recordHateoas, new Authorisation());
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(recordHateoas);
}
use of nikita.model.noark5.v4.Series in project nikita-noark5-core by HiOA-ABI.
the class SeriesHateoasController method createFileAssociatedWithSeries.
// API - All POST Requests (CRUD - CREATE)
// Create a new file
// POST [contextPath][api]/arkivstruktur/arkivdel/ny-mappe/
@ApiOperation(value = "Persists a File object associated with the given Series systemId", notes = "Returns the " + "newly created file object after it was associated with a Series object and persisted to the database", response = FileHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "File " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = FileHateoas.class), @ApiResponse(code = 201, message = "File " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = FileHateoas.class), @ApiResponse(code = 401, message = API_MESSAGE_UNAUTHENTICATED_USER), @ApiResponse(code = 403, message = API_MESSAGE_UNAUTHORISED_FOR_USER), @ApiResponse(code = 404, message = API_MESSAGE_PARENT_DOES_NOT_EXIST + " of type File"), @ApiResponse(code = 409, message = API_MESSAGE_CONFLICT), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR) })
@Counted
@RequestMapping(method = RequestMethod.POST, value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + NEW_FILE, consumes = { NOARK5_V4_CONTENT_TYPE_JSON })
public ResponseEntity<FileHateoas> createFileAssociatedWithSeries(HttpServletRequest request, @ApiParam(name = "systemID", value = "systemId of series to associate the caseFile with", required = true) @PathVariable String systemID, @ApiParam(name = "File", value = "Incoming file object", required = true) @RequestBody File file) throws NikitaException {
validateForCreate(file);
File createdFile = seriesService.createFileAssociatedWithSeries(systemID, file);
FileHateoas fileHateoas = new FileHateoas(createdFile);
fileHateoasHandler.addLinks(fileHateoas, new Authorisation());
applicationEventPublisher.publishEvent(new AfterNoarkEntityCreatedEvent(this, createdFile));
return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(createdFile.getVersion().toString()).body(fileHateoas);
}
use of nikita.model.noark5.v4.Series in project nikita-noark5-core by HiOA-ABI.
the class SeriesHateoasController method findAllSeries.
// Retrieve all Series (paginated)
// GET [contextPath][api]/arkivstruktur/arkivdel/{systemId}/klassifikasjonssystem/
@ApiOperation(value = "Retrieves multiple Series entities limited by ownership rights", notes = "The field skip" + "tells how many Series 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 = SeriesHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Series list found", response = SeriesHateoas.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<SeriesHateoas> findAllSeries(HttpServletRequest request, @RequestParam(name = "top", required = false) Integer top, @RequestParam(name = "skip", required = false) Integer skip) {
String ownedBy = SecurityContextHolder.getContext().getAuthentication().getName();
SeriesHateoas seriesHateoas = new SeriesHateoas((List<INikitaEntity>) (List) seriesService.findByOwnedBy(ownedBy));
seriesHateoasHandler.addLinksOnRead(seriesHateoas, new Authorisation());
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(seriesHateoas);
}
use of nikita.model.noark5.v4.Series in project nikita-noark5-core by HiOA-ABI.
the class CaseFileHateoasController method createRegistryEntryAssociatedWithFile.
// API - All POST Requests (CRUD - CREATE)
// Create a RegistryEntry entity
// POST [contextPath][api]/casehandling/{systemId}/ny-journalpost
@ApiOperation(value = "Persists a RegistryEntry object associated with the given Series systemId", notes = "Returns the newly created record object after it was associated with a File object and " + "persisted to the database", response = RegistryEntryHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "RegistryEntry " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = RegistryEntryHateoas.class), @ApiResponse(code = 201, message = "RegistryEntry " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = RegistryEntryHateoas.class), @ApiResponse(code = 401, message = API_MESSAGE_UNAUTHENTICATED_USER), @ApiResponse(code = 403, message = API_MESSAGE_UNAUTHORISED_FOR_USER), @ApiResponse(code = 404, message = API_MESSAGE_PARENT_DOES_NOT_EXIST + " of type RegistryEntry"), @ApiResponse(code = 409, message = API_MESSAGE_CONFLICT), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR) })
@Counted
@RequestMapping(method = RequestMethod.POST, value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + NEW_REGISTRY_ENTRY, consumes = { NOARK5_V4_CONTENT_TYPE_JSON })
public ResponseEntity<RegistryEntryHateoas> createRegistryEntryAssociatedWithFile(HttpServletRequest request, @ApiParam(name = "systemID", value = "systemId of file to associate the record with", required = true) @PathVariable("systemID") final String systemID, @ApiParam(name = "RegistryEntry", value = "Incoming registryEntry object", required = true) @RequestBody RegistryEntry registryEntry) throws NikitaException {
RegistryEntry createdRegistryEntry = caseFileService.createRegistryEntryAssociatedWithCaseFile(systemID, registryEntry);
RegistryEntryHateoas registryEntryHateoas = new RegistryEntryHateoas(createdRegistryEntry);
registryEntryHateoasHandler.addLinks(registryEntryHateoas, new Authorisation());
applicationEventPublisher.publishEvent(new AfterNoarkEntityCreatedEvent(this, createdRegistryEntry));
return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(createdRegistryEntry.getVersion().toString()).body(registryEntryHateoas);
}
Aggregations