Class ORecordAbstract
java.lang.Object
com.orientechnologies.orient.core.record.ORecordAbstract
- All Implemented Interfaces:
OIdentifiable,ORecordElement,ORecord,OSerializableStream,Serializable,Comparable<OIdentifiable>,Comparator<OIdentifiable>
- Direct Known Subclasses:
ODocument,ORecordBytes,ORecordFlat
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.orientechnologies.orient.core.db.record.ORecordElement
ORecordElement.STATUS -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected booleanstatic final Stringprotected booleanprotected ODirtyManagerstatic final Stringprotected ORecordSerializerprotected ORecordIdprotected intprotected intprotected byte[]protected ORecordElement.STATUS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddIdentityChangeListener(OIdentityChangeListener identityChangeListener) protected voidclear()All the fields are deleted but the record identity is maintained.protected voidintcompare(OIdentifiable iFirst, OIdentifiable iSecond) intcompareTo(OIdentifiable iOther) copyTo(ORecordAbstract cloned) delete()Deprecated.booleandetach()Removes all the dependencies with other records.booleanprotected ORecordAbstractprotected ORecordAbstractfill(ORID iRid, int iVersion, byte[] iBuffer, boolean iDirty, ODatabaseDocumentInternal db) protected <RET extends ORecord>
RETflatCopy()<RET extends ORecord>
RETfromJSON(InputStream iContentResult) <RET extends ORecord>
RETFills the record parsing the content in JSON format.<RET extends ORecord>
RET<RET extends ORecord>
RETfromStream(byte[] iRecordBuffer) Unmarshalls the object.protected ORecordAbstractfromStream(byte[] iRecordBuffer, ODatabaseDocumentInternal db) Returns the database where the record belongs.protected ODatabaseDocumentInternalprotected ODatabaseDocumentInternalprotected ODirtyManagerReturns the record identity as <cluster-id>:<cluster-position>Returns the current status of the record.getOwner()Returns the record instance.protected abstract byteintgetSize()Returns the size in bytes of the record.intReturns the current version number of the record.inthashCode()protected booleanbooleanisDirty()Checks if the record is dirty, namely if it was changed in memory.booleanisLocked()Deprecated.load()Deprecated.voidlock(boolean iExclusive) Deprecated.Deprecated.protected voidonAfterIdentityChanged(ORecord iRecord) protected voidonBeforeIdentityChanged(ORecord iRecord) reload()Deprecated.Deprecated.Deprecated.Deprecated.protected voidremoveIdentityChangeListener(OIdentityChangeListener identityChangeListener) reset()Resets the record to be reused.save()Deprecated.save(boolean forceCreate) Deprecated.Deprecated.Deprecated.protected voidsetContentChanged(boolean contentChanged) setDirty()Marks the instance as dirty.protected voidsetDirtyManager(ODirtyManager dirtyManager) voidprotected ORecordAbstractsetIdentity(int iClusterId, long iClusterPosition) protected ORecordAbstractsetIdentity(ORecordId iIdentity) voidsetInternalStatus(ORecordElement.STATUS iStatus) Changes the current internal status.protected voidprotected voidsetVersion(int iVersion) toJSON()Exports the record in JSON format.voidtoJSON(OutputStream stream) Exports the record in JSON format specifying additional formatting settings.voidtoJSON(String format, OutputStream stream) byte[]toStream()Marshalls the object.toString()protected voidtrack(OIdentifiable id) unload()Unloads current record.voidunlock()Deprecated.protected voidprotected voidunTrack(OIdentifiable id) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Field Details
-
BASE_FORMAT
- See Also:
-
DEFAULT_FORMAT
- See Also:
-
OLD_FORMAT_WITH_LATE_TYPES
- See Also:
-
recordId
-
recordVersion
protected int recordVersion -
source
protected byte[] source -
size
protected int size -
recordFormat
-
dirty
protected boolean dirty -
contentChanged
protected boolean contentChanged -
status
-
dirtyManager
-
-
Constructor Details
-
ORecordAbstract
public ORecordAbstract() -
ORecordAbstract
public ORecordAbstract(byte[] iSource)
-
-
Method Details
-
getIdentity
Description copied from interface:ORecordReturns the record identity as <cluster-id>:<cluster-position>- Specified by:
getIdentityin interfaceOIdentifiable- Specified by:
getIdentityin interfaceORecord- Returns:
- ORID instance
-
setIdentity
-
getOwner
- Specified by:
getOwnerin interfaceORecordElement- Returns:
- Returns record element which contains given one.
-
getRecord
Description copied from interface:OIdentifiableReturns the record instance.- Specified by:
getRecordin interfaceOIdentifiable- Returns:
- ORecord instance
-
detach
public boolean detach()Description copied from interface:ORecordRemoves all the dependencies with other records. All the relationships remain in form of RecordID. If some links contain dirty records, the detach cannot be complete and this method returns false. -
clear
Description copied from interface:ORecordAll the fields are deleted but the record identity is maintained. Use this to remove all the document's fields. -
reset
Description copied from interface:ORecordResets the record to be reused. The record is fresh like just created. Use this method to recycle records avoiding the creation of them stressing the JVM Garbage Collector. -
toStream
public byte[] toStream()Description copied from interface:OSerializableStreamMarshalls the object. Transforms the current object in byte[] form to being stored or transferred over the network.- Specified by:
toStreamin interfaceOSerializableStream- Returns:
- The byte array representation of the object
- See Also:
-
fromStream
Description copied from interface:OSerializableStreamUnmarshalls the object. Fills the current object with the values contained in the byte array representation restoring a previous state. Usually byte[] comes from the storage or network.- Specified by:
fromStreamin interfaceOSerializableStream- Parameters:
iRecordBuffer- byte array representation of the object- Returns:
- The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
fromStream
-
setDirty
Description copied from interface:ORecordElementMarks the instance as dirty. The dirty status could be propagated up if the implementation supports ownership concept.- Specified by:
setDirtyin interfaceORecordElement- Returns:
- The object it self. Useful to call methods in chain.
-
setDirtyNoChanged
public void setDirtyNoChanged()- Specified by:
setDirtyNoChangedin interfaceORecordElement
-
isDirty
public boolean isDirty()Description copied from interface:ORecordChecks if the record is dirty, namely if it was changed in memory. -
fromJSON
-
fromJSON
Description copied from interface:ORecordFills the record parsing the content in JSON format. -
fromJSON
-
fromJSON
- Throws:
IOException
-
toJSON
Description copied from interface:ORecordExports the record in JSON format. -
toJSON
Description copied from interface:ORecordExports the record in JSON format specifying additional formatting settings.- Specified by:
toJSONin interfaceORecord- Parameters:
format- Format settings separated by comma. Available settings are:- rid: exports the record's id as property "@rid"
- version: exports the record's version as property "@version"
- class: exports the record's class as property "@class"
- attribSameRow: exports all the record attributes in the same row
- indent:<level>: Indents the output if the <level> specified. Default is 0
- Returns:
- Object content in JSON format
-
toJSON
- Throws:
IOException
-
toJSON
- Throws:
IOException
-
toString
-
getVersion
public int getVersion()Description copied from interface:ORecordReturns the current version number of the record. When the record is created has version = 0. At every change the storage increment the version number. Version number is used by Optimistic transactions to check if the record is changed in the meanwhile of the transaction.- Specified by:
getVersionin interfaceORecord- Returns:
- The version number. 0 if it's a brand new record.
- See Also:
-
setVersion
protected void setVersion(int iVersion) -
unload
Description copied from interface:ORecordUnloads current record. All information are lost but the record identity. At the next access the record will be auto-reloaded. Useful to free memory or to avoid to keep an old version of it. -
load
Deprecated.Description copied from interface:ORecordLoads the record content in memory. If the record is in cache will be returned a new instance, so pay attention to use the returned. If the record is dirty, then it returns to the original content. If the record does not exist a ORecordNotFoundException exception is thrown.Use
instead.invalid reference
ODatabaseSession#load(ORecord) -
getDatabase
Description copied from interface:ORecordReturns the database where the record belongs.- Specified by:
getDatabasein interfaceORecord- Returns:
-
getDatabaseIfDefined
-
reload
Deprecated.Description copied from interface:ORecordLoads the record content in memory. No cache is used. If the record is dirty, then it returns to the original content. If the record does not exist a ORecordNotFoundException exception is thrown.Use
ODatabaseDocument.reload(OElement)instead. -
reload
Deprecated. -
reload
Deprecated. -
reload
@Deprecated public ORecord reload(String fetchPlan, boolean ignoreCache, boolean force) throws ORecordNotFoundException Deprecated.Description copied from interface:ORecordUseinstead.invalid reference
ODatabaseSession#reload(ORecord, String, boolean)- Specified by:
reloadin interfaceORecord- Throws:
ORecordNotFoundException
-
save
Deprecated.Description copied from interface:ORecordSaves in-memory changes to the database. Behavior depends by the current running transaction if any. If no transaction is running then changes apply immediately. If an Optimistic transaction is running then the record will be changed at commit time. The current transaction will continue to see the record as modified, while others not. If a Pessimistic transaction is running, then an exclusive lock is acquired against the record. Current transaction will continue to see the record as modified, while others cannot access to it since it's locked.Use
instead.invalid reference
ODatabaseSession#save(ORecord) -
save
Deprecated.Description copied from interface:ORecordSaves in-memory changes to the database defining a specific cluster where to save it. Behavior depends by the current running transaction if any. If no transaction is running then changes apply immediately. If an Optimistic transaction is running then the record will be changed at commit time. The current transaction will continue to see the record as modified, while others not. If a Pessimistic transaction is running, then an exclusive lock is acquired against the record. Current transaction will continue to see the record as modified, while others cannot access to it since it's locked.Use
instead.invalid reference
ODatabaseSession#save(ORecord, String) -
save
Deprecated.Description copied from interface:ORecordUseinstead.invalid reference
ODatabaseSession#save(ORecord, String) -
save
Deprecated.Description copied from interface:ORecordUseinstead.invalid reference
ODatabaseSession#save(ORecord, String) -
delete
Deprecated.Description copied from interface:ORecordDeletes the record from the database. Behavior depends by the current running transaction if any. If no transaction is running then the record is deleted immediately. If an Optimistic transaction is running then the record will be deleted at commit time. The current transaction will continue to see the record as deleted, while others not. If a Pessimistic transaction is running, then an exclusive lock is acquired against the record. Current transaction will continue to see the record as deleted, while others cannot access to it since it's locked. -
getSize
public int getSize()Description copied from interface:ORecordReturns the size in bytes of the record. The size can be computed only for not new records. -
lock
Deprecated.Description copied from interface:OIdentifiableUseODatabase.lock(ORID)instead.- Specified by:
lockin interfaceOIdentifiable
-
isLocked
Deprecated.- Specified by:
isLockedin interfaceOIdentifiable
-
lockingStrategy
Deprecated.- Specified by:
lockingStrategyin interfaceOIdentifiable
-
unlock
Deprecated.Description copied from interface:OIdentifiableUseODatabase.unlock(ORID)instead.- Specified by:
unlockin interfaceOIdentifiable
-
hashCode
public int hashCode() -
equals
- Specified by:
equalsin interfaceComparator<OIdentifiable>- Overrides:
equalsin classObject
-
compare
- Specified by:
comparein interfaceComparator<OIdentifiable>
-
compareTo
- Specified by:
compareToin interfaceComparable<OIdentifiable>
-
getInternalStatus
Description copied from interface:ORecordReturns the current status of the record.- Specified by:
getInternalStatusin interfaceORecord- Returns:
- Current status as value between the defined values in the enum
ORecordElement.STATUS
-
setInternalStatus
Description copied from interface:ORecordChanges the current internal status.- Specified by:
setInternalStatusin interfaceORecord- Parameters:
iStatus- status between the values defined in the enumORecordElement.STATUS
-
copyTo
-
fill
-
fill
protected ORecordAbstract fill(ORID iRid, int iVersion, byte[] iBuffer, boolean iDirty, ODatabaseDocumentInternal db) -
setIdentity
-
unsetDirty
protected void unsetDirty() -
getRecordType
protected abstract byte getRecordType() -
onBeforeIdentityChanged
-
onAfterIdentityChanged
-
getDatabaseInternal
-
getDatabaseIfDefinedInternal
-
flatCopy
-
addIdentityChangeListener
-
removeIdentityChangeListener
-
setup
-
checkForLoading
protected void checkForLoading() -
isContentChanged
protected boolean isContentChanged() -
setContentChanged
protected void setContentChanged(boolean contentChanged) -
clearSource
protected void clearSource() -
getDirtyManager
-
setDirtyManager
-
track
-
unTrack
-