Class OEdgeDelegate
java.lang.Object
com.orientechnologies.orient.core.record.impl.OEdgeDelegate
- All Implemented Interfaces:
OIdentifiable,ORecordElement,OEdge,OElement,ORecord,OSerializableStream,Serializable,Comparable<OIdentifiable>,Comparator<OIdentifiable>
- Author:
- Luigi Dell'Aquila
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.orientechnologies.orient.core.db.record.ORecordElement
ORecordElement.STATUS -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ODocumentprotected OImmutableClassprotected Stringprotected OVertexprotected OVertexFields inherited from interface com.orientechnologies.orient.core.record.OEdge
DIRECITON_IN, DIRECITON_OUT, DIRECTION_IN, DIRECTION_OUT -
Constructor Summary
ConstructorsConstructorDescriptionOEdgeDelegate(ODocument elem) OEdgeDelegate(OVertex out, OVertex in, OImmutableClass lightweightEdgeType, String edgeLabel) -
Method Summary
Modifier and TypeMethodDescriptionasEdge()Returns an instance of OEdge representing current elementasVertex()Returns an instance of OVertex representing current elementclear()All the fields are deleted but the record identity is maintained.intcompare(OIdentifiable o1, OIdentifiable o2) intcopy()Creates a copy of the record.delete()Deletes the record from the database.booleandetach()Removes all the dependencies with other records.boolean<RET extends ORecord>
RETFills the record parsing the content in JSON format.fromStream(byte[] iStream) Unmarshalls the object.Returns the database where the record belongs.getFrom()Returns the record identity as <cluster-id>:<cluster-position>Returns the current status of the record.getOwner()<RET> RETgetProperty(String name) Gets a property given its nameReturns all the names of defined properties<T extends ORecord>
TReturns the record instance.Returns the type of current element, ie the class in the schema (if any)intgetSize()Returns the size in bytes of the record.getTo()intReturns the current version number of the record.inthashCode()booleanhasProperty(String propertyName) Check if a property exists in the ElementbooleanisDirty()Checks if the record is dirty, namely if it was changed in memory.booleanisEdge()return true if the current element is an edgebooleanbooleanbooleanisLocked()booleanisVertex()return true if the current element is a vertex<RET extends ORecord>
RETload()Loads the record content in memory.voidlock(boolean iExclusive) UseODatabase.lock(ORID)instead.<RET extends ORecord>
RETreload()Loads the record content in memory.<RET extends ORecord>
RETUseinstead.invalid reference
ODatabaseSession#reload(ORecord, String, boolean)<RET> RETremoveProperty(String name) Remove a property<RET extends ORecord>
RETreset()Resets the record to be reused.<RET extends ORecord>
RETsave()Saves in-memory changes to the database.<RET extends ORecord>
RETsave(boolean forceCreate) Useinstead.invalid reference
ODatabaseSession#save(ORecord, String)<RET extends ORecord>
RETSaves in-memory changes to the database defining a specific cluster where to save it.<RET extends ORecord>
RETUseinstead.invalid reference
ODatabaseSession#save(ORecord, String)<RET> RETsetDirty()Marks the instance as dirty.voidvoidsetInternalStatus(ORecordElement.STATUS iStatus) Changes the current internal status.voidsetProperty(String name, Object value) Sets a property valuevoidsetProperty(String name, Object value, OType... fieldType) Sets a property valuetoJSON()Exports the record in JSON format.Exports the record in JSON format specifying additional formatting settings.byte[]toStream()Marshalls the object.toString()unload()Unloads current record.voidunlock()UseODatabase.unlock(ORID)instead.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
-
vOut
-
vIn
-
lightweightEdgeType
-
lightwightEdgeLabel
-
element
-
-
Constructor Details
-
OEdgeDelegate
public OEdgeDelegate(OVertex out, OVertex in, OImmutableClass lightweightEdgeType, String edgeLabel) -
OEdgeDelegate
-
-
Method Details
-
getFrom
-
getTo
-
isLightweight
public boolean isLightweight()- Specified by:
isLightweightin interfaceOEdge
-
getPropertyNames
Description copied from interface:OElementReturns all the names of defined properties- Specified by:
getPropertyNamesin interfaceOElement- Returns:
- all the names of defined properties
-
delete
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. -
getProperty
Description copied from interface:OElementGets a property given its name- Specified by:
getPropertyin interfaceOElement- Type Parameters:
RET-- Parameters:
name- the property name- Returns:
- Returns the property value
-
hasProperty
Description copied from interface:OElementCheck if a property exists in the Element- Specified by:
hasPropertyin interfaceOElement- Parameters:
propertyName-- Returns:
- true if exists otherwise false.
-
setProperty
Description copied from interface:OElementSets a property value- Specified by:
setPropertyin interfaceOElement- Parameters:
name- the property namevalue- the property value
-
setProperty
Description copied from interface:OElementSets a property value- Specified by:
setPropertyin interfaceOElement- Parameters:
name- the property namevalue- the property valuefieldType- Forced type (not auto-determined)
-
removeProperty
Description copied from interface:OElementRemove a property- Specified by:
removePropertyin interfaceOElement- Parameters:
name- the property name
-
asVertex
Description copied from interface:OElementReturns an instance of OVertex representing current element -
asEdge
Description copied from interface:OElementReturns an instance of OEdge representing current element -
isVertex
public boolean isVertex()Description copied from interface:OElementreturn true if the current element is a vertex -
isEdge
public boolean isEdge()Description copied from interface:OElementreturn true if the current element is an edge -
getSchemaType
Description copied from interface:OElementReturns the type of current element, ie the class in the schema (if any)- Specified by:
getSchemaTypein interfaceOElement- Returns:
- the type of current element. An empty optional is returned if current element does not have a schema
-
isLabeled
-
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
-
getRecord
Description copied from interface:OIdentifiableReturns the record instance.- Specified by:
getRecordin interfaceOIdentifiable- Returns:
- ORecord instance
-
lock
public void lock(boolean iExclusive) Description copied from interface:OIdentifiableUseODatabase.lock(ORID)instead.- Specified by:
lockin interfaceOIdentifiable
-
isLocked
public boolean isLocked()- Specified by:
isLockedin interfaceOIdentifiable
-
lockingStrategy
- Specified by:
lockingStrategyin interfaceOIdentifiable
-
unlock
public void unlock()Description copied from interface:OIdentifiableUseODatabase.unlock(ORID)instead.- Specified by:
unlockin interfaceOIdentifiable
-
compare
- Specified by:
comparein interfaceComparator<OIdentifiable>
-
compareTo
- Specified by:
compareToin interfaceComparable<OIdentifiable>
-
equals
- Specified by:
equalsin interfaceComparator<OIdentifiable>- Overrides:
equalsin classObject
-
hashCode
public int hashCode() -
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
-
setDirty
public <RET> RET 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
-
getOwner
- Specified by:
getOwnerin interfaceORecordElement- Returns:
- Returns record element which contains given one.
-
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
- Throws:
OSerializationException- if the marshalling does not succeed- 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:
iStream- byte array representation of the object- Returns:
- The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
- Throws:
OSerializationException- if the unmarshalling does not succeed
-
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. -
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. -
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. -
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. -
copy
Description copied from interface:ORecordCreates a copy of the record. All the record contents are copied. -
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:
-
getDatabase
Description copied from interface:ORecordReturns the database where the record belongs.- Specified by:
getDatabasein interfaceORecord- Returns:
-
isDirty
public boolean isDirty()Description copied from interface:ORecordChecks if the record is dirty, namely if it was changed in memory. -
load
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)- Specified by:
loadin interfaceORecord- Returns:
- The record loaded or itself if the record has been reloaded from the storage. Useful to call methods in chain.
- Throws:
ORecordNotFoundException
-
reload
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.- Specified by:
reloadin interfaceORecord- Returns:
- The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
- Throws:
ORecordNotFoundException
-
reload
public <RET extends ORecord> RET reload(String fetchPlan, boolean ignoreCache, boolean force) throws ORecordNotFoundException Description copied from interface:ORecordUseinstead.invalid reference
ODatabaseSession#reload(ORecord, String, boolean)- Specified by:
reloadin interfaceORecord- Throws:
ORecordNotFoundException
-
save
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
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
Description copied from interface:ORecordUseinstead.invalid reference
ODatabaseSession#save(ORecord, String) -
save
Description copied from interface:ORecordUseinstead.invalid reference
ODatabaseSession#save(ORecord, String) -
fromJSON
Description copied from interface:ORecordFills the record parsing the content in JSON format. -
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:
iFormat- 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
-
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. -
toString
-