Search in sources :

Example 16 with AfterNoarkEntityCreatedEvent

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

the class SeriesHateoasController method createCaseFileAssociatedWithSeries.

// Create a new casefile
// POST [contextPath][api]/arkivstruktur/arkivdel/{systemId}/ny-saksmappe/
// This currently is not supported in the standard, but probably will be later
@ApiOperation(value = "Persists a CaseFile object associated with the given Series systemId", notes = "Returns " + "the newly created caseFile object after it was associated with a Series object and persisted to " + "the database", response = CaseFileHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "File " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = CaseFileHateoas.class), @ApiResponse(code = 201, message = "File " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = CaseFileHateoas.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 CaseFile"), @ApiResponse(code = 409, message = API_MESSAGE_CONFLICT), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR) })
@Counted
@Timed
@RequestMapping(method = RequestMethod.POST, value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + NEW_CASE_FILE, consumes = { NOARK5_V4_CONTENT_TYPE_JSON })
public ResponseEntity<CaseFileHateoas> createCaseFileAssociatedWithSeries(HttpServletRequest request, @ApiParam(name = "systemID", value = "systemId of series to associate the caseFile with", required = true) @PathVariable String systemID, @ApiParam(name = "caseFile", value = "Incoming caseFile object", required = true) @RequestBody CaseFile caseFile) throws NikitaException {
    validateForCreate(caseFile);
    CaseFile createdCaseFile = seriesService.createCaseFileAssociatedWithSeries(systemID, caseFile);
    CaseFileHateoas caseFileHateoas = new CaseFileHateoas(createdCaseFile);
    caseFileHateoasHandler.addLinks(caseFileHateoas, request, new Authorisation());
    applicationEventPublisher.publishEvent(new AfterNoarkEntityCreatedEvent(this, createdCaseFile));
    return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(createdCaseFile.getVersion().toString()).body(caseFileHateoas);
}
Also used : CaseFileHateoas(nikita.model.noark5.v4.hateoas.casehandling.CaseFileHateoas) AfterNoarkEntityCreatedEvent(no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityCreatedEvent) CaseFile(nikita.model.noark5.v4.casehandling.CaseFile) Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) Counted(com.codahale.metrics.annotation.Counted) Timed(com.codahale.metrics.annotation.Timed)

Example 17 with AfterNoarkEntityCreatedEvent

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

the class RegistryEntryHateoasController method createCorrespondencePartInternalAssociatedWithRecord.

// Create a new CorrespondencePartInternal and associate it with the given journalpost
// POST [contextPath][api]/casehandling/journalpost/{systemId}/ny-korrespondansepartintern
// http://rel.kxml.no/noark5/v4/api/sakarkiv/ny-korrespondansepartintern/
@ApiOperation(value = "Persists a CorrespondencePartInternal object associated with the given Record systemId", notes = "Returns the newly created CorrespondencePartInternal object after it was associated with a " + "Record object and persisted to the database", response = CorrespondencePartInternalHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "CorrespondencePartInternal " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = CorrespondencePartInternalHateoas.class), @ApiResponse(code = 201, message = "CorrespondencePartInternal " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = CorrespondencePartInternalHateoas.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 CorrespondencePartInternal"), @ApiResponse(code = 409, message = API_MESSAGE_CONFLICT), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR) })
@Counted
@Timed
@RequestMapping(method = RequestMethod.POST, value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + NEW_CORRESPONDENCE_PART_INTERNAL, consumes = { NOARK5_V4_CONTENT_TYPE_JSON })
public ResponseEntity<CorrespondencePartInternalHateoas> createCorrespondencePartInternalAssociatedWithRecord(HttpServletRequest request, @ApiParam(name = "systemID", value = "systemId of record to associate the CorrespondencePartInternal with.", required = true) @PathVariable("systemID") String systemID, @ApiParam(name = "CorrespondencePartInternal", value = "Incoming CorrespondencePartInternal object", required = true) @RequestBody CorrespondencePartInternal CorrespondencePartInternal) throws NikitaException {
    CorrespondencePartInternal createdCorrespondencePartInternal = registryEntryService.createCorrespondencePartInternalAssociatedWithRegistryEntry(systemID, CorrespondencePartInternal);
    CorrespondencePartInternalHateoas correspondencePartInternalHateoas = new CorrespondencePartInternalHateoas(createdCorrespondencePartInternal);
    correspondencePartHateoasHandler.addLinks(correspondencePartInternalHateoas, request, new Authorisation());
    applicationEventPublisher.publishEvent(new AfterNoarkEntityCreatedEvent(this, createdCorrespondencePartInternal));
    return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(createdCorrespondencePartInternal.getVersion().toString()).body(correspondencePartInternalHateoas);
}
Also used : AfterNoarkEntityCreatedEvent(no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityCreatedEvent) Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) Counted(com.codahale.metrics.annotation.Counted) Timed(com.codahale.metrics.annotation.Timed) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 18 with AfterNoarkEntityCreatedEvent

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

the class RegistryEntryHateoasController method createCorrespondencePartPersonAssociatedWithRecord.

// API - All POST Requests (CRUD - CREATE)
// Create a new CorrespondencePartPerson and associate it with the given journalpost
// POST [contextPath][api]/casehandling/journalpost/{systemId}/ny-korrespondansepartperson
// http://rel.kxml.no/noark5/v4/api/sakarkiv/ny-korrespondansepartperson/
@ApiOperation(value = "Persists a CorrespondencePartPerson object associated with the given Record systemId", notes = "Returns the newly created CorrespondencePartPerson object after it was associated with a " + "Record object and persisted to the database", response = CorrespondencePartPersonHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "CorrespondencePartPerson " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = CorrespondencePartPersonHateoas.class), @ApiResponse(code = 201, message = "CorrespondencePartPerson " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = CorrespondencePartPersonHateoas.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 CorrespondencePartPerson"), @ApiResponse(code = 409, message = API_MESSAGE_CONFLICT), @ApiResponse(code = 500, message = API_MESSAGE_INTERNAL_SERVER_ERROR) })
@Counted
@Timed
@RequestMapping(method = RequestMethod.POST, value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + NEW_CORRESPONDENCE_PART_PERSON, consumes = { NOARK5_V4_CONTENT_TYPE_JSON })
public ResponseEntity<CorrespondencePartPersonHateoas> createCorrespondencePartPersonAssociatedWithRecord(HttpServletRequest request, @ApiParam(name = "systemID", value = "systemId of record to associate the CorrespondencePartPerson with.", required = true) @PathVariable("systemID") String systemID, @ApiParam(name = "CorrespondencePartPerson", value = "Incoming CorrespondencePartPerson object", required = true) @RequestBody CorrespondencePartPerson CorrespondencePartPerson) throws NikitaException {
    CorrespondencePartPerson createdCorrespondencePartPerson = registryEntryService.createCorrespondencePartPersonAssociatedWithRegistryEntry(systemID, CorrespondencePartPerson);
    CorrespondencePartPersonHateoas correspondencePartPersonHateoas = new CorrespondencePartPersonHateoas(createdCorrespondencePartPerson);
    correspondencePartHateoasHandler.addLinks(correspondencePartPersonHateoas, request, new Authorisation());
    applicationEventPublisher.publishEvent(new AfterNoarkEntityCreatedEvent(this, createdCorrespondencePartPerson));
    return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(createdCorrespondencePartPerson.getVersion().toString()).body(correspondencePartPersonHateoas);
}
Also used : AfterNoarkEntityCreatedEvent(no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityCreatedEvent) Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) 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)18 Timed (com.codahale.metrics.annotation.Timed)18 Authorisation (no.arkivlab.hioa.nikita.webapp.security.Authorisation)18 AfterNoarkEntityCreatedEvent (no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityCreatedEvent)18 ApiOperation (io.swagger.annotations.ApiOperation)16 ApiResponses (io.swagger.annotations.ApiResponses)16 Class (nikita.model.noark5.v4.Class)2 Fonds (nikita.model.noark5.v4.Fonds)2 CaseFile (nikita.model.noark5.v4.casehandling.CaseFile)2 ClassHateoas (nikita.model.noark5.v4.hateoas.ClassHateoas)2 FondsCreatorHateoas (nikita.model.noark5.v4.hateoas.FondsCreatorHateoas)2 FondsHateoas (nikita.model.noark5.v4.hateoas.FondsHateoas)2 CaseFileHateoas (nikita.model.noark5.v4.hateoas.casehandling.CaseFileHateoas)2 ClassificationSystem (nikita.model.noark5.v4.ClassificationSystem)1 DocumentDescription (nikita.model.noark5.v4.DocumentDescription)1 DocumentObject (nikita.model.noark5.v4.DocumentObject)1 Series (nikita.model.noark5.v4.Series)1 RegistryEntry (nikita.model.noark5.v4.casehandling.RegistryEntry)1 ClassificationSystemHateoas (nikita.model.noark5.v4.hateoas.ClassificationSystemHateoas)1 DocumentObjectHateoas (nikita.model.noark5.v4.hateoas.DocumentObjectHateoas)1