Package adams.db

Interface DataProvider<T extends DataContainer>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Integer add​(T cont)
      Adds a data container to the database.
      boolean exists​(int id)
      Checks whether the container exists in the database.
      boolean exists​(String id)
      Checks whether the container exists in the database.
      T load​(int id)
      Load a data container with given database ID.
      T load​(String id)
      Load a data container with given ID.
      boolean remove​(int id, boolean keepReport)
      Removes the data container from the database (and the associated report, if any).
      boolean remove​(String id, boolean keepReport)
      Removes the data container from the database (and the associated report, if any).
    • Method Detail

      • add

        Integer add​(T cont)
        Adds a data container to the database. Returns the created auto-id, and sets it in the data container as well.
        Parameters:
        cont - the container to store in the database
        Returns:
        new ID, or null if fail
      • exists

        boolean exists​(int id)
        Checks whether the container exists in the database.
        Parameters:
        id - the database ID of the data container
        Returns:
        true if the container exists
      • exists

        boolean exists​(String id)
        Checks whether the container exists in the database.
        Parameters:
        id - the ID of the data container
        Returns:
        true if the container exists
      • load

        T load​(int id)
        Load a data container with given database ID.
        Parameters:
        id - the database ID
        Returns:
        the data container, or null if not found
      • load

        T load​(String id)
        Load a data container with given ID.
        Parameters:
        id - the ID
        Returns:
        the data container, or null if not found
      • remove

        boolean remove​(int id,
                       boolean keepReport)
        Removes the data container from the database (and the associated report, if any).
        Parameters:
        id - the database ID of the container to remove from the database
        keepReport - if true does not delete associated report
        Returns:
        true if no error
      • remove

        boolean remove​(String id,
                       boolean keepReport)
        Removes the data container from the database (and the associated report, if any).
        Parameters:
        id - the ID of the container to remove from the database
        keepReport - if true does not delete associated report
        Returns:
        true if no error