Search in sources :

Example 11 with AfterNoarkEntityUpdatedEvent

use of no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent in project nikita-noark5-core by HiOA-ABI.

the class ClassHateoasController method updateClass.

// API - All PUT Requests (CRUD - UPDATE)
// Update a Class
// PUT [contextPath][api]/arkivstruktur/basisregistrering/{systemID}
@ApiOperation(value = "Updates a Class object", notes = "Returns the newly" + " update Class object after it is persisted to the database", response = ClassHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Class " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = ClassHateoas.class), @ApiResponse(code = 201, message = "Class " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = ClassHateoas.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.PUT, value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS, consumes = { NOARK5_V4_CONTENT_TYPE_JSON })
public ResponseEntity<ClassHateoas> updateClass(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response, @ApiParam(name = "systemID", value = "systemId of class to update.", required = true) @PathVariable("systemID") String systemID, @ApiParam(name = "class", value = "Incoming class object", required = true) @RequestBody Class klass) throws NikitaException {
    validateForUpdate(klass);
    Class updatedClass = classService.handleUpdate(systemID, parseETAG(request.getHeader(ETAG)), klass);
    ClassHateoas classHateoas = new ClassHateoas(updatedClass);
    classHateoasHandler.addLinks(classHateoas, request, new Authorisation());
    applicationEventPublisher.publishEvent(new AfterNoarkEntityUpdatedEvent(this, updatedClass));
    return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(updatedClass.getVersion().toString()).body(classHateoas);
}
Also used : ClassHateoas(nikita.model.noark5.v4.hateoas.ClassHateoas) Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) Class(nikita.model.noark5.v4.Class) AfterNoarkEntityUpdatedEvent(no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent) Counted(com.codahale.metrics.annotation.Counted) Timed(com.codahale.metrics.annotation.Timed) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 12 with AfterNoarkEntityUpdatedEvent

use of no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent 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);
}
Also used : ClassificationSystem(nikita.model.noark5.v4.ClassificationSystem) ClassificationSystemHateoas(nikita.model.noark5.v4.hateoas.ClassificationSystemHateoas) Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) AfterNoarkEntityUpdatedEvent(no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent) Counted(com.codahale.metrics.annotation.Counted) Timed(com.codahale.metrics.annotation.Timed) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 13 with AfterNoarkEntityUpdatedEvent

use of no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent in project nikita-noark5-core by HiOA-ABI.

the class DocumentObjectHateoasController method updateDocumentObject.

// API - All PUT Requests (CRUD - UPDATE)
// Update a DocumentObject
// PUT [contextPath][api]/arkivstruktur/dokumentobjekt/{systemID}
@ApiOperation(value = "Updates a DocumentObject object", notes = "Returns the newly" + " update DocumentObject object after it is persisted to the database", response = DocumentObjectHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "DocumentObject " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = DocumentObjectHateoas.class), @ApiResponse(code = 201, message = "DocumentObject " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = DocumentObjectHateoas.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 DocumentObject"), @ApiResponse(code = 409, message = API_MESSAGE_CONFLICT), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR) })
@Counted
@Timed
@RequestMapping(method = RequestMethod.PUT, value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS, consumes = { NOARK5_V4_CONTENT_TYPE_JSON })
public ResponseEntity<DocumentObjectHateoas> updateDocumentObject(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response, @ApiParam(name = "systemID", value = "systemId of documentObject to update.", required = true) @PathVariable("systemID") String systemID, @ApiParam(name = "documentObject", value = "Incoming documentObject object", required = true) @RequestBody DocumentObject documentObject) throws NikitaException {
    validateForUpdate(documentObject);
    DocumentObject updatedDocumentObject = documentObjectService.handleUpdate(systemID, parseETAG(request.getHeader(ETAG)), documentObject);
    DocumentObjectHateoas documentObjectHateoas = new DocumentObjectHateoas(updatedDocumentObject);
    documentObjectHateoasHandler.addLinks(documentObjectHateoas, request, new Authorisation());
    applicationEventPublisher.publishEvent(new AfterNoarkEntityUpdatedEvent(this, updatedDocumentObject));
    return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(updatedDocumentObject.getVersion().toString()).body(documentObjectHateoas);
}
Also used : DocumentObjectHateoas(nikita.model.noark5.v4.hateoas.DocumentObjectHateoas) Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) DocumentObject(nikita.model.noark5.v4.DocumentObject) AfterNoarkEntityUpdatedEvent(no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent) Counted(com.codahale.metrics.annotation.Counted) Timed(com.codahale.metrics.annotation.Timed) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 14 with AfterNoarkEntityUpdatedEvent

use of no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent in project nikita-noark5-core by HiOA-ABI.

the class FondsCreatorHateoasController method updateFondsCreator.

// API - All PUT Requests (CRUD - UPDATE)
// Updates a FondsCreator identified by a systemId
// PUT [contextPath][api]/arkivstruktur/arkivskaper/{systemId}
@ApiOperation(value = "Updates a FondsCreator identified by a systemId with new values", response = FondsCreator.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "FondsCreator updated", response = FondsCreator.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 = FONDS_CREATOR + SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS, method = RequestMethod.PUT, consumes = { NOARK5_V4_CONTENT_TYPE_JSON })
public ResponseEntity<FondsCreatorHateoas> updateFondsCreator(HttpServletRequest request, @ApiParam(name = "fondsCreator", value = "Incoming fondsCreator object", required = true) @RequestBody FondsCreator fondsCreator, @ApiParam(name = "systemId", value = "systemId of FondsCreator to retrieve.", required = true) @PathVariable("systemID") final String systemID) {
    FondsCreator createdFonds = fondsCreatorService.handleUpdate(systemID, parseETAG(request.getHeader(ETAG)), fondsCreator);
    applicationEventPublisher.publishEvent(new AfterNoarkEntityUpdatedEvent(this, createdFonds));
    FondsCreatorHateoas fondsCreatorHateoas = new FondsCreatorHateoas(createdFonds);
    fondsCreatorHateoasHandler.addLinks(fondsCreatorHateoas, request, new Authorisation());
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(createdFonds.getVersion().toString()).body(fondsCreatorHateoas);
}
Also used : Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) FondsCreatorHateoas(nikita.model.noark5.v4.hateoas.FondsCreatorHateoas) FondsCreator(nikita.model.noark5.v4.FondsCreator) AfterNoarkEntityUpdatedEvent(no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent) Counted(com.codahale.metrics.annotation.Counted) Timed(com.codahale.metrics.annotation.Timed) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 15 with AfterNoarkEntityUpdatedEvent

use of no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent in project nikita-noark5-core by HiOA-ABI.

the class FondsHateoasController method updateFonds.

// API - All PUT Requests (CRUD - UPDATE)
// Update a Fonds
// PUT [contextPath][api]/arkivstruktur/arkiv
@ApiOperation(value = "Updates a Fonds object", notes = "Returns the newly" + " update 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.PUT, value = FONDS + SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS, consumes = { NOARK5_V4_CONTENT_TYPE_JSON })
public ResponseEntity<FondsHateoas> updateFonds(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response, @ApiParam(name = "systemID", value = "systemId of fonds to update.", required = true) @PathVariable("systemID") String systemID, @ApiParam(name = "fonds", value = "Incoming fonds object", required = true) @RequestBody Fonds fonds) throws NikitaException {
    validateForUpdate(fonds);
    Fonds updatedFonds = fondsService.handleUpdate(systemID, parseETAG(request.getHeader(ETAG)), fonds);
    FondsHateoas fondsHateoas = new FondsHateoas(updatedFonds);
    fondsHateoasHandler.addLinks(fondsHateoas, request, new Authorisation());
    applicationEventPublisher.publishEvent(new AfterNoarkEntityUpdatedEvent(this, updatedFonds));
    return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(updatedFonds.getVersion().toString()).body(fondsHateoas);
}
Also used : FondsHateoas(nikita.model.noark5.v4.hateoas.FondsHateoas) Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) Fonds(nikita.model.noark5.v4.Fonds) AfterNoarkEntityUpdatedEvent(no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent) Counted(com.codahale.metrics.annotation.Counted) Timed(com.codahale.metrics.annotation.Timed) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

Counted (com.codahale.metrics.annotation.Counted)16 Timed (com.codahale.metrics.annotation.Timed)16 Authorisation (no.arkivlab.hioa.nikita.webapp.security.Authorisation)16 AfterNoarkEntityUpdatedEvent (no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent)16 ApiOperation (io.swagger.annotations.ApiOperation)15 ApiResponses (io.swagger.annotations.ApiResponses)15 FondsHateoas (nikita.model.noark5.v4.hateoas.FondsHateoas)2 CaseFileHateoas (nikita.model.noark5.v4.hateoas.casehandling.CaseFileHateoas)2 Class (nikita.model.noark5.v4.Class)1 ClassificationSystem (nikita.model.noark5.v4.ClassificationSystem)1 DocumentDescription (nikita.model.noark5.v4.DocumentDescription)1 DocumentObject (nikita.model.noark5.v4.DocumentObject)1 Fonds (nikita.model.noark5.v4.Fonds)1 FondsCreator (nikita.model.noark5.v4.FondsCreator)1 Record (nikita.model.noark5.v4.Record)1 CaseFile (nikita.model.noark5.v4.casehandling.CaseFile)1 RegistryEntry (nikita.model.noark5.v4.casehandling.RegistryEntry)1 CorrespondencePartInternal (nikita.model.noark5.v4.casehandling.secondary.CorrespondencePartInternal)1 CorrespondencePartPerson (nikita.model.noark5.v4.casehandling.secondary.CorrespondencePartPerson)1 CorrespondencePartUnit (nikita.model.noark5.v4.casehandling.secondary.CorrespondencePartUnit)1