void throwRecordNotFoundException(final ORID identity, final String message) { if (settings.isStandardExceptions()) throw new IllegalStateException(message); else throw new ORecordNotFoundException(identity, message); }
@Deprecated public ODocument load(final String iFetchPlan, boolean iIgnoreCache, boolean loadTombstone) { Object result; try { result = getDatabase().load(this, iFetchPlan, iIgnoreCache, loadTombstone, OStorage.LOCKING_STRATEGY.DEFAULT); } catch (Exception e) { throw OException.wrapException(new ORecordNotFoundException(getIdentity()), e); } if (result == null) throw new ORecordNotFoundException(getIdentity()); return (ODocument) result; }
public ORecord load() { if (!getIdentity().isValid()) throw new ORecordNotFoundException(getIdentity(), "The record has no id, probably it's new or transient yet "); final ORecord result = getDatabase().load(this); if (result == null) throw new ORecordNotFoundException(getIdentity()); return result; }
/** * Loads the record using a fetch plan. Example: <p> <code>doc.load( "*:3", true ); // LOAD THE DOCUMENT BY EARLY FETCHING UP TO * 3rd LEVEL OF CONNECTIONS IGNORING THE CACHE</code> </p> * * @param iIgnoreCache Ignore the cache or use it */ public ODocument load(final String iFetchPlan, boolean iIgnoreCache) { Object result; try { result = getDatabase().load(this, iFetchPlan, iIgnoreCache); } catch (Exception e) { throw OException.wrapException(new ORecordNotFoundException(getIdentity()), e); } if (result == null) throw new ORecordNotFoundException(getIdentity()); return (ODocument) result; }
@Override public ORawBuffer readRecordIfVersionIsNotLatest(long clusterPosition, int recordVersion) throws IOException, ORecordNotFoundException { throw OException.wrapException(new ORecordNotFoundException(new ORecordId(id, clusterPosition), "Record with rid #" + id + ":" + clusterPosition + " was not found in database"), new OOfflineClusterException("Cannot read a record from the offline cluster '" + name + "'")); }
@Override public ORawBuffer readRecord(long clusterPosition, boolean prefetchRecords) throws IOException { throw OException.wrapException(new ORecordNotFoundException(new ORecordId(id, clusterPosition), "Record with rid #" + id + ":" + clusterPosition + " was not found in database"), new OOfflineClusterException("Cannot read a record from the offline cluster '" + name + "'")); }
@Override public ORecord reload(String fetchPlan, boolean ignoreCache, boolean force) throws ORecordNotFoundException { if (!getIdentity().isValid()) throw new ORecordNotFoundException(getIdentity(), "The record has no id. It is probably new or still transient"); try { getDatabase().reload(this, fetchPlan, ignoreCache, force); return this; } catch (OOfflineClusterException e) { throw e; } catch (ORecordNotFoundException e) { throw e; } catch (Exception e) { throw OException.wrapException(new ORecordNotFoundException(getIdentity()), e); } }
@Override public ORecord loadRecordIfVersionIsNotLatest(ORID rid, final int recordVersion, String fetchPlan, boolean ignoreCache) throws ORecordNotFoundException { checkTransaction(); final ORecord txRecord = getRecord(rid); if (txRecord == OBasicTransaction.DELETED_RECORD) // DELETED IN TX throw new ORecordNotFoundException(rid); if (txRecord != null) { if (txRecord.getVersion() > recordVersion) return txRecord; else return null; } if (rid.isTemporary()) throw new ORecordNotFoundException(rid); // DELEGATE TO THE STORAGE, NO TOMBSTONES SUPPORT IN TX MODE final ORecord record = database .executeReadRecord((ORecordId) rid, null, recordVersion, fetchPlan, ignoreCache, !ignoreCache, false, OStorage.LOCKING_STRATEGY.NONE, new SimpleRecordReader(database.isPrefetchRecords())); if (record != null && isolationLevel == ISOLATION_LEVEL.REPEATABLE_READ) // KEEP THE RECORD IN TX TO ASSURE REPEATABLE READS addRecord(record, ORecordOperation.LOADED, null); return record; }
@Override public <RET extends ORecord> RET reload(ORecord record, String fetchPlan, boolean ignoreCache, boolean force) { checkIfActive(); final ORecord loadedRecord = currentTx.reloadRecord(record.getIdentity(), record, fetchPlan, ignoreCache, force); if (loadedRecord != null && record != loadedRecord) { record.fromStream(loadedRecord.toStream()); ORecordInternal.setVersion(record, loadedRecord.getVersion()); } else if (loadedRecord == null) { throw new ORecordNotFoundException(record.getIdentity()); } return (RET) record; }
private ORawBuffer readRecord(final OCluster clusterSegment, final ORecordId rid, final boolean prefetchRecords) { checkOpenness(); if (!rid.isPersistent()) { throw new ORecordNotFoundException(rid, "Cannot read record " + rid + " since the position is invalid in database '" + name + '\''); } if (transaction.get() != null) { // Disabled this assert have no meaning anymore // assert iLockingStrategy.equals(LOCKING_STRATEGY.DEFAULT); return doReadRecord(clusterSegment, rid, prefetchRecords); } stateLock.acquireReadLock(); try { if (pessimisticLock) { acquireReadLock(rid); } checkOpenness(); return doReadRecord(clusterSegment, rid, prefetchRecords); } finally { try { if (pessimisticLock) { releaseReadLock(rid); } } finally { stateLock.releaseReadLock(); } } }
private ORawBuffer readRecordIfNotLatest(final OCluster cluster, final ORecordId rid, final int recordVersion) throws ORecordNotFoundException { checkOpenness(); if (!rid.isPersistent()) { throw new ORecordNotFoundException(rid, "Cannot read record " + rid + " since the position is invalid in database '" + name + '\''); } if (transaction.get() != null) { return doReadRecordIfNotLatest(cluster, rid, recordVersion); } stateLock.acquireReadLock(); try { if (pessimisticLock) { acquireReadLock(rid); } final ORawBuffer buff; checkOpenness(); buff = doReadRecordIfNotLatest(cluster, rid, recordVersion); return buff; } finally { try { if (pessimisticLock) { releaseReadLock(rid); } } finally { stateLock.releaseReadLock(); } } }
@Override public final OStorageOperationResult<ORawBuffer> readRecord(final ORecordId iRid, final String iFetchPlan, final boolean iIgnoreCache, final boolean prefetchRecords, final ORecordCallback<ORawBuffer> iCallback) { try { checkOpenness(); final OCluster cluster; try { cluster = getClusterById(iRid.getClusterId()); } catch (final IllegalArgumentException e) { throw OException.wrapException(new ORecordNotFoundException(iRid), e); } return new OStorageOperationResult<>(readRecord(cluster, iRid, prefetchRecords)); } catch (final RuntimeException ee) { throw logAndPrepareForRethrow(ee); } catch (final Error ee) { throw logAndPrepareForRethrow(ee); } catch (final Throwable t) { throw logAndPrepareForRethrow(t); } }
throw new ORecordNotFoundException(new ORecordId(id, clusterPosition), "Record for cluster with id " + id + " and position " + clusterPosition + " is absent."); throw new ORecordNotFoundException(new ORecordId(id, clusterPosition), "Record for cluster with id " + id + " and position " + clusterPosition + " is absent."); final OClusterPage localPage = new OClusterPage(cacheEntry, false); if (localPage.isDeleted(recordPosition)) { throw new ORecordNotFoundException(new ORecordId(id, clusterPosition), "Record for cluster with id " + id + " and position " + clusterPosition + " is absent.");
throw new ORecordNotFoundException(new ORecordId(id, clusterPosition), "Record for cluster with id " + id + " and position " + clusterPosition + " is absent."); final OClusterPage localPage = new OClusterPage(cacheEntry, false); if (localPage.isDeleted(recordPosition)) { throw new ORecordNotFoundException(new ORecordId(id, clusterPosition), "Record for cluster with id " + id + " and position " + clusterPosition + " is absent.");
throw new ORecordNotFoundException(currentVertex.getIdentity(), "The vertex " + currentVertex.getIdentity() + " has been deleted"); throw new ORecordNotFoundException(inVertex.getIdentity(), "The vertex " + inVertex.getIdentity() + " has been deleted");
public ORID moveTo(final String iClassName, final String iClusterName) { throw new ORecordNotFoundException(getIdentity(), "The vertex " + getIdentity() + " has been deleted"); throw new ORecordNotFoundException(getIdentity(), "The vertex " + getIdentity() + " has been deleted");
public ORID moveTo(final String iClassName, final String iClusterName) { throw new ORecordNotFoundException(getIdentity(), "The vertex " + getIdentity() + " has been deleted"); throw new ORecordNotFoundException(getIdentity(), "The vertex " + getIdentity() + " has been deleted");
OrientEdge addEdgeInternal(final OrientVertex currentVertex, String label, final OrientVertex inVertex, final String iClassName, final String iClusterName, final Object... fields) { if (currentVertex.checkDeletedInTx()) throw new ORecordNotFoundException(currentVertex.getIdentity(), "The vertex " + currentVertex.getIdentity() + " has been deleted"); throw new ORecordNotFoundException(inVertex.getIdentity(), "The vertex " + inVertex.getIdentity() + " has been deleted");