/** * Loads the record using a fetch plan. Example: <p> <code>doc.load( "*:3" ); // LOAD THE DOCUMENT BY EARLY FETCHING UP TO 3rd * LEVEL OF CONNECTIONS</code> </p> * * @param iFetchPlan Fetch plan to use */ public ODocument load(final String iFetchPlan) { return load(iFetchPlan, false); }
public <RET extends ODocumentWrapper> RET load(final String iFetchPlan, final boolean iIgnoreCache, final boolean loadTombstone) { //noinspection deprecation document = document.load(iFetchPlan, iIgnoreCache, loadTombstone); return (RET) this; }
@Override public <RET extends ORecord> RET load() throws ORecordNotFoundException { return (RET) element.load(); }
public <RET extends ODocumentWrapper> RET load(final String iFetchPlan, final boolean iIgnoreCache) { document = document.load(iFetchPlan, iIgnoreCache); return (RET) this; }
void load(final String iFetchPlan) { document = document.load(iFetchPlan); }
@Override public <RET extends ORecord> RET load() throws ORecordNotFoundException { return (RET) element.load(); }
void load() { document = (ODocument) document.load(); }
protected OElement getRawDocument(ORecord record) { if (record == null) throw new NoSuchElementException(); if (record instanceof OIdentifiable) record = record.getRecord(); ODocument currentDocument = (ODocument) record; if (currentDocument.getInternalStatus() == ODocument.STATUS.NOT_LOADED) currentDocument.load(); if (ODocumentInternal.getImmutableSchemaClass(currentDocument) == 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"); return currentDocument; }
private static ODocument checkForLoading(final ODocument iRecord) { if (iRecord.getInternalStatus() == ORecordElement.STATUS.NOT_LOADED) { try { return (ODocument) iRecord.load(); } catch (final ORecordNotFoundException e) { throw new OIndexException("Error during loading of record with id : " + iRecord.getIdentity()); } } return iRecord; }
private static ODocument checkForLoading(final ODocument iRecord) { if (iRecord.getInternalStatus() == ORecordElement.STATUS.NOT_LOADED) { try { return (ODocument) iRecord.load(); } catch (final ORecordNotFoundException e) { throw OException.wrapException(new OIndexException("Error during loading of record with id " + iRecord.getIdentity()), e); } } return iRecord; }
public <RET extends T> RET get(final String iKey, final String iFetchPlan) { final OIdentifiable value = index.get(iKey); if (value == null) return null; if (value instanceof ORID) return (RET) ODatabaseRecordThreadLocal.instance().get().load(((ORID) value), iFetchPlan); return (RET) ((ODocument) value).load(iFetchPlan); }
public Object execute(OResult iCurrentRecord, OCommandContext ctx) { Object result; if (all) { result = iCurrentRecord; } else { result = expression.execute(iCurrentRecord, ctx); } if (nestedProjection != null) { if (result instanceof ODocument && ((ODocument) result).isEmpty()) { ((ODocument) result).load(null); } result = nestedProjection.apply(expression, result, ctx); } return convert(result); }
@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; }
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(); final OClass schemaClass = ODocumentInternal.getImmutableSchemaClass(currentDocument); if (schemaClass != null && schemaClass.isSubClassOf(graph.getEdgeBaseType())) currentElement = graph.getEdge(currentDocument); else // RETURN VERTEX IN ALL THE CASES, EVEN FOR PROJECTED DOCUMENTS currentElement = graph.getVertex(currentDocument); } if(currentElement==null){ return current; } return currentElement; }
@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; }
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; }
target.load(); } catch (final ORecordNotFoundException ignore) {
/** * Removes the Element from the Graph. In case the element is a Vertex, all the incoming and outgoing edges are automatically * removed too. */ void removeRecord() { checkIfAttached(); final OrientBaseGraph graph = getGraph(); graph.setCurrentGraphInThreadLocal(); graph.autoStartTransaction(); if (checkDeletedInTx()) graph.throwRecordNotFoundException(getIdentity(), "The graph element with id " + getIdentity() + " not found"); try { getRecord().load(); } catch (ORecordNotFoundException e) { graph.throwRecordNotFoundException(getIdentity(), e.getMessage()); } getRecord().delete(); }
db.commit(); ODocument taskSessionDoc = taskSession.getOTaskSessionPersisted().getDocument(); taskSessionDoc.load(); assertNull(taskSessionDoc.field(ITaskSession.Field.ERROR.fieldName())); assertNotNull(taskSessionDoc.field(ITaskSession.Field.FINISH_TIMESTAMP.fieldName()));