Interface ChangeDetectionService

  • All Known Implementing Classes:
    DefaultChangeDetectionService

    public interface ChangeDetectionService
    API for detecting and consuming changes for specified Item or type.
    • Method Detail

      • getChangeForExistingItem

        ItemChangeDTO getChangeForExistingItem​(ItemModel item,
                                               java.lang.String streamId)
        Detects change for a given existing item and stream. Finds changes of change type 'NEW' or "MODIFIED'.
        Parameters:
        item - the item to be checked
        streamId - the streamId for which the changes should be detect
        Returns:
        ItemChangeDTO Object containing all the information about the change
      • getChangeForRemovedItem

        ItemChangeDTO getChangeForRemovedItem​(PK pk,
                                              java.lang.String streamId)
        Detects potential change for a an not existing item - (change type 'DELETED'), stored under ItemVersionMarker referencing given item pk.
        Parameters:
        pk - the pk of the item to be checked
        streamId - the streamId for which the change should be detect
        Returns:
        ItemChangeDTO Object containing all the information about the change
      • getChangesForRemovedItems

        java.util.List<ItemChangeDTO> getChangesForRemovedItems​(java.lang.String streamId)
        Detects changes for all items, which doesn't exist anymore (change type 'DELETED'), stored under ItemVersionMarker referencing the not existing item pks.
        Parameters:
        streamId - the streamId for which the change should be detect
        Returns:
        List of ItemChangeDTO Objects containing all the information about the changes
      • collectChangesForType

        void collectChangesForType​(ComposedTypeModel composedType,
                                   java.lang.String streamId,
                                   ChangesCollector collector)
        Detects all kind of changes (NEW, MODIFIED, DELETED) on items for the given composed type.
        Parameters:
        composedType - the type for which the change detection should be executed (including subtypes)
        streamId - the streamId for which the change should be detect
        collector - responsible for collecting the changes in specified way, e.g. store them in memory or generate csv file.
      • collectChangesForType

        void collectChangesForType​(ComposedTypeModel composedType,
                                   StreamConfiguration configuration,
                                   ChangesCollector collector)
        Detects all kind of changes (NEW, MODIFIED, DELETED) on items for the given composed type.
        Parameters:
        composedType - the type for which the change detection should be executed (including subtypes)
        configuration - the stream configuration defining which item should be included into the stream.
        collector - responsible for collecting the changes in specified way, e.g. store them in memory or generate csv file.
        See Also:
        StreamConfiguration
      • consumeChanges

        void consumeChanges​(java.util.List<ItemChangeDTO> changes)
        Consumes all given changes. it Means, for the changes of change type NEW - a new ItemVersionMarker is created, in case of change type MODIFIED - the item version marker is updated properly and in case of change type DELETED - the ItemVersionMarker is removed. The stream for which the changes will be consumed is defined inside the given ItemChangeDTO objects
        Parameters:
        changes - list of the changes to be consumed.
      • deleteItemVersionMarkersForStream

        void deleteItemVersionMarkersForStream​(java.lang.String streamId)
        Deletes all item version markers belonging to the stream
        Parameters:
        streamId - stream id for which item version markers should be deleted
      • resetStream

        void resetStream​(java.lang.String streamId)
        Resets the stream. It means that all ItemVersionMarkers with status DELETED will change their status to ACTIVE and all the ItemVersionMarkers with status ACTIVE will have their versionTS set to the beginning of Unix Epoch time (1 January 1970).
        Parameters:
        streamId - stream id for which item version markers should be reset