|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectcom.orientechnologies.orient.core.record.ORecordAbstract<T>
com.orientechnologies.orient.core.record.ORecordSchemaAwareAbstract<java.lang.Object>
com.orientechnologies.orient.core.record.impl.ODocument
public class ODocument
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.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.orientechnologies.orient.core.db.record.ORecordElement |
|---|
ORecordElement.STATUS |
| Field Summary | |
|---|---|
static char[] |
INDEX_SEPARATOR
|
static byte |
RECORD_TYPE
|
| Constructor Summary | |
|---|---|
ODocument()
Internal constructor used on unmarshalling. |
|
ODocument(byte[] iSource)
Creates a new instance by the raw stream usually read from the database. |
|
ODocument(java.util.Map<? extends java.lang.Object,java.lang.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. |
|
ODocument(java.lang.Object[] iFields)
Fills a document passing the field array in form of pairs of field name and value. |
|
ODocument(OClass iClass)
Creates a new instance in memory of the specified schema class. |
|
ODocument(ODatabaseRecord iDatabase)
Creates a new instance and binds to the specified database. |
|
ODocument(ODatabaseRecord iDatabase,
ORID iRID)
Creates a new instance in memory linked by the Record Id to the persistent one. |
|
ODocument(ODatabaseRecord iDatabase,
java.lang.String iClassName)
Creates a new instance in memory of the specified class. |
|
ODocument(ODatabaseRecord iDatabase,
java.lang.String iClassName,
ORID iRID)
Creates a new instance in memory of the specified class, linked by the Record Id to the persistent one. |
|
ODocument(java.lang.String iFieldName,
java.lang.Object iFieldValue,
java.lang.Object... iFields)
Fills a document passing the field names/values pair, where the first pair is mandatory. |
|
| Method Summary | ||
|---|---|---|
ODocument |
addOwner(ORecordElement iOwner)
Internal. |
|
ODocument |
clear()
Clears all the field values and types. |
|
boolean |
containsField(java.lang.String iFieldName)
Checks if a field exists. |
|
ODocument |
copy()
Copies the current instance to a new one. |
|
boolean |
detach()
Removes all the dependencies with other records. |
|
boolean |
equals(java.lang.Object obj)
|
|
|
field(java.lang.String iFieldName)
Reads the field value. |
|
|
field(java.lang.String iFieldName,
java.lang.Class<?> iFieldType)
Reads the field value forcing the return type. |
|
ODocument |
field(java.lang.String iFieldName,
java.lang.Object iPropertyValue)
Writes the field value. |
|
ODocument |
field(java.lang.String iFieldName,
java.lang.Object iPropertyValue,
OType iFieldType)
Writes the field value forcing the type. |
|
|
field(java.lang.String iFieldName,
OType iFieldType)
Reads the field value forcing the return type. |
|
java.lang.String[] |
fieldNames()
Returns the set of field names. |
|
int |
fields()
Returns the number of fields in memory. |
|
ODocument |
fields(java.lang.String iFieldName,
java.lang.Object iFieldValue,
java.lang.Object... iFields)
Fill a document passing the field names/values |
|
OType |
fieldType(java.lang.String iFieldName)
Returns the forced field type if any. |
|
java.lang.Object[] |
fieldValues()
Returns the array of field values. |
|
ODocument |
flatCopy()
Internal only. |
|
ODocument |
fromStream(byte[] iRecordBuffer)
Unmarshalls the object. |
|
void |
fromString(java.lang.String iValue)
Fills the ODocument directly with the string representation of the document itself. |
|
java.lang.String[] |
getDirtyFields()
Returns the original value of a field before it has been changed. |
|
java.lang.Object |
getOriginalValue(java.lang.String iFieldName)
Returns the original value of a field before it has been changed. |
|
byte |
getRecordType()
Internal. |
|
boolean |
hasOwners()
Returns true if the record has some owner. |
|
boolean |
hasSameContentOf(ODocument iOther)
|
|
boolean |
isEmbedded()
|
|
boolean |
isEmpty()
|
|
boolean |
isLazyLoad()
|
|
boolean |
isOrdered()
|
|
boolean |
isTrackingChanges()
|
|
java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Object>> |
iterator()
Returns the iterator against only the changed fields if tracking was enabled |
|
ODocument |
load(java.lang.String iFetchPlan)
Loads the record using a fetch plan. |
|
ODocument |
load(java.lang.String iFetchPlan,
boolean iIgnoreCache)
Loads the record using a fetch plan. |
|
ODocument |
merge(java.util.Map<java.lang.String,java.lang.Object> iOther,
boolean iAddOnlyMode,
boolean iMergeSingleItemsOfMultiValueFields)
Merge current document with the document passed as parameter. |
|
ODocument |
merge(ODocument iOther,
boolean iConflictsOtherWins,
boolean iMergeSingleItemsOfMultiValueFields)
Merge current document with the document passed as parameter. |
|
void |
onAfterIdentityChanged(ORecord<?> iRecord)
Internal only. |
|
void |
onBeforeIdentityChanged(ORID iRID)
Internal only. |
|
ORecord<?> |
placeholder()
Returns an empty record as place-holder of the current. |
|
|
rawField(java.lang.String iFieldName)
|
|
java.lang.Object |
removeField(java.lang.String iFieldName)
Removes a field. |
|
ODocument |
removeOwner(ORecordElement iRecordElement)
|
|
ODocument |
reset()
Resets the record values and class type to being reused. |
|
boolean |
setDatabase(ODatabaseRecord iDatabase)
Sets the current database. |
|
ORecordAbstract<java.lang.Object> |
setDirty()
Propagates the dirty status to the owner, if any. |
|
ODocument |
setFieldType(java.lang.String iFieldName,
OType iFieldType)
Sets the field type. |
|
void |
setLazyLoad(boolean iLazyLoad)
|
|
ODocument |
setOrdered(boolean iOrdered)
|
|
ODocument |
setTrackingChanges(boolean iTrackingChanges)
Enabled or disabled the tracking of changes in the document. |
|
java.lang.String |
toString()
Dumps the instance as string. |
|
ODocument |
unload()
Unloads current record. |
|
void |
unsetDirty()
Internal only. |
|
| Methods inherited from class com.orientechnologies.orient.core.record.ORecordSchemaAwareAbstract |
|---|
deserializeFields, fill, getClassName, getSchemaClass, remove, save, save, setClassName, setClassNameIfExists, toStream, toStream, validate, validateField |
| Methods inherited from class com.orientechnologies.orient.core.record.ORecordAbstract |
|---|
compare, compareTo, copyTo, delete, fill, fromJSON, getDatabase, getIdentity, getInternalStatus, getRecord, getSize, getVersion, hashCode, isDirty, isPinned, load, pin, reload, reload, reload, removeListener, setIdentity, setIdentity, setInternalStatus, setListener, setVersion, toJSON, toJSON, unpin |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.orientechnologies.orient.core.record.ORecordInternal |
|---|
fill, setIdentity, setIdentity, setVersion |
| Methods inherited from interface com.orientechnologies.orient.core.record.ORecord |
|---|
delete, fromJSON, getDatabase, getIdentity, getSize, getVersion, isDirty, isPinned, load, pin, reload, toJSON, toJSON, unpin |
| Methods inherited from interface com.orientechnologies.orient.core.db.record.ORecordElement |
|---|
getInternalStatus, setInternalStatus |
| Methods inherited from interface com.orientechnologies.orient.core.db.record.OIdentifiable |
|---|
getRecord |
| Methods inherited from interface java.lang.Comparable |
|---|
compareTo |
| Methods inherited from interface java.util.Comparator |
|---|
compare |
| Field Detail |
|---|
public static final byte RECORD_TYPE
public static final char[] INDEX_SEPARATOR
| Constructor Detail |
|---|
public ODocument()
public ODocument(byte[] iSource)
ORecordSchemaAwareAbstract.save()
is called.
iSource - Raw streampublic ODocument(ODatabaseRecord iDatabase)
ORecordSchemaAwareAbstract.save() is called.
iDatabase - Database instance
public ODocument(ODatabaseRecord iDatabase,
ORID iRID)
ORecordSchemaAwareAbstract.save() is called.
iDatabase - Database instanceiRID - Record Id
public ODocument(ODatabaseRecord iDatabase,
java.lang.String iClassName,
ORID iRID)
ORecordSchemaAwareAbstract.save() is called.
iDatabase - Database instanceiClassName - Class nameiRID - Record Id
public ODocument(ODatabaseRecord iDatabase,
java.lang.String iClassName)
ORecordSchemaAwareAbstract.save() is called.
iDatabase - Database instanceiClassName - Class namepublic ODocument(OClass iClass)
ORecordSchemaAwareAbstract.save() is
called. The database reference is taken by the OClass instance received.
iClass - OClass instancepublic ODocument(java.lang.Object[] iFields)
iFields - Array of field pairspublic ODocument(java.util.Map<? extends java.lang.Object,java.lang.Object> iFieldMap)
iFieldMap - Map of Object/Object
public ODocument(java.lang.String iFieldName,
java.lang.Object iFieldValue,
java.lang.Object... iFields)
| Method Detail |
|---|
public ODocument copy()
copy in interface ORecord<java.lang.Object>public ODocument flatCopy()
ORecordInternal
flatCopy in interface ORecordInternal<java.lang.Object>flatCopy in class ORecordAbstract<java.lang.Object>ORecord.copy()public ORecord<?> placeholder()
public boolean detach()
ORecord
detach in interface ORecord<java.lang.Object>detach in class ORecordAbstract<java.lang.Object>public ODocument load(java.lang.String iFetchPlan)
doc.load( "*:3" ); // LOAD THE DOCUMENT BY EARLY FETCHING UP TO 3rd LEVEL OF CONNECTIONS
iFetchPlan - Fetch plan to use
public ODocument load(java.lang.String iFetchPlan,
boolean iIgnoreCache)
doc.load( "*:3", true ); // LOAD THE DOCUMENT BY EARLY FETCHING UP TO 3rd LEVEL OF CONNECTIONS IGNORING THE CACHE
iIgnoreCache - Ignore the cache or use itpublic boolean hasSameContentOf(ODocument iOther)
public java.lang.String toString()
toString in class ORecordAbstract<java.lang.Object>public void fromString(java.lang.String iValue)
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();
iValue - public java.lang.String[] fieldNames()
fieldNames in interface ORecordSchemaAware<java.lang.Object>public java.lang.Object[] fieldValues()
fieldValues in interface ORecordSchemaAware<java.lang.Object>public <RET> RET rawField(java.lang.String iFieldName)
public <RET> RET field(java.lang.String iFieldName)
field in interface ORecordSchemaAware<java.lang.Object>iFieldName - field name
public <RET> RET field(java.lang.String iFieldName,
java.lang.Class<?> iFieldType)
iFieldName - field nameiFieldType - Forced type.
public <RET> RET field(java.lang.String iFieldName,
OType iFieldType)
field in interface ORecordSchemaAware<java.lang.Object>iFieldName - field nameiFieldType - Forced type.
public ODocument field(java.lang.String iFieldName,
java.lang.Object iPropertyValue)
field in interface ORecordSchemaAware<java.lang.Object>iFieldName - field nameiPropertyValue - field value
public ODocument fields(java.lang.String iFieldName,
java.lang.Object iFieldValue,
java.lang.Object... iFields)
public ODocument field(java.lang.String iFieldName,
java.lang.Object iPropertyValue,
OType iFieldType)
field in interface ORecordSchemaAware<java.lang.Object>iFieldName - field nameiPropertyValue - field valueiFieldType - Forced type (not auto-determined)
public java.lang.Object removeField(java.lang.String iFieldName)
removeField in interface ORecordSchemaAware<java.lang.Object>iFieldName - Field name
public ODocument merge(ODocument iOther,
boolean iConflictsOtherWins,
boolean iMergeSingleItemsOfMultiValueFields)
iOther - Other ODocument instance to mergeiConflictsOtherWins - if true, the other document wins in case of conflicts, otherwise the current document winsiMergeSingleItemsOfMultiValueFields -
public ODocument merge(java.util.Map<java.lang.String,java.lang.Object> iOther,
boolean iAddOnlyMode,
boolean iMergeSingleItemsOfMultiValueFields)
iOther - Other ODocument instance to mergeiAddOnlyMode - if true, the other document properties will be always added. If false, the missed propertie in the "other" document
will be removed by original tooiMergeSingleItemsOfMultiValueFields -
public java.lang.String[] getDirtyFields()
iFieldName - Property name to retrieve the original valuepublic java.lang.Object getOriginalValue(java.lang.String iFieldName)
iFieldName - Property name to retrieve the original valuepublic java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.Object>> iterator()
iterator in interface java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.lang.Object>>public boolean setDatabase(ODatabaseRecord iDatabase)
ORecordElement
setDatabase in interface ORecordElementsetDatabase in class ORecordAbstract<java.lang.Object>public boolean containsField(java.lang.String iFieldName)
containsField in interface ORecordSchemaAware<java.lang.Object>iFieldName - Field name
public byte getRecordType()
getRecordType in interface ORecordInternal<java.lang.Object>public boolean hasOwners()
public ODocument addOwner(ORecordElement iOwner)
public ODocument removeOwner(ORecordElement iRecordElement)
public ORecordAbstract<java.lang.Object> setDirty()
setDirty in interface ORecordElementsetDirty in class ORecordAbstract<java.lang.Object>public void onBeforeIdentityChanged(ORID iRID)
ORecordElement
onBeforeIdentityChanged in interface ORecordElementonBeforeIdentityChanged in class ORecordAbstract<java.lang.Object>public void onAfterIdentityChanged(ORecord<?> iRecord)
ORecordElement
onAfterIdentityChanged in interface ORecordElementonAfterIdentityChanged in class ORecordAbstract<java.lang.Object>public ODocument fromStream(byte[] iRecordBuffer)
OSerializableStream
fromStream in interface OSerializableStreamfromStream in class ORecordAbstract<java.lang.Object>iRecordBuffer - byte array representation of the object
public void unsetDirty()
ORecordInternal
unsetDirty in interface ORecordInternal<java.lang.Object>unsetDirty in class ORecordAbstract<java.lang.Object>public OType fieldType(java.lang.String iFieldName)
iFieldName - public ODocument unload()
ORecord
unload in interface ORecord<java.lang.Object>unload in class ORecordAbstract<java.lang.Object>public ODocument clear()
clear in interface ORecord<java.lang.Object>clear in class ORecordAbstract<java.lang.Object>public ODocument reset()
reset in interface ORecord<java.lang.Object>reset in class ORecordSchemaAwareAbstract<java.lang.Object>public boolean isLazyLoad()
public void setLazyLoad(boolean iLazyLoad)
public boolean isTrackingChanges()
public ODocument setTrackingChanges(boolean iTrackingChanges)
OPropertyIndexManager
to determine what fields are changed to update indexes.
iTrackingChanges - True to enable it, otherwise false
public boolean isOrdered()
public ODocument setOrdered(boolean iOrdered)
public boolean equals(java.lang.Object obj)
equals in interface java.util.Comparator<OIdentifiable>equals in class ORecordAbstract<java.lang.Object>public int fields()
fields in interface ORecordSchemaAware<java.lang.Object>public boolean isEmpty()
public boolean isEmbedded()
public ODocument setFieldType(java.lang.String iFieldName,
OType iFieldType)
iFieldName - Field nameiFieldType - Type to set between OType enumaration values
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||