use of nikita.common.model.noark5.v4.metadata.DocumentStatus in project nikita-noark5-core by HiOA-ABI.
the class DocumentStatusController method findBySystemId.
// Retrieves a given documentStatus identified by a systemId
// GET [contextPath][api]/metadata/dokumentstatus/{systemId}/
@ApiOperation(value = "Gets documentStatus identified by its systemId", notes = "Returns the requested " + " documentStatus object", response = DocumentStatus.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "DocumentStatus " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = DocumentStatus.class), @ApiResponse(code = 201, message = "DocumentStatus " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = DocumentStatus.class), @ApiResponse(code = 401, message = API_MESSAGE_UNAUTHENTICATED_USER), @ApiResponse(code = 403, message = API_MESSAGE_UNAUTHORISED_FOR_USER), @ApiResponse(code = 404, message = API_MESSAGE_MALFORMED_PAYLOAD), @ApiResponse(code = 409, message = API_MESSAGE_CONFLICT), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR), @ApiResponse(code = 501, message = API_MESSAGE_NOT_IMPLEMENTED) })
@Counted
@RequestMapping(value = DOCUMENT_STATUS + SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH, method = RequestMethod.GET)
public ResponseEntity<MetadataHateoas> findBySystemId(@PathVariable("systemID") final String systemId, HttpServletRequest request) {
DocumentStatus documentStatus = documentStatusService.findBySystemId(systemId);
MetadataHateoas metadataHateoas = new MetadataHateoas(documentStatus);
metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(documentStatus.getVersion().toString()).body(metadataHateoas);
}
use of nikita.common.model.noark5.v4.metadata.DocumentStatus in project nikita-noark5-core by HiOA-ABI.
the class DocumentStatusController method createDocumentStatus.
// API - All POST Requests (CRUD - CREATE)
// Creates a new dokumentstatus
// POST [contextPath][api]/metadata/dokumentstatus/ny-dokumentstatus
@ApiOperation(value = "Persists a new DocumentStatus object", notes = "Returns the newly" + " created DocumentStatus object after it is persisted to the database", response = DocumentStatus.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "DocumentStatus " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = DocumentStatus.class), @ApiResponse(code = 201, message = "DocumentStatus " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = DocumentStatus.class), @ApiResponse(code = 401, message = API_MESSAGE_UNAUTHENTICATED_USER), @ApiResponse(code = 403, message = API_MESSAGE_UNAUTHORISED_FOR_USER), @ApiResponse(code = 404, message = API_MESSAGE_MALFORMED_PAYLOAD), @ApiResponse(code = 409, message = API_MESSAGE_CONFLICT), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR), @ApiResponse(code = 501, message = API_MESSAGE_NOT_IMPLEMENTED) })
@Counted
@RequestMapping(method = RequestMethod.POST, value = DOCUMENT_STATUS + SLASH + NEW_DOCUMENT_STATUS)
public ResponseEntity<MetadataHateoas> createDocumentStatus(HttpServletRequest request, @RequestBody DocumentStatus documentStatus) throws NikitaException {
documentStatusService.createNewDocumentStatus(documentStatus);
MetadataHateoas metadataHateoas = new MetadataHateoas(documentStatus);
metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(documentStatus.getVersion().toString()).body(metadataHateoas);
}
Aggregations