Class ContextTransaction

java.lang.Object
com._1c.g5.v8.internal.derived.context.ContextTransaction

public class ContextTransaction extends Object
Demarkation of derived data context (IObjectDerivedDataContext) transaction operations. One could read/change multiple DD contexts within a single transaction. All affected contexts are being tracked by the IDerivedDataContextManager and being the subject of the conflict control.
For the information on the current strategy of conflict resolving please check the IDerivedDataContextManager.
  • Constructor Details

    • ContextTransaction

      public ContextTransaction(IContextTransactionManager transactionManager, boolean computation, boolean forcedUpdate, Object computationCause, boolean trackWaitingScope)
      Creates an instance of the transaction being controlled by the external transaction manager.
      Parameters:
      transactionManager - The instance of the transaction manager. Cannot be null.
      computation - This transaction is used during the DD computation cycle.
      forcedUpdate - Forces update of contexts, even if they aren't changed
      computationCause - The object bound to the computation context and used to track computations.
      trackWaitingScope - Enables collection of the implicit waiting scope if true
  • Method Details

    • getExistingObjectContext

      public IObjectDerivedDataContext getExistingObjectContext(Object objectId, String segmentId)
      Gets existing context
      Parameters:
      objectId - The identifier of the object. Cannot be null.
      segmentId - The identifier of the DD segment. Cannot be null.
      Returns:
      Existing context if corresponding context exists; null otherwise.
    • commit

      public void commit()
      Commits the transaction using the attached scope.
    • getObjectContext

      public IObjectDerivedDataContext getObjectContext(IBmObject bmObject, String segmentId)
      Gets the object context for the specified scope. Registers a new global instance in case if it's a first context gathering.
      Parameters:
      bmObject - The BM object instance. Cannot be null.
      segmentId - The identifier of the DD segment. Cannot be null.
      Returns:
      The attached context for the givent context. Never null.
    • getObjectContext

      public IObjectDerivedDataContext getObjectContext(Object objectId, org.eclipse.emf.ecore.EClass objectEClass, String segmentId)
      Gets the object context for the specified scope. Registers a new global instance in case if it's a first context gathering.
      Parameters:
      objectId - The object instance. Cannot be null.
      objectEClass - The EClass of the object. Cannot be null.
      segmentId - The identifier of the DD segment. Cannot be null.
      Returns:
      The attached context for the givent context. Never null.
    • scheduleOperation

      public IObjectDerivedDataContext scheduleOperation(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, OperationType operationType, boolean important, String segmentId)
      Schedules the operation
      Parameters:
      operation - The operation executable. May not be null
      operationType - The type of the operation. May not be null
      important -
      segmentId - Target segment of the pipeline. May not be null
      Returns:
      the scheduled operation context. May not be null
    • scheduleOperationRemoval

      public void scheduleOperationRemoval(IObjectDerivedDataContext handle)
      Schedules the removal of previously scheduled operation
      Parameters:
      handle - The handle of the operation. May not be null
    • isContextExists

      public boolean isContextExists(IBmObject bmObject, String segmentId)
      Checks if the DD context exists(supported) for the given object and segment
      Parameters:
      bmObject - The object to get the context for. May not be null
      segmentId - The DD segment identifier. May not be null
      Returns:
      True if the context exists/may be created
    • isContextExists

      public boolean isContextExists(org.eclipse.emf.ecore.EClass topObjectEClass, long topObjectId, String segmentId)
      Checks if the DD context exists(supported) for the given object and segment
      Parameters:
      topObjectEClass - Top object EClass. May not be null
      topObjectId - Top object identifier. May not be null
      segmentId - The DD segment identifier. May not be null
      Returns:
      True if the context exists/may be created
    • getObjectContext

      public IObjectDerivedDataContext getObjectContext(long bmObjectId, org.eclipse.emf.ecore.EClass objectEClass, String segmentId)
      Gets the object context for the specified scope. Registers a new global instance in case if it's a first context gathering.
      Parameters:
      bmObjectId - The identifier of the BM object.
      objectEClass - The EClass of the BM object. Cannot be null.
      bmObject - The BM object instance. Cannot be null.
      segmentId - The identifier of the DD segment. Cannot be null.
      Returns:
      The attached context for the givent context. Cannot be null.
    • markAsComputed

      public void markAsComputed(IObjectDerivedDataContext context)
      Marks the context as a computed. Will be re-set on a commit.
      Parameters:
      context - Transaction context. Cannot be null.
    • confirmOperationComputation

      public void confirmOperationComputation(OperationContext operationContext)
      Сonfirms the successive operation computation
      Parameters:
      operationContext - The operation context to confirm. May not be null
    • markAsFailed

      public void markAsFailed(IObjectDerivedDataContext context)
      Marks the context as a failed.
      Parameters:
      context - Transaction context. Cannot be null.
    • rollback

      public void rollback()
      Rolls back the transaction discarding all collected context changes.
    • scheduleModalOperation

      public IObjectDerivedDataContext scheduleModalOperation(Consumer<org.eclipse.core.runtime.IProgressMonitor> operation, String operationSegment, IModalOperationController modalOperationController)
      Schedules a new modal operation
      Parameters:
      operation - The operation executable to schedule. May not be null
      operationSegment - The target segment of the async pipeline. May not be null
      modalOperationController - The modal operation controller. May not be null
      Returns:
      The context of the scheduled operation. May not be null