protected static void checkType(final OClass iType) { if (iType == null) throw new IllegalArgumentException("Edge class is null"); if (((iType instanceof OImmutableClass) && !((OImmutableClass) iType).isEdgeType()) || !iType.isSubClassOf(CLASS_NAME)) throw new IllegalArgumentException("Type error. The class " + iType + " does not extend class '" + CLASS_NAME + "' and therefore cannot be considered an Edge"); }
/** * (Internal only) */ protected static void deleteEdgeIfAny(final OIdentifiable iRecord, boolean forceReload) { if (iRecord != null) { final ODocument doc = getDocument(iRecord, forceReload); if (doc != null) { final OImmutableClass clazz = ODocumentInternal.getImmutableSchemaClass(doc); if (clazz != null && clazz.isEdgeType()) // DELETE THE EDGE RECORD TOO doc.delete(); } } }
protected Object e2v(final OrientBaseGraph graph, final OIdentifiable iRecord, final Direction iDirection, final String[] iLabels) { final ODocument rec = iRecord.getRecord(); OImmutableClass clazz = ODocumentInternal.getImmutableSchemaClass(rec); if (clazz != null && clazz.isEdgeType()) { // EDGE final OrientEdge edge = graph.getEdge(rec); if (edge != null) { if (Direction.BOTH.equals(iDirection)) { Set<Vertex> result = new HashSet<Vertex>(); result.add(edge.getVertex(Direction.OUT)); result.add(edge.getVertex(Direction.IN)); return result; } else { return edge.getVertex(iDirection); } } } return null; } }
if (doc != null) { final OImmutableClass schemaClass = ODocumentInternal.getImmutableSchemaClass(doc); if (schemaClass != null && schemaClass.isEdgeType()) return getEdge(doc); else
@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(); OImmutableClass immutableClass = ODocumentInternal.getImmutableSchemaClass(currentDocument); // clusterId -2 is a projection and is correct that doesn't have a class, we consider projection a vertex if (immutableClass == null && currentDocument.getIdentity().getClusterId() != -2) 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.getIdentity().getClusterId() != -2 && immutableClass.isEdgeType() ) currentElement = graph.getEdge(currentDocument); else currentElement = graph.getVertex(currentDocument); } return (T) currentElement; }
break; } else if (ODocumentInternal.getImmutableSchemaClass(curr).isEdgeType()) { final Direction direction = OrientVertex.getConnectionDirection(iFieldName, useVertexFieldsForEdgeLabels);
@Override public OIdentifiable getGraphElementRecord(final Object iObject) { final ORecord rec = ((OIdentifiable) iObject).getRecord(); if (rec == null || !(rec instanceof ODocument)) return null; final ODocument value = (ODocument) rec; final OIdentifiable v; OImmutableClass immutableClass = ODocumentInternal.getImmutableSchemaClass(value); if (immutableClass.isVertexType()) { // DIRECT VERTEX v = value; } else if (immutableClass.isEdgeType()) { // EDGE if (vertex.settings.isUseVertexFieldsForEdgeLabels() || OrientEdge.isLabeled(OrientEdge.getRecordLabel(value), iLabels)) v = OrientEdge.getConnection(value, connection.getKey().opposite()); else v = null; } else throw new IllegalStateException("Invalid content found between connections: " + value); return v; }
else { final OImmutableClass immutableClass = ODocumentInternal.getImmutableSchemaClass(record); if (immutableClass == null || (!immutableClass.isVertexType() && !immutableClass.isEdgeType()))
else { final OImmutableClass immutableClass = ODocumentInternal.getImmutableSchemaClass(record); if (immutableClass == null || (!immutableClass.isVertexType() && !immutableClass.isEdgeType()))
} else if (immutableClass.isEdgeType() && ("out".equals(fieldName) || "in".equals(fieldName)) && (fieldValue instanceof List)) { List lst = (List) fieldValue;
edge = this.sourceVertex.getGraph().getEdgeInstance( rec.getIdentity(), this.sourceVertex.getIdentity(), connection.getValue()); } else if (immutableSchema.isEdgeType()) {