use of nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas in project nikita-noark5-core by HiOA-ABI.
the class DocumentMediumController method findBySystemId.
// Retrieves a given documentMedium identified by a systemId
// GET [contextPath][api]/metadata/dokumentmedium/{systemId}/
@ApiOperation(value = "Gets documentMedium identified by its systemId", notes = "Returns the requested " + " documentMedium object", response = DocumentMedium.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "DocumentMedium " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = DocumentMedium.class), @ApiResponse(code = 201, message = "DocumentMedium " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = DocumentMedium.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_MEDIUM + SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH, method = RequestMethod.GET)
public ResponseEntity<MetadataHateoas> findBySystemId(@PathVariable("systemID") final String systemId, HttpServletRequest request) {
DocumentMedium documentMedium = documentMediumService.findBySystemId(systemId);
MetadataHateoas metadataHateoas = new MetadataHateoas(documentMedium);
metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(documentMedium.getVersion().toString()).body(metadataHateoas);
}
use of nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas in project nikita-noark5-core by HiOA-ABI.
the class DocumentMediumController method updateDocumentMedium.
// API - All PUT Requests (CRUD - UPDATE)
// Update a documentmedium
// PUT [contextPath][api]/metatdata/dokumentmedium/
@ApiOperation(value = "Updates a DocumentMedium object", notes = "Returns the newly" + " updated DocumentMedium object after it is persisted to the database", response = DocumentMedium.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "DocumentMedium " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = DocumentMedium.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) })
@Counted
@RequestMapping(method = RequestMethod.PUT, value = DOCUMENT_MEDIUM + SLASH + DOCUMENT_MEDIUM)
public ResponseEntity<MetadataHateoas> updateDocumentMedium(@RequestBody DocumentMedium documentMedium, HttpServletRequest request) throws NikitaException {
documentMediumService.update(documentMedium);
MetadataHateoas metadataHateoas = new MetadataHateoas(documentMedium);
metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(metadataHateoas);
}
use of nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas in project nikita-noark5-core by HiOA-ABI.
the class DocumentMediumController method createDocumentMedium.
// API - All POST Requests (CRUD - CREATE)
// Creates a new documentmedium
// POST [contextPath][api]/metadata/dokumentmedium/ny-dokumentmedium
@ApiOperation(value = "Persists a new DocumentMedium object", notes = "Returns the newly" + " created DocumentMedium object after it is persisted to the database", response = DocumentMedium.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "DocumentMedium " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = DocumentMedium.class), @ApiResponse(code = 201, message = "DocumentMedium " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = DocumentMedium.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_MEDIUM + SLASH + NEW_DOCUMENT_MEDIUM)
public ResponseEntity<MetadataHateoas> createDocumentMedium(HttpServletRequest request, @RequestBody DocumentMedium documentMedium) throws NikitaException {
DocumentMedium newDocumentMedium = documentMediumService.createNewDocumentMedium(documentMedium);
MetadataHateoas metadataHateoas = new MetadataHateoas(newDocumentMedium);
metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(newDocumentMedium.getVersion().toString()).body(metadataHateoas);
}
use of nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas in project nikita-noark5-core by HiOA-ABI.
the class DocumentMediumController method getDocumentMediumTemplate.
// Create a suggested documentMedium(like a template) with default values (nothing persisted)
// GET [contextPath][api]/metadata/ny-dokumentmedium
@ApiOperation(value = "Creates a suggested DocumentMedium", response = DocumentMedium.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "DocumentMedium codes found", response = DocumentMedium.class), @ApiResponse(code = 404, message = "No DocumentMedium found"), @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, value = NEW_DOCUMENT_MEDIUM)
public ResponseEntity<MetadataHateoas> getDocumentMediumTemplate(HttpServletRequest request) {
DocumentMedium documentMedium = new DocumentMedium();
documentMedium.setCode(TEMPLATE_DOCUMENT_MEDIUM_CODE);
documentMedium.setDescription(TEMPLATE_DOCUMENT_MEDIUM_DESCRIPTION);
MetadataHateoas metadataHateoas = new MetadataHateoas(documentMedium);
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(metadataHateoas);
}
use of nikita.common.model.noark5.v4.hateoas.metadata.MetadataHateoas in project nikita-noark5-core by HiOA-ABI.
the class DocumentStatusController method updateDocumentStatus.
// API - All PUT Requests (CRUD - UPDATE)
// Update a dokumentstatus
// PUT [contextPath][api]/metatdata/dokumentstatus/
@ApiOperation(value = "Updates a DocumentStatus object", notes = "Returns the newly" + " updated 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 = 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) })
@Counted
@RequestMapping(method = RequestMethod.PUT, value = DOCUMENT_STATUS + SLASH + DOCUMENT_STATUS)
public ResponseEntity<MetadataHateoas> updateDocumentStatus(@RequestBody DocumentStatus documentStatus, HttpServletRequest request) throws NikitaException {
documentStatusService.update(documentStatus);
MetadataHateoas metadataHateoas = new MetadataHateoas(documentStatus);
metadataHateoasHandler.addLinks(metadataHateoas, new Authorisation());
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(metadataHateoas);
}
Aggregations