while (cursor.hasNext()) { VPackSlice aDocument = cursor.next(); HashMap<String, ByteIterator> aMap = new HashMap<String, ByteIterator>(aDocument.size()); if (!this.fillMap(aMap, aDocument)) { if (cursor != null) { try { cursor.close(); } catch (IOException e) { logger.error("Fail to close cursor", e);
@SuppressWarnings("unchecked") @Override public IType next() { ArangoDBBaseDocument next = null; next = (ArangoDBBaseDocument) delegate.next(); next.graph(graph); next.setPaired(true); return (IType) next; }
public PageImpl<?> convertPage() { Assert.notNull(result.getStats().getFullCount(), MISSING_FULL_COUNT); return new PageImpl<>(result.asListRemaining(), accessor.getPageable(), result.getStats().getFullCount()); }
@Override public boolean hasNext() { return delegate.hasNext(); }
public List<?> convertList() { return result.asListRemaining(); }
private Object _resolveOne(final String id, final TypeInformation<?> type, final Relations annotation) { return _resolve(id, type.getType(), annotation, true).first(); }
/** * Build a GeoResults object with the ArangoCursor returned by query execution * * @param cursor * ArangoCursor containing query results * @return GeoResults object with all results */ @SuppressWarnings({ "rawtypes", "unchecked" }) private GeoResults<?> buildGeoResults(final ArangoCursor<?> cursor) { final List<GeoResult<?>> list = new LinkedList<>(); cursor.forEachRemaining(o -> { final GeoResult<?> geoResult = buildGeoResult(o); if (geoResult != null) { list.add(geoResult); } }); return new GeoResults(list); }
@SuppressWarnings("unchecked") @Override public P next() { ArangoDBElementProperty<V> next = null; next = (ArangoDBElementProperty<V>) delegate.next(); next.graph(graph); next.setPaired(true); return (P) next; }
public PageImpl<?> convertPage() { Assert.notNull(result.getStats().getFullCount(), MISSING_FULL_COUNT); return new PageImpl<>(result.asListRemaining(), accessor.getPageable(), result.getStats().getFullCount()); }
@Override public boolean hasNext() { return delegate.hasNext(); }
public List<?> convertList() { return result.asListRemaining(); }
private Object _resolveOne(final String id, final TypeInformation<?> type) { return _resolve(id, type.getType(), true).first(); }
/** * Build a GeoResults object with the ArangoCursor returned by query execution * * @param cursor * ArangoCursor containing query results * @return GeoResults object with all results */ @SuppressWarnings({ "rawtypes", "unchecked" }) private GeoResults<?> buildGeoResults(final ArangoCursor<?> cursor) { final List<GeoResult<?>> list = new LinkedList<>(); cursor.forEachRemaining(o -> { final GeoResult<?> geoResult = buildGeoResult(o); if (geoResult != null) { list.add(geoResult); } }); return new GeoResults(list); }
/** * Finds one document which matches the given example object * * @param example * example object to construct query with * @param <S> * @return An object representing the example if it exists, else null */ @Override public <S extends T> Optional<S> findOne(final Example<S> example) { final ArangoCursor cursor = findAllInternal((Pageable) null, example, new HashMap()); return cursor.hasNext() ? Optional.ofNullable((S) cursor.next()) : Optional.empty(); }
/** * Counts the number of documents in the collection which match with the given example * * @param example * example object to construct query with * @param <S> * @return number of matching documents found */ @Override public <S extends T> long count(final Example<S> example) { final Map<String, Object> bindVars = new HashMap<>(); final String predicate = exampleConverter.convertExampleToPredicate(example, bindVars); final String filter = predicate.length() == 0 ? "" : " FILTER " + predicate; final String query = String.format("FOR e IN %s%s COLLECT WITH COUNT INTO length RETURN length", getCollectionName(), filter); final ArangoCursor<Long> cursor = arangoOperations.query(query, bindVars, null, Long.class); return cursor.next(); }