Class ODatabaseDocumentAbstract
- All Implemented Interfaces:
ODatabaseDocument,ODatabase<ORecord>,ODatabaseDocumentInternal,ODatabaseInternal<ORecord>,ODatabaseSession,OBackupable,Closeable,AutoCloseable
- Direct Known Subclasses:
ODatabaseDocumentEmbedded,ODatabaseDocumentRemote
- Author:
- Luca Garulli (l.garulli--(at)--orientdb.com)
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.orientechnologies.orient.core.db.ODatabase
ODatabase.ATTRIBUTES, ODatabase.STATUS -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<String,OQueryDatabaseState> protected OCurrentStorageComponentsFactoryprotected OTransactionprotected ODatabaseInternal<?>protected final Map<ORecordHook,ORecordHook.HOOK_POSITION> protected final ORecordHook[][]protected final Set<OIdentifiable>protected booleanprotected longprotected OLocalRecordCacheprotected longprotected longprotected OSessionMetadataprotected longprotected longprotected LinkedList<OQueryDatabaseState>protected final byteprotected booleanprotected longprotected ORecordSerializerprotected OSharedContextprotected ODatabase.STATUSprotected longprotected longprotected Map<ORecordHook,ORecordHook.HOOK_POSITION> protected Stringprotected OImmutableUserFields inherited from interface com.orientechnologies.orient.core.db.document.ODatabaseDocument
TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionActivates current database instance on current thread.protected voidprotected voidintassignAndCheckCluster(ORecord record, String iClusterName) protected voidprotected voidbegin()Begins a new transaction.begin(OTransaction.TXTYPE iType) Begins a new transaction specifying the transaction type.browseClass(String iClassName) Browses all the records of the specified class and also all the subclasses.browseClass(String iClassName, boolean iPolymorphic) Browses all the records of the specified class and if iPolymorphic is true also all the subclasses.browseCluster(String iClusterName) Browses all the records of the specified cluster.<REC extends ORecord>
ORecordIteratorCluster<REC>browseCluster(String iClusterName, Class<REC> iClass) Browses all the records of the specified cluster of the passed record type.<REC extends ORecord>
ORecordIteratorCluster<REC>browseCluster(String iClusterName, Class<REC> iRecordClass, long startClusterPosition, long endClusterPosition) protected voidcallbackHookFailure(ORecord record, boolean wasNew, byte[] stream) protected voidcallbackHookFinalize(ORecord record, boolean wasNew, byte[] stream) callbackHooks(ORecordHook.TYPE type, OIdentifiable id) Callback the registered hooks if any.protected voidcallbackHookSuccess(ORecord record, boolean wasNew, byte[] stream, OStorageOperationResult<Integer> operationResult) voidvoidvoidvoidcheckForClusterPermissions(String iClusterName) voidprotected voidprotected voidcheckRecordClass(OClass recordClass, String iClusterName, ORecordId rid) voidcheckSecurity(int operation, OIdentifiable record, String cluster) cleanOutRecord(ORID iRecord, int iVersion) protected voidclearDocumentTracking(ORecord record) voidclose()Closes an opened database, if the database is already closed does nothing, if a transaction is active will be rollback.protected voidcommit()Commits the current transaction.commit(boolean force) protected longcountClass(OImmutableClass cls, boolean iPolymorphic) longcountClass(String iClassName) Returns the number of the records of the class iClassName.longcountClass(String iClassName, boolean iPolymorphic) Returns the number of the records of the class iClassName considering also sub classes if polymorphic is true.longReturns the number of the records of the class iClassName.Deletes the record without checking the version.Deletes the record checking the version.abstract <RET extends ORecord>
RETexecuteReadRecord(ORecordId rid, ORecord iRecord, int recordVersion, String fetchPlan, boolean ignoreCache, boolean iUpdateCache, RecordReader recordReader) This method is internal, it can be subject to signature change or be removed, do not use.static ObjectexecuteWithRetries(OCallable<Object, Integer> callback, int maxRetry) static ObjectexecuteWithRetries(OCallable<Object, Integer> callback, int maxRetry, int waitBetweenRetry) static ObjectexecuteWithRetries(OCallable<Object, Integer> callback, int maxRetry, int waitBetweenRetry, ORecord[] recordToReloadOnRetry) booleanexistsCluster(String iClusterName) Returns true if the cluster exists, otherwise false.get(ODatabase.ATTRIBUTES iAttribute) Returns a database attribute valuegetActiveQuery(String id) Retrieve the set of defined blob cluster.intgetClusterIdByName(String iClusterName) Returns the cluster id by name.getClusterNameById(int iClusterId) Returns the cluster name by id.Returns all the names of the clusters.intReturns the number of clusters.Returns the database configuration settings.Returns the database owner.intReturns the default cluster id.static ORecordSerializerDeprecated.getHooks()Retrieves all the registered hooks.Retrieves all the registered listeners.Returns the level1 cache.Return the OMetadata instance.getName()Returns the database name.Returns an iterator of the property entriesgetProperty(String iName) Gets the property value.<RET extends ORecord>
RETgetRecord(OIdentifiable iIdentifiable) Returns the record for a OIdentifiable instance.byteReturns the default record type for this kind of database.Returns the current status of database.Internal.Return active transaction.getType()<DB extends ODatabase>
DBThis method is internal, it can be subject to signature change or be removed, do not use.getURL()Returns the database URL.getUser()Returns the current user logged into the database.getViewFromCluster(int cluster) protected voidinit()booleanReturns true if the current database instance is active on current thread, otherwise false.booleanisClusterEdge(int cluster) booleanisClusterVertex(int cluster) booleanisClusterView(int cluster) booleanisPooled()booleanbooleanbooleanTells if validation of record is active.<RET extends ORecord>
RETLoads the entity by the Record ID.<RET extends ORecord>
RETLoads the entity by the Record ID using a fetch plan.<RET extends ORecord>
RETLoads the entity by the Record ID using a fetch plan and specifying if the cache must be ignored.<RET extends ORecord>
RETLoads the entity and return it.<RET extends ORecord>
RETLoads a record using a fetch plan.<RET extends ORecord>
RETLoads a record using a fetch plan.<RET extends ORecord>
RETloadIfVersionIsNotLatest(ORID rid, int recordVersion, String fetchPlan, boolean ignoreCache) protected abstract voidnewBlob()Create a new empty instance of a blob.newBlob(byte[] bytes) Create a new instance of a blob containing the given bytes.Creates a new EdgeCreates a new EdgenewElement(OClass clazz) newElement(String className) newEmbeddedElement(String className) Creates a new ODocument.newInstance(String iClassName) Creates a document with specific class.newLightweightEdge(String iClassName, OVertex from, OVertex to) newRegularEdge(String iClassName, OVertex from, OVertex to) Creates a new VertexCreates a new Vertexprotected voidpessimisticLockChecks(ORID recordId) voidqueryClosed(String id) voidqueryStarted(String id, OQueryDatabaseState state) voidrawBegin(OTransaction iTx) <DB extends ODatabase<?>>
DBregisterHook(ORecordHook iHookImpl) Registers a hook to listen all events for Records.<DB extends ODatabase<?>>
DBregisterHook(ORecordHook iHookImpl, ORecordHook.HOOK_POSITION iPosition) <RET extends ORecord>
RET<RET extends ORecord>
RET<RET extends ORecord>
RETForce the reloading of the entity.<RET extends ORecord>
RETForce the reloading of the entity.voidvoidrollback()Aborts the current running transaction.rollback(boolean force) <RET extends ORecord>
RETSaves a document to the database.<RET extends ORecord>
RETSaves a document specifying a cluster where to store the record.<RET extends ORecord>
RETSaves a document specifying a cluster where to store the record.voidDeprecated.setDatabaseOwner(ODatabaseInternal<?> iOwner) Internal.static voidsetDefaultSerializer(ORecordSerializer iDefaultSerializer) Sets default serializer.voidvoidsetInternal(ODatabase.ATTRIBUTES iAttribute, Object iValue) Internal method.voidsetPrefetchRecords(boolean prefetchRecords) setProperty(String iName, Object iValue) Sets a property valuevoidsetSerializer(ORecordSerializer serializer) Sets serializer for the database which will be used for document serialization.<DB extends ODatabase>
DBsetStatus(ODatabase.STATUS status) Set the current status of database. deprecated since 2.2voidsetStatusInternal(ODatabase.STATUS status) voidsetUseLightweightEdges(boolean b) voidsetUser(OSecurityUser user) Set user for current database instance.<DB extends ODatabaseDocument>
DBsetValidationEnabled(boolean iEnabled) Enables or disables the record validation.swapTx(OTransaction newTx) <DB extends ODatabase<?>>
DBunregisterHook(ORecordHook iHookImpl) Unregisters a previously registered hook.Methods inherited from class com.orientechnologies.common.listener.OListenerManger
browseListeners, getListenersCopy, registerListener, resetListeners, unregisterListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.orientechnologies.orient.core.util.OBackupable
backup, restoreMethods inherited from interface com.orientechnologies.orient.core.db.ODatabase
addCluster, addCluster, command, command, countClusterElements, countClusterElements, countClusterElements, createClass, delete, dropCluster, dropCluster, execute, execute, executeWithRetry, getClass, getClusterRecordSizeById, getClusterRecordSizeByName, getConflictStrategy, getRecordMetadata, getSize, incrementalBackup, isClosed, live, live, lock, lock, query, query, registerListener, reload, set, setConflictStrategy, setConflictStrategy, truncateCluster, unlock, unregisterListenerMethods inherited from interface com.orientechnologies.orient.core.db.document.ODatabaseDocument
addBlobCluster, checkSecurity, checkSecurity, checkSecurity, createClassIfNotExist, createEdgeClass, createVertexClass, freeze, freeze, newEdge, newVertex, release, reloadMethods inherited from interface com.orientechnologies.orient.core.db.ODatabaseDocumentInternal
afterCreateOperations, afterDeleteOperations, afterReadOperations, afterUpdateOperations, beforeCreateOperations, beforeDeleteOperations, beforeReadOperations, beforeUpdateOperations, ceilingPhysicalPositions, commandLikeLegacy, commitPreallocate, copy, countRecords, createSBTree, directRead, dropClusterInternal, endEsclusiveMetadataChange, executeDeleteRecord, executeLikeLegacy, floorPhysicalPositions, getClusterDataRange, getClusterName, getClusterRecordConflictStrategy, getClustersIds, getHaStatus, getLastClusterPosition, getSbTreeCollectionManager, getStorageId, higherPhysicalPositions, indexQuery, internalClose, internalCommit, internalCommitPreallocate, internalLockRecord, internalUnlockRecord, isDistributed, isLocalEnv, isRemote, isReusable, lowerPhysicalPositions, queryLikeLegacy, queryOnNode, queryStartUsingViewCluster, queryStartUsingViewIndex, readIfVersionIsNotLatest, realClose, remoteRollback, removeHaServer, reuse, saveAll, sendSequenceAction, setCustom, setDefaultClusterId, startEsclusiveMetadataChange, sync, syncCommit, truncateClass, truncateClass, truncateClusterInternalMethods inherited from interface com.orientechnologies.orient.core.db.ODatabaseInternal
addRidbagPrefetchStats, createInterruptTimerTask, getActiveDataCenterMap, getEnterpriseEndpoint, getLocalNodeName, getStats, getStorage, getStorageInfo, isSharded, replaceStorage, resetRecordLoadStats
-
Field Details
-
properties
-
unmodifiableHooks
-
inHook
-
serializer
-
url
-
status
-
databaseOwner
-
metadata
-
user
-
recordType
protected final byte recordType- See Also:
-
hooks
-
retainRecords
protected boolean retainRecords -
localCache
-
componentsFactory
-
initialized
protected boolean initialized -
currentTx
-
hooksByScope
-
activeQueries
-
queryState
-
loadedRecordsCount
protected long loadedRecordsCount -
totalRecordLoadMs
protected long totalRecordLoadMs -
minRecordLoadMs
protected long minRecordLoadMs -
maxRecordLoadMs
protected long maxRecordLoadMs -
ridbagPrefetchCount
protected long ridbagPrefetchCount -
totalRidbagPrefetchMs
protected long totalRidbagPrefetchMs -
minRidbagPrefetchMs
protected long minRidbagPrefetchMs -
maxRidbagPrefetchMs
protected long maxRidbagPrefetchMs
-
-
Constructor Details
-
ODatabaseDocumentAbstract
protected ODatabaseDocumentAbstract()
-
-
Method Details
-
getDefaultSerializer
- Returns:
- default serializer which is used to serialize documents. Default serializer is common for all database instances.
-
setDefaultSerializer
Sets default serializer. The default serializer is common for all database instances.- Parameters:
iDefaultSerializer- new default serializer value
-
callOnOpenListeners
public void callOnOpenListeners()- Specified by:
callOnOpenListenersin interfaceODatabaseDocumentInternal
-
loadMetadata
protected abstract void loadMetadata() -
callOnCloseListeners
public void callOnCloseListeners()- Specified by:
callOnCloseListenersin interfaceODatabaseDocumentInternal
-
callOnDropListeners
public void callOnDropListeners()- Specified by:
callOnDropListenersin interfaceODatabaseDocumentInternal
-
getRecord
Returns the record for a OIdentifiable instance. If the argument received already is a ORecord instance, then it's returned as is, otherwise a new ORecord is created with the identity received and returned.- Specified by:
getRecordin interfaceODatabaseDocument- Returns:
- A ORecord instance
-
load
Loads the entity by the Record ID using a fetch plan and specifying if the cache must be ignored. -
delete
Deletes the record checking the version. -
cleanOutRecord
- Specified by:
cleanOutRecordin interfaceODatabaseDocumentInternal
-
getType
-
browseCluster
public <REC extends ORecord> ORecordIteratorCluster<REC> browseCluster(String iClusterName, Class<REC> iClass) Description copied from interface:ODatabaseDocumentBrowses all the records of the specified cluster of the passed record type.- Specified by:
browseClusterin interfaceODatabaseDocument- Parameters:
iClusterName- Cluster name to iterateiClass- The record class expected- Returns:
- Iterator of ODocument instances
-
browseCluster
public <REC extends ORecord> ORecordIteratorCluster<REC> browseCluster(String iClusterName, Class<REC> iRecordClass, long startClusterPosition, long endClusterPosition) - Specified by:
browseClusterin interfaceODatabaseDocument
-
getRecordType
public byte getRecordType()Returns the default record type for this kind of database.- Specified by:
getRecordTypein interfaceODatabaseDocument
-
getMetadata
Return the OMetadata instance. Cannot be null.- Specified by:
getMetadatain interfaceODatabase<ORecord>- Specified by:
getMetadatain interfaceODatabaseDocumentInternal- Returns:
- The OMetadata instance.
-
getDatabaseOwner
Returns the database owner. Used in wrapped instances to know the up level ODatabase instance.- Specified by:
getDatabaseOwnerin interfaceODatabaseInternal<ORecord>- Returns:
- Returns the database owner.
-
setDatabaseOwner
Internal. Sets the database owner.- Specified by:
setDatabaseOwnerin interfaceODatabaseInternal<ORecord>
-
setStatus
Set the current status of database. deprecated since 2.2 -
setStatusInternal
-
setInternal
Internal method. Don't call it directly unless you're building an internal component.- Specified by:
setInternalin interfaceODatabaseInternal<ORecord>
-
getUser
Returns the current user logged into the database. -
setUser
Set user for current database instance.- Specified by:
setUserin interfaceODatabaseInternal<ORecord>
-
reloadUser
public void reloadUser()- Specified by:
reloadUserin interfaceODatabaseDocumentInternal
-
getDictionary
Deprecated.Returns the Dictionary manual index.- Specified by:
getDictionaryin interfaceODatabase<ORecord>- Returns:
- ODictionary instance
-
registerHook
public <DB extends ODatabase<?>> DB registerHook(ORecordHook iHookImpl, ORecordHook.HOOK_POSITION iPosition) - Specified by:
registerHookin interfaceODatabase<ORecord>
-
registerHook
Registers a hook to listen all events for Records.- Specified by:
registerHookin interfaceODatabase<ORecord>- Parameters:
iHookImpl- ORecordHook implementation- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
unregisterHook
Unregisters a previously registered hook.- Specified by:
unregisterHookin interfaceODatabase<ORecord>- Parameters:
iHookImpl- ORecordHook implementation- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain. deprecated since 2.2
-
getLocalCache
Returns the level1 cache. Cannot be null.- Specified by:
getLocalCachein interfaceODatabase<ORecord>- Returns:
- Current cache.
-
getHooks
Retrieves all the registered hooks. -
callbackHooks
Callback the registered hooks if any.- Specified by:
callbackHooksin interfaceODatabaseDocumentInternal- Parameters:
type- Hook type. Define when hook is called.id- Record received in the callback- Returns:
- True if the input record is changed, otherwise false
-
isValidationEnabled
public boolean isValidationEnabled()Tells if validation of record is active. Default is true.- Specified by:
isValidationEnabledin interfaceODatabaseDocument- Returns:
- true if it's active, otherwise false.
-
setValidationEnabled
Enables or disables the record validation.Since 2.2 this setting is persistent.
- Specified by:
setValidationEnabledin interfaceODatabaseDocument- Parameters:
iEnabled- True to enable, false to disable- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
-
getConfiguration
Description copied from interface:ODatabaseReturns the database configuration settings. If defined, any database configuration overwrites the global one.- Specified by:
getConfigurationin interfaceODatabase<ORecord>- Returns:
- OContextConfiguration
-
close
public void close()Description copied from interface:ODatabaseCloses an opened database, if the database is already closed does nothing, if a transaction is active will be rollback. -
getStatus
Description copied from interface:ODatabaseReturns the current status of database. -
getName
Description copied from interface:ODatabaseReturns the database name. -
getURL
Description copied from interface:ODatabaseReturns the database URL. -
getDefaultClusterId
public int getDefaultClusterId()Description copied from interface:ODatabaseReturns the default cluster id. If not specified all the new entities will be stored in the default cluster.- Specified by:
getDefaultClusterIdin interfaceODatabase<ORecord>- Returns:
- The default cluster id
-
getClusters
public int getClusters()Description copied from interface:ODatabaseReturns the number of clusters.- Specified by:
getClustersin interfaceODatabase<ORecord>- Returns:
- Number of the clusters
-
existsCluster
Description copied from interface:ODatabaseReturns true if the cluster exists, otherwise false.- Specified by:
existsClusterin interfaceODatabase<ORecord>- Parameters:
iClusterName- Cluster name- Returns:
- true if the cluster exists, otherwise false
-
getClusterNames
Description copied from interface:ODatabaseReturns all the names of the clusters.- Specified by:
getClusterNamesin interfaceODatabase<ORecord>- Returns:
- Collection of cluster names.
-
getClusterIdByName
Description copied from interface:ODatabaseReturns the cluster id by name.- Specified by:
getClusterIdByNamein interfaceODatabase<ORecord>- Parameters:
iClusterName- Cluster name- Returns:
- The id of searched cluster.
-
getClusterNameById
Description copied from interface:ODatabaseReturns the cluster name by id.- Specified by:
getClusterNameByIdin interfaceODatabase<ORecord>- Parameters:
iClusterId- Cluster id- Returns:
- The name of searched cluster.
-
checkForClusterPermissions
- Specified by:
checkForClusterPermissionsin interfaceODatabaseDocumentInternal
-
setProperty
Description copied from interface:ODatabaseSets a property value- Specified by:
setPropertyin interfaceODatabase<ORecord>- Parameters:
iName- Property nameiValue- new value to set- Returns:
- The previous value if any, otherwise null
-
getProperty
Description copied from interface:ODatabaseGets the property value.- Specified by:
getPropertyin interfaceODatabase<ORecord>- Parameters:
iName- Property name- Returns:
- The previous value if any, otherwise null
-
getProperties
Description copied from interface:ODatabaseReturns an iterator of the property entries- Specified by:
getPropertiesin interfaceODatabase<ORecord>
-
get
Description copied from interface:ODatabaseReturns a database attribute value -
getTransaction
Description copied from interface:ODatabaseReturn active transaction. Cannot be null. If no transaction is active, then a OTransactionNoTx instance is returned.- Specified by:
getTransactionin interfaceODatabase<ORecord>- Returns:
- OTransaction implementation
-
load
Description copied from interface:ODatabaseLoads a record using a fetch plan. -
load
Description copied from interface:ODatabaseLoads the entity and return it. -
load
Description copied from interface:ODatabaseLoads the entity by the Record ID. -
load
Description copied from interface:ODatabaseLoads the entity by the Record ID using a fetch plan. -
loadIfVersionIsNotLatest
public <RET extends ORecord> RET loadIfVersionIsNotLatest(ORID rid, int recordVersion, String fetchPlan, boolean ignoreCache) throws ORecordNotFoundException - Specified by:
loadIfVersionIsNotLatestin interfaceODatabaseDocumentInternal- Throws:
ORecordNotFoundException
-
reload
-
reload
-
reload
Description copied from interface:ODatabaseForce the reloading of the entity. -
reload
public <RET extends ORecord> RET reload(ORecord record, String fetchPlan, boolean ignoreCache, boolean force) Description copied from interface:ODatabaseForce the reloading of the entity.- Specified by:
reloadin interfaceODatabase<ORecord>- Parameters:
record- The entity to load. If the entity was already loaded it will be reloaded and all the changes will be lost.fetchPlan- Fetch plan usedignoreCache- Ignore cache or use itforce- Force to reload record even if storage has the same record as reloaded record, it is useful if fetch plan is not null and alongside with root record linked records will be reloaded.- Returns:
- The loaded entity
-
delete
Deletes the record without checking the version. -
getSerializerFactory
- Specified by:
getSerializerFactoryin interfaceODatabaseDocumentInternal- Returns:
- the factory of binary serializers.
-
swapTx
- Specified by:
swapTxin interfaceODatabaseDocumentInternal
-
rawBegin
- Specified by:
rawBeginin interfaceODatabaseDocumentInternal
-
load
Loads a record using a fetch plan. -
setPrefetchRecords
public void setPrefetchRecords(boolean prefetchRecords) - Specified by:
setPrefetchRecordsin interfaceODatabaseDocumentInternal
-
isPrefetchRecords
public boolean isPrefetchRecords()- Specified by:
isPrefetchRecordsin interfaceODatabaseDocumentInternal
-
executeReadRecord
public abstract <RET extends ORecord> RET executeReadRecord(ORecordId rid, ORecord iRecord, int recordVersion, String fetchPlan, boolean ignoreCache, boolean iUpdateCache, RecordReader recordReader) This method is internal, it can be subject to signature change or be removed, do not use. @Internal- Specified by:
executeReadRecordin interfaceODatabaseDocumentInternal
-
assignAndCheckCluster
- Specified by:
assignAndCheckClusterin interfaceODatabaseDocumentInternal
-
begin
Description copied from interface:ODatabaseBegins a new transaction. By default the type is OPTIMISTIC. If a previous transaction is running a nested call counter is incremented. A transaction once begun has to be closed by calling theODatabase.commit()orODatabase.rollback(). -
begin
Description copied from interface:ODatabaseBegins a new transaction specifying the transaction type. If a previous transaction is running a nested call counter is incremented. A transaction once begun has to be closed by calling theODatabase.commit()orODatabase.rollback(). -
setDefaultTransactionMode
public void setDefaultTransactionMode(Map<ORID, OTransactionAbstract.LockedRecordMetadata> noTxLocks) - Specified by:
setDefaultTransactionModein interfaceODatabaseDocumentInternal
-
newInstance
Creates a new ODocument.- Specified by:
newInstancein interfaceODatabase<ORecord>- Returns:
- The new instance.
-
newBlob
Description copied from interface:ODatabaseDocumentCreate a new instance of a blob containing the given bytes.- Specified by:
newBlobin interfaceODatabaseDocument- Parameters:
bytes- content of the OBlob- Returns:
- the OBlob instance.
-
newBlob
Description copied from interface:ODatabaseDocumentCreate a new empty instance of a blob.- Specified by:
newBlobin interfaceODatabaseDocument- Returns:
- the OBlob instance.
-
newInstance
Creates a document with specific class.- Specified by:
newInstancein interfaceODatabaseDocument- Parameters:
iClassName- the name of class that should be used as a class of created document.- Returns:
- new instance of document.
-
newEmbeddedElement
- Specified by:
newEmbeddedElementin interfaceODatabaseDocument
-
newEmbeddedElement
- Specified by:
newEmbeddedElementin interfaceODatabaseDocument
-
newElement
- Specified by:
newElementin interfaceODatabaseDocument
-
newElement
- Specified by:
newElementin interfaceODatabaseDocument
-
newElement
-
newVertex
Description copied from interface:ODatabaseDocumentCreates a new Vertex- Specified by:
newVertexin interfaceODatabaseDocument- Parameters:
iClassName- the vertex type (class name)- Returns:
-
newVertex
Description copied from interface:ODatabaseDocumentCreates a new Vertex- Specified by:
newVertexin interfaceODatabaseDocument- Parameters:
type- the vertex type- Returns:
-
newEdge
Description copied from interface:ODatabaseDocumentCreates a new Edge- Specified by:
newEdgein interfaceODatabaseDocument- Parameters:
from- the starting point vertexto- the endpoint vertextype- the edge type- Returns:
- the edge
-
newEdge
Description copied from interface:ODatabaseDocumentCreates a new Edge- Specified by:
newEdgein interfaceODatabaseDocument- Parameters:
from- the starting point vertexto- the endpoint vertextype- the edge type- Returns:
- the edge
-
browseClass
Browses all the records of the specified class and also all the subclasses. If you've a class Vehicle and Car that extends Vehicle then a db.browseClass("Vehicle", true) will return all the instances of Vehicle and Car. The order of the returned instance starts from record id with position 0 until the end. Base classes are worked at first.- Specified by:
browseClassin interfaceODatabaseDocument- Parameters:
iClassName- Class name to iterate- Returns:
- Iterator of ODocument instances
-
browseClass
Browses all the records of the specified class and if iPolymorphic is true also all the subclasses. If you've a class Vehicle and Car that extends Vehicle then a db.browseClass("Vehicle", true) will return all the instances of Vehicle and Car. The order of the returned instance starts from record id with position 0 until the end. Base classes are worked at first.- Specified by:
browseClassin interfaceODatabaseDocument- Parameters:
iClassName- Class name to iterateiPolymorphic- Consider also the instances of the subclasses or not- Returns:
- Iterator of ODocument instances
-
browseCluster
Browses all the records of the specified cluster.- Specified by:
browseClusterin interfaceODatabaseDocument- Parameters:
iClusterName- Cluster name to iterate- Returns:
- Iterator of ODocument instances
-
getListeners
Retrieves all the registered listeners.- Specified by:
getListenersin interfaceODatabase<ORecord>- Returns:
- An iterable of ODatabaseListener instances.
-
save
Saves a document 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.If MVCC is enabled and the version of the document is different by the version stored in the database, then a
OConcurrentModificationExceptionexception is thrown.Before to save the document it must be valid following the constraints declared in the schema if any (can work also in schema-less mode). To validate the document theODocument.validate()is called.- Specified by:
savein interfaceODatabase<ORecord>- Parameters:
iRecord- Record to save.- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
- Throws:
OConcurrentModificationException- if the version of the document is different by the version contained in the database.OValidationException- if the document breaks some validation constraints defined in the schema
-
save
Saves a document specifying a cluster where to store the record. 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.If MVCC is enabled and the version of the document is different by the version stored in the database, then a
OConcurrentModificationExceptionexception is thrown. Before to save the document it must be valid following the constraints declared in the schema if any (can work also in schema-less mode). To validate the document theODocument.validate()is called.- Specified by:
savein interfaceODatabase<ORecord>- Parameters:
iRecord- Record to saveiClusterName- Cluster name where to save the record- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
- Throws:
OConcurrentModificationException- if the version of the document is different by the version contained in the database.OValidationException- if the document breaks some validation constraints defined in the schema- See Also:
-
save
Saves a document specifying a cluster where to store the record. 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.If MVCC is enabled and the version of the document is different by the version stored in the database, then a
OConcurrentModificationExceptionexception is thrown. Before to save the document it must be valid following the constraints declared in the schema if any (can work also in schema-less mode). To validate the document theODocument.validate()is called.- Specified by:
savein interfaceODatabaseInternal<ORecord>- Parameters:
iRecord- Record to saveiClusterName- Cluster name where to save the recordiMode- Mode of save: synchronous (default) or asynchronousiForceCreate- Flag that indicates that record should be created. If record with current rid already exists, exception is throwniRecordCreatedCallback- callback that is called after creation of new recordiRecordUpdatedCallback- callback that is called after record update- Returns:
- The Database instance itself giving a "fluent interface". Useful to call multiple methods in chain.
- Throws:
OConcurrentModificationException- if the version of the document is different by the version contained in the database.OValidationException- if the document breaks some validation constraints defined in the schema
-
countView
Returns the number of the records of the class iClassName.- Specified by:
countViewin interfaceODatabaseDocument
-
countClass
Returns the number of the records of the class iClassName.- Specified by:
countClassin interfaceODatabaseDocument- Parameters:
iClassName- Class name- Returns:
- Total entities
-
countClass
Returns the number of the records of the class iClassName considering also sub classes if polymorphic is true.- Specified by:
countClassin interfaceODatabaseDocument- Parameters:
iClassName- Class nameiPolymorphic- True if consider also the sub classes, otherwise false- Returns:
- Total entities
-
countClass
-
commit
Commits the current transaction. The approach is all or nothing. All changes will be permanent following the storage type. If the operation succeed all the entities changed inside the transaction context will be effective. If the operation fails, all the changed entities will be restored in the data store. -
commit
- Specified by:
commitin interfaceODatabase<ORecord>- Throws:
OTransactionException
-
beforeCommitOperations
protected void beforeCommitOperations() -
afterCommitOperations
protected void afterCommitOperations() -
beforeRollbackOperations
protected void beforeRollbackOperations() -
afterRollbackOperations
protected void afterRollbackOperations() -
rollback
Aborts the current running transaction. All the pending changed entities will be restored in the data store. -
rollback
- Specified by:
rollbackin interfaceODatabase<ORecord>- Throws:
OTransactionException
-
getUnderlying
This method is internal, it can be subject to signature change or be removed, do not use. @Internal- Specified by:
getUnderlyingin interfaceODatabaseInternal<ORecord>- Returns:
- The underlying ODatabase implementation.
-
getStorageVersions
Description copied from interface:ODatabaseDocumentInternalInternal. Returns the factory that defines a set of components that current database should use to be compatible to current version of storage. So if you open a database create with old version of OrientDB it defines a components that should be used to provide backward compatibility with that version of database.- Specified by:
getStorageVersionsin interfaceODatabaseDocumentInternal
-
getSerializer
- Specified by:
getSerializerin interfaceODatabaseDocumentInternal- Returns:
- serializer which is used for document serialization.
-
setSerializer
Sets serializer for the database which will be used for document serialization.- Specified by:
setSerializerin interfaceODatabaseDocumentInternal- Parameters:
serializer- the serializer to set.
-
resetInitialization
public void resetInitialization()- Specified by:
resetInitializationin interfaceODatabaseInternal<ORecord>
-
checkSecurity
-
isPooled
public boolean isPooled()- Specified by:
isPooledin interfaceODatabaseDocument- Returns:
trueif database is obtained from the pool andfalseotherwise.
-
setCurrentDatabaseInThreadLocal
Deprecated.Use #activateOnCurrentThread instead. -
activateOnCurrentThread
Activates current database instance on current thread.- Specified by:
activateOnCurrentThreadin interfaceODatabase<ORecord>
-
isActiveOnCurrentThread
public boolean isActiveOnCurrentThread()Description copied from interface:ODatabaseReturns true if the current database instance is active on current thread, otherwise false.- Specified by:
isActiveOnCurrentThreadin interfaceODatabase<ORecord>
-
checkOpenness
protected void checkOpenness() -
callbackHookFailure
-
callbackHookSuccess
protected void callbackHookSuccess(ORecord record, boolean wasNew, byte[] stream, OStorageOperationResult<Integer> operationResult) -
callbackHookFinalize
-
clearDocumentTracking
-
checkRecordClass
-
init
protected void init() -
checkIfActive
public void checkIfActive()- Specified by:
checkIfActivein interfaceODatabaseDocumentInternal
-
getBlobClusterIds
Description copied from interface:ODatabaseRetrieve the set of defined blob cluster.- Specified by:
getBlobClusterIdsin interfaceODatabase<ORecord>- Returns:
- the set of defined blob cluster ids.
-
executeWithRetries
-
executeWithRetries
-
executeWithRetries
-
isUseLightweightEdges
public boolean isUseLightweightEdges()- Specified by:
isUseLightweightEdgesin interfaceODatabaseDocumentInternal
-
setUseLightweightEdges
public void setUseLightweightEdges(boolean b) - Specified by:
setUseLightweightEdgesin interfaceODatabaseDocumentInternal
-
newLightweightEdge
- Specified by:
newLightweightEdgein interfaceODatabaseDocumentInternal
-
newRegularEdge
- Specified by:
newRegularEdgein interfaceODatabaseDocumentInternal
-
queryStarted
-
queryClosed
-
closeActiveQueries
protected void closeActiveQueries() -
getActiveQueries
- Specified by:
getActiveQueriesin interfaceODatabaseDocumentInternal
-
getActiveQuery
- Specified by:
getActiveQueryin interfaceODatabaseDocumentInternal
-
isClusterEdge
public boolean isClusterEdge(int cluster) - Specified by:
isClusterEdgein interfaceODatabaseDocumentInternal
-
isClusterVertex
public boolean isClusterVertex(int cluster) - Specified by:
isClusterVertexin interfaceODatabaseDocumentInternal
-
isClusterView
public boolean isClusterView(int cluster) - Specified by:
isClusterViewin interfaceODatabaseDocumentInternal
-
getViewFromCluster
- Specified by:
getViewFromClusterin interfaceODatabaseDocumentInternal
-
pessimisticLockChecks
-
getCollectionsChanges
- Specified by:
getCollectionsChangesin interfaceODatabaseDocumentInternal
-