Search in sources :

Example 16 with DocumentDescriptionHateoas

use of nikita.model.noark5.v4.hateoas.DocumentDescriptionHateoas in project nikita-noark5-core by HiOA-ABI.

the class RecordHateoasController method createDefaultDocumentDescription.

// Create a DocumentDescription with default values
// GET [contextPath][api]/arkivstruktur/resgistrering/{systemId}/ny-dokumentbeskrivelse
@ApiOperation(value = "Create a DocumentDescription with default values", response = DocumentDescriptionHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "DocumentDescription returned", response = DocumentDescriptionHateoas.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
@RequestMapping(value = SLASH + LEFT_PARENTHESIS + SYSTEM_ID + RIGHT_PARENTHESIS + SLASH + NEW_DOCUMENT_DESCRIPTION, method = RequestMethod.GET)
public ResponseEntity<DocumentDescriptionHateoas> createDefaultDocumentDescription(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response) {
    DocumentDescription defaultDocumentDescription = new DocumentDescription();
    defaultDocumentDescription.setAssociatedWithRecordAs(MAIN_DOCUMENT);
    defaultDocumentDescription.setDocumentType(LETTER);
    defaultDocumentDescription.setDocumentStatus(DOCUMENT_STATUS_FINALISED);
    DocumentDescriptionHateoas documentDescriptionHateoas = new DocumentDescriptionHateoas(defaultDocumentDescription);
    documentDescriptionHateoasHandler.addLinksOnNew(documentDescriptionHateoas, new Authorisation());
    return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(documentDescriptionHateoas);
}
Also used : DocumentDescription(nikita.common.model.noark5.v4.DocumentDescription) Authorisation(nikita.webapp.security.Authorisation) Counted(com.codahale.metrics.annotation.Counted) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

Counted (com.codahale.metrics.annotation.Counted)14 ApiOperation (io.swagger.annotations.ApiOperation)14 ApiResponses (io.swagger.annotations.ApiResponses)14 Timed (com.codahale.metrics.annotation.Timed)7 Authorisation (nikita.webapp.security.Authorisation)7 Authorisation (no.arkivlab.hioa.nikita.webapp.security.Authorisation)7 DocumentDescription (nikita.common.model.noark5.v4.DocumentDescription)6 DocumentDescription (nikita.model.noark5.v4.DocumentDescription)6 DocumentDescriptionHateoas (nikita.common.model.noark5.v4.hateoas.DocumentDescriptionHateoas)4 DocumentDescriptionHateoas (nikita.model.noark5.v4.hateoas.DocumentDescriptionHateoas)4 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Record (nikita.common.model.noark5.v4.Record)2 INikitaEntity (nikita.common.model.noark5.v4.interfaces.entities.INikitaEntity)2 NoarkEntityNotFoundException (nikita.common.util.exceptions.NoarkEntityNotFoundException)2 Record (nikita.model.noark5.v4.Record)2 NoarkEntityNotFoundException (nikita.util.exceptions.NoarkEntityNotFoundException)2 DocumentObject (nikita.common.model.noark5.v4.DocumentObject)1 NoarkEntity (nikita.common.model.noark5.v4.NoarkEntity)1 HateoasNoarkObject (nikita.common.model.noark5.v4.hateoas.HateoasNoarkObject)1