Interface IDerivedDataManager


  • public interface IDerivedDataManager
    Derived data manager is responsible for providing clients with the unified access to the DD management functionality, including status tracking.
    • Method Detail

      • addObjectStatusListener

        void addObjectStatusListener​(IDerivedDataObjectStatusListener listener,
                                     long bmObjectId,
                                     String... segments)
        Adds listener for DD status changes of the given object and set of tracked DD segments.
        Parameters:
        listener - The listener instance. Cannot be null. One can re-use the same instance of the listener to subscribe for different sets of objects and segments, but in this case the call to the removeObjectStatusListener(com._1c.g5.v8.derived.IDerivedDataObjectStatusListener) will remove all subscriptions.
        bmObjectId - The identifier of the object which DD changes are being notified via the supplied listener. Cannot be null or empty due to performance reasons. To track down computation of the entire DD segment use IDerivedDataManager#addStatusListener(IDerivedDataStatusListener) instead}.
        segments - DD segment filter allows to subscribe for specific segments of DD. Cannot be null
      • addObjectStatusListener

        void addObjectStatusListener​(IDerivedDataObjectStatusListener listener,
                                     Map<Long,​Collection<String>> scope)
        Adds listener for DD status changes of the given DD change scope. The scope is defined as a map of BM object identifiers to the respective traked DD segments.
        Parameters:
        listener - The listener instance. Cannot be null. One can re-use the same instance of the listener to subscribe for different sets of objects and segments, but in this case the call to the removeObjectStatusListener(com._1c.g5.v8.derived.IDerivedDataObjectStatusListener) will remove all subscriptions.
        scope - Tracked DD segments mapped to corresponding BM object ids. Cannot be null. Scope entries cannot contain null or empty sets of tracked DD segments.
      • addStatusListener

        void addStatusListener​(IDerivedDataStatusListener listener)
        Adds listener that will be notified about derived data status changes.
        Parameters:
        listener - the listener that should be notified
      • blockAsyncPipeline

        void blockAsyncPipeline​(boolean forcedStop)
        Blocks the async. processing pipeline. This methods waits until all current DD operations are finished before return from the call.
        Parameters:
        forcedStop - Locks pipeline in forced mode. In case if true, could be unlocked only with corresponding value of the flag. Forced lock is being used to prevent file sycnhronization opearions/etc to remove manually defined locks.
      • disableImplicitWaiting

        void disableImplicitWaiting()
        Disables implicit waiting of the DD independenly of the current system status. Used during the explicitely managed operations, like merging, etc.
      • enableImplicitWaiting

        void enableImplicitWaiting()
        Enables implicit waiting of the DD independenly of the current system status. Used during the explicitely managed operations, like merging, etc.
      • getDerivedDataStatus

        DerivedDataStatus getDerivedDataStatus()
        Gets the current status of DD for the corresponding BM model.
        Returns:
        The overall status of the DD facility.
      • isAllComputed

        boolean isAllComputed()
        Checks if all derived data parts are computed.
        Returns:
        true if computed, false otherwise
      • isComputed

        boolean isComputed​(Collection<String> segmentIds)
        Checks if the given parts are computed (if applicable) for all the BM objects.
        Parameters:
        partIds - the IDs of the parts to check
        Returns:
        true if computed, false otherwise
      • isComputed

        boolean isComputed​(long bmObjectId,
                           Collection<String> segmentIds)
        Checks if the given parts are computed for the given BM object.
        Parameters:
        bmObjectId - the ID of the BM object to check
        partIds - the IDs of the parts to check
        Returns:
        true if computed, false otherwise
      • isComputed

        boolean isComputed​(long bmObjectId,
                           String segmentId)
        Checks if the given part is computed for the given BM object.
        Parameters:
        bmObjectId - the ID of the BM object to check
        segmentId - the ID of the part to check
        Returns:
        true if computed, false otherwise
      • isComputed

        boolean isComputed​(long bmObjectId,
                           String partId,
                           boolean strict)
        Checks if the given part is computed for the given BM object.
        Parameters:
        bmObjectId - the ID of the BM object to check
        partId - the ID of the part to check
        strict - In strict mode caller expecting, that part must be calculated. In case if part is still not indicated, the method will return false
        Returns:
        true if computed, false otherwise
      • isComputed

        boolean isComputed​(String... segmentIds)
        Checks if the given DD segments are computed (if applicable) for all the BM objects.
        Parameters:
        segmentIds - Array of the DD segment Ids to check
        Returns:
        true if computed, false otherwise
      • recomputeAll

        void recomputeAll()
        Forces the DD mechanism to recompute all the known parts of all the known objects.
      • removeObjectStatusListener

        void removeObjectStatusListener​(IDerivedDataObjectStatusListener listener)
        Removes specific DD object status listener instance from the notification chain. All subscriptions of the given listener instance will be removed as a result.
        Parameters:
        listener - The listener that should be removed. Cannot be null.
      • removeStatusListener

        void removeStatusListener​(IDerivedDataStatusListener listener)
        Removes listener that will be notified about derived data status changes.
        Parameters:
        listener - the listener that should be removed.
      • unblockAsyncPipeline

        void unblockAsyncPipeline​(boolean forcedStop)
        Force unblocking of the async. pipeline. Could stay blocked after the call of this method if async. DD computation prerequisites are not met yet.
        Parameters:
        forcedStop - Unblocks the forced block in case if true. Unblocks usual lock instead.
      • updateDerviedData

        boolean updateDerviedData​(IDerivedDataUpdate update,
                                  long waitTimeout)
        Updates derivided data using the provided IDerivedDataUpdate update
        Parameters:
        update - The update to perform
        waitTimeout - Waiting time (in milliseconds) for the updated DD to be re-computed; 0 means no wait
        Returns:
        True if the requested DD were computed until the end of the waiting period; false otherwise
      • waitAccumulatedDerivedDataComputation

        void waitAccumulatedDerivedDataComputation​(Object computationCause)
                                            throws InterruptedException
        Computes synchronous derived data pending for the current session (if any). The computation is synchronous.
        Parameters:
        computationCause - The object bound to the computation context and used to track computations. Can be null
        Throws:
        InterruptedException
      • waitAllComputations

        boolean waitAllComputations​(long timeout)
                             throws InterruptedException
        Wait till all computations are finished or waiting time exceeds the specified value.
        Parameters:
        timeout - the maximum time to wait in milliseconds
        Returns:
        true if all derived data has been computed by the time this method returns, false otherwise
        Throws:
        InterruptedException - if any thread interrupted the current thread before or while the current thread was waiting for the computations.
      • waitComputation

        boolean waitComputation​(long timeout,
                                boolean priority,
                                String... scope)
                         throws InterruptedException
        Waits completion of the given scope
        Parameters:
        timeout - The wait timeout
        priority - The data that is being waited are priority computations
        scope - The scope (parts) to wait
        Returns:
        True if the wait was successful; false if it was timed out
        Throws:
        InterruptedException
      • waitComputation

        void waitComputation​(Map<Long,​Collection<String>> scope)
                      throws InterruptedException
        Waits till the given scope of computations is finished.
        Parameters:
        scope - the scope of computations to wait for. The scope is a map, where the keys are BM objects whose derived data parts must be computed and the values are collections of the part IDs
        Throws:
        InterruptedException - if any thread interrupted the current thread before or while the current thread was waiting for the computation
      • waitComputation

        boolean waitComputation​(Map<Long,​Collection<String>> scope,
                                long timeout)
                         throws InterruptedException
        Waits till the given scope of computations is finished or waiting time exceeds the specified value.
        Parameters:
        scope - the scope of computations to wait for. The scope is a map, where the keys are BM objects whose derived data parts must be computed and the values are collections of the part IDs
        timeout - the maximum time to wait in milliseconds
        Returns:
        true if the given scope has been computed by the time this method returns, false otherwise
        Throws:
        InterruptedException - if any thread interrupted the current thread before or while the current thread was waiting for the computation.
      • waitComputationExt

        boolean waitComputationExt​(Map<Object,​Collection<String>> scope,
                                   long timeout)
                            throws InterruptedException
        Waits till the given scope of computations is finished or waiting time exceeds the specified value.
        Parameters:
        scope - the scope of computations to wait for. The scope is a map, where the keys are BM objects whose derived data parts must be computed and the values are collections of the part IDs
        timeout - the maximum time to wait in milliseconds
        Returns:
        true if the given scope has been computed by the time this method returns, false otherwise
        Throws:
        InterruptedException - if any thread interrupted the current thread before or while the current thread was waiting for the computation.
      • startMassiveComputing

        void startMassiveComputing()
        Enables the massive computing mode for the DD pipeline. The mode is being desingaged after computing of all registered important tasks