Interface DFDao


  • public interface DFDao
    Performs the database operations for a single entity. This includes the classic CRUD operations of a DAO, but also includes DDL operations. Each entity type will have a corresponding DFDao implementation to perform its database operations.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.util.List<? extends java.lang.Comparable<?>> deleteIds​(java.util.List<? extends java.lang.Comparable<?>> ids, com.im.commons.progress.DFEnvironmentRW env)
      Delete the specified rows.
      java.util.Map<java.lang.Comparable<?>,​java.util.Map<java.lang.String,​java.lang.Object>> getData​(java.util.Collection<? extends java.lang.Comparable<?>> ids)
      Fetches data for all fields and the specified row IDs.
      java.util.Map<java.lang.Comparable<?>,​java.util.Map<java.lang.String,​java.lang.Object>> getData​(java.util.Collection<? extends java.lang.Comparable<?>> ids, java.util.List<DFField> fields)
      Fetches data for given fields and the specified row IDs.
      int getRowCount​(com.im.commons.progress.DFEnvironmentRO env)
      Returns the number of rows in the entity.
      DFUpdateInfo insert​(java.util.Map<java.lang.String,​java.lang.Object> values, java.util.Map<java.lang.String,​java.lang.Object> insertOptions, com.im.commons.progress.DFEnvironmentRW env)
      Inserts new row into the entity.
      java.util.List retrieveDistinctValues​(java.lang.String fieldId)
      Retrieves all distinct values from the field.
      java.util.Map<DFUpdateDescription,​DFUpdateResult> update​(java.util.List<DFUpdateDescription> updateDescriptors, boolean readOriginalData, com.im.commons.progress.DFEnvironmentRW env)
      Updates rows in entity based on DFUpdateDescription.
    • Method Detail

      • getRowCount

        int getRowCount​(com.im.commons.progress.DFEnvironmentRO env)
        Returns the number of rows in the entity.
        Parameters:
        env - Environment to use for retrieving the number of rows.
        Returns:
        The number of rows.
      • retrieveDistinctValues

        java.util.List retrieveDistinctValues​(java.lang.String fieldId)
        Retrieves all distinct values from the field.
        Parameters:
        fieldId - The ID of the field.
        Returns:
        List of distinct values in the entity.
      • getData

        java.util.Map<java.lang.Comparable<?>,​java.util.Map<java.lang.String,​java.lang.Object>> getData​(java.util.Collection<? extends java.lang.Comparable<?>> ids)
        Fetches data for all fields and the specified row IDs.
        Parameters:
        ids - the row IDs
        Returns:
        A map of the data, keyed by the row ID. The values of the first level of Map are instances of Map again. In these nested Maps key is id of DFField and value is the read data value.
      • getData

        java.util.Map<java.lang.Comparable<?>,​java.util.Map<java.lang.String,​java.lang.Object>> getData​(java.util.Collection<? extends java.lang.Comparable<?>> ids,
                                                                                                                    java.util.List<DFField> fields)
        Fetches data for given fields and the specified row IDs.
        Parameters:
        ids - the row IDs
        fields - Set of fields to retrieve the values from. If null or empty, then all fields of the entity are retrieved.
        Returns:
        A map of the data, keyed by the row ID. The values of the first level of Map are instances of Map again. In these nested Maps key is id of DFField and value is the read data value. Nested Maps contain only data for each DFField specified in fields parameter.
      • deleteIds

        java.util.List<? extends java.lang.Comparable<?>> deleteIds​(java.util.List<? extends java.lang.Comparable<?>> ids,
                                                                    com.im.commons.progress.DFEnvironmentRW env)
        Delete the specified rows. NOTE: this method may return null, as JChem's UpdateHandler does not provide a way of determining whether the deletion was successful.
        Parameters:
        ids - The row IDs to remove.
        env - The environment to use for removing rows.
        Returns:
        The removed row IDs.
      • insert

        DFUpdateInfo insert​(java.util.Map<java.lang.String,​java.lang.Object> values,
                            java.util.Map<java.lang.String,​java.lang.Object> insertOptions,
                            com.im.commons.progress.DFEnvironmentRW env)
        Inserts new row into the entity.
        Parameters:
        values - The mapping of field IDs to values in the new row.
        insertOptions - Options specific to this type of entity. Can be null.
        env - Environment for writing data.
        Returns:
        Update info - id of inserted row and if it's duplicate.
      • update

        java.util.Map<DFUpdateDescription,​DFUpdateResult> update​(java.util.List<DFUpdateDescription> updateDescriptors,
                                                                       boolean readOriginalData,
                                                                       com.im.commons.progress.DFEnvironmentRW env)
        Updates rows in entity based on DFUpdateDescription.
        Parameters:
        updateDescriptors - The update description.
        readOriginalData - If the result DFUpdateResult has to contain the data before the update.
        env - The environment used for update.
        Returns:
        The result of the update is a Map where the keys are the DFUpdateDescriptions from the parameters and the values are the results of particular updates.