Package com._1c.g5.v8.bm.integration
Interface IBmModel
-
public interface IBmModel
Entry point for all interactions with the BM integration mechanism.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addAsyncEventListener(IBmAsyncEventListener listener, BmEventFilter... filters)
Adds a newIBmAsyncEventListener
listener with associated a set of filters.void
addResourceSyncListener(IBmWorkspaceSynchronizationListener listener)
Registers the given workspace synchronization listener.void
addSyncEventListener(IBmSyncEventListener listener)
Adds the specified synchronous event listener.Object
beginBatchSession()
Begins batch session.Object
beginBatchSession(Object handle)
Begins batch mode.void
close()
Closes the BM model.IBmLocalEditingContext
createLocalContext(String name)
Creates a local context.void
endBatchSession(Object handle)
Ends the batch session associated with the specified handle.<T> T
execute(IBmTask<T> task)
Executes the given task without recording history.<T> T
executeAndRollback(IBmTask<T> task)
Executes the given task without recording history.<T> T
executeInBatchSession(Object handle, IBmTask<T> task)
Executes the giventask
within the batch session associated with the specifiedhandle
.<T> T
executeReadonlyTask(IBmTask<T> task)
Executes the given task.<T> T
executeReadonlyTask(IBmTask<T> task, boolean lightweight)
Executes the given task.List<IBmLocalEditingContext>
getAllLocalContexts()
Gets all the active local contexts.IBmEngine
getEngine()
Gets the underlying engine.IBmGlobalEditingContext
getGlobalContext()
Gets the global context instance.String
getId()
Gets the identifier of the model.IBmProvider
getProvider(String providerId)
Deprecated.The method has been added to support existing legacy solutions only.boolean
isDisposed()
Checks if the model is disposed.void
registerProvider(IBmProvider provider)
Deprecated.The method has been added to support existing legacy solutions only.void
removeAsyncEventListener(IBmAsyncEventListener listener)
Removes the specified asynchronous event listener.void
removeResourceSyncListener(IBmWorkspaceSynchronizationListener listener)
Unregisters the given workspace synchronization listener.void
removeSyncEventListener(IBmSyncEventListener listener)
Removes the specified synchronous event listener.void
waitAllEnqueuedEventsSent()
Waits till all the events enqueued prior to calling this method are sent.void
waitForProcessing(long timeOut)
Deprecated.
-
-
-
Method Detail
-
addResourceSyncListener
void addResourceSyncListener(IBmWorkspaceSynchronizationListener listener)
Registers the given workspace synchronization listener.- Parameters:
listener
- The workspace synchronization listener. May not benull
.
-
removeResourceSyncListener
void removeResourceSyncListener(IBmWorkspaceSynchronizationListener listener)
Unregisters the given workspace synchronization listener.- Parameters:
listener
- The workspace synchronization listener. May not benull
.
-
addSyncEventListener
void addSyncEventListener(IBmSyncEventListener listener)
Adds the specified synchronous event listener.- Parameters:
listener
- The listener to add. May not benull
.
-
removeSyncEventListener
void removeSyncEventListener(IBmSyncEventListener listener)
Removes the specified synchronous event listener.- Parameters:
listener
- The listener to remove. May not benull
.
-
addAsyncEventListener
void addAsyncEventListener(IBmAsyncEventListener listener, BmEventFilter... filters)
Adds a newIBmAsyncEventListener
listener with associated a set of filters. Listener is being notified only in case if input matches at least one filter criteria, i.e. filters work in "OR" logic together as triggers.- Parameters:
listener
- The Listener to add. May not benull
.filters
- The set of associated filters. May benull
.
-
removeAsyncEventListener
void removeAsyncEventListener(IBmAsyncEventListener listener)
Removes the specified asynchronous event listener.- Parameters:
listener
- The listener to remove. May not benull
.
-
waitAllEnqueuedEventsSent
void waitAllEnqueuedEventsSent()
Waits till all the events enqueued prior to calling this method are sent.
-
waitForProcessing
@Deprecated void waitForProcessing(long timeOut)
Deprecated.Testing only method for waiting till all the specified providers complete their data processing.- Parameters:
timeOut
- The maximum time to wait in milliseconds.
-
createLocalContext
IBmLocalEditingContext createLocalContext(String name)
Creates a local context.- Parameters:
name
- The name of the context. May not benull
.- Returns:
- a newly created local context instance, never
null
.
-
getGlobalContext
IBmGlobalEditingContext getGlobalContext()
Gets the global context instance.- Returns:
- the global context instance, never
null
.
-
getEngine
IBmEngine getEngine()
Gets the underlying engine.- Returns:
- the underlying engine, never
null
.
-
getId
String getId()
Gets the identifier of the model.- Returns:
- the identifier of the model, never
null
.
-
execute
<T> T execute(IBmTask<T> task)
Executes the given task without recording history.- If the task execution causes the transaction deadlock (throw
BmDeadlockDetectedException
), the transaction is rolled back, and the task executed again. - If after certain amount of retries the task still fails to execute without deadlock, an exception is thrown.
- If the task throws any exception other than
BmDeadlockDetectedException
it is re-thrown.
- Parameters:
task
- The task. May not benull
.- Returns:
- the result returned by
IBmTask.execute(IBmTransaction, IProgressMonitor)
method.
- If the task execution causes the transaction deadlock (throw
-
executeAndRollback
<T> T executeAndRollback(IBmTask<T> task)
Executes the given task without recording history.- If the task execution causes the transaction deadlock (throw
BmDeadlockDetectedException
), the transaction is rolled back, and the task executed again. - If after certain amount of retries the task still fails to execute without deadlock, an exception is thrown.
- If the task throws any exception other than
BmDeadlockDetectedException
it is re-thrown.
- Parameters:
task
- The task. May not benull
.- Returns:
- the result returned by
IBmTask.execute(IBmTransaction, IProgressMonitor)
method.
- If the task execution causes the transaction deadlock (throw
-
executeReadonlyTask
<T> T executeReadonlyTask(IBmTask<T> task)
Executes the given task. The task is executed within read-only transaction.
This method is shortcut forexecuteReadonlyTask(IBmTask, boolean)
withlightweight
flag set totrue
.- Returns:
- the result returned by
IBmTask.execute(IBmTransaction, IProgressMonitor)
method. - See Also:
executeReadonlyTask(IBmTask, boolean)
-
executeReadonlyTask
<T> T executeReadonlyTask(IBmTask<T> task, boolean lightweight)
Executes the given task. The task is executed within read-only transaction.- If the task execution causes the transaction deadlock (throw
BmDeadlockDetectedException
), the transaction is rolled back, and the task executed again. - If after certain amount of retries the task still fails to execute without deadlock, an exception is thrown.
- If the task throws any exception other than
BmDeadlockDetectedException
it is re-thrown.
- Parameters:
task
- The task. May not benull
.lightweight
- the flag indicating whether the transaction should be lightweight or not.- Returns:
- the result returned by
IBmTask.execute(IBmTransaction, IProgressMonitor)
method.
- If the task execution causes the transaction deadlock (throw
-
getAllLocalContexts
List<IBmLocalEditingContext> getAllLocalContexts()
Gets all the active local contexts.- Returns:
- a list of all the active contexts, never
null
.
-
isDisposed
boolean isDisposed()
Checks if the model is disposed.- Returns:
true
if the model is disposed,false
otherwise.
-
close
void close()
Closes the BM model.
-
beginBatchSession
Object beginBatchSession()
Begins batch session.- Returns:
- the handle object of the batch session, never
null
.
-
beginBatchSession
Object beginBatchSession(Object handle)
Begins batch mode.- Parameters:
The
- externally provided handle object. Can benull
. In case if the descendant of theIBatchSessionController
is supplied as a handle - enables managed batch mode.- Returns:
- the batch mode handle object, never
null
.
-
endBatchSession
void endBatchSession(Object handle)
Ends the batch session associated with the specified handle.- Parameters:
handle
- The batch session handle. May not benull
.- See Also:
#beginBatchMode()
-
executeInBatchSession
<T> T executeInBatchSession(Object handle, IBmTask<T> task)
Executes the giventask
within the batch session associated with the specifiedhandle
.- If the task execution causes the transaction deadlock (throw
BmDeadlockDetectedException
), the transaction is rolled back, and the task executed again. - If after certain amount of retries the task still fails to execute without deadlock, an exception is thrown.
- If the task throws any exception other than
BmDeadlockDetectedException
it is re-thrown.
- Parameters:
handle
- The batch session handle. May not benull
.task
- The task. May not benull
.- Returns:
- the result returned by
IBmTask.execute(IBmTransaction, IProgressMonitor)
method.
- If the task execution causes the transaction deadlock (throw
-
registerProvider
@Deprecated void registerProvider(IBmProvider provider)
Deprecated.The method has been added to support existing legacy solutions only.Registers the specified provider.- Parameters:
provider
- The provider to register. May not benull
.
-
getProvider
@Deprecated IBmProvider getProvider(String providerId)
Deprecated.The method has been added to support existing legacy solutions only.Gets provider by ID.- Parameters:
providerId
- The ID to get provider by. May not benull
.- Returns:
- the provider or
null
if the there is no provider with the specified ID.
-
-