Class TokenFilterBuilder


  • public class TokenFilterBuilder
    extends Object
    Allows the assembly of TokenFilter instances for use with the CTSPersistentStore and other uses of the generic data layer.

    The role of a TokenFilter is to restrict the results of a CTS query to both reduce load on the CTS and make the return results more specific to the callers query.

    Each TokenFilter can include CoreTokenField attribute filters which ensure that only CTS tokens that have the matching attribute are returned.

    In addition the TokenFilter can define the return attributes from matched CTS Tokens. Rather than returning complete CTS tokens, when a return attribute is defined the CTS Tokens will only contain the defined subset of CoreTokenField attributes.

    • Constructor Detail

      • TokenFilterBuilder

        public TokenFilterBuilder()
    • Method Detail

      • withSizeLimit

        public TokenFilterBuilder withSizeLimit​(int sizeLimit)
        Sets the size limit for the query request. Defaults to 0. The size limit will be enforced by the underlying backend technology.
        Parameters:
        sizeLimit - The non-negative amount of entries that should be returned at most via the query.
        Returns:
        This builder.
      • withTimeLimit

        public TokenFilterBuilder withTimeLimit​(Duration timeLimit)
        Sets the time limit for the query request. Defaults to 0 seconds - no time limit. The time limit will be enforced by the underlying backend technology.
        Parameters:
        timeLimit - The non-negative time duration under which the query must finish.
        Returns:
        This builder.
      • returnAttribute

        public TokenFilterBuilder returnAttribute​(CoreTokenField field)
        If you only require the returned CTS Tokens to contains a subset of the standard CoreTokenField.values() then this method allows the caller to specify the fields they would like in the returned CTS Tokens.
        Parameters:
        field - The required attribute to return from the query.
        Returns:
        This query builder.
      • build

        public TokenFilter build()
        Returns:
        The assembled TokenFilter.