Class TrustedListFacade

java.lang.Object
proseccoCoding.TLN.model.TrustedListFacade

public class TrustedListFacade extends Object
This class is used as interface for all the business logic operations. Provides access to all trusted data and some basic methods for query management and query interaction. It implements the Singleton pattern since there's the necessity to guarantee the uniqueness of the Facade.
  • Field Details

    • instance

      private static TrustedListFacade instance
      Unique instance of TrustedListFacade class
    • query

      private Query query
      The query currently used or the latest used
    • trustedListData

      private TrustedListData trustedListData
      Trusted data from the trusted service list
  • Constructor Details

    • TrustedListFacade

      private TrustedListFacade()
      Constructor for the facade class. It initializes the trusted list data structure.
  • Method Details

    • getInstance

      public static TrustedListFacade getInstance()
      Method to get the unique instance of singleton class TrustedListFacade
      Returns:
      the unique TrustedListFacade object
    • startQuery

      public boolean startQuery(ArrayList<String> countryCodes) throws IllegalArgumentException
      Starts and initialize a new query with the given countries
      Parameters:
      countryCodes - Country codes of the selected countries (must have size>0)
      Returns:
      true if the query has been initialized, false otherwise
      Throws:
      IllegalArgumentException - In case of null parameter
    • requestData

      public void requestData() throws Exception
      Tells APIHandler to request the services data to the TrustedListAPI
      Throws:
      Exception
    • retrieveCountriesNames

      public ArrayList<String> retrieveCountriesNames()
      Retrieves from APIHandler the list of the EU countries names
      Returns:
      ArrayList containing the names of the EU countries
    • retriveServiceTypes

      public ArrayList<javafx.util.Pair<String,String>> retriveServiceTypes()
      Retrieves from APIHandler the list of the service types names and codes
      Returns:
      ArrayList<Pair<String, String>> containing Pairs which first value is the service type's code and the second one is its name
    • getQuery

      public Query getQuery()
      Returns the current query or null if there isn't one
      Returns:
      The Query in use or null if there isn't one
    • getData

      public TrustedListData getData()
      Returns the TrustedListData object
      Returns:
      trustedListData