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>

public class OEdgeDelegate extends Object implements OEdge
Author:
Luigi Dell'Aquila
See Also:
  • Field Details

    • vOut

      protected OVertex vOut
    • vIn

      protected OVertex vIn
    • lightweightEdgeType

      protected OImmutableClass lightweightEdgeType
    • lightwightEdgeLabel

      protected String lightwightEdgeLabel
    • element

      protected ODocument element
  • Constructor Details

  • Method Details

    • getFrom

      public OVertex getFrom()
      Specified by:
      getFrom in interface OEdge
    • getTo

      public OVertex getTo()
      Specified by:
      getTo in interface OEdge
    • isLightweight

      public boolean isLightweight()
      Specified by:
      isLightweight in interface OEdge
    • getPropertyNames

      public Set<String> getPropertyNames()
      Description copied from interface: OElement
      Returns all the names of defined properties
      Specified by:
      getPropertyNames in interface OElement
      Returns:
      all the names of defined properties
    • getProperty

      public <RET> RET getProperty(String name)
      Description copied from interface: OElement
      Gets a property given its name
      Specified by:
      getProperty in interface OElement
      Type Parameters:
      RET -
      Parameters:
      name - the property name
      Returns:
      Returns the property value
    • hasProperty

      public boolean hasProperty(String propertyName)
      Description copied from interface: OElement
      Check if a property exists in the Element
      Specified by:
      hasProperty in interface OElement
      Parameters:
      propertyName -
      Returns:
      true if exists otherwise false.
    • setProperty

      public void setProperty(String name, Object value)
      Description copied from interface: OElement
      Sets a property value
      Specified by:
      setProperty in interface OElement
      Parameters:
      name - the property name
      value - the property value
    • setProperty

      public void setProperty(String name, Object value, OType... fieldType)
      Description copied from interface: OElement
      Sets a property value
      Specified by:
      setProperty in interface OElement
      Parameters:
      name - the property name
      value - the property value
      fieldType - Forced type (not auto-determined)
    • removeProperty

      public <RET> RET removeProperty(String name)
      Description copied from interface: OElement
      Remove a property
      Specified by:
      removeProperty in interface OElement
      Parameters:
      name - the property name
    • asVertex

      public Optional<OVertex> asVertex()
      Description copied from interface: OElement
      Returns an instance of OVertex representing current element
      Specified by:
      asVertex in interface OElement
      Returns:
      An OVertex that represents the current element. An empty optional if the current element is not a vertex
    • asEdge

      public Optional<OEdge> asEdge()
      Description copied from interface: OElement
      Returns an instance of OEdge representing current element
      Specified by:
      asEdge in interface OElement
      Returns:
      An OEdge that represents the current element. An empty optional if the current element is not an edge
    • isVertex

      public boolean isVertex()
      Description copied from interface: OElement
      return true if the current element is a vertex
      Specified by:
      isVertex in interface OElement
      Returns:
      true if the current element is a vertex
    • isEdge

      public boolean isEdge()
      Description copied from interface: OElement
      return true if the current element is an edge
      Specified by:
      isEdge in interface OElement
      Returns:
      true if the current element is an edge
    • getSchemaType

      public Optional<OClass> getSchemaType()
      Description copied from interface: OElement
      Returns the type of current element, ie the class in the schema (if any)
      Specified by:
      getSchemaType in interface OElement
      Returns:
      the type of current element. An empty optional is returned if current element does not have a schema
    • isLabeled

      public boolean isLabeled(String[] labels)
      Specified by:
      isLabeled in interface OEdge
    • getIdentity

      public ORID getIdentity()
      Description copied from interface: ORecord
      Returns the record identity as <cluster-id>:<cluster-position>
      Specified by:
      getIdentity in interface OIdentifiable
      Specified by:
      getIdentity in interface ORecord
      Returns:
      ORID instance
    • getRecord

      public <T extends ORecord> T getRecord()
      Description copied from interface: OIdentifiable
      Returns the record instance.
      Specified by:
      getRecord in interface OIdentifiable
      Returns:
      ORecord instance
    • compare

      public int compare(OIdentifiable o1, OIdentifiable o2)
      Specified by:
      compare in interface Comparator<OIdentifiable>
    • compareTo

      public int compareTo(OIdentifiable o)
      Specified by:
      compareTo in interface Comparable<OIdentifiable>
    • equals

      public boolean equals(Object obj)
      Specified by:
      equals in interface Comparator<OIdentifiable>
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getInternalStatus

      public ORecordElement.STATUS getInternalStatus()
      Description copied from interface: ORecord
      Returns the current status of the record.
      Specified by:
      getInternalStatus in interface ORecord
      Returns:
      Current status as value between the defined values in the enum ORecordElement.STATUS
    • setInternalStatus

      public void setInternalStatus(ORecordElement.STATUS iStatus)
      Description copied from interface: ORecord
      Changes the current internal status.
      Specified by:
      setInternalStatus in interface ORecord
      Parameters:
      iStatus - status between the values defined in the enum ORecordElement.STATUS
    • setDirty

      public <RET> RET setDirty()
      Description copied from interface: ORecordElement
      Marks the instance as dirty. The dirty status could be propagated up if the implementation supports ownership concept.
      Specified by:
      setDirty in interface ORecordElement
      Returns:
      The object it self. Useful to call methods in chain.
    • setDirtyNoChanged

      public void setDirtyNoChanged()
      Specified by:
      setDirtyNoChanged in interface ORecordElement
    • getOwner

      public ORecordElement getOwner()
      Specified by:
      getOwner in interface ORecordElement
      Returns:
      Returns record element which contains given one.
    • toStream

      public byte[] toStream() throws OSerializationException
      Description copied from interface: OSerializableStream
      Marshalls the object. Transforms the current object in byte[] form to being stored or transferred over the network.
      Specified by:
      toStream in interface OSerializableStream
      Returns:
      The byte array representation of the object
      Throws:
      OSerializationException - if the marshalling does not succeed
      See Also:
    • fromStream

      public OSerializableStream fromStream(byte[] iStream) throws OSerializationException
      Description copied from interface: OSerializableStream
      Unmarshalls 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:
      fromStream in interface OSerializableStream
      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: ORecord
      Removes 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.
      Specified by:
      detach in interface ORecord
      Returns:
      True if the document has been successfully detached, otherwise false.
    • reset

      public <RET extends ORecord> RET reset()
      Description copied from interface: ORecord
      Resets 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.
      Specified by:
      reset in interface ORecord
      Returns:
      The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
    • unload

      public OEdge unload()
      Description copied from interface: ORecord
      Unloads 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.
      Specified by:
      unload in interface ORecord
      Returns:
      The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
    • clear

      public OEdge clear()
      Description copied from interface: ORecord
      All the fields are deleted but the record identity is maintained. Use this to remove all the document's fields.
      Specified by:
      clear in interface ORecord
      Returns:
      The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
    • copy

      public OEdge copy()
      Description copied from interface: ORecord
      Creates a copy of the record. All the record contents are copied.
      Specified by:
      copy in interface ORecord
      Returns:
      The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
    • getVersion

      public int getVersion()
      Description copied from interface: ORecord
      Returns 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:
      getVersion in interface ORecord
      Returns:
      The version number. 0 if it's a brand new record.
      See Also:
    • getDatabase

      public ODatabaseDocument getDatabase()
    • isDirty

      public boolean isDirty()
      Description copied from interface: ORecord
      Checks if the record is dirty, namely if it was changed in memory.
      Specified by:
      isDirty in interface ORecord
      Returns:
      True if dirty, otherwise false
    • fromJSON

      public <RET extends ORecord> RET fromJSON(String iJson)
      Description copied from interface: ORecord
      Fills the record parsing the content in JSON format.
      Specified by:
      fromJSON in interface ORecord
      Parameters:
      iJson - Object content in JSON format
      Returns:
      The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
    • toJSON

      public String toJSON()
      Description copied from interface: ORecord
      Exports the record in JSON format.
      Specified by:
      toJSON in interface ORecord
      Returns:
      Object content in JSON format
    • toJSON

      public String toJSON(String iFormat)
      Description copied from interface: ORecord
      Exports the record in JSON format specifying additional formatting settings.
      Specified by:
      toJSON in interface ORecord
      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
      Example: "rid,version,class,indent:6" exports record id, version and class properties along with record properties using an indenting level equals of 6.
      Returns:
      Object content in JSON format
    • getSize

      public int getSize()
      Description copied from interface: ORecord
      Returns the size in bytes of the record. The size can be computed only for not new records.
      Specified by:
      getSize in interface ORecord
      Returns:
      the size in bytes
    • toString

      public String toString()
      Overrides:
      toString in class Object