use of nikita.model.noark5.v4.hateoas.FondsHateoas in project nikita-noark5-core by HiOA-ABI.
the class FondsHateoasController method createFonds.
// API - All POST Requests (CRUD - CREATE)
// Create a Fonds
// POST [contextPath][api]/arkivstruktur/arkiv
@ApiOperation(value = "Persists a Fonds object", notes = "Returns the newly" + " created Fonds object after it is persisted to the database", response = FondsHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Fonds " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = FondsHateoas.class), @ApiResponse(code = 201, message = "Fonds " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = FondsHateoas.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 Fonds"), @ApiResponse(code = 409, message = API_MESSAGE_CONFLICT), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR) })
@Counted
@Timed
@RequestMapping(method = RequestMethod.POST, value = NEW_FONDS, consumes = { NOARK5_V4_CONTENT_TYPE_JSON })
public ResponseEntity<FondsHateoas> createFonds(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response, @ApiParam(name = "fonds", value = "Incoming fonds object", required = true) @RequestBody Fonds fonds) throws NikitaException {
validateForCreate(fonds);
Fonds createdFonds = fondsService.createNewFonds(fonds);
FondsHateoas fondsHateoas = new FondsHateoas(createdFonds);
fondsHateoasHandler.addLinks(fondsHateoas, request, new Authorisation());
response.setHeader(ETAG, fonds.getVersion().toString());
applicationEventPublisher.publishEvent(new AfterNoarkEntityCreatedEvent(this, createdFonds));
return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(createdFonds.getVersion().toString()).body(fondsHateoas);
}
use of nikita.model.noark5.v4.hateoas.FondsHateoas in project nikita-noark5-core by HiOA-ABI.
the class FondsImportController method createFonds.
// API - All POST Requests (CRUD - CREATE)
@ApiOperation(value = "Persists a Fonds object", notes = "Returns the newly" + " created Fonds object after it is persisted to the database", response = FondsHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Fonds " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = FondsHateoas.class), @ApiResponse(code = 201, message = "Fonds " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = FondsHateoas.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 Fonds"), @ApiResponse(code = 409, message = API_MESSAGE_CONFLICT), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR) })
@Counted
@Timed
@RequestMapping(method = RequestMethod.POST, value = NEW_FONDS)
public ResponseEntity<FondsHateoas> createFonds(@ApiParam(name = "fonds", value = "Incoming fonds object", required = true) @RequestBody Fonds fonds) throws NikitaException {
Fonds createdFonds = fondsImportService.createNewFonds(fonds);
FondsHateoas fondsHateoas = new FondsHateoas(createdFonds);
return new ResponseEntity<>(fondsHateoas, HttpStatus.CREATED);
}
use of nikita.model.noark5.v4.hateoas.FondsHateoas in project nikita-noark5-core by HiOA-ABI.
the class FondsImportController method createFondsAssociatedWithFonds.
// TODO: Doublecheck this logic
@ApiOperation(value = "Persists a child Fonds object", notes = "Returns the newly" + " created child Fonds object after it is persisted to the database", response = FondsHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Fonds " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = FondsHateoas.class), @ApiResponse(code = 201, message = "Fonds " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = FondsHateoas.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 Fonds"), @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
@Timed
@RequestMapping(method = RequestMethod.POST, value = FONDS + SLASH + LEFT_PARENTHESIS + "fondsSystemId" + RIGHT_PARENTHESIS + SLASH + NEW_FONDS)
public ResponseEntity<FondsHateoas> createFondsAssociatedWithFonds(@ApiParam(name = "parentFondsSystemId", value = "systemId of parent fonds to associate the fonds with.", required = true) @PathVariable String parentFondsSystemId, @ApiParam(name = "fonds", value = "Incoming fonds object", required = true) @RequestBody Fonds fonds) throws NikitaException {
Fonds createdFonds = fondsImportService.createFondsAssociatedWithFonds(parentFondsSystemId, fonds);
FondsHateoas fondsHateoas = new FondsHateoas(createdFonds);
return new ResponseEntity<>(fondsHateoas, HttpStatus.CREATED);
}
Aggregations