@Override public STATUS getInternalStatus() { if (element == null) { return STATUS.LOADED; } return element.getInternalStatus(); }
@Override public STATUS getInternalStatus() { return element.getInternalStatus(); }
public Object call(ODatabaseDocumentInternal database) { if (iCurrent.getInternalStatus() == STATUS.NOT_LOADED) iCurrent.reload(); return null; } });
public Object call(ODatabaseDocumentInternal database) { if (iOther.getInternalStatus() == STATUS.NOT_LOADED) iOther.reload(); return null; } });
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; }
public void forceSnapshot(ODatabaseDocumentInternal database) { acquireSchemaReadLock(); try { if (document.getInternalStatus() == ORecordElement.STATUS.LOADED) { snapshot = new OImmutableSchema(this, database); } } finally { releaseSchemaReadLock(); } }
private String safeDocumentToString() { ORecordElement.STATUS oldStatus = document.getInternalStatus(); try { // stop orient from loading missing fields as DB might not be set // and we only want to dump what was actually loaded at this point document.setInternalStatus(ORecordElement.STATUS.UNMARSHALLING); return document.toString(); } catch (Exception e) { // NOSONAR return document.getIdentity().toString(); } finally { document.setInternalStatus(oldStatus); } }
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 OImmutableSchema(OSchemaShared schemaShared, ODatabaseDocumentInternal database) { assert schemaShared.getDocument().getInternalStatus() == ORecordElement.STATUS.LOADED; assert database.getSharedContext().getIndexManager().getDocument().getInternalStatus() == ORecordElement.STATUS.LOADED; version = schemaShared.getVersion(); identity = schemaShared.getIdentity(); clusterSelectionFactory = schemaShared.getClusterSelectionFactory(); clustersToClasses = new HashMap<Integer, OClass>(schemaShared.getClasses(database).size() * 3); classes = new HashMap<String, OClass>(schemaShared.getClasses(database).size()); for (OClass oClass : schemaShared.getClasses(database)) { final OImmutableClass immutableClass = new OImmutableClass(oClass, this); classes.put(immutableClass.getName().toLowerCase(Locale.ENGLISH), immutableClass); if (immutableClass.getShortName() != null) classes.put(immutableClass.getShortName().toLowerCase(Locale.ENGLISH), immutableClass); for (int clusterId : immutableClass.getClusterIds()) clustersToClasses.put(clusterId, immutableClass); } properties = new ArrayList<OGlobalProperty>(); for (OGlobalProperty globalProperty : schemaShared.getGlobalProperties()) properties.add(globalProperty); for (OClass cl : classes.values()) { ((OImmutableClass) cl).init(); } this.blogClusters = Collections.unmodifiableSet(new HashSet<Integer>(schemaShared.getBlobClusters())); }
public void onAfterRecordChanged(final OMultiValueChangeEvent<K, V> event) { ODocument document = oDocument.get(); if (document == null) //doc not alive anymore, do nothing. return; if (document.getInternalStatus() != STATUS.UNMARSHALLING) { if (event.isChangesOwnerContent()) document.setDirty(); else document.setDirtyNoChanged(); } if (!(document._trackingChanges && document.getIdentity().isValid()) || document.getInternalStatus() == STATUS.UNMARSHALLING) return; if (entry == null || entry.isChanged()) return; if (entry.timeLine == null) { entry.timeLine = new OMultiValueChangeTimeLine<Object, Object>(); } entry.timeLine.addCollectionChangeEvent((OMultiValueChangeEvent<Object, Object>) event); } }
@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; }
if (target.getInternalStatus() == ORecordElement.STATUS.NOT_LOADED) try { target.load();