public static void setDirtyManager(ORecord record, final ODirtyManager dirtyManager) { if (!(record instanceof ORecordAbstract)) { record = record.getRecord(); } ((ORecordAbstract) record).setDirtyManager(dirtyManager); }
public static void addIdentityChangeListener(ORecord record, final OIdentityChangeListener identityChangeListener) { if (!(record instanceof ORecordAbstract)) { //manage O*Delegate record = record.getRecord(); } if (record instanceof ORecordAbstract) { ((ORecordAbstract) record).addIdentityChangeListener(identityChangeListener); } }
public static ODirtyManager getDirtyManager(ORecord record) { if (!(record instanceof ORecordAbstract)) { record = record.getRecord(); } return ((ORecordAbstract) record).getDirtyManager(); }
@Override public String getRid(ORecord entity) { return entity.getRecord().getIdentity().toString(); }
@Override public String getRid(ORecord entity) { return entity.getRecord().getIdentity().toString(); }
/** * Internal only. Return the record type. */ public static byte getRecordType(final ORecord record) { if (record instanceof ORecordAbstract) { return ((ORecordAbstract) record).getRecordType(); } final ORecordAbstract rec = (ORecordAbstract) record.getRecord(); return rec.getRecordType(); }
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 boolean matchesClass(ORecord record, String className) { ORecord doc = record.getRecord(); if (!(doc instanceof ODocument)) { return false; } OClass schema = ((ODocument) doc).getSchemaClass(); if (schema == null) return className == null; else if (schema.getName().equals(className)) { return true; } else if (schema.isSubClassOf(className)) { return true; } return false; }
@SuppressWarnings({ "unchecked", "rawtypes" }) private Object loadIfNeed(Object o) { final ORecord record = (ORecord) o; if (record.getRecord().getInternalStatus() == ORecordElement.STATUS.NOT_LOADED) { try { o = record.<ORecord>load(); } catch (ORecordNotFoundException e) { throw OException.wrapException(new ODatabaseException("Error during loading record with id : " + record.getIdentity()), e); } } return o; } }