use of nikita.common.model.noark5.v4.FondsCreator in project nikita-noark5-core by HiOA-ABI.
the class FondsCreatorHateoasController method deleteSeriesBySystemId.
// Delete a FondsCreator identified by systemID
// DELETE [contextPath][api]/arkivstruktur/arkivskaper/{systemId}/
@ApiOperation(value = "Deletes a single FondsCreator entity identified by systemID", response = FondsHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Parent Fonds returned", response = FondsHateoas.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 + FONDS_CREATOR + SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS, method = RequestMethod.DELETE)
public ResponseEntity<String> deleteSeriesBySystemId(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response, @ApiParam(name = "systemID", value = "systemID of the fondsCreator to delete", required = true) @PathVariable("systemID") final String seriesSystemId) {
FondsCreator fondsCreator = fondsCreatorService.findBySystemId(seriesSystemId);
fondsCreatorService.deleteEntity(seriesSystemId);
applicationEventPublisher.publishEvent(new AfterNoarkEntityDeletedEvent(this, fondsCreator));
/* List<Fonds> fonds = new List<>();
fonds.addAll(fondsCreator.getReferenceFonds());
FondsHateoas fondsHateoas = new FondsHateoas((List<INikitaEntity>) (List)fonds);
fondsHateoasHandler.addLinks(fondsHateoas, new Authorisation());
*/
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body("{\"status\" : \"Success\"}");
}
use of nikita.common.model.noark5.v4.FondsCreator in project nikita-noark5-core by HiOA-ABI.
the class FondsHateoasController method createFondsCreatorAssociatedWithFonds.
// Create a FondsCreator and associate it with the Fonds identified by systemId
// API - All GET Requests (CRUD - READ)
// POST [contextPath][api]/arkivstruktur/arkiv/{systemId}/ny-arkivskaper
@ApiOperation(value = "Persists a FondsCreator associated with the given Fonds " + "systemId", notes = "Returns the newly created FondsCreator after it was " + "associated with a Fonds and persisted to the database", response = FondsCreatorHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "FondsCreator " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = FondsCreatorHateoas.class), @ApiResponse(code = 201, message = "FondsCreator " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = FondsCreatorHateoas.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 " + "FondsCreator"), @ApiResponse(code = 409, message = API_MESSAGE_CONFLICT), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR) })
@Counted
@RequestMapping(method = RequestMethod.POST, value = FONDS + SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + NEW_FONDS_CREATOR, consumes = { NOARK5_V4_CONTENT_TYPE_JSON })
public ResponseEntity<FondsCreatorHateoas> createFondsCreatorAssociatedWithFonds(HttpServletRequest request, @ApiParam(name = "systemID", value = "systemId of fonds to associate the series with.", required = true) @PathVariable("systemID") String systemID, @ApiParam(name = "fondsCreator", value = "Incoming fondsCreator object", required = true) @RequestBody FondsCreator fondsCreator) throws NikitaException {
validateForCreate(fondsCreator);
FondsCreatorHateoas fondsCreatorHateoas = fondsService.createFondsCreatorAssociatedWithFonds(systemID, fondsCreator);
return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(fondsCreatorHateoas.getEntityVersion().toString()).body(fondsCreatorHateoas);
}
Aggregations