protected ORecordAbstract setIdentity(final int iClusterId, final long iClusterPosition) { if (_recordId == null || _recordId == ORecordId.EMPTY_RECORD_ID) _recordId = new ORecordId(iClusterId, iClusterPosition); else { _recordId.setClusterId(iClusterId); _recordId.setClusterPosition(iClusterPosition); } return this; }
protected ORecordAbstract fill(final ORID iRid, final int iVersion, final byte[] iBuffer, boolean iDirty) { _recordId.setClusterId(iRid.getClusterId()); _recordId.setClusterPosition(iRid.getClusterPosition()); _recordVersion = iVersion; _status = ORecordElement.STATUS.LOADED; _source = iBuffer; _size = iBuffer != null ? iBuffer.length : 0; if (_source != null && _source.length > 0) { _dirty = iDirty; _contentChanged = iDirty; if (!iDirty && _dirtyManager != null) _dirtyManager.removePointed(this); } return this; }
protected ORecordAbstract fill(final ORID iRid, final int iVersion, final byte[] iBuffer, boolean iDirty, ODatabaseDocumentInternal db) { _recordId.setClusterId(iRid.getClusterId()); _recordId.setClusterPosition(iRid.getClusterPosition()); _recordVersion = iVersion; _status = ORecordElement.STATUS.LOADED; _source = iBuffer; _size = iBuffer != null ? iBuffer.length : 0; if (_source != null && _source.length > 0) { _dirty = iDirty; _contentChanged = iDirty; if (!iDirty && _dirtyManager != null) _dirtyManager.removePointed(this); } return this; }
public static ODocument createProjectionDocument(final int iProgressive) { final ODocument doc = new ODocument().setOrdered(true).setTrackingChanges(false); // ASSIGN A TEMPORARY RID TO ALLOW PAGINATION IF ANY ((ORecordId) doc.getIdentity()).setClusterId(-2); ((ORecordId) doc.getIdentity()).setClusterPosition(iProgressive); return doc; }
} else { recordId.setClusterPosition(newRid.getClusterPosition()); recordId.setClusterId(newRid.getClusterId());
rid.setClusterId(getClusterIdByName(iClusterName)); if (rid.getClusterId() == -1) throw new IllegalArgumentException("Cluster name '" + iClusterName + "' is not configured"); if (schemaClass.isAbstract()) throw new OSchemaException("Document belongs to abstract class " + schemaClass.getName() + " and cannot be saved"); rid.setClusterId(schemaClass.getClusterForNewInstance((ODocument) record)); } else throw new ODatabaseException("Cannot save (1) document " + record + ": no class or cluster defined"); Set<Integer> blobs = getBlobClusterIds(); if (blobs.size() == 0) { rid.setClusterId(getDefaultClusterId()); } else { rid.setClusterId(blobs.iterator().next());
} else { recordId.setClusterPosition(newRid.getClusterPosition()); recordId.setClusterId(newRid.getClusterId());
current.setClusterId(iClusterId); final long[] range = database.getStorage().getClusterDataRange(current.getClusterId());
oldId.setClusterId(((ORID) newRid).getClusterId()); oldId.setClusterPosition(((ORID) newRid).getClusterPosition()); } else if (s.equalsIgnoreCase("@version")) {
/** * Move the iterator to the begin of the range. If no range was specified move to the first record of the cluster. * * @return The object itself */ @Override public ORecordIteratorClusters<REC> begin() { if (clusterIds.length == 0) return this; browsedRecords = 0; currentClusterIdx = 0; current.setClusterId(clusterIds[currentClusterIdx]); updateClusterRange(); resetCurrentPosition(); nextPosition(); final ORecord record = getRecord(); currentRecord = readCurrentRecord(record, 0); if (currentRecord != null && !include(currentRecord)) { currentRecord = null; hasNext(); } return this; }
/** * Move the iterator to the end of the range. If no range was specified move to the last record of the cluster. * * @return The object itself */ @Override public ORecordIteratorClusters<REC> last() { if (clusterIds.length == 0) return this; browsedRecords = 0; currentClusterIdx = clusterIds.length - 1; updateClusterRange(); current.setClusterId(clusterIds[currentClusterIdx]); resetCurrentPosition(); prevPosition(); final ORecord record = getRecord(); currentRecord = readCurrentRecord(record, 0); if (currentRecord != null && !include(currentRecord)) { currentRecord = null; hasPrevious(); } return this; }
protected void updateClusterRange() { if (clusterIds.length == 0) return; // ADJUST IDX CHECKING BOUNDARIES if (currentClusterIdx >= clusterIds.length) currentClusterIdx = clusterIds.length - 1; else if (currentClusterIdx < 0) currentClusterIdx = 0; current.setClusterId(clusterIds[currentClusterIdx]); final long[] range = database.getStorage().getClusterDataRange(current.getClusterId()); if (beginRange != null && beginRange.getClusterId() == current.getClusterId() && beginRange.getClusterPosition() > range[0]) firstClusterEntry = beginRange.getClusterPosition(); else firstClusterEntry = range[0]; if (endRange != null && endRange.getClusterId() == current.getClusterId() && endRange.getClusterPosition() < range[1]) lastClusterEntry = endRange.getClusterPosition(); else lastClusterEntry = range[1]; resetCurrentPosition(); }
OPhysicalPosition physicalPosition = cluster.allocatePosition(ORecordInternal.getRecordType(rec)); assert atomicOperation.getCounter() == 1; rid.setClusterId(cluster.getId());