Class Query

java.lang.Object
proseccoCoding.TLN.model.Query

public class Query extends Object
This class represents a Query used for the trusted services search. It is necessary to use this given order of method calls to correctly make the selection.\n addSelectedCountries - setSelectedProviders - setSelectedserviceTypes - setSelectedServiceStatus\n And at the end the results can be retrieved using getResults(). It is also possible to retrieve all the possible choices for the next selection, after a selection is made.
  • Field Details

    • selectedCountries

      private ArrayList<Country> selectedCountries
      ArrayList that stores the Country objects selected by the user
    • selectedProviders

      private ArrayList<Provider> selectedProviders
      ArrayList that stores the Provider objects selected by the user
    • selectedServicesByType

      private ArrayList<Service> selectedServicesByType
      ArrayList that stores the Service objects which service type has been selected by the user
    • selectedServiceStatus

      private ArrayList<String> selectedServiceStatus
      ArrayList that stores the selected service statuses that are associated with at least one service which service type, country and provider has been selected by the user, as Strings.
  • Constructor Details

    • Query

      public Query()
  • Method Details

    • addSelectedCountries

      public boolean addSelectedCountries(ArrayList<Country> countries) throws IllegalArgumentException
      This method sets selectedCountries with the given parameter
      Parameters:
      ArrayList - of countries objects that correspond to the ones selected by the user
      Returns:
      true if countries was added, false otherwise
      Throws:
      IllegalArgumentException - In case of null parameter
    • getAvailableProviders

      public ArrayList<Provider> getAvailableProviders()
      This method retrieves from selectedCountries all the relative Provider objects and returns them as an ArrayList
      Returns:
      ArraList of Provider objects that contains all the possible providers from the selected countries
    • setSelectedProviders

      public boolean setSelectedProviders(ArrayList<String> providerCodes) throws IllegalArgumentException
      This method adds to selectedProviders the providers object associated with the Strings contained in providerCodes
      Parameters:
      providerCodes - , ArrayList of Strings that contains all the codes of the selected providers
      Returns:
      true if the Provider objects were added, false otherwise
      Throws:
      IllegalArgumentException - In case of null parameter
    • getAvailableServiceTypes

      public ArrayList<ServiceType> getAvailableServiceTypes()
      This method returns an ArrayList of all the possible service types user can select in this query
      Returns:
      ArrayList of ServiceType objects
    • setSelectedServiceTypes

      public boolean setSelectedServiceTypes(ArrayList<String> typeCodes) throws IllegalArgumentException
      This method adds to selectedServicesByType all the Service objects contained in selectedProviders' Provider objects which service type is among the selected ones by the user
      Parameters:
      typeCodes - , ArrayList of Strings that indicates the selected service types
      Returns:
      true if the Service objects were added, false otherwise
      Throws:
      IllegalArgumentException - In case of null parameter
    • getAvailableServiceStatus

      public ArrayList<String> getAvailableServiceStatus()
      This method saves and returns all possible service status from selectedServicesByType in an ArrayList of Strings
      Returns:
      ArrayList of Strings
    • setSelectedServiceStatus

      public boolean setSelectedServiceStatus(ArrayList<String> status) throws IllegalArgumentException
      This method adds to selectedServiceStatus all the service statuses selected by the user
      Parameters:
      status - , ArrayList of Strings
      Returns:
      true if selectedServiceStatus was correctly loaded, false otherwise
      Throws:
      IllegalArgumentException - In case of null parameter
    • getResults

      public ArrayList<Service> getResults()
      This method returns all Service objects from selectedServiceByType which status is among the ones contained in selectedServiceStatus
      Returns:
      ArrayList of Service objects