@Override public ResultCursor call() throws Exception { // not sure we have to check it at all.. checkPermission(Permission.Value.read); return docMgr.getDocuments(pattern, context); }
private java.util.Collection<String> getUris(String pattern, String properties) throws Exception { Properties props = propsFromString(properties); if (props == null) { props = new Properties(); } props.setProperty(pn_document_headers, String.valueOf(DocumentAccessor.HDR_URI)); Iterable<DocumentAccessor> uris = (Iterable<DocumentAccessor>) docManager.getDocuments(pattern, props); List<String> result = new ArrayList<>(); //uris.size() for (DocumentAccessor doc: uris) { result.add(doc.getUri()); } //uris.close(); logger.debug("getUris; returning {} uris", result); return result; }
@GET @Path("/{name}") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "getCollectionDocuments: return Document uris belonging to the specified Collection") public Collection<String> getCollectionDocuments(@PathParam("name") String name) { DocumentManagement docMgr = getDocManager(); Properties props = new Properties(); props.setProperty(pn_document_headers, String.valueOf(DocumentAccessor.HDR_URI)); try (ResultCursor<DocumentAccessor> docs = docMgr.getDocuments("collections.contains(" + name + "), txFinish = 0", props)) { List<String> result = new ArrayList<>(); //itr.size()); for (DocumentAccessor doc: docs) { result.add(doc.getUri()); } return result; } catch (Exception ex) { logger.error("getCollectionDocuments.error", ex); throw new WebApplicationException(ex, Status.INTERNAL_SERVER_ERROR); } }
props.setProperty(pn_client_fetchSize, String.valueOf(size)); props.setProperty(pn_document_headers, String.valueOf(DocumentAccessor.HDR_URI)); try (ResultCursor<DocumentAccessor> uris = docMgr.getDocuments(query, props)) { if (uris.isEmpty()) { return Response.noContent().build();
@Override public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException { String pattern = arguments[0].head().getStringValue(); Properties props = null; if (arguments.length > 1) { props = sequence2Properties(arguments[1]); } else { props = new Properties(); } props.setProperty(pn_document_headers, String.valueOf(DocumentAccessor.HDR_URI)); try (ResultCursor<DocumentAccessor> uris = xdm.getDocuments(pattern, props)) { List<AtomicValue> result = new ArrayList<>(); //uris.size()); for (DocumentAccessor da: uris) { result.add(new StringValue(da.getUri())); } return new AtomicArray(result); } catch (Exception ex) { throw new XPathException(ex); } } };