Class 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
- 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 booleanprotected static final String[]protected Map<String,ODocumentEntry> protected intprotected booleanprotected booleanprotected WeakReference<ORecordElement>protected OPropertyAccessprotected OPropertyEncryptionstatic final byteprotected OImmutableSchemaprotected booleanFields inherited from class com.orientechnologies.orient.core.record.ORecordAbstract
BASE_FORMAT, contentChanged, DEFAULT_FORMAT, dirty, dirtyManager, OLD_FORMAT_WITH_LATE_TYPES, recordFormat, recordId, recordVersion, size, source, status -
Constructor Summary
ConstructorsConstructorDescriptionInternal constructor used on unmarshalling.ODocument(byte[] iSource) Deprecated.ODocument(ODatabaseSession database) Internal constructor used on unmarshalling.ODocument(ODatabaseSession session, String iClassName) Creates a new instance in memory of the specified class.Creates a new instance in memory linked by the Record Id to the persistent one.Creates a new instance in memory of the specified schema class.ODocument(InputStream iSource) Creates a new instance by the raw stream usually read from the database.Fills a document passing the field array in form of pairs of field name and value.Creates a new instance in memory of the specified class.Creates a new instance in memory of the specified class, linked by the Record Id to the persistent one.Fills a document passing the field names/values pair, where the first pair is mandatory.Fills a document passing a map of key/values where the key is the field name and the value the field's value. -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectaccessProperty(String property) protected voidaddOwner(ORecordElement iOwner) Internal.asEdge()Returns an instance of OEdge representing current elementasVertex()Returns an instance of OVertex representing current elementprotected voidprotected voidprotected voidcheckClass(ODatabaseDocumentInternal database) protected voidprotected StringcheckFieldName(String iFieldName) protected booleancheckForFields(String... iFields) clear()Clears all the field values and types.protected voidprotected voidprotected voidbooleancontainsField(String iFieldName) Checks if a field exists.protected voidcopy()Copies the current instance to a new one.copyTo(ORecordAbstract iDestination) Copies all the fields into iDestination document.booleandeserializeFields(String... iFields) booleandetach()Detaches all the connected records.booleanEvaluates a SQL expression against current document.eval(String iExpression, OCommandContext iContext) Evaluates a SQL expression against current document by passing a context.<RET> RETReads the field value.<RET> RETReads the field value forcing the return type.<RET> RETReads the field value forcing the return type.Writes the field value.Writes the field value forcing the type.String[]Returns the set of field names.intfields()Returns the number of fields in memory.Fills a document passing the field names/values.Deprecated.Returns the forced field type if any.Object[]Returns the array of field values.protected ORecordAbstractprotected ORecordAbstractfill(ORID iRid, int iVersion, byte[] iBuffer, boolean iDirty, ODatabaseDocumentInternal db) protected voidfillClassIfNeed(String iClassName) fromJSON(InputStream contentStream) Fills the record parsing the content in JSON format.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.fromStream(byte[] iRecordBuffer) Unmarshalls the object.protected ODocumentfromStream(byte[] iRecordBuffer, ODatabaseDocumentInternal db) voidfromString(String iValue) Deprecated.Returns the class name associated to the current record.getCollectionTimeLine(String iFieldName) String[]Returns list of changed fields.protected List<Map.Entry<String,ODocumentEntry>> protected OGlobalPropertygetGlobalPropertyById(int id) protected OImmutableSchemaprotected OImmutableClassprotected OImmutableClassprotected ODocumentEntrygetOrCreate(String key) getOriginalValue(String iFieldName) Returns the original value of a field before it has been changed.getOwner()Deprecated.<RET> RETgetProperty(String iFieldName) retrieves a property value from the current documentReturns all the names of defined propertiesprotected Set<Map.Entry<String,ODocumentEntry>> protected <RET> RETgetRawProperty(String iFieldName) retrieves a property value from the current document, without evaluating it (eg.protected byteInternal.Returns the schema class object for the record.Returns the type of current element, ie the class in the schema (if any)inthashCode()booleanReturns true if the record has some owner.booleanhasProperty(String propertyName) Checks if a property exists.booleanhasSameContentOf(ODocument iOther) protected voidbooleanReturns the behavior of field() methods allowing access to the sub documents with dot notation ('.').booleanisEdge()return true if the current element is an edgebooleanbooleanisEmpty()booleanbooleanbooleanbooleanisVertex()return true if the current element is a vertexiterator()Returns the iterator fieldsDeprecated.Deprecated.Merge current document with the document passed as parameter.merge(Map<String, Object> iOther, boolean iUpdateOnlyMode, boolean iMergeSingleItemsOfMultiValueFields) Merge current document with the document passed as parameter.protected ODocumentmergeMap(Map<String, ODocumentEntry> iOther, boolean iUpdateOnlyMode, boolean iMergeSingleItemsOfMultiValueFields) Deprecated.protected booleanrawContainsField(String iFiledName) <RET> RETprotected voidvoidreadExternal(ObjectInput stream) Deprecated.removeField(String iFieldName) Removes a field.protected voidremoveOwner(ORecordElement iRecordElement) <RET> RETremoveProperty(String iFieldName) Remove a propertyreset()Resets the record values and class type to being reused.save()Deprecated.Deprecated.Deprecated.setAllowChainedAccess(boolean allowChainedAccess) Change the behavior of field() methods allowing access to the sub documents with dot notation ('.').protected voidvoidsetClassName(String className) Sets the class for the current record.voidsetClassNameIfExists(String iClassName) Sets the class for the current record only if already exists in the schema.setDirty()Propagates the dirty status to the owner, if any.voidsetFieldType(String iFieldName, OType iFieldType) Sets the field type.voidsetLazyLoad(boolean iLazyLoad) setOrdered(boolean iOrdered) voidsetProperty(String iFieldName, Object iPropertyValue) sets a property value on current documentvoidsetProperty(String iPropetyName, Object iPropertyValue, OType... iFieldType) SetssetTrackingChanges(boolean iTrackingChanges) Enabled or disabled the tracking of changes in the document.protected voidInternal.toMap()Returns the document as Map String,Object .byte[]toStream()Deprecated.protected byte[]toStream(boolean iOnlyDelta) toString()Dumps the instance as string.protected Stringprotected voidtrack(OIdentifiable id) undo()Rollbacks changes to the loaded version without reloading the document.unload()Unloads current record.protected voidunTrack(OIdentifiable id) voidvalidate()Validates the record following the declared constraints defined in schema such as mandatory, notNull, min, max, regexp, etc.protected static voidvalidateEmbedded(OProperty p, Object fieldValue) protected static voidvalidateField(ODocument iRecord, OImmutableProperty p) protected static voidvalidateFieldsSecurity(ODatabaseDocumentInternal internal, ODocument iRecord) protected static voidvalidateLink(OProperty p, Object fieldValue, boolean allowNull) protected static voidvalidateLinkCollection(OProperty property, Iterable<Object> values, ODocumentEntry value) protected static voidvalidateType(OProperty p, Object value) voidwriteExternal(ObjectOutput stream) Methods inherited from class com.orientechnologies.orient.core.record.ORecordAbstract
addIdentityChangeListener, checkForLoading, compare, compareTo, delete, flatCopy, getDatabase, getDatabaseIfDefined, getDatabaseIfDefinedInternal, getDatabaseInternal, getDirtyManager, getIdentity, getInternalStatus, getRecord, getSize, getVersion, isContentChanged, isDirty, isLocked, load, lock, lockingStrategy, onAfterIdentityChanged, onBeforeIdentityChanged, reload, reload, reload, removeIdentityChangeListener, save, setContentChanged, setDirtyManager, setIdentity, setIdentity, setInternalStatus, setVersion, toJSON, toJSON, toJSON, toJSON, unlock, unsetDirtyMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface java.util.Comparator
compare, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface com.orientechnologies.orient.core.db.record.OIdentifiable
getRecord, isLocked, lock, lockingStrategy, unlockMethods inherited from interface com.orientechnologies.orient.core.record.ORecord
delete, getDatabase, getIdentity, getInternalStatus, getSize, getVersion, isDirty, load, reload, reload, save, setInternalStatus, toJSON, toJSON
-
Field Details
-
RECORD_TYPE
public static final byte RECORD_TYPE- See Also:
-
EMPTY_STRINGS
-
fieldSize
protected int fieldSize -
fields
-
trackingChanges
protected boolean trackingChanges -
ordered
protected boolean ordered -
lazyLoad
protected boolean lazyLoad -
allowChainedAccess
protected boolean allowChainedAccess -
owner
-
schema
-
propertyAccess
-
propertyEncryption
-
-
Constructor Details
-
ODocument
public ODocument()Internal constructor used on unmarshalling. -
ODocument
Internal constructor used on unmarshalling. -
ODocument
Deprecated.Creates a new instance by the raw stream usually read from the database. New instances are not persistent untilsave()is called.- Parameters:
iSource- Raw stream
-
ODocument
Creates a new instance by the raw stream usually read from the database. New instances are not persistent untilsave()is called.- Parameters:
iSource- Raw stream as InputStream- Throws:
IOException
-
ODocument
Creates a new instance in memory linked by the Record Id to the persistent one. New instances are not persistent untilsave()is called.- Parameters:
iRID- Record Id
-
ODocument
Creates a new instance in memory of the specified class, linked by the Record Id to the persistent one. New instances are not persistent untilsave()is called.- Parameters:
iClassName- Class nameiRID- Record Id
-
ODocument
Creates a new instance in memory of the specified class. New instances are not persistent untilsave()is called.- Parameters:
iClassName- Class name
-
ODocument
Creates a new instance in memory of the specified class. New instances are not persistent untilsave()is called.- Parameters:
session- the session the instance will be attached toiClassName- Class name
-
ODocument
Creates a new instance in memory of the specified schema class. New instances are not persistent untilsave()is called. The database reference is taken from the thread local.- Parameters:
iClass- OClass instance
-
ODocument
Fills a document passing the field array in form of pairs of field name and value.- Parameters:
iFields- Array of field pairs
-
ODocument
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
Fills a document passing the field names/values pair, where the first pair is mandatory.
-
-
Method Details
-
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
-
calculatePropertyNames
-
getPropertyNames
Description copied from interface:OElementReturns all the names of defined properties- Specified by:
getPropertyNamesin interfaceOElement- Returns:
- all the names of defined properties
-
getProperty
retrieves a property value from the current document- Specified by:
getPropertyin interfaceOElement- 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
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
sets a property value on current document- Specified by:
setPropertyin interfaceOElement- Parameters:
iFieldName- The property nameiPropertyValue- The property value
-
setProperty
Sets- Specified by:
setPropertyin interfaceOElement- Parameters:
iPropetyName- The property nameiPropertyValue- The property valueiFieldType- Forced type (not auto-determined)
-
removeProperty
Description copied from interface:OElementRemove a property- Specified by:
removePropertyin interfaceOElement- 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
-
validateLink
-
validateEmbedded
-
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. -
copyTo
Copies all the fields into iDestination document.- Overrides:
copyToin classORecordAbstract
-
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:
detachin interfaceODetachable- Specified by:
detachin interfaceORecord- Overrides:
detachin classORecordAbstract- Returns:
- true if the record has been detached, otherwise false
-
load
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.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.- Overrides:
reloadin classORecordAbstract
-
hasSameContentOf
-
toStream
Deprecated.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- Overrides:
toStreamin classORecordAbstract- Returns:
- The byte array representation of the object
- See Also:
-
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
Dumps the instance as string.- Overrides:
toStringin classORecordAbstract
-
fromString
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
Returns the set of field names.- Specified by:
fieldNamesin interfaceORecordSchemaAware- Returns:
- Set of string containing the field names
-
fieldValues
Returns the array of field values.- Specified by:
fieldValuesin interfaceORecordSchemaAware- Returns:
- Object array of the field values
-
rawField
-
eval
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
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
Reads the field value.- Specified by:
fieldin interfaceORecordSchemaAware- Parameters:
iFieldName- field name- Returns:
- field value if defined, otherwise null
-
field
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 nameiFieldType- Forced type.- Returns:
- field value if defined, otherwise null
-
field
Reads the field value forcing the return type. Use this method to force return of binary data.- Specified by:
fieldin interfaceORecordSchemaAware- Parameters:
iFieldName- field nameiFieldType- Forced type.- Returns:
- field value if defined, otherwise null
-
field
Writes the field value. This method sets the current document as dirty.- Specified by:
fieldin interfaceORecordSchemaAware- Parameters:
iFieldName- field name. If contains dots (.) the change is applied to the nested documents in chain. To disable this feature callsetAllowChainedAccess(boolean)to false.iPropertyValue- field value- Returns:
- The Record instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
fields
Fills a document passing the field names/values. -
fields
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
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
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:
fieldin interfaceORecordSchemaAware- Parameters:
iFieldName- field name. If contains dots (.) the change is applied to the nested documents in chain. To disable this feature callsetAllowChainedAccess(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
Removes a field.- Specified by:
removeFieldin interfaceORecordSchemaAware- 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 mergeiUpdateOnlyMode- 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 documentiMergeSingleItemsOfMultiValueFields- 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 mergeiUpdateOnlyMode- 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 documentiMergeSingleItemsOfMultiValueFields- If true, merges single items of multi field fields (collections, maps, arrays, etc)- Returns:
-
getDirtyFields
Returns list of changed fields. There are two types of changes:- Value of field itself was changed by calling of
field(String, Object)method for example. - 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.
- Value of field itself was changed by calling of
-
getOriginalValue
Returns the original value of a field before it has been changed.- Parameters:
iFieldName- Property name to retrieve the original value
-
getCollectionTimeLine
-
iterator
Returns the iterator fields -
containsField
Checks if a field exists.- Specified by:
containsFieldin interfaceORecordSchemaAware- Parameters:
iFieldName- Field name- Returns:
- True if exists, otherwise false.
-
hasProperty
Checks if a property exists.- Specified by:
hasPropertyin interfaceOElement- Returns:
- True if exists, otherwise false.
-
hasOwners
public boolean hasOwners()Returns true if the record has some owner. -
getOwner
- Specified by:
getOwnerin interfaceORecordElement- Overrides:
getOwnerin classORecordAbstract- Returns:
- Returns record element which contains given one.
-
getOwners
Deprecated. -
setDirty
Propagates the dirty status to the owner, if any. This happens when the object is embedded in another one.- Specified by:
setDirtyin interfaceORecordElement- Overrides:
setDirtyin classORecordAbstract- Returns:
- The object it self. Useful to call methods in chain.
-
setDirtyNoChanged
public void setDirtyNoChanged()- Specified by:
setDirtyNoChangedin interfaceORecordElement- Overrides:
setDirtyNoChangedin classORecordAbstract
-
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- Overrides:
fromStreamin classORecordAbstract- 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
- Overrides:
fromStreamin classORecordAbstract
-
fieldType
Returns the forced field type if any.- Parameters:
iFieldName- name of field to check
-
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.- Specified by:
unloadin interfaceORecord- Overrides:
unloadin classORecordAbstract- Returns:
- The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
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:
clearin interfaceORecord- Overrides:
clearin classORecordAbstract- Returns:
- this
- See Also:
-
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:
resetin interfaceORecord- Overrides:
resetin classORecordAbstract- Returns:
- this
- Throws:
IllegalStateException- if transaction is begun.- See Also:
-
undo
Rollbacks changes to the loaded version without reloading the document. Works only if tracking changes is enabled @seeisTrackingChanges()andsetTrackingChanges(boolean)methods. -
undo
-
isLazyLoad
public boolean isLazyLoad() -
setLazyLoad
public void setLazyLoad(boolean iLazyLoad) -
isTrackingChanges
public boolean isTrackingChanges() -
setTrackingChanges
Enabled or disabled the tracking of changes in the document. This is needed by some triggers likeOClassIndexManagerto 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
-
equals
- Specified by:
equalsin interfaceComparator<OIdentifiable>- Overrides:
equalsin classORecordAbstract
-
hashCode
public int hashCode()- Overrides:
hashCodein classORecordAbstract
-
fields
public int fields()Returns the number of fields in memory.- Specified by:
fieldsin interfaceORecordSchemaAware- Returns:
- Fields number
-
isEmpty
public boolean isEmpty() -
fromJSON
- Overrides:
fromJSONin classORecordAbstract
-
fromJSON
Description copied from interface:ORecordFills the record parsing the content in JSON format.- Specified by:
fromJSONin interfaceORecord- Overrides:
fromJSONin classORecordAbstract- Parameters:
iSource- Object content in JSON format- Returns:
- The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
fromJSON
- Overrides:
fromJSONin classORecordAbstract- Throws:
IOException
-
fromJSON
- Overrides:
fromJSONin classORecordAbstract
-
isEmbedded
public boolean isEmbedded() -
setFieldType
Sets the field type. This overrides the schema property settings if any.- Parameters:
iFieldName- Field nameiFieldType- Type to set between OType enumeration values
-
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
ODatabaseSession#save(ORecord)instead.- Specified by:
savein interfaceORecord- Overrides:
savein classORecordAbstract- Returns:
- The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
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
ODatabaseSession#save(ORecord, String)instead.- Specified by:
savein interfaceORecord- Overrides:
savein classORecordAbstract- Returns:
- The Object instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
save
Deprecated.Description copied from interface:ORecordUseODatabaseSession#save(ORecord, String)instead.- Specified by:
savein interfaceORecord- Overrides:
savein classORecordAbstract- Returns:
-
deserializeFields
-
writeExternal
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
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
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
Description copied from interface:ORecordSchemaAwareSets the class for the current record only if already exists in the schema.- Specified by:
setClassNameIfExistsin interfaceORecordSchemaAware- Parameters:
iClassName- Class name to set
-
getSchemaClass
Description copied from interface:ORecordSchemaAwareReturns the schema class object for the record.- Specified by:
getSchemaClassin interfaceORecordSchemaAware- Returns:
OClassinstance or null if the record has no class associated
-
getClassName
Description copied from interface:ORecordSchemaAwareReturns the class name associated to the current record. Can be null. Call this method after a#reset()to re-associate the class.- Specified by:
getClassNamein interfaceORecordSchemaAware- Returns:
- Class name if any
-
setClassName
Description copied from interface:ORecordSchemaAwareSets the class for the current record. If the class not exists, it will be created in transparent way as empty (no fields).- Specified by:
setClassNamein interfaceORecordSchemaAware- Parameters:
className- Class name to set
-
validate
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:
validatein interfaceORecordSchemaAware- Throws:
OValidationException- if the document breaks some validation constraints defined in the schema- See Also:
-
toString
-
mergeMap
protected ODocument mergeMap(Map<String, ODocumentEntry> iOther, boolean iUpdateOnlyMode, boolean iMergeSingleItemsOfMultiValueFields) -
fill
- Overrides:
fillin classORecordAbstract
-
fill
protected ORecordAbstract fill(ORID iRid, int iVersion, byte[] iBuffer, boolean iDirty, ODatabaseDocumentInternal db) - Overrides:
fillin classORecordAbstract
-
clearSource
protected void clearSource()- Overrides:
clearSourcein classORecordAbstract
-
getGlobalPropertyById
-
fillClassIfNeed
-
getImmutableSchemaClass
-
getImmutableSchemaClass
-
rawField
-
getOrCreate
-
rawContainsField
-
autoConvertValues
protected void autoConvertValues() -
toStream
protected byte[] toStream(boolean iOnlyDelta) -
getRecordType
protected byte getRecordType()Internal.- Specified by:
getRecordTypein classORecordAbstract
-
addOwner
Internal. -
removeOwner
-
convertAllMultiValuesToTrackedVersions
protected void convertAllMultiValuesToTrackedVersions() -
internalReset
protected void internalReset() -
checkForFields
-
accessProperty
-
setup
Internal.- Overrides:
setupin classORecordAbstract- Parameters:
db-
-
checkFieldName
-
setClass
-
getRawEntries
-
getFilteredEntries
-
autoConvertFieldsToClass
-
checkClass
-
track
- Overrides:
trackin classORecordAbstract
-
unTrack
- Overrides:
unTrackin classORecordAbstract
-
getImmutableSchema
-
checkEmbeddable
protected void checkEmbeddable()
-