@Override public String toString() { return (_recordId.isValid() ? _recordId : "") + (_source != null ? Arrays.toString(_source) : "[]") + " v" + _recordVersion; }
@Override public boolean equals(Object obj) { if (!super.equals(obj)) return false; return this == obj || _recordId.isValid(); }
@Override public int hashCode() { if (_recordId.isValid()) return super.hashCode(); return System.identityHashCode(this); }
@SuppressWarnings("unchecked") public <T extends ORecord> T getRecord() { if (!isValid()) return null; final ODatabaseDocument db = ODatabaseRecordThreadLocal.instance().get(); if (db == null) throw new ODatabaseException( "No database found in current thread local space. If you manually control databases over threads assure to set the current database before to use it by calling: ODatabaseRecordThreadLocal.instance().set(db);"); return (T) db.load(this); }
if (!oid.isValid()) { logger.error("User Id " + userId + " is not valid"); return null;
try { final ORecordId rid = new ORecordId(target); if (!rid.isValid()) throwParsingException("Record ID " + target + " is not valid"); recordIds.add(rid);
/** * Deletes the record. */ public void deleteRecord(final ORecord iRecord, final OPERATION_MODE iMode) { if (!iRecord.getIdentity().isPersistent()) return; try { database.executeDeleteRecord(iRecord, iRecord.getVersion(), true, iMode, false); } catch (Exception e) { // REMOVE IT FROM THE CACHE TO AVOID DIRTY RECORDS final ORecordId rid = (ORecordId) iRecord.getIdentity(); if (rid.isValid()) database.getLocalCache().freeRecord(rid); if (e instanceof RuntimeException) throw (RuntimeException) e; throw OException.wrapException( new ODatabaseException("Error during deletion of record" + (iRecord != null ? " with rid " + iRecord.getIdentity() : "")), e); } }
/** * This method is internal, it can be subject to signature change or be removed, do not use. * * @Internal */ public void executeDeleteRecord(OIdentifiable record, final int iVersion, final boolean iRequired, final OPERATION_MODE iMode, boolean prohibitTombstones) { checkOpenness(); checkIfActive(); final ORecordId rid = (ORecordId) record.getIdentity(); if (rid == null) throw new ODatabaseException( "Cannot delete record because it has no identity. Probably was created from scratch or contains projections of fields rather than a full record"); if (!rid.isValid()) return; record = record.getRecord(); if (record == null) return; final OMicroTransaction microTx = beginMicroTransaction(); try { microTx.deleteRecord(record.getRecord(), iMode); } catch (Exception e) { endMicroTransaction(false); throw e; } endMicroTransaction(true); return; }
public OSchemaShared load(ODatabaseDocumentInternal database) { rwSpinLock.acquireWriteLock(); try { if (!new ORecordId(database.getStorage().getConfiguration().getSchemaRecordId()).isValid()) throw new OSchemaNotCreatedException("Schema is not created and cannot be loaded"); ((ORecordId) document.getIdentity()).fromString(database.getStorage().getConfiguration().getSchemaRecordId()); reload("*:-1 index:0"); return this; } finally { rwSpinLock.releaseWriteLock(); } }
final ORecordId recordId = (ORecordId) record.getIdentity(); if (!recordId.isValid()) { ORecordInternal.onBeforeIdentityChanged(record); database.assignAndCheckCluster(record, clusterName);
if (!rid.isValid()) { ORecordInternal.onBeforeIdentityChanged(iRecord); database.assignAndCheckCluster(iRecord, iClusterName);
"Cannot hide record because it has no identity. Probably was created from scratch or contains projections of fields rather than a full record"); if (!rid.isValid()) return false;
if (rid.isValid()) database.getLocalCache().freeRecord(rid);
if (!rid.isValid()) recordBuffer = null; else {