use of nikita.model.noark5.v4.ClassificationSystem in project nikita-noark5-core by HiOA-ABI.
the class ClassificationSystemHateoasController method updateClassificationSystem.
// API - All PUT Requests (CRUD - UPDATE)
// Update a ClassificationSystem
// PUT [contextPath][api]/arkivstruktur/klassifikasjonsystem/{systemID}
@ApiOperation(value = "Updates a ClassificationSystem object", notes = "Returns the newly" + " update ClassificationSystem object after it is persisted to the database", response = ClassificationSystemHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "ClassificationSystem " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = ClassificationSystemHateoas.class), @ApiResponse(code = 201, message = "ClassificationSystem " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = ClassificationSystemHateoas.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 ClassificationSystem"), @ApiResponse(code = 409, message = API_MESSAGE_CONFLICT), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR) })
@Counted
@Timed
@RequestMapping(method = RequestMethod.PUT, value = CLASSIFICATION_SYSTEM + SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS, consumes = { NOARK5_V4_CONTENT_TYPE_JSON })
public ResponseEntity<ClassificationSystemHateoas> updateClassificationSystem(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response, @ApiParam(name = "systemID", value = "systemId of classificationSystem to update.", required = true) @PathVariable("systemID") String systemID, @ApiParam(name = "classificationSystem", value = "Incoming classificationSystem object", required = true) @RequestBody ClassificationSystem classificationSystem) throws NikitaException {
validateForUpdate(classificationSystem);
ClassificationSystem updatedClassificationSystem = classificationSystemService.handleUpdate(systemID, parseETAG(request.getHeader(ETAG)), classificationSystem);
ClassificationSystemHateoas classificationSystemHateoas = new ClassificationSystemHateoas(updatedClassificationSystem);
classificationSystemHateoasHandler.addLinks(classificationSystemHateoas, request, new Authorisation());
applicationEventPublisher.publishEvent(new AfterNoarkEntityUpdatedEvent(this, updatedClassificationSystem));
return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(updatedClassificationSystem.getVersion().toString()).body(classificationSystemHateoas);
}
use of nikita.model.noark5.v4.ClassificationSystem in project nikita-noark5-core by HiOA-ABI.
the class ClassificationSystemHateoasController method createClassificationSystemAssociatedWithFile.
// API - All POST Requests (CRUD - CREATE)
@ApiOperation(value = "Persists a ClassificationSystem object", notes = "Returns the newly created " + "classificationSystem object after it was persisted to the database", response = ClassificationSystemHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "ClassificationSystem " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = ClassificationSystemHateoas.class), @ApiResponse(code = 201, message = "ClassificationSystem " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = ClassificationSystemHateoas.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 ClassificationSystem"), @ApiResponse(code = 409, message = API_MESSAGE_CONFLICT), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR) })
@Counted
@Timed
@RequestMapping(method = RequestMethod.POST, value = NEW_CLASSIFICATION_SYSTEM, consumes = { NOARK5_V4_CONTENT_TYPE_JSON })
public ResponseEntity<ClassificationSystemHateoas> createClassificationSystemAssociatedWithFile(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response, @ApiParam(name = "classificationSystem", value = "Incoming classificationSystem object", required = true) @RequestBody ClassificationSystem classificationSystem) throws NikitaException {
ClassificationSystem createdClassificationSystem = classificationSystemService.createNewClassificationSystem(classificationSystem);
ClassificationSystemHateoas classificationSystemHateoas = new ClassificationSystemHateoas(createdClassificationSystem);
classificationSystemHateoasHandler.addLinks(classificationSystemHateoas, request, new Authorisation());
applicationEventPublisher.publishEvent(new AfterNoarkEntityCreatedEvent(this, createdClassificationSystem));
return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(createdClassificationSystem.getVersion().toString()).body(classificationSystemHateoas);
}
use of nikita.model.noark5.v4.ClassificationSystem in project nikita-noark5-core by HiOA-ABI.
the class ClassificationSystemHateoasController method findAllClassificationSystem.
@ApiOperation(value = "Retrieves multiple ClassificationSystem entities limited by ownership rights", notes = "The field skip" + "tells how many ClassificationSystem 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 = ClassificationSystemHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "ClassificationSystem list found", response = ClassificationSystemHateoas.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 = CLASSIFICATION_SYSTEM, method = RequestMethod.GET)
public ResponseEntity<ClassificationSystemHateoas> findAllClassificationSystem(HttpServletRequest request, final HttpServletResponse response, @RequestParam(name = "top", required = false) Integer top, @RequestParam(name = "skip", required = false) Integer skip) {
ClassificationSystemHateoas classificationSystemHateoas = new ClassificationSystemHateoas((ArrayList<INikitaEntity>) (ArrayList) classificationSystemService.findClassificationSystemByOwnerPaginated(top, skip));
classificationSystemHateoasHandler.addLinks(classificationSystemHateoas, request, new Authorisation());
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(classificationSystemHateoas);
}
use of nikita.model.noark5.v4.ClassificationSystem in project nikita-noark5-core by HiOA-ABI.
the class ClassificationSystemHateoasController method createClassAssociatedWithClassificationSystem.
@ApiOperation(value = "Persists a Class object associated with the given ClassificationSystem systemId", notes = "Returns the newly created class object after it was associated with a classificationSystem " + "object and persisted to the database", response = ClassHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Class " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = Class.class), @ApiResponse(code = 201, message = "Class " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = Class.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 Class"), @ApiResponse(code = 409, message = API_MESSAGE_CONFLICT), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR) })
@Counted
@Timed
@RequestMapping(method = RequestMethod.POST, value = CLASSIFICATION_SYSTEM + SLASH + LEFT_PARENTHESIS + "classificationSystemSystemId" + RIGHT_PARENTHESIS + SLASH + NEW_RECORD, consumes = { NOARK5_V4_CONTENT_TYPE_JSON })
public ResponseEntity<ClassHateoas> createClassAssociatedWithClassificationSystem(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response, @ApiParam(name = "classificationSystemSystemId", value = "systemId of classificationSystem to associate the klass with.", required = true) @PathVariable String classificationSystemSystemId, @ApiParam(name = "klass", value = "Incoming class object", required = true) @RequestBody Class klass) throws NikitaException {
Class createdClass = classificationSystemService.createClassAssociatedWithClassificationSystem(classificationSystemSystemId, klass);
ClassHateoas classHateoas = new ClassHateoas(createdClass);
classHateoasHandler.addLinks(classHateoas, request, new Authorisation());
applicationEventPublisher.publishEvent(new AfterNoarkEntityCreatedEvent(this, createdClass));
return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(createdClass.getVersion().toString()).body(classHateoas);
}
Aggregations