Interface AttachmentListManipulator


  • public interface AttachmentListManipulator
    An AttachmentListManipulator is used to manipulate the list of attachments that can be selected and attached by the agent.
    Since:
    10.0.38
    • Method Detail

      • getFilterPredicate

        default java.util.function.Predicate<Attachment> getFilterPredicate​(AttachmentFilterContext context)
        The method allows to filter the list of all available system attachments stored on the file system or added by other plugins, that are displayed to the agent's attachment selection dialog. The method getFilterPredicate will be called on all AttachmentListManipulators after the invocation of getAdditionalAttachments(AttachmentFilterContext). As a consequence of this other plugins can also filter the attachments added by other plugins or themselves. An attachment will be hidden to the agent if there is at least one Predicate provided by any AttachmentListManipulator, that returns false for that attachment. Otherwise the attachment will be visible to the agent (default).
        Parameters:
        context - the context with the current user and selected issue.
        Returns:
        a Predicate that selects the attachments to be displayed. If no predicate is provided, there will be no filter applied by this plugin.
        Since:
        10.0.38
      • getAdditionalAttachments

        default java.util.Set<Attachment> getAdditionalAttachments​(AttachmentFilterContext context)
        The method provides a list of suitable attachments for an issue and an agent. The method getAdditionalAttachments will always be called on all available plugins first. In a second step the method getFilterPredicate(AttachmentFilterContext) will be called to all AttachmentListManipulators to let them filter the list of previously added attachments. If an attachment is added by this method it is obligatory to provide also an AttachmentDataSourceProvider for the attachment's scheme to ensure that the binary content of the attachment can always be accessed, also by other processes.
        Parameters:
        context - the context with the current user and selected issue.
        Returns:
        a Set of attachments available to be attached by the agent. The list of attachments finally provided to the agent will be sorted by the Attachment's displayName.
        Since:
        10.0.38