while (cursor.hasNext()) { VPackSlice aDocument = cursor.next(); HashMap<String, ByteIterator> aMap = new HashMap<String, ByteIterator>(aDocument.size());
@Override public boolean hasNext() { return delegate.hasNext(); }
@Override public boolean hasNext() { return delegate.hasNext(); }
private Object getNext(final ArangoCursor<?> cursor) { return cursor.hasNext() ? cursor.next() : null; } }
private Object getNext(final ArangoCursor<?> cursor) { return cursor.hasNext() ? cursor.next() : null; } }
/** * 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(); }
/** * 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(); }
@Override public Variables variables() { ArangoCursor<ArangoDBGraphVariables> iter = client.getGraphVariables(this.name, variables_id); if (iter.hasNext()) { ArangoDBGraphVariables v = iter.next(); v.graph(this); return v; } else { throw new ArangoDBGraphException("Existing graph does not have a Variables collection"); } }
ArangoDBUtil.checkGraphForErrors(vertexCollections, edgeCollections, relations, graph, options); ArangoCursor<String> iter = client.getGraphVariablesId(this.name); if (iter.hasNext()) { this.variables_id = iter.next();
private Object convertResult(final ArangoCursor<?> result, final ArangoParameterAccessor accessor) { if (isExistsQuery()) { if (!result.hasNext()) { return false; } return (Integer) result.next() > 0; } final ArangoResultConverter resultConverter = new ArangoResultConverter(accessor, result, operations, domainClass); return resultConverter.convertResult(method.getReturnType().getType()); }
private Object convertResult(final ArangoCursor<?> result, final ArangoParameterAccessor accessor) { if (isExistsQuery()) { if (!result.hasNext()) { return false; } return (Integer) result.next() > 0; } final ArangoResultConverter resultConverter = new ArangoResultConverter(accessor, result, operations, domainClass); return resultConverter.convertResult(method.getReturnType().getType()); }
/** * Build a GeoResult from the given ArangoCursor * * @param cursor * query result from driver * @return GeoResult object */ private GeoResult<?> buildGeoResult(final ArangoCursor<?> cursor) { GeoResult<?> geoResult = null; while (cursor.hasNext() && geoResult == null) { final Object object = cursor.next(); if (!(object instanceof VPackSlice)) { continue; } final VPackSlice slice = (VPackSlice) object; final VPackSlice distSlice = slice.get("_distance"); final Double distanceInMeters = distSlice.isDouble() ? distSlice.getAsDouble() : null; if (distanceInMeters == null) { continue; } final Object entity = operations.getConverter().read(domainClass, slice); final Distance distance = new Distance(distanceInMeters / 1000, Metrics.KILOMETERS); geoResult = new GeoResult<>(entity, distance); } return geoResult; }
/** * Build a GeoResult from the given ArangoCursor * * @param cursor * query result from driver * @return GeoResult object */ private GeoResult<?> buildGeoResult(final ArangoCursor<?> cursor) { GeoResult<?> geoResult = null; while (cursor.hasNext() && geoResult == null) { final Object object = cursor.next(); if (!(object instanceof VPackSlice)) { continue; } final VPackSlice slice = (VPackSlice) object; final VPackSlice distSlice = slice.get("_distance"); final Double distanceInMeters = distSlice.isDouble() ? distSlice.getAsDouble() : null; if (distanceInMeters == null) { continue; } final Object entity = operations.getConverter().read(domainClass, slice); final Distance distance = new Distance(distanceInMeters / 1000, Metrics.KILOMETERS); geoResult = new GeoResult<>(entity, distance); } return geoResult; }