Interface TrackedResourceCollector


  • public interface TrackedResourceCollector
    A tracked resources (and their change events) collector.
    Since:
    1.10.0
    • Method Detail

      • collectBaseMembers

        void collectBaseMembers​(Collection<ProjectArea> trsExposedProjects,
                                Person trsFunctionalUser,
                                Consumer<ResourceSeed> baseMembersConsumer)
        Collects all base members. Implementation must notify the consumer of each artifact of the application that must be reported as TRS base member. Consumers may raise CancellationException to indicate the collecting process must stop, but implementations must no propagate this exception, this is a convenient way to stop a searching process.
        Parameters:
        trsExposedProjects - the collection of TRS exposed projects. The project identifier is available through the dcterms:identifier extended property.
        trsFunctionalUser - the TRS functional user.
        baseMembersConsumer - base members consumer.
        Throws:
        CompletionException - if consumer raise it to stop the collecting process due an error occurred.
        Since:
        3.3.0
      • isCollectingResourceEvents

        default boolean isCollectingResourceEvents()
        Determines whether this instance is to collect events by querying changes in the host application. Default implementation returns false. Subclasses that override collectResourceEventsAfter(Date, Collection, Person, Consumer) must also override this method to return true.
        Returns:
        true if change events can be collected by this instance, false otherwise.
        Since:
        3.5.0
      • collectResourceEventsAfter

        default void collectResourceEventsAfter​(Date after,
                                                Collection<ProjectArea> trsExposedProjects,
                                                Person trsFunctionalUser,
                                                Consumer<ResourceEvent> resourceEventsConsumer)
        Collects latest change events after a moment in time. Implementations must call this consumer's accept method per change event since after chronologically - this means older events first and newer events last. Default implementation does nothing.

        Implementers are advised to prefer using listeners in the application to record events as they occur with ResourceEventStore.store(ResourceEvent...), which is the most reliable way to handle large volume of events. This method should be implemented only in the case there are some changes that can be queried in the application and cannot be captured using a listener. Consumers may raise CancellationException to indicate the collecting process must stop, but implementations must no propagate this exception, this is a convenient way to stop a searching process.

        Implementers overriding this method must also override isCollectingResourceEvents() to return true.

        Parameters:
        after - the reference time to search changed resources.
        trsExposedProjects - the collection of TRS exposed projects. The project identifier is available through the dcterms:identifier extended property.
        trsFunctionalUser - the TRS functional user.
        resourceEventsConsumer - change events consumer.
        Throws:
        CompletionException - if consumer raise it to stop the collecting process due an error occurred.
        Since:
        3.3.0