Class DataSetManager

  • All Implemented Interfaces:
    CommonManager

    public final class DataSetManager
    extends AbstractManager
    This class is responsible for managing datasets (add and remove).
    • Constructor Detail

      • DataSetManager

        public DataSetManager​(SQLiteDataSource dataSource)
        Instantiates a DataSet Manager that uses the DataSet DB in the provided path.
        Parameters:
        managerName - Manager/service name.
    • Method Detail

      • newDataSet

        public DataSetID newDataSet​(DataSet newDataSet)
        This operation creates a new dataset.
        Parameters:
        newDataSet - Information of the dataset to create
        Returns:
        datasetID of the new dataset if the it was successfully created.
        Throws:
        Exception - if an exception occurs:
        DataSetExistsException if the dataset already exists
      • getAllDataSetsOfAccount

        public List<DataSet> getAllDataSetsOfAccount​(AccountID accountID)
        Get all DataSets of account
        Parameters:
        accountID - ID of account
        Returns:
        DataSets of the account.
      • getDataSetID

        public DataSetID getDataSetID​(String datasetName)
        Returns the datasetID of the specified dataset name
        Parameters:
        datasetName - the name of the dataset
        Returns:
        the datasetID of the dataset
        Throws:
        Exception - if an exception occurs:
        DataSetDoesNotExistException: if the dataset does not exist
      • getDataSetsInfo

        public Map<String,​DataSet> getDataSetsInfo​(Set<DataSetID> datasetIDs)
        Returns the datasetIDs of the specified datasets names
        Parameters:
        datasetsNames - the names of the datasets
        Returns:
        the info related with the given datasets
        Throws:
        Exception - if an exception occurs:
        DataSetDoesNotExistException: if a dataset does not exist
      • getDataSetInfo

        public DataSet getDataSetInfo​(String datasetName)
      • removeDataSet

        public void removeDataSet​(DataSetID datasetID)
        This operation removes the indicated dataset
        Parameters:
        datasetID - DataSetID of the dataset to be removed
        Throws:
        Exception - if an exception occurs:
        DataSetDoesNotExistException: if the dataset does not exist
      • checkDataSetResponsible

        public boolean checkDataSetResponsible​(DataSetID datasetID,
                                               AccountID responsible)
        This operation checks whether an account is responsible for a dataset
        Parameters:
        responsible - AccountID of the responsible to be checked
        datasetID - ID of the dataset to be checked
        Returns:
        true if accountID is responsible for datasetID, false if not.
        Throws:
        Exception - if an exception occurs:
        DataSetDoesNotExistException: if the dataset does not exist
      • checkDataSetIsPublic

        public boolean checkDataSetIsPublic​(DataSetID datasetID)
        This operation checks whether a dataset is p ublic or not
        Parameters:
        datasetID - ID of the dataset to be checked
        Returns:
        true if the dataset is public, false otherwise.
        Throws:
        Exception - if an exception occurs:
        DataSetDoesNotExistException: if the dataset does not exist
      • getPublicDataSets

        public Set<DataSet> getPublicDataSets()
        This operation retrieves all public datasets
        Returns:
        set of dataset names that are public
      • getDbHandler

        public DataSetManagerDB getDbHandler()
        Method used for unit testing.
        Returns:
        The db handler reference of this manager.