Search in sources :

Example 11 with AfterNoarkEntityDeletedEvent

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

the class RegistryEntryHateoasController method deleteRecordBySystemId.

// Delete a Record identified by systemID
// DELETE [contextPath][api]/casehandling/journalpost/{systemId}/
@ApiOperation(value = "Deletes a single RegistryEntry entity identified by systemID", response = String.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "Parent entity (DocumentDescription or Record) returned", response = String.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 = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS, method = RequestMethod.DELETE)
public ResponseEntity<String> deleteRecordBySystemId(HttpServletRequest request, @ApiParam(name = "systemID", value = "systemID of the record to delete", required = true) @PathVariable("systemID") final String systemID) {
    RegistryEntry registryEntry = registryEntryService.findBySystemIdOrderBySystemId(systemID);
    registryEntryService.deleteEntity(systemID);
    applicationEventPublisher.publishEvent(new AfterNoarkEntityDeletedEvent(this, registryEntry));
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(CommonUtils.WebUtils.getSuccessStatusStringForDelete());
}
Also used : RegistryEntry(nikita.model.noark5.v4.casehandling.RegistryEntry) AfterNoarkEntityDeletedEvent(no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityDeletedEvent) 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)11 Timed (com.codahale.metrics.annotation.Timed)11 AfterNoarkEntityDeletedEvent (no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityDeletedEvent)11 ApiOperation (io.swagger.annotations.ApiOperation)10 ApiResponses (io.swagger.annotations.ApiResponses)10 Authorisation (no.arkivlab.hioa.nikita.webapp.security.Authorisation)7 NikitaException (nikita.util.exceptions.NikitaException)5 Class (nikita.model.noark5.v4.Class)4 NoarkEntity (nikita.model.noark5.v4.NoarkEntity)3 Record (nikita.model.noark5.v4.Record)3 HateoasNoarkObject (nikita.model.noark5.v4.hateoas.HateoasNoarkObject)3 ClassificationSystem (nikita.model.noark5.v4.ClassificationSystem)2 DocumentDescription (nikita.model.noark5.v4.DocumentDescription)2 ClassHateoas (nikita.model.noark5.v4.hateoas.ClassHateoas)2 RecordHateoas (nikita.model.noark5.v4.hateoas.RecordHateoas)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 DocumentObject (nikita.model.noark5.v4.DocumentObject)1 FondsCreator (nikita.model.noark5.v4.FondsCreator)1 Series (nikita.model.noark5.v4.Series)1