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);
}
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);
}
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);
}
Aggregations