Search in sources :

Example 1 with FondsStatus

use of nikita.model.noark5.v4.metadata.FondsStatus in project nikita-noark5-core by HiOA-ABI.

the class FondsStatusController method findBySystemIdOrderBySystemId.

// Retrieves a given fondsStatus identified by a systemId
// GET [contextPath][api]/metadata/arkivstatus/{systemId}/
@ApiOperation(value = "Gets fondsStatus identified by its systemId", notes = "Returns the requested " + " fondsStatus object", response = FondsStatus.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "FondsStatus " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = FondsStatus.class), @ApiResponse(code = 201, message = "FondsStatus " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = FondsStatus.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 = FONDS_STATUS + SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH, method = RequestMethod.GET)
public ResponseEntity<MetadataHateoas> findBySystemIdOrderBySystemId(@PathVariable("systemID") final String systemId, HttpServletRequest request) {
    FondsStatus fondsStatus = fondsStatusService.findBySystemIdOrderBySystemId(systemId);
    MetadataHateoas metadataHateoas = new MetadataHateoas(fondsStatus);
    metadataHateoasHandler.addLinks(metadataHateoas, request, new Authorisation());
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(fondsStatus.getVersion().toString()).body(metadataHateoas);
}
Also used : Authorisation(no.arkivlab.hioa.nikita.webapp.security.Authorisation) FondsStatus(nikita.model.noark5.v4.metadata.FondsStatus) 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 2 with FondsStatus

use of nikita.model.noark5.v4.metadata.FondsStatus in project nikita-noark5-core by HiOA-ABI.

the class FondsStatusController method getFondsStatusTemplate.

// Create a suggested fondsStatus(like a template) with default values (nothing persisted)
// GET [contextPath][api]/metadata/ny-arkivstatus
@ApiOperation(value = "Creates a suggested FondsStatus", response = FondsStatus.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "FondsStatus codes found", response = FondsStatus.class), @ApiResponse(code = 404, message = "No FondsStatus 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 = NEW_FONDS_STATUS)
public ResponseEntity<MetadataHateoas> getFondsStatusTemplate(HttpServletRequest request) {
    FondsStatus fondsStatus = new FondsStatus();
    fondsStatus.setCode(TEMPLATE_FONDS_STATUS_CODE);
    fondsStatus.setDescription(TEMPLATE_FONDS_STATUS_DESCRIPTION);
    MetadataHateoas metadataHateoas = new MetadataHateoas(fondsStatus);
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(metadataHateoas);
}
Also used : FondsStatus(nikita.model.noark5.v4.metadata.FondsStatus) 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 3 with FondsStatus

use of nikita.model.noark5.v4.metadata.FondsStatus in project nikita-noark5-core by HiOA-ABI.

the class FondsStatusController method updateFondsStatus.

// API - All PUT Requests (CRUD - UPDATE)
// Update a arkivstatus
// PUT [contextPath][api]/metatdata/arkivstatus/
@ApiOperation(value = "Updates a FondsStatus object", notes = "Returns the newly" + " updated FondsStatus object after it is persisted to the database", response = FondsStatus.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "FondsStatus " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = FondsStatus.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 = FONDS_STATUS + SLASH + FONDS_STATUS)
public ResponseEntity<MetadataHateoas> updateFondsStatus(@RequestBody FondsStatus fondsStatus, HttpServletRequest request) throws NikitaException {
    FondsStatus newFondsStatus = fondsStatusService.update(fondsStatus);
    MetadataHateoas metadataHateoas = new MetadataHateoas(fondsStatus);
    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) FondsStatus(nikita.model.noark5.v4.metadata.FondsStatus) 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 4 with FondsStatus

use of nikita.model.noark5.v4.metadata.FondsStatus in project nikita-noark5-core by HiOA-ABI.

the class FondsStatusController method createFondsStatus.

// API - All POST Requests (CRUD - CREATE)
// Creates a new arkivstatus
// POST [contextPath][api]/metadata/arkivstatus/ny-arkivstatus
@ApiOperation(value = "Persists a new FondsStatus object", notes = "Returns the newly" + " created FondsStatus object after it is persisted to the database", response = FondsStatus.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "FondsStatus " + API_MESSAGE_OBJECT_ALREADY_PERSISTED, response = FondsStatus.class), @ApiResponse(code = 201, message = "FondsStatus " + API_MESSAGE_OBJECT_SUCCESSFULLY_CREATED, response = FondsStatus.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 = FONDS_STATUS + SLASH + NEW_FONDS_STATUS)
public ResponseEntity<MetadataHateoas> createFondsStatus(HttpServletRequest request, @RequestBody FondsStatus fondsStatus) throws NikitaException {
    fondsStatusService.createNewFondsStatus(fondsStatus);
    MetadataHateoas metadataHateoas = new MetadataHateoas(fondsStatus);
    metadataHateoasHandler.addLinks(metadataHateoas, request, new Authorisation());
    return ResponseEntity.status(HttpStatus.CREATED).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).eTag(fondsStatus.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 5 with FondsStatus

use of nikita.model.noark5.v4.metadata.FondsStatus in project nikita-noark5-core by HiOA-ABI.

the class FondsStatusController method findAll.

// API - All GET Requests (CRUD - READ)
// Retrieves all fondsStatus
// GET [contextPath][api]/metadata/arkivstatus/
@ApiOperation(value = "Retrieves all FondsStatus ", response = FondsStatus.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "FondsStatus codes found", response = FondsStatus.class), @ApiResponse(code = 404, message = "No FondsStatus 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 = FONDS_STATUS)
public ResponseEntity<MetadataHateoas> findAll(HttpServletRequest request) {
    MetadataHateoas metadataHateoas = new MetadataHateoas(new ArrayList<>(fondsStatusService.findAllAsList()), FONDS_STATUS);
    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)

Aggregations

Counted (com.codahale.metrics.annotation.Counted)5 Timed (com.codahale.metrics.annotation.Timed)5 ApiOperation (io.swagger.annotations.ApiOperation)5 ApiResponses (io.swagger.annotations.ApiResponses)5 MetadataHateoas (nikita.model.noark5.v4.hateoas.metadata.MetadataHateoas)5 Authorisation (no.arkivlab.hioa.nikita.webapp.security.Authorisation)4 FondsStatus (nikita.model.noark5.v4.metadata.FondsStatus)3