Class DynamoFilterUtil


  • public final class DynamoFilterUtil
    extends Object
    Author:
    Bas Rutten
    • Method Detail

      • extractFilter

        public static Filter extractFilter​(Filter filter,
                                           String propertyId)
        Extracts a specific filter from a (possibly) composite filter
        Parameters:
        filter - the filter from which to extract a certain part
        propertyId - the propertyId of the filter to extract
        Returns:
      • flattenAnd

        public static List<Filter> flattenAnd​(And and)
        Take a (nested) And filter and flatten it to a single level
        Parameters:
        and - the filter to flatten
        Returns:
      • removeFilters

        public static void removeFilters​(Filter filter,
                                         String... propertyIds)
        Removes filters with certain property IDs from a certain filter
        Parameters:
        filter - the filter to remove the filters from
        propertyIds - the property IDs of the filters to remove
      • replaceMasterAndDetailFilters

        public static void replaceMasterAndDetailFilters​(Filter filter,
                                                         EntityModel<?> entityModel)
        Replaces all filters that query a detail relation by the appropriate filters
        Parameters:
        filter - the original filter
        entityModel - the entity model used to determine which filters must be replaced
        overrideProperty - optional property - if supplied, then we the application will check this property instead of the property supplied in the original filters
      • replaceFilter

        public static void replaceFilter​(Filter original,
                                         Filter newFilter,
                                         String propertyId,
                                         boolean firstOnly)
        Replaces a filter by another filter
        Parameters:
        original - the main filter that contains the filter to be replaced
        newFilter - the replacement filter
        propertyId - the property ID of the filter to replace
        firstOnly - indicates whether to replace only the first instance