protected OrientVertex getVertexInstance(final OIdentifiable id) { return new OrientVertex(this, id); }
protected OrientVertex getVertexInstance(final String className, final Object... fields) { return new OrientVertex(this, className, fields); }
public OrientVertex copy() { final OrientVertex v = new OrientVertex(); super.copyTo(v); return v; }
/** * Creates a temporary vertex. The vertex is not saved and the transaction * is not started. * * @param iClassName * Vertex's class name * @param prop * Varargs of properties to set * @return */ public OrientVertex addTemporaryVertex(final String iClassName, final Object... prop) { this.autoStartTransaction(); final OrientVertex vertex = new OrientVertex(this, iClassName); vertex.setProperties(prop); return vertex; }
public OrientVertex addVertex(final String iClassName, final String iClusterName) { this.autoStartTransaction(); final OrientVertex vertex = new OrientVertex(this, iClassName); // SAVE IT if (iClusterName != null) vertex.save(iClusterName); else vertex.save(); return vertex; }
final OrientVertex vertex = new OrientVertex(this, className, fields); vertex.setProperties(prop);
@Override public OrientVertex getVertex(final Direction direction) { graph.setCurrentGraphInThreadLocal(); if (direction.equals(Direction.OUT)) return new OrientVertex(graph, getOutVertex()); else if (direction.equals(Direction.IN)) return new OrientVertex(graph, getInVertex()); else throw ExceptionFactory.bothIsNotSupported(); }
public OrientVertex getVertex(final Object id) { if (null == id) throw ExceptionFactory.vertexIdCanNotBeNull(); if (id instanceof OrientVertex) return (OrientVertex) id; else if (id instanceof ODocument) return new OrientVertex(this, (OIdentifiable) id); setCurrentGraphInThreadLocal(); ORID rid; if (id instanceof OIdentifiable) rid = ((OIdentifiable) id).getIdentity(); else { try { rid = new ORecordId(id.toString()); } catch (IllegalArgumentException iae) { // orientdb throws IllegalArgumentException: Argument 'xxxx' is // not a RecordId in form of string. Format must be: // <cluster-id>:<cluster-position> return null; } } if (!rid.isValid()) return null; final ODocument doc = rid.getRecord(); if (doc == null) return null; return new OrientVertex(this, doc); }
@SuppressWarnings("unchecked") public T next() { OrientElement currentElement = null; if (!hasNext()) throw new NoSuchElementException(); Object current = itty.next(); if (null == current) throw new NoSuchElementException(); if (current instanceof OIdentifiable) current = ((OIdentifiable) current).getRecord(); if (current instanceof ODocument) { final ODocument currentDocument = (ODocument) current; if (currentDocument.getInternalStatus() == ODocument.STATUS.NOT_LOADED) currentDocument.load(); if (currentDocument.getSchemaClass() == null) throw new IllegalArgumentException( "Cannot determine the graph element type because the document class is null. Probably this is a projection, use the EXPAND() function"); if (currentDocument.getSchemaClass().isSubClassOf(graph.getEdgeBaseType())) currentElement = new OrientEdge(graph, currentDocument); else currentElement = new OrientVertex(graph, currentDocument); } return (T) currentElement; }
@Override public Vertex createWrapper(final Object iObject) { if (iObject instanceof OrientVertex) return (OrientVertex) iObject; final ODocument value = ((OIdentifiable) iObject).getRecord(); final OrientVertex v; if (value.getSchemaClass().isSubClassOf(OrientVertex.CLASS_NAME)) { // DIRECT VERTEX v = new OrientVertex(vertex.graph, value); } else if (value.getSchemaClass().isSubClassOf(OrientEdge.CLASS_NAME)) { // EDGE if (vertex.graph.isUseVertexFieldsForEdgeLabels() || OrientEdge.isLabeled(OrientEdge.getRecordLabel(value), iLabels)) v = new OrientVertex(vertex.graph, OrientEdge.getConnection(value, connection.getKey().opposite())); else v = null; } else throw new IllegalStateException("Invalid content found between connections:" + value); return v; }
final OClass schemaClass = doc.getSchemaClass(); if (schemaClass.isSubClassOf(OrientVertex.CLASS_NAME)) { return new OrientVertex(this, doc); } else if (schemaClass.isSubClassOf(OrientEdge.CLASS_NAME)) { return new OrientEdge(this, doc);
public Object next() { OrientElement currentElement = null; if (!hasNext()) throw new NoSuchElementException(); Object current = itty.next(); if (null == current) throw new NoSuchElementException(); if (current instanceof OIdentifiable) current = ((OIdentifiable) current).getRecord(); if (current instanceof ODocument) { final ODocument currentDocument = (ODocument) current; if (currentDocument.getInternalStatus() == ODocument.STATUS.NOT_LOADED) currentDocument.load(); if (currentDocument.getSchemaClass() == null) return currentDocument; if (currentDocument.getSchemaClass().isSubClassOf(graph.getVertexBaseType())) currentElement = new OrientVertex(graph, currentDocument); else if (currentDocument.getSchemaClass().isSubClassOf(graph.getEdgeBaseType())) currentElement = new OrientEdge(graph, currentDocument); else return currentDocument; } return currentElement; }
if (fieldRecord.getSchemaClass().isSubClassOf(CLASS_NAME)) { toAdd = new OrientVertex(graph, fieldRecord); } else if (fieldRecord.getSchemaClass().isSubClassOf( OrientEdge.CLASS_NAME)) { toAdd = new OrientVertex(graph, vertexDoc); } else toAdd = null;