Interface SortDataParsingStrategy

All Known Implementing Classes:
DefaultSortDataParsingStrategy

public interface SortDataParsingStrategy
A Strategy interface to parse the given SortData from the given Map, so that "ORDER BY" query clause can be generated dynamically with proper query alias, attribute and sorting direction specified.

Note: This strategy handles sortData's code as lower case to achieve case insensitive behavior for sortCode. Therefore, key String of sortCodeToQueryAlias should be set as lower case.

  • Method Details

    • getQueryAlias

      String getQueryAlias(Map<String,String> sortCodeToQueryAlias, SortData sortData)
      Gets the query alias for the given SortData defined from the given Map
      Parameters:
      sortCodeToQueryAlias - the map contains mapping between sortData.code and query alias
      sortData - the sort data
      Returns:
      the matching query alias
    • getSortCode

      String getSortCode(Map<String,String> sortCodeToQueryAlias, SortData sortData)
      Gets the sort code for the given {link SortData} if Map contains the sortData.code as key. Otherwise, returns an empty string.
      Parameters:
      sortCodeToQueryAlias - the map contains mapping between sortData.code and query alias
      sortData - the sort data
      Returns:
      the sort code
    • getSortDirection

      String getSortDirection(Map<String,String> sortCodeToQueryAlias, SortData sortData)
      Gets the sort direction of the given SortData
      Parameters:
      sortCodeToQueryAlias - the map contains mapping between sortData.code and query alias
      sortData - the sort data
      Returns:
      the sort direction