@SuppressWarnings("rawtypes") public CloseableIterable<T> get(final String key, final Object iValue) { final String keyTemp = key + SEPARATOR + iValue; Collection<OIdentifiable> records = (Collection<OIdentifiable>) underlying.get(keyTemp); if (records == null || records.isEmpty()) return new WrappingCloseableIterable(Collections.emptySet()); return new OrientElementIterable<T>(graph, records); }
@Override public boolean call(final ScriptEngine iEngine, final OrientBaseGraph iGraph) { if( iCurrentRecord == null ) // IGNORE PRE-PROCESSING return true; final ODocument document = (ODocument) iCurrentRecord; OClass clazz =ODocumentInternal.getImmutableSchemaClass(document); if (clazz != null && clazz.isSubClassOf(OrientEdgeType.CLASS_NAME)) { // EDGE TYPE, CREATE THE BLUEPRINTS'S WRAPPER OrientEdge graphElement = (OrientEdge) new OrientElementIterable<OrientEdge>(iGraph, Arrays .asList(new ODocument[] { document })).iterator().next(); iEngine.getBindings(ScriptContext.ENGINE_SCOPE).put("current", graphElement); iEngine.getBindings(ScriptContext.ENGINE_SCOPE).put("it", graphElement); // FRAMES LIKE SYNTAX } else { // VERTEX TYPE, CREATE THE BLUEPRINTS'S WRAPPER OrientVertex graphElement = (OrientVertex) new OrientElementIterable<OrientVertex>(iGraph, Arrays .asList(new ODocument[] { document })).iterator().next(); iEngine.getBindings(ScriptContext.ENGINE_SCOPE).put("current", graphElement); iEngine.getBindings(ScriptContext.ENGINE_SCOPE).put("it", graphElement); // FRAMES LIKE SYNTAX } return true; } }, null);
@Override public Iterator<Vertex> iterator() { return new OrientClassVertexIterator(super.graph, super.iterator(), klass); }
jsonMap.put("createDate", entity.getProperty("createDate")); OrientElementIterable iterable = entity.getProperty("in_Create"); Iterator iterator = iterable.iterator(); if(iterator.hasNext()) { OrientVertex vertex = (OrientVertex)iterator.next(); iterator = iterable.iterator(); List<String> tags = new ArrayList<String>(); while(iterator.hasNext()) { jsonMap.put("content", entity.getProperty("content")); iterable = entity.getProperty("in_HasPost"); iterator = iterable.iterator(); if(iterator.hasNext()) { OrientVertex vertex = (OrientVertex)iterator.next(); jsonMap.put("variants", entity.getProperty("variants")); iterable = entity.getProperty("in_HasProduct"); iterator = iterable.iterator(); if(iterator.hasNext()) { OrientVertex vertex = (OrientVertex)iterator.next();
public Iterable<Vertex> getVertices(final String iKey, Object iValue) { if (iKey.equals("@class")) return getVerticesOfClass(iValue.toString()); final String indexName; final String key; int pos = iKey.indexOf('.'); if (pos > -1) { indexName = iKey; key = iKey.substring(iKey.indexOf('.') + 1); } else { indexName = OrientVertex.CLASS_NAME + "." + iKey; key = iKey; } final OIndex<?> idx = getContext(true).rawGraph.getMetadata() .getIndexManager().getIndex(indexName); if (idx != null) { iValue = convertKey(idx, iValue); Object indexValue = idx.get(iValue); if (indexValue != null && !(indexValue instanceof Iterable<?>)) indexValue = Arrays.asList(indexValue); return new OrientElementIterable<Vertex>(this, (Iterable<?>) indexValue); } // NO INDEX: EXECUTE A QUERY return query().has(key, iValue).vertices(); }
public Iterable<Edge> getEdges(final String iKey, Object iValue) { if (iKey.equals("@class")) return getEdgesOfClass(iValue.toString()); final String indexName; final String key; int pos = iKey.indexOf('.'); if (pos > -1) { indexName = iKey; key = iKey.substring(iKey.indexOf('.') + 1); } else { indexName = OrientEdge.CLASS_NAME + "." + iKey; key = iKey; } final OIndex<?> idx = getContext(true).rawGraph.getMetadata() .getIndexManager().getIndex(indexName); if (idx != null) { iValue = convertKey(idx, iValue); Object indexValue = (Iterable<?>) idx.get(iValue); if (indexValue != null && !(indexValue instanceof Iterable<?>)) indexValue = Arrays.asList(indexValue); return new OrientElementIterable<Edge>(this, (Iterable<?>) indexValue); } // NO INDEX: EXECUTE A QUERY return query().has(key, iValue).edges(); }
return new WrappingCloseableIterable(Collections.emptySet()); return new OrientElementIterable<T>(graph, records);
query.setFetchPlan(fetchPlan); return new OrientElementIterable<Vertex>(((OrientBaseGraph) graph), ((OrientBaseGraph) graph).getRawGraph().query(query, queryParams.toArray()));
query.setFetchPlan(fetchPlan); return new OrientElementIterable<Vertex>(((OrientBaseGraph) graph), ((OrientBaseGraph) graph).getRawGraph().query(query));
indexValue = Arrays.asList(indexValue); return new OrientElementIterable<Edge>(this, (Iterable<?>) indexValue);
indexValue = Arrays.asList(indexValue); return new OrientElementIterable<Vertex>(this, (Iterable<?>) indexValue); } else {
query.setLimit(limit); return new OrientElementIterable<Edge>(((OrientBaseGraph) graph), ((OrientBaseGraph) graph).getRawGraph().query(query, queryParams.toArray()));
query.setLimit((int) limit); return new OrientElementIterable<Edge>(((OrientBaseGraph) graph), ((OrientBaseGraph) graph).getRawGraph().query(query));
return (T) new OrientElementIterable<OrientElement>(graph, OMultiValue.getMultiValueIterable(fieldValue));