Package com._1c.g5.v8.bm.core
Interface IBmTransaction
public interface IBmTransaction
Former transaction interface that is preserved to simplify migration of the existing solutions to the new API
(IBmPlatformTransaction
).
Note that all requests are directed to the namespace the transaction is bound to.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPostCommitHandler
(Runnable handler) Adds a post-commit handler.void
attachTopObject
(IBmObject object, String fqn) Attaches a new top-level object with the specified FQN, i.e. this method makes the specified object persistent and managed by the BM.void
cancel()
Requests transaction cancellation.commit()
Commits the transaction.createBlob
(String fqn) Creates a blob.void
detachTopObject
(IBmObject object) Detaches (removes) a top object.void
evict
(long id) Deprecated.Gets a blob.getContainedObjectIdsByEClass
(org.eclipse.emf.ecore.EClass eClass) Gets IDs of the contained objects of the specifiedEMF class
and its subclasses.getContainedObjectIdsByTopObjectIdAndEClass
(long topObjectId, org.eclipse.emf.ecore.EClass eClass) Gets IDs of the contained objects of the specifiedEMF class
(and its subclasses) contained (directly or indirectly) in the top object with the specified ID.getContainedObjectIterator
(IBmObject topObject, org.eclipse.emf.ecore.EClass eClass) Gets iterator over the contained objects of the specifiedEMF class
(and its subclasses) contained (directly or indirectly) in the specified top object.getContainedObjectIterator
(org.eclipse.emf.ecore.EClass eClass) Gets iterator over the contained objects of the specifiedEMF class
and its subclasses.org.eclipse.emf.ecore.EObject
getExternalObjectByUri
(org.eclipse.emf.common.util.URI uri) Deprecated.This method has been added to support existing legacy solutions.Gets the namespace the transaction is bound to.getObjectById
(long id) Gets object by ID.getObjectByUri
(org.eclipse.emf.common.util.URI uri) Gets object by URI.getObjectsByAttributeValue
(org.eclipse.emf.ecore.EAttribute attribute, Object value) Gets objects by attribute value.Gets the corresponding platform-wide transaction.getReferences
(org.eclipse.emf.common.util.URI uri) Gets references to the specified object from objects belonging to the current namespace.com._1c.g5.v8.bm.core.internal.IBmInternalResourceSet
Deprecated.This method has been added to support existing legacy solutions.getTopObjectByFqn
(String fqn) Gets top-level object by FQN.getTopObjectByResourceId
(int resourceId) Gets top object by resource ID.Iterator<org.eclipse.emf.ecore.EClass>
Gets specificEClass
'es of all top objects being registered in the store at this pointlong
Gets top-level object ID by FQN.getTopObjectIdsByEClass
(org.eclipse.emf.ecore.EClass eClass) Gets IDs of the top objects of the specifiedEMF class
and its subclasses.Gets iterator over the top objects managed by this engine.getTopObjectIterator
(org.eclipse.emf.ecore.EClass eClass) Gets iterator over the top objects of the specifiedEMF class
and its subclasses.Gets top objects by FQN ignoring case.boolean
Checks whether the transaction is read-only.org.eclipse.emf.ecore.EClass
peekEClass
(long id) Peeks theEMF class
of the specified object without locking the object.void
redo
(IBmTransactionRecord transactionRecord) Redoes the modifications represented by the specified transaction record.void
removeBlob
(IBmBlob blob) Removes a blob.void
renameBlob
(IBmBlob blob, String newFqn) Renames a blob.void
rollback()
Rolls back the transaction.<T extends org.eclipse.emf.ecore.EObject>
TtoTransactionObject
(T object) The shortcut for getting the transaction counterpart by the given object.void
undo
(IBmTransactionRecord transactionRecord) Undoes the modifications represented by the specified transaction record.void
updateTopObjectFqn
(IBmObject object, String fqn) Assigns the specified top-level object a new FQN.
-
Method Details
-
commit
IBmTransactionCommitResult commit()Commits the transaction.- Returns:
- an instance of
IBmTransactionCommitResult
, nevernull
.
-
rollback
void rollback()Rolls back the transaction. -
attachTopObject
Attaches a new top-level object with the specified FQN, i.e. this method makes the specified object persistent and managed by the BM.- The FQN must be unique.
- If there is already an object with the specified FQN then depending on the situation either this method
or
commit()
will throw an exception. - If the specified object is already attached to a BM then an exception is thrown.
- Parameters:
object
- The object to attach. May not benull
.fqn
- The FQN. May not benull
.
-
detachTopObject
Detaches (removes) a top object.- If the specified object is a contained object an exception is thrown.
- If the specified object is not attached to the BM an exception is thrown.
- Parameters:
object
- The top object to detach. May not benull
.
-
updateTopObjectFqn
Assigns the specified top-level object a new FQN. The FQN must be unique. If there is already an object with the specified FQN then depending on the situation either this method orcommit()
will throw an exception.- Parameters:
object
- The object to assign FQN to. May not benull
.fqn
- The FQN to assign. May not benull
.
-
getObjectById
Gets object by ID.- Parameters:
id
- The ID to get object by.- Returns:
- the object with the specified ID or
null
if it does not exist.
-
getTopObjectByFqn
Gets top-level object by FQN.- Parameters:
fqn
- The FQN to get object by. May not benull
- Returns:
- the object with the specified FQN or
null
if it does not exist.
-
getTopObjectByResourceId
Gets top object by resource ID.- Parameters:
resourceId
- The resource ID to get object by.- Returns:
- the top object belonging to the resource specified by ID if exists, otherwise
null
.
-
getObjectByUri
Gets object by URI.- Parameters:
uri
- The URI to get object by. May not benull
.- Returns:
- the object identified by the specified URI or
null
if it does not exist.
-
isReadOnly
boolean isReadOnly()Checks whether the transaction is read-only.- Returns:
true
if the transaction is read-only,false
otherwise.
-
undo
Undoes the modifications represented by the specified transaction record. An undo operation is prohibited in transactions which have a record tracking mode enabled- Parameters:
transactionRecord
- The transaction record. May not benull
.
-
redo
Redoes the modifications represented by the specified transaction record.- Parameters:
transactionRecord
- The transaction record. May not benull
.
-
getResourceSet
Deprecated.This method has been added to support existing legacy solutions.Gets the transaction resource set.- Returns:
- the transaction resource set, never
null
.
-
getExternalObjectByUri
@Deprecated org.eclipse.emf.ecore.EObject getExternalObjectByUri(org.eclipse.emf.common.util.URI uri) Deprecated.This method has been added to support existing legacy solutions.Gets external object (that is not managed by the engine this transaction belongs to) by URI.- Parameters:
uri
- The URI to get external object by. May not benull
.- Returns:
- the object identified by the specified URI or
null
if it does not exist.
-
toTransactionObject
<T extends org.eclipse.emf.ecore.EObject> T toTransactionObject(T object) The shortcut for getting the transaction counterpart by the given object.
The same thing can be made by using:T object = ...; long objectId = ((IBmObject)object).bmGetId(); IBmObject bmObject = transaction.getObjectById(objectId); T transactionObject = (T)bmObject;
- Parameters:
object
- The object to get transaction counterpart for. May not benull
.- Returns:
- transaction object or
null
if the object gets detached from BM before this invocation finishes.
-
getTopObjectIterator
Gets iterator over the top objects managed by this engine. The iterator does not implementremove
method.- Returns:
- the iterator, never
null
.
-
getTopObjectIterator
Gets iterator over the top objects of the specifiedEMF class
and its subclasses. The iterator does not implementremove
method.- Parameters:
eClass
- TheEMF class
. May not benull
.- Returns:
- the iterator, never
null
.
-
getTopObjectEClasses
Iterator<org.eclipse.emf.ecore.EClass> getTopObjectEClasses()Gets specificEClass
'es of all top objects being registered in the store at this point- Returns:
- An iterator over
EMF classes
of known top objects. May not benull
. Elements are guaranteed to be unique.
-
getTopObjectIdByFqn
Gets top-level object ID by FQN.- Parameters:
fqn
- The FQN to get ID by. May not benull
- Returns:
- the ID or
IBmObject.BM_NULL_ID
if there is no object with the specified FQN.
-
getTopObjectIdsByEClass
Gets IDs of the top objects of the specifiedEMF class
and its subclasses. Note that the correponding objects are not attached to the transaction i.e. not locked. Thus the returned set of identifiers may already be outdated. The method should be used only for mass operations with external control on BM contents changing and external means of data integrity tracking and support. The iterator does not implementremove
method.- Parameters:
eClass
- TheEMF class
. May not benull
.- Returns:
- an iterator over the IDs of the top objects of the specified
EMF class
. Nevernull
.
-
getContainedObjectIterator
Iterator<IBmObject> getContainedObjectIterator(IBmObject topObject, org.eclipse.emf.ecore.EClass eClass) Gets iterator over the contained objects of the specifiedEMF class
(and its subclasses) contained (directly or indirectly) in the specified top object. The iterator does not implementremove
method.- Parameters:
topObject
- The top obect. May not benull
.eClass
- TheEMF class
. May not benull
.- Returns:
- the iterator, never
null
.
-
getContainedObjectIterator
Gets iterator over the contained objects of the specifiedEMF class
and its subclasses. The iterator does not implementremove
method.- Parameters:
eClass
- TheEMF class
. May not benull
.- Returns:
- the iterator, never
null
.
-
getContainedObjectIdsByEClass
Gets IDs of the contained objects of the specifiedEMF class
and its subclasses. Note that the correponding objects are not attached to the transaction i.e. not locked. Thus the returned set of identifiers may already be outdated. The method should be used only for mass operations with external control on BM contents changing and external means of data integrity tracking and support. The iterator does not implementremove
method.- Parameters:
eClass
- TheEMF class
. May not benull
.- Returns:
- an iterator over the IDs of the top objects of the specified
EMF class
. Nevernull
.
-
getContainedObjectIdsByTopObjectIdAndEClass
IBmLongIterator getContainedObjectIdsByTopObjectIdAndEClass(long topObjectId, org.eclipse.emf.ecore.EClass eClass) Gets IDs of the contained objects of the specifiedEMF class
(and its subclasses) contained (directly or indirectly) in the top object with the specified ID. Note that the correponding objects are not attached to the transaction i.e. not locked. Thus the returned set of identifiers may already be outdated. The method should be used only for mass operations with external control on BM contents changing and external means of data integrity tracking and support. The iterator does not implementremove
method.- Parameters:
topObjectId
- The ID of the top object.eClass
- TheEMF class
. May not benull
.- Returns:
- an iterator over the IDs of the top objects of the specified
EMF class
. Nevernull
.
-
getTopObjectsByFqnIgnoreCase
Gets top objects by FQN ignoring case.- Parameters:
handle
- The handle of the transaction. May not benull
.fqn
- The FQN. May not benull
.- Returns:
- an iterator over top objects matching the FQN. Never
null
.
-
getObjectsByAttributeValue
Iterator<IBmObject> getObjectsByAttributeValue(org.eclipse.emf.ecore.EAttribute attribute, Object value) Gets objects by attribute value. Throws an exception if the attribute is not indexed.- Parameters:
attribute
- The attribute. May not benull
.value
- The value. May not benull
.- Returns:
- an iterator over the objects with the specified attribute value, never
null
. The iterator does not implementremove
method. - See Also:
-
BmPlatformConfiguration#indexedAttributes(java.util.Collection)
-
getReferences
Gets references to the specified object from objects belonging to the current namespace.- Parameters:
uri
- The URI of the object to get references to. May not benull
.- Returns:
- a collection of references. Never
null
.
-
getNamespace
IBmNamespace getNamespace()Gets the namespace the transaction is bound to.- Returns:
- the namespace the transaction is bound to, never
null
.
-
peekEClass
org.eclipse.emf.ecore.EClass peekEClass(long id) Peeks theEMF class
of the specified object without locking the object.- Parameters:
id
- The ID of the object.- Returns:
- the
EMF class
of the object ornull
if the object does not exist.
-
evict
Deprecated.Evicts the specified object form the transaction. After evicting the object from the transaction, any change to the evicted object won't be persisted on transaction commit. Evicting affects all contained objects being attached to the transaction.
Evicting also releases all locks (both read and write) to this object being captured earlier in the transaction.- Parameters:
id
- The ID to release lock for.
-
addPostCommitHandler
Adds a post-commit handler. The handlers are invoked until after the transaction is successfully committed.- Parameters:
handler
- The post-commit handler to add. May not benull
.
-
getPlatformTransaction
IBmPlatformTransaction getPlatformTransaction()Gets the corresponding platform-wide transaction.- Returns:
- the corresponding platform-wide transaction, never
null
.
-
cancel
void cancel()Requests transaction cancellation. Any subsequent method invocation apart fromrollback()
will throwBmTransactionCancelledException
. -
createBlob
Creates a blob.- Parameters:
fqn
- The FQN of the blob. Cannot benull
.- Returns:
- the created blob. Never
null
.
-
getBlob
Gets a blob.- Parameters:
fqn
- The FQN of the blob. Cannot benull
.- Returns:
- the blob with the specified FQN or
null
if it does not exist.
-
removeBlob
Removes a blob.- Parameters:
blob
-
-
renameBlob
Renames a blob. Note that the transaction result will look as though the blob was removed and then created with a new name.- Parameters:
blob
-newFqn
-
-