java.lang.Object
com.orientechnologies.orient.core.record.ORecordAbstract
com.orientechnologies.orient.core.record.impl.ODocument
All Implemented Interfaces:
ODetachable, OIdentifiable, ORecordElement, OElement, ORecord, ORecordSchemaAware, OSerializableStream, Externalizable, Serializable, Comparable<OIdentifiable>, Iterable<Map.Entry<String,Object>>, Comparator<OIdentifiable>
Direct Known Subclasses:
ODocumentEmbedded, OEdgeDocument, OVertexDocument, OViewDocument

Document representation to handle values dynamically. Can be used in schema-less, schema-mixed and schema-full modes. Fields can be added at run-time. Instances can be reused across calls by using the reset() before to re-use.
See Also:
  • Field Details

    • RECORD_TYPE

      public static final byte RECORD_TYPE
      See Also:
    • EMPTY_STRINGS

      protected static final String[] EMPTY_STRINGS
    • fieldSize

      protected int fieldSize
    • fields

      protected Map<String,ODocumentEntry> fields
    • trackingChanges

      protected boolean trackingChanges
    • ordered

      protected boolean ordered
    • lazyLoad

      protected boolean lazyLoad
    • allowChainedAccess

      protected boolean allowChainedAccess
    • owner

      protected transient WeakReference<ORecordElement> owner
    • schema

      protected OImmutableSchema schema
    • propertyAccess

      protected OPropertyAccess propertyAccess
    • propertyEncryption

      protected OPropertyEncryption propertyEncryption
  • Constructor Details

    • ODocument

      public ODocument()
      Internal constructor used on unmarshalling.
    • ODocument

      public ODocument(ODatabaseSession database)
      Internal constructor used on unmarshalling.
    • ODocument

      @Deprecated public ODocument(byte[] iSource)
      Deprecated.
      Creates a new instance by the raw stream usually read from the database. New instances are not persistent until save() is called.
      Parameters:
      iSource - Raw stream
    • ODocument

      public ODocument(InputStream iSource) throws IOException
      Creates a new instance by the raw stream usually read from the database. New instances are not persistent until save() is called.
      Parameters:
      iSource - Raw stream as InputStream
      Throws:
      IOException
    • ODocument

      public ODocument(ORID iRID)
      Creates a new instance in memory linked by the Record Id to the persistent one. New instances are not persistent until save() is called.
      Parameters:
      iRID - Record Id
    • ODocument

      public ODocument(String iClassName, ORID iRID)
      Creates a new instance in memory of the specified class, linked by the Record Id to the persistent one. New instances are not persistent until save() is called.
      Parameters:
      iClassName - Class name
      iRID - Record Id
    • ODocument

      public ODocument(String iClassName)
      Creates a new instance in memory of the specified class. New instances are not persistent until save() is called.
      Parameters:
      iClassName - Class name
    • ODocument

      public ODocument(ODatabaseSession session, String iClassName)
      Creates a new instance in memory of the specified class. New instances are not persistent until save() is called.
      Parameters:
      session - the session the instance will be attached to
      iClassName - Class name
    • ODocument

      public ODocument(OClass iClass)
      Creates a new instance in memory of the specified schema class. New instances are not persistent until save() is called. The database reference is taken from the thread local.
      Parameters:
      iClass - OClass instance
    • ODocument

      public ODocument(Object[] iFields)
      Fills a document passing the field array in form of pairs of field name and value.
      Parameters:
      iFields - Array of field pairs
    • ODocument

      public ODocument(Map<?,Object> iFieldMap)
      Fills a document passing a map of key/values where the key is the field name and the value the field's value.
      Parameters:
      iFieldMap - Map of Object/Object
    • ODocument

      public ODocument(String iFieldName, Object iFieldValue, Object... iFields)
      Fills a document passing the field names/values pair, where the first pair is mandatory.
  • Method Details

    • 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
    • calculatePropertyNames

      protected Set<String> calculatePropertyNames()
    • 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 iFieldName)
      retrieves a property value from the current document
      Specified by:
      getProperty in interface OElement
      Type Parameters:
      RET -
      Parameters:
      iFieldName - The field name, it can contain any character (it's not evaluated as an expression, as in #eval()
      Returns:
      the field value. Null if the field does not exist.
    • getRawProperty

      protected <RET> RET getRawProperty(String iFieldName)
      retrieves a property value from the current document, without evaluating it (eg. no conversion from RID to document)
      Type Parameters:
      RET -
      Parameters:
      iFieldName - The field name, it can contain any character (it's not evaluated as an expression, as in #eval()
      Returns:
      the field value. Null if the field does not exist.
    • setProperty

      public void setProperty(String iFieldName, Object iPropertyValue)
      sets a property value on current document
      Specified by:
      setProperty in interface OElement
      Parameters:
      iFieldName - The property name
      iPropertyValue - The property value
    • setProperty

      public void setProperty(String iPropetyName, Object iPropertyValue, OType... iFieldType)
      Sets
      Specified by:
      setProperty in interface OElement
      Parameters:
      iPropetyName - The property name
      iPropertyValue - The property value
      iFieldType - Forced type (not auto-determined)
    • removeProperty

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

      protected static void validateFieldsSecurity(ODatabaseDocumentInternal internal, ODocument iRecord) throws OValidationException
      Throws:
      OValidationException
    • validateField

      protected static void validateField(ODocument iRecord, OImmutableProperty p) throws OValidationException
      Throws:
      OValidationException
    • validateLinkCollection

      protected static void validateLinkCollection(OProperty property, Iterable<Object> values, ODocumentEntry value)
    • validateType

      protected static void validateType(OProperty p, Object value)
    • validateLink

      protected static void validateLink(OProperty p, Object fieldValue, boolean allowNull)
    • validateEmbedded

      protected static void validateEmbedded(OProperty p, Object fieldValue)
    • copy

      public ODocument copy()
      Copies the current instance to a new one. Hasn't been choose the clone() to let ODocument return type. Once copied the new instance has the same identity and values but all the internal structure are totally independent by the source.
      Specified by:
      copy in interface ORecord
      Returns:
      The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
    • copyTo

      public ORecordAbstract copyTo(ORecordAbstract iDestination)
      Copies all the fields into iDestination document.
      Overrides:
      copyTo in class ORecordAbstract
    • placeholder

      @Deprecated public ORecord placeholder()
      Deprecated.
      Returns an empty record as place-holder of the current. Used when a record is requested, but only the identity is needed.
      Returns:
      placeholder of this document
    • detach

      public boolean detach()
      Detaches all the connected records. If new records are linked to the document the detaching cannot be completed and false will be returned. RidBag types cannot be fully detached when the database is connected using "remote" protocol.
      Specified by:
      detach in interface ODetachable
      Specified by:
      detach in interface ORecord
      Overrides:
      detach in class ORecordAbstract
      Returns:
      true if the record has been detached, otherwise false
    • load

      @Deprecated public ODocument load(String iFetchPlan)
      Deprecated.
      Loads the record using a fetch plan. Example:

      doc.load( "*:3" ); // LOAD THE DOCUMENT BY EARLY FETCHING UP TO 3rd LEVEL OF CONNECTIONS

      Parameters:
      iFetchPlan - Fetch plan to use
    • load

      @Deprecated public ODocument load(String iFetchPlan, boolean iIgnoreCache)
      Deprecated.
      Loads the record using a fetch plan. Example:

      doc.load( "*:3", true ); // LOAD THE DOCUMENT BY EARLY FETCHING UP TO 3rd LEVEL OF CONNECTIONS IGNORING THE CACHE

      Parameters:
      iIgnoreCache - Ignore the cache or use it
    • reload

      @Deprecated public ODocument reload(String fetchPlan, boolean ignoreCache)
      Deprecated.
      Overrides:
      reload in class ORecordAbstract
    • hasSameContentOf

      public boolean hasSameContentOf(ODocument iOther)
    • toStream

      @Deprecated public byte[] toStream()
      Deprecated.
      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
      Overrides:
      toStream in class ORecordAbstract
      Returns:
      The byte array representation of the object
      See Also:
    • toMap

      public Map<String,Object> toMap()
      Returns the document as Map String,Object . If the document has identity, then the @rid entry is valued. If the document has a class, then the @class entry is valued.
      Since:
      2.0
    • toString

      public String toString()
      Dumps the instance as string.
      Overrides:
      toString in class ORecordAbstract
    • fromString

      @Deprecated public void fromString(String iValue)
      Deprecated.
      Fills the ODocument directly with the string representation of the document itself. Use it for faster insertion but pay attention to respect the OrientDB record format.

      record.reset();
      record.setClassName("Account");
      record.fromString(new String("Account@id:" + data.getCyclesDone() + ",name:'Luca',surname:'Garulli',birthDate:" + date.getTime()
      + ",salary:" + 3000f + i));
      record.save();

      Parameters:
      iValue - String representation of the record.
    • fieldNames

      public String[] fieldNames()
      Returns the set of field names.
      Specified by:
      fieldNames in interface ORecordSchemaAware
      Returns:
      Set of string containing the field names
    • fieldValues

      public Object[] fieldValues()
      Returns the array of field values.
      Specified by:
      fieldValues in interface ORecordSchemaAware
      Returns:
      Object array of the field values
    • rawField

      public <RET> RET rawField(String iFieldName)
    • eval

      public Object eval(String iExpression)
      Evaluates a SQL expression against current document. Example: long amountPlusVat = doc.eval("amount * 120 / 100");
      Parameters:
      iExpression - SQL expression to evaluate.
      Returns:
      The result of expression
      Throws:
      OQueryParsingException - in case the expression is not valid
    • eval

      public Object eval(String iExpression, OCommandContext iContext)
      Evaluates a SQL expression against current document by passing a context. The expression can refer to the variables contained in the context. Example: OCommandContext context = new OBasicCommandContext().setVariable("vat", 20); long amountPlusVat = doc.eval("amount * (100+$vat) / 100", context);
      Parameters:
      iExpression - SQL expression to evaluate.
      Returns:
      The result of expression
      Throws:
      OQueryParsingException - in case the expression is not valid
    • field

      public <RET> RET field(String iFieldName)
      Reads the field value.
      Specified by:
      field in interface ORecordSchemaAware
      Parameters:
      iFieldName - field name
      Returns:
      field value if defined, otherwise null
    • field

      public <RET> RET field(String iFieldName, Class<?> iFieldType)
      Reads the field value forcing the return type. Use this method to force return of ORID instead of the entire document by passing ORID.class as iFieldType.
      Parameters:
      iFieldName - field name
      iFieldType - Forced type.
      Returns:
      field value if defined, otherwise null
    • field

      public <RET> RET field(String iFieldName, OType iFieldType)
      Reads the field value forcing the return type. Use this method to force return of binary data.
      Specified by:
      field in interface ORecordSchemaAware
      Parameters:
      iFieldName - field name
      iFieldType - Forced type.
      Returns:
      field value if defined, otherwise null
    • field

      public ODocument field(String iFieldName, Object iPropertyValue)
      Writes the field value. This method sets the current document as dirty.
      Specified by:
      field in interface ORecordSchemaAware
      Parameters:
      iFieldName - field name. If contains dots (.) the change is applied to the nested documents in chain. To disable this feature call setAllowChainedAccess(boolean) to false.
      iPropertyValue - field value
      Returns:
      The Record instance itself giving a "fluent interface". Useful to call multiple methods in chain.
    • fields

      public ODocument fields(String iFieldName, Object iFieldValue, Object... iFields)
      Fills a document passing the field names/values.
    • fields

      @Deprecated public ODocument fields(Map<String,Object> iMap)
      Deprecated.
      Deprecated. Use fromMap(Map) instead.
      Fills a document passing the field names/values as a Map String,Object where the keys are the field names and the values are the field values.
      See Also:
    • fromMap

      public ODocument fromMap(Map<String,?> iMap)
      Fills a document passing the field names/values as a Map String,Object where the keys are the field names and the values are the field values. It accepts also @rid for record id and @class for class name.
      Since:
      2.0
    • field

      public ODocument field(String iFieldName, Object iPropertyValue, OType... iFieldType)
      Writes the field value forcing the type. This method sets the current document as dirty.

      if there's a schema definition for the specified field, the value will be converted to respect the schema definition if needed. if the type defined in the schema support less precision than the iPropertyValue provided, the iPropertyValue will be converted following the java casting rules with possible precision loss.

      Specified by:
      field in interface ORecordSchemaAware
      Parameters:
      iFieldName - field name. If contains dots (.) the change is applied to the nested documents in chain. To disable this feature call setAllowChainedAccess(boolean) to false.
      iPropertyValue - field value.
      iFieldType - Forced type (not auto-determined)
      Returns:
      The Record instance itself giving a "fluent interface". Useful to call multiple methods in chain. If the updated document is another document (using the dot (.) notation) then the document returned is the changed one or NULL if no document has been found in chain
    • removeField

      public Object removeField(String iFieldName)
      Removes a field.
      Specified by:
      removeField in interface ORecordSchemaAware
      Parameters:
      iFieldName - Field name
      Returns:
      The old value contained in the remove field
    • merge

      public ODocument merge(ODocument iOther, boolean iUpdateOnlyMode, boolean iMergeSingleItemsOfMultiValueFields)
      Merge current document with the document passed as parameter. If the field already exists then the conflicts are managed based on the value of the parameter 'iUpdateOnlyMode'.
      Parameters:
      iOther - Other ODocument instance to merge
      iUpdateOnlyMode - if true, the other document properties will always be added or overwritten. If false, the missed properties in the "other" document will be removed by original document
      iMergeSingleItemsOfMultiValueFields - If true, merges single items of multi field fields (collections, maps, arrays, etc)
      Returns:
    • merge

      public ODocument merge(Map<String,Object> iOther, boolean iUpdateOnlyMode, boolean iMergeSingleItemsOfMultiValueFields)
      Merge current document with the document passed as parameter. If the field already exists then the conflicts are managed based on the value of the parameter 'iUpdateOnlyMode'.
      Parameters:
      iOther - Other ODocument instance to merge
      iUpdateOnlyMode - if true, the other document properties will always be added or overwritten. If false, the missed properties in the "other" document will be removed by original document
      iMergeSingleItemsOfMultiValueFields - If true, merges single items of multi field fields (collections, maps, arrays, etc)
      Returns:
    • getDirtyFields

      public String[] getDirtyFields()
      Returns list of changed fields. There are two types of changes:
      1. Value of field itself was changed by calling of field(String, Object) method for example.
      2. Internal state of field was changed but was not saved. This case currently is applicable for for collections only.
      Returns:
      List of fields, values of which were changed.
    • getOriginalValue

      public Object getOriginalValue(String iFieldName)
      Returns the original value of a field before it has been changed.
      Parameters:
      iFieldName - Property name to retrieve the original value
    • getCollectionTimeLine

      public OMultiValueChangeTimeLine<Object,Object> getCollectionTimeLine(String iFieldName)
    • iterator

      public Iterator<Map.Entry<String,Object>> iterator()
      Returns the iterator fields
      Specified by:
      iterator in interface Iterable<Map.Entry<String,Object>>
    • containsField

      public boolean containsField(String iFieldName)
      Checks if a field exists.
      Specified by:
      containsField in interface ORecordSchemaAware
      Parameters:
      iFieldName - Field name
      Returns:
      True if exists, otherwise false.
    • hasProperty

      public boolean hasProperty(String propertyName)
      Checks if a property exists.
      Specified by:
      hasProperty in interface OElement
      Returns:
      True if exists, otherwise false.
    • hasOwners

      public boolean hasOwners()
      Returns true if the record has some owner.
    • getOwner

      public ORecordElement getOwner()
      Specified by:
      getOwner in interface ORecordElement
      Overrides:
      getOwner in class ORecordAbstract
      Returns:
      Returns record element which contains given one.
    • getOwners

      @Deprecated public Iterable<ORecordElement> getOwners()
      Deprecated.
    • setDirty

      public ORecordAbstract setDirty()
      Propagates the dirty status to the owner, if any. This happens when the object is embedded in another one.
      Specified by:
      setDirty in interface ORecordElement
      Overrides:
      setDirty in class ORecordAbstract
      Returns:
      The object it self. Useful to call methods in chain.
    • setDirtyNoChanged

      public void setDirtyNoChanged()
      Specified by:
      setDirtyNoChanged in interface ORecordElement
      Overrides:
      setDirtyNoChanged in class ORecordAbstract
    • fromStream

      public ODocument fromStream(byte[] iRecordBuffer)
      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
      Overrides:
      fromStream in class ORecordAbstract
      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

      protected ODocument fromStream(byte[] iRecordBuffer, ODatabaseDocumentInternal db)
      Overrides:
      fromStream in class ORecordAbstract
    • fieldType

      public OType fieldType(String iFieldName)
      Returns the forced field type if any.
      Parameters:
      iFieldName - name of field to check
    • unload

      public ODocument 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
      Overrides:
      unload in class ORecordAbstract
      Returns:
      The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
    • clear

      public ODocument clear()
      Clears all the field values and types. Clears only record content, but saves its identity.

      The following code will clear all data from specified document. doc.clear(); doc.save();

      Specified by:
      clear in interface ORecord
      Overrides:
      clear in class ORecordAbstract
      Returns:
      this
      See Also:
    • reset

      public ODocument reset()
      Resets the record values and class type to being reused. It's like you create a ODocument from scratch. This method is handy when you want to insert a bunch of documents and don't want to strain GC.

      The following code will create a new document in database. doc.clear(); doc.save();

      IMPORTANT! This can be used only if no transactions are begun.

      Specified by:
      reset in interface ORecord
      Overrides:
      reset in class ORecordAbstract
      Returns:
      this
      Throws:
      IllegalStateException - if transaction is begun.
      See Also:
    • undo

      public ODocument undo()
      Rollbacks changes to the loaded version without reloading the document. Works only if tracking changes is enabled @see isTrackingChanges() and setTrackingChanges(boolean) methods.
    • undo

      public ODocument undo(String field)
    • isLazyLoad

      public boolean isLazyLoad()
    • setLazyLoad

      public void setLazyLoad(boolean iLazyLoad)
    • isTrackingChanges

      public boolean isTrackingChanges()
    • setTrackingChanges

      public ODocument setTrackingChanges(boolean iTrackingChanges)
      Enabled or disabled the tracking of changes in the document. This is needed by some triggers like OClassIndexManager to determine what fields are changed to update indexes.
      Parameters:
      iTrackingChanges - True to enable it, otherwise false
      Returns:
      this
    • clearTrackData

      protected void clearTrackData()
    • clearTransactionTrackData

      protected void clearTransactionTrackData()
    • isOrdered

      public boolean isOrdered()
    • setOrdered

      public ODocument setOrdered(boolean iOrdered)
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class ORecordAbstract
    • fields

      public int fields()
      Returns the number of fields in memory.
      Specified by:
      fields in interface ORecordSchemaAware
      Returns:
      Fields number
    • isEmpty

      public boolean isEmpty()
    • fromJSON

      public ODocument fromJSON(String iSource, String iOptions)
      Overrides:
      fromJSON in class ORecordAbstract
    • fromJSON

      public ODocument fromJSON(String iSource)
      Description copied from interface: ORecord
      Fills the record parsing the content in JSON format.
      Specified by:
      fromJSON in interface ORecord
      Overrides:
      fromJSON in class ORecordAbstract
      Parameters:
      iSource - Object content in JSON format
      Returns:
      The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
    • fromJSON

      public ODocument fromJSON(InputStream contentStream) throws IOException
      Overrides:
      fromJSON in class ORecordAbstract
      Throws:
      IOException
    • fromJSON

      public ODocument fromJSON(String iSource, boolean needReload)
      Overrides:
      fromJSON in class ORecordAbstract
    • isEmbedded

      public boolean isEmbedded()
    • setFieldType

      public ODocument setFieldType(String iFieldName, OType iFieldType)
      Sets the field type. This overrides the schema property settings if any.
      Parameters:
      iFieldName - Field name
      iFieldType - Type to set between OType enumeration values
    • save

      @Deprecated public ODocument save()
      Deprecated.
      Description copied from interface: ORecord
      Saves 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 ODatabaseSession#save(ORecord) instead.

      Specified by:
      save in interface ORecord
      Overrides:
      save in class ORecordAbstract
      Returns:
      The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
    • save

      @Deprecated public ODocument save(String iClusterName)
      Deprecated.
      Description copied from interface: ORecord
      Saves 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 ODatabaseSession#save(ORecord, String) instead.

      Specified by:
      save in interface ORecord
      Overrides:
      save in class ORecordAbstract
      Returns:
      The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
    • save

      @Deprecated public ORecordAbstract save(String iClusterName, boolean forceCreate)
      Deprecated.
      Description copied from interface: ORecord
      Use ODatabaseSession#save(ORecord, String) instead.
      Specified by:
      save in interface ORecord
      Overrides:
      save in class ORecordAbstract
      Returns:
    • deserializeFields

      public boolean deserializeFields(String... iFields)
    • writeExternal

      public void writeExternal(ObjectOutput stream) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput stream) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
      ClassNotFoundException
    • isAllowChainedAccess

      public boolean isAllowChainedAccess()
      Returns the behavior of field() methods allowing access to the sub documents with dot notation ('.'). Default is true. Set it to false if you allow to store properties with the dot.
    • setAllowChainedAccess

      public ODocument setAllowChainedAccess(boolean allowChainedAccess)
      Change the behavior of field() methods allowing access to the sub documents with dot notation ('.'). Default is true. Set it to false if you allow to store properties with the dot.
    • setClassNameIfExists

      public void setClassNameIfExists(String iClassName)
      Description copied from interface: ORecordSchemaAware
      Sets the class for the current record only if already exists in the schema.
      Specified by:
      setClassNameIfExists in interface ORecordSchemaAware
      Parameters:
      iClassName - Class name to set
    • getSchemaClass

      public OClass getSchemaClass()
      Description copied from interface: ORecordSchemaAware
      Returns the schema class object for the record.
      Specified by:
      getSchemaClass in interface ORecordSchemaAware
      Returns:
      OClass instance or null if the record has no class associated
    • getClassName

      public String getClassName()
      Description copied from interface: ORecordSchemaAware
      Returns the class name associated to the current record. Can be null. Call this method after a #reset() to re-associate the class.
      Specified by:
      getClassName in interface ORecordSchemaAware
      Returns:
      Class name if any
    • setClassName

      public void setClassName(String className)
      Description copied from interface: ORecordSchemaAware
      Sets the class for the current record. If the class not exists, it will be created in transparent way as empty (no fields).
      Specified by:
      setClassName in interface ORecordSchemaAware
      Parameters:
      className - Class name to set
    • validate

      public void validate() throws OValidationException
      Validates the record following the declared constraints defined in schema such as mandatory, notNull, min, max, regexp, etc. If the schema is not defined for the current class or there are not constraints then the validation is ignored.
      Specified by:
      validate in interface ORecordSchemaAware
      Throws:
      OValidationException - if the document breaks some validation constraints defined in the schema
      See Also:
    • toString

      protected String toString(Set<ORecord> inspected)
    • mergeMap

      protected ODocument mergeMap(Map<String,ODocumentEntry> iOther, boolean iUpdateOnlyMode, boolean iMergeSingleItemsOfMultiValueFields)
    • fill

      protected ORecordAbstract fill(ORID iRid, int iVersion, byte[] iBuffer, boolean iDirty)
      Overrides:
      fill in class ORecordAbstract
    • fill

      protected ORecordAbstract fill(ORID iRid, int iVersion, byte[] iBuffer, boolean iDirty, ODatabaseDocumentInternal db)
      Overrides:
      fill in class ORecordAbstract
    • clearSource

      protected void clearSource()
      Overrides:
      clearSource in class ORecordAbstract
    • getGlobalPropertyById

      protected OGlobalProperty getGlobalPropertyById(int id)
    • fillClassIfNeed

      protected void fillClassIfNeed(String iClassName)
    • getImmutableSchemaClass

      protected OImmutableClass getImmutableSchemaClass()
    • getImmutableSchemaClass

      protected OImmutableClass getImmutableSchemaClass(ODatabaseDocumentInternal database)
    • rawField

      protected void rawField(String iFieldName, Object iFieldValue, OType iFieldType)
    • getOrCreate

      protected ODocumentEntry getOrCreate(String key)
    • rawContainsField

      protected boolean rawContainsField(String iFiledName)
    • autoConvertValues

      protected void autoConvertValues()
    • toStream

      protected byte[] toStream(boolean iOnlyDelta)
    • getRecordType

      protected byte getRecordType()
      Internal.
      Specified by:
      getRecordType in class ORecordAbstract
    • addOwner

      protected void addOwner(ORecordElement iOwner)
      Internal.
    • removeOwner

      protected void removeOwner(ORecordElement iRecordElement)
    • convertAllMultiValuesToTrackedVersions

      protected void convertAllMultiValuesToTrackedVersions()
    • internalReset

      protected void internalReset()
    • checkForFields

      protected boolean checkForFields(String... iFields)
    • accessProperty

      protected Object accessProperty(String property)
    • setup

      protected void setup(ODatabaseDocumentInternal db)
      Internal.
      Overrides:
      setup in class ORecordAbstract
      Parameters:
      db -
    • checkFieldName

      protected String checkFieldName(String iFieldName)
    • setClass

      protected void setClass(OClass iClass)
    • getRawEntries

      protected Set<Map.Entry<String,ODocumentEntry>> getRawEntries()
    • getFilteredEntries

      protected List<Map.Entry<String,ODocumentEntry>> getFilteredEntries()
    • autoConvertFieldsToClass

      protected void autoConvertFieldsToClass(ODatabaseDocumentInternal database)
    • checkClass

      protected void checkClass(ODatabaseDocumentInternal database)
    • track

      protected void track(OIdentifiable id)
      Overrides:
      track in class ORecordAbstract
    • unTrack

      protected void unTrack(OIdentifiable id)
      Overrides:
      unTrack in class ORecordAbstract
    • getImmutableSchema

      protected OImmutableSchema getImmutableSchema()
    • checkEmbeddable

      protected void checkEmbeddable()