Interface GenericDAO<T>

    • Method Detail

      • create

        T create​(Context context,
                 T t)
          throws SQLException
        Create a new instance of this type in the database.
        Parameters:
        context - current DSpace context.
        t - type to be created.
        Returns:
        entity tracking the created instance.
        Throws:
        SQLException
      • save

        void save​(Context context,
                  T t)
           throws SQLException
        Persist this instance in the database.
        Parameters:
        context - current DSpace context.
        t - type created here.
        Throws:
        SQLException - passed through.
      • delete

        void delete​(Context context,
                    T t)
             throws SQLException
        Remove an instance from the database.
        Parameters:
        context - current DSpace context.
        t - type of the instance to be removed.
        Throws:
        SQLException - passed through.
      • findAll

        List<T> findAll​(Context context,
                        Class<T> clazz)
                 throws SQLException
        Fetch all persisted instances of a given object type.
        Parameters:
        context - The relevant DSpace Context.
        clazz - the desired type.
        Returns:
        list of DAOs of the same type as clazz
        Throws:
        SQLException - if database error
      • findAll

        List<T> findAll​(Context context,
                        Class<T> clazz,
                        Integer limit,
                        Integer offset)
                 throws SQLException
        Fetch all persisted instances of a given object type.
        Parameters:
        context - The relevant DSpace Context.
        clazz - the desired type.
        limit - paging limit
        offset - paging offset
        Returns:
        list of DAOs of the same type as clazz
        Throws:
        SQLException - if database error
      • findUnique

        T findUnique​(Context context,
                     String query)
              throws SQLException
        Execute a JPQL query returning a unique result.
        Parameters:
        context - The relevant DSpace Context.
        query - JPQL query string
        Returns:
        a DAO specified by the query string
        Throws:
        SQLException - if database error
      • findByID

        T findByID​(Context context,
                   Class clazz,
                   int id)
            throws SQLException
        Fetch the entity identified by its legacy database identifier.
        Parameters:
        context - current DSpace context.
        clazz - class of entity to be found.
        id - legacy database record ID.
        Returns:
        the found entity.
        Throws:
        SQLException - passed through.
      • findByID

        T findByID​(Context context,
                   Class clazz,
                   UUID id)
            throws SQLException
        Fetch the entity identified by its UUID primary key.
        Parameters:
        context - current DSpace context.
        clazz - class of entity to be found.
        id - primary key of the database record.
        Returns:
        the found entity.
        Throws:
        SQLException
      • findMany

        List<T> findMany​(Context context,
                         String query)
                  throws SQLException
        Execute a JPQL query and return a collection of results.
        Parameters:
        context - The relevant DSpace Context.
        query - JPQL query string
        Returns:
        list of DAOs specified by the query string
        Throws:
        SQLException - if database error