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