Search in sources :

Example 46 with Authorisation

use of no.arkivlab.hioa.nikita.webapp.security.Authorisation in project nikita-noark5-core by HiOA-ABI.

the class RegistryEntryHateoasController method findOneRegistryEntrybySystemId.

// Retrieve a single registryEntry identified by systemId
// GET [contextPath][api]/casehandling/journalpost/{systemID}
@ApiOperation(value = "Retrieves a single RegistryEntry entity given a systemId", response = RegistryEntry.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "RegistryEntry returned", response = RegistryEntry.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.GET)
public ResponseEntity<RegistryEntryHateoas> findOneRegistryEntrybySystemId(HttpServletRequest request, @ApiParam(name = "systemID", value = "systemID of the registryEntry to retrieve", required = true) @PathVariable("systemID") final String registryEntrySystemId) {
    RegistryEntry registryEntry = registryEntryService.findBySystemIdOrderBySystemId(registryEntrySystemId);
    RegistryEntryHateoas registryEntryHateoas = new RegistryEntryHateoas(registryEntry);
    registryEntryHateoasHandler.addLinks(registryEntryHateoas, request, new Authorisation());
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(registryEntry.getVersion().toString()).body(registryEntryHateoas);
}
Also used : Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) RegistryEntry(nikita.model.noark5.v4.casehandling.RegistryEntry) Counted(com.codahale.metrics.annotation.Counted) Timed(com.codahale.metrics.annotation.Timed) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 47 with Authorisation

use of no.arkivlab.hioa.nikita.webapp.security.Authorisation in project nikita-noark5-core by HiOA-ABI.

the class CorrespondencePartTypeController method createCorrespondencePartType.

// API - All POST Requests (CRUD - CREATE)
// Creates a new korrespondanseparttype
// POST [contextPath][api]/metadata/korrespondanseparttype/ny-korrespondanseparttype
@ApiOperation(value = "Persists a new CorrespondencePartType object", notes = "Returns the newly" + " created CorrespondencePartType object after it is persisted to the database", response = CorrespondencePartType.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "CorrespondencePartType " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = CorrespondencePartType.class), @ApiResponse(code = 201, message = "CorrespondencePartType " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = CorrespondencePartType.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), @ApiResponse(code = 501, message = API_MESSAGE_NOT_IMPLEMENTED) })
@Counted
@Timed
@RequestMapping(method = RequestMethod.POST, value = CORRESPONDENCE_PART_TYPE + SLASH + NEW_CORRESPONDENCE_PART_TYPE)
public ResponseEntity<MetadataHateoas> createCorrespondencePartType(HttpServletRequest request, @RequestBody CorrespondencePartType correspondencePartType) throws NikitaException {
    correspondencePartTypeService.createNewCorrespondencePartType(correspondencePartType);
    MetadataHateoas metadataHateoas = new MetadataHateoas(correspondencePartType);
    metadataHateoasHandler.addLinks(metadataHateoas, request, new Authorisation());
    return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(correspondencePartType.getVersion().toString()).body(metadataHateoas);
}
Also used : Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) MetadataHateoas(nikita.model.noark5.v4.hateoas.metadata.MetadataHateoas) Counted(com.codahale.metrics.annotation.Counted) Timed(com.codahale.metrics.annotation.Timed) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 48 with Authorisation

use of no.arkivlab.hioa.nikita.webapp.security.Authorisation in project nikita-noark5-core by HiOA-ABI.

the class CorrespondencePartTypeController method findAll.

// API - All GET Requests (CRUD - READ)
// Retrieves all correspondencePartType
// GET [contextPath][api]/metadata/korrespondanseparttype/
@ApiOperation(value = "Retrieves all CorrespondencePartType ", response = CorrespondencePartType.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "CorrespondencePartType codes found", response = CorrespondencePartType.class), @ApiResponse(code = 404, message = "No CorrespondencePartType found"), @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(method = RequestMethod.GET, value = CORRESPONDENCE_PART_TYPE)
public ResponseEntity<MetadataHateoas> findAll(HttpServletRequest request) {
    MetadataHateoas metadataHateoas = new MetadataHateoas(new ArrayList<>(correspondencePartTypeService.findAllAsList()), CORRESPONDENCE_PART_TYPE);
    metadataHateoasHandler.addLinks(metadataHateoas, request, new Authorisation());
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(metadataHateoas);
}
Also used : Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) MetadataHateoas(nikita.model.noark5.v4.hateoas.metadata.MetadataHateoas) Counted(com.codahale.metrics.annotation.Counted) Timed(com.codahale.metrics.annotation.Timed) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 49 with Authorisation

use of no.arkivlab.hioa.nikita.webapp.security.Authorisation in project nikita-noark5-core by HiOA-ABI.

the class CorrespondencePartTypeController method findBySystemIdOrderBySystemId.

// Retrieves a given correspondencePartType identified by a systemId
// GET [contextPath][api]/metadata/korrespondanseparttype/{systemId}
@ApiOperation(value = "Gets correspondencePartType identified by its systemId", notes = "Returns the requested " + " correspondencePartType object", response = CorrespondencePartType.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "CorrespondencePartType " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = CorrespondencePartType.class), @ApiResponse(code = 201, message = "CorrespondencePartType " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = CorrespondencePartType.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), @ApiResponse(code = 501, message = API_MESSAGE_NOT_IMPLEMENTED) })
@Counted
@Timed
@RequestMapping(value = CORRESPONDENCE_PART_TYPE + SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS, method = RequestMethod.GET)
public ResponseEntity<MetadataHateoas> findBySystemIdOrderBySystemId(@PathVariable("systemID") final String systemId, HttpServletRequest request) {
    CorrespondencePartType correspondencePartType = correspondencePartTypeService.findBySystemIdOrderBySystemId(systemId);
    MetadataHateoas metadataHateoas = new MetadataHateoas(correspondencePartType);
    metadataHateoasHandler.addLinks(metadataHateoas, request, new Authorisation());
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(correspondencePartType.getVersion().toString()).body(metadataHateoas);
}
Also used : Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) CorrespondencePartType(nikita.model.noark5.v4.metadata.CorrespondencePartType) MetadataHateoas(nikita.model.noark5.v4.hateoas.metadata.MetadataHateoas) Counted(com.codahale.metrics.annotation.Counted) Timed(com.codahale.metrics.annotation.Timed) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Example 50 with Authorisation

use of no.arkivlab.hioa.nikita.webapp.security.Authorisation in project nikita-noark5-core by HiOA-ABI.

the class DocumentMediumController method updateDocumentMedium.

// API - All PUT Requests (CRUD - UPDATE)
// Update a documentmedium
// PUT [contextPath][api]/metatdata/dokumentmedium/
@ApiOperation(value = "Updates a DocumentMedium object", notes = "Returns the newly" + " updated DocumentMedium object after it is persisted to the database", response = DocumentMedium.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "DocumentMedium " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = DocumentMedium.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 = DOCUMENT_MEDIUM + SLASH + DOCUMENT_MEDIUM)
public ResponseEntity<MetadataHateoas> updateDocumentMedium(@RequestBody DocumentMedium documentMedium, HttpServletRequest request) throws NikitaException {
    DocumentMedium newDocumentMedium = documentMediumService.update(documentMedium);
    MetadataHateoas metadataHateoas = new MetadataHateoas(documentMedium);
    metadataHateoasHandler.addLinks(metadataHateoas, request, new Authorisation());
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(metadataHateoas);
}
Also used : Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) MetadataHateoas(nikita.model.noark5.v4.hateoas.metadata.MetadataHateoas) DocumentMedium(nikita.model.noark5.v4.metadata.DocumentMedium) Counted(com.codahale.metrics.annotation.Counted) Timed(com.codahale.metrics.annotation.Timed) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

Authorisation (no.arkivlab.hioa.nikita.webapp.security.Authorisation)108 Counted (com.codahale.metrics.annotation.Counted)105 Timed (com.codahale.metrics.annotation.Timed)105 ApiOperation (io.swagger.annotations.ApiOperation)94 ApiResponses (io.swagger.annotations.ApiResponses)94 AfterNoarkEntityCreatedEvent (no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityCreatedEvent)18 ArrayList (java.util.ArrayList)16 AfterNoarkEntityUpdatedEvent (no.arkivlab.hioa.nikita.webapp.web.events.AfterNoarkEntityUpdatedEvent)16 INikitaEntity (nikita.model.noark5.v4.interfaces.entities.INikitaEntity)15 NoarkEntityNotFoundException (nikita.util.exceptions.NoarkEntityNotFoundException)15 CaseFileHateoas (nikita.model.noark5.v4.hateoas.casehandling.CaseFileHateoas)13 MetadataHateoas (nikita.model.noark5.v4.hateoas.metadata.MetadataHateoas)12 Class (nikita.model.noark5.v4.Class)8 CaseFile (nikita.model.noark5.v4.casehandling.CaseFile)8 FondsHateoas (nikita.model.noark5.v4.hateoas.FondsHateoas)8 DocumentDescription (nikita.model.noark5.v4.DocumentDescription)7 DocumentObject (nikita.model.noark5.v4.DocumentObject)7 Fonds (nikita.model.noark5.v4.Fonds)7 ClassHateoas (nikita.model.noark5.v4.hateoas.ClassHateoas)7 DocumentObjectHateoas (nikita.model.noark5.v4.hateoas.DocumentObjectHateoas)7