use of nikita.common.model.noark5.v4.DocumentObject in project nikita-noark5-core by HiOA-ABI.
the class DocumentObjectHateoasController method findAllDocumentObject.
// Get all documentObject
// GET [contextPath][api]/arkivstruktur/dokumentobjekt/
@ApiOperation(value = "Retrieves multiple DocumentObject entities limited by ownership rights", notes = "The field skip" + "tells how many DocumentObject rows of the result set to ignore (starting at 0), while top tells how many rows" + " after skip to return. Note if the value of top is greater than system value " + " nikita-noark5-core.pagination.maxPageSize, then nikita-noark5-core.pagination.maxPageSize is used. ", response = DocumentObjectHateoas.class)
@ApiResponses(value = { @ApiResponse(code = 200, message = "DocumentObject list found", response = DocumentObjectHateoas.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(method = RequestMethod.GET, produces = { NOARK5_V4_CONTENT_TYPE_JSON, NOARK5_V4_CONTENT_TYPE_JSON_XML })
public ResponseEntity<DocumentObjectHateoas> findAllDocumentObject(final UriComponentsBuilder uriBuilder, HttpServletRequest request, final HttpServletResponse response, @RequestParam(name = "top", required = false) Integer top, @RequestParam(name = "skip", required = false) Integer skip, @RequestParam(name = "filter", required = false) String filter) {
String reg = " ";
String[] pieces;
DocumentObjectHateoas documentObjectHateoas = null;
if (filter != null) {
pieces = filter.split(reg);
if (pieces.length == 3 && pieces[1].equalsIgnoreCase("eq")) {
pieces[2] = pieces[2].replace("\'", "");
documentObjectHateoas = new DocumentObjectHateoas((List<INikitaEntity>) (List) documentObjectService.findDocumentObjectByAnyColumn(pieces[0], pieces[2]));
}
}
if (null == documentObjectHateoas) {
String loggedInUser = SecurityContextHolder.getContext().getAuthentication().getName();
documentObjectHateoas = new DocumentObjectHateoas((List<INikitaEntity>) (List) documentObjectService.findByOwnedBy(loggedInUser));
}
documentObjectHateoasHandler.addLinks(documentObjectHateoas, new Authorisation());
return ResponseEntity.status(HttpStatus.OK).allow(CommonUtils.WebUtils.getMethodsForRequestOrThrow(request.getServletPath())).body(documentObjectHateoas);
}
Aggregations