use of nikita.model.noark5.v4.hateoas.admin.AdministrativeUnitHateoas in project nikita-noark5-core by HiOA-ABI.
the class AdministrativeUnitController method updateAdministrativeUnit.
// API - All PUT Requests (CRUD - UPDATE)
// Update a administrativtenhet
// PUT [contextPath][api]/metatdata/administrativtenhet/{systemID}
@ApiOperation(value = "Updates a AdministrativeUnit object", notes = "Returns the newly" + " updated AdministrativeUnit object after it is persisted to the database", response = AdministrativeUnit.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "AdministrativeUnit " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = AdministrativeUnit.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
@Timed
@RequestMapping(method = RequestMethod.PUT, value = ADMINISTRATIVE_UNIT + SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS)
public ResponseEntity<AdministrativeUnitHateoas> updateAdministrativeUnit(HttpServletRequest request, @ApiParam(name = "systemID", value = "systemID of documentDescription to update.", required = true) @PathVariable("systemID") String systemID, @ApiParam(name = "administrativeUnit", value = "Incoming administrativeUnit object", required = true) @RequestBody AdministrativeUnit administrativeUnit) throws NikitaException {
AdministrativeUnit newAdministrativeUnit = administrativeUnitService.update(systemID, parseETAG(request.getHeader(ETAG)), administrativeUnit);
AdministrativeUnitHateoas adminHateoas = new AdministrativeUnitHateoas(administrativeUnit);
administrativeUnitHateoasHandler.addLinks(adminHateoas, request, new Authorisation());
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(adminHateoas);
}
Aggregations