Package proseccoCoding.TLN.model
Class Query
java.lang.Object
proseccoCoding.TLN.model.Query
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 Summary
FieldsModifier and TypeFieldDescriptionArrayList that stores the Country objects selected by the userArrayList that stores the Provider objects selected by the userArrayList that stores the Service objects which service type has been selected by the userArrayList 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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
addSelectedCountries
(ArrayList<Country> countries) This method sets selectedCountries with the given parameterThis method retrieves from selectedCountries all the relative Provider objects and returns them as an ArrayListThis method saves and returns all possible service status from selectedServicesByType in an ArrayList of StringsThis method returns an ArrayList of all the possible service types user can select in this queryThis method returns all Service objects from selectedServiceByType which status is among the ones contained in selectedServiceStatusboolean
setSelectedProviders
(ArrayList<String> providerCodes) This method adds to selectedProviders the providers object associated with the Strings contained in providerCodesboolean
setSelectedServiceStatus
(ArrayList<String> status) This method adds to selectedServiceStatus all the service statuses selected by the userboolean
setSelectedServiceTypes
(ArrayList<String> typeCodes) 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
-
Field Details
-
selectedCountries
ArrayList that stores the Country objects selected by the user -
selectedProviders
ArrayList that stores the Provider objects selected by the user -
selectedServicesByType
ArrayList that stores the Service objects which service type has been selected by the user -
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
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
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
This method returns an ArrayList of all the possible service types user can select in this query- Returns:
- ArrayList of ServiceType objects
-
setSelectedServiceTypes
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
This method saves and returns all possible service status from selectedServicesByType in an ArrayList of Strings- Returns:
- ArrayList of Strings
-
setSelectedServiceStatus
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
This method returns all Service objects from selectedServiceByType which status is among the ones contained in selectedServiceStatus- Returns:
- ArrayList of Service objects
-