Class ClientRefDataQuery


  • public class ClientRefDataQuery
    extends Object
    Provides a class for querying CSV property files for reference data lookup. propertyRowList (required) The calling class first gets the existing CSV property value. The CSV is imported into memory as a row list - List>. The row list maybe cached in memory. queryJson (required) This is used to select the fields to use, filter and order the result. Below is an example queryJson
     {
       "select": ["postcode","suburb","state","dc"],
       "filter": [
           {"field": "postcode", "operation": "match", "value": "2099"},
           {"field": "suburb", "operation": "contains", "value": "E"}
       ],
       "order": [
           {"field": "suburb", "sortAsc": false},
           {"field": "state", "sortAsc": true}
       ],
       "fetchLimit": 50
    }
     
    The results of the query is in a row list json format List>.
    • Constructor Detail

      • ClientRefDataQuery

        public ClientRefDataQuery()
    • Method Detail

      • setQuery

        public ClientRefDataQuery setQuery​(String queryJson)
        Sets the property query json.
        Parameters:
        queryJson - the String JSON value defining the property query
        Returns:
        this instance of CsvPropertyQuery
      • setRowList

        public ClientRefDataQuery setRowList​(List<Map<String,​String>> rowList)
        Sets the property row list.
        Parameters:
        rowList - the List> imported from the CSV property
        Returns:
        this instance of CsvPropertyQuery
      • validate

        public List<String> validate()
        Validates the inputs returning a List of String validation errors First it does some basic checks to ensure data is set
        Returns:
        this List of String validation errors
      • execute

        public String execute()
        Runs the query against the row list.
        Returns:
        the query result as JSON String. The result is an array of Objects.
      • getExampleQuery

        public String getExampleQuery()
        Gets an example JSON query String. This is used by the ClientRefDataTestPage as a starter.
        Returns:
        an example JSON query String.