Package com.im.df.api.support
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 correspondingDFDao
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 thefield
.java.util.Map<DFUpdateDescription,DFUpdateResult>
update(java.util.List<DFUpdateDescription> updateDescriptors, boolean readOriginalData, com.im.commons.progress.DFEnvironmentRW env)
Updates rows in entity based onDFUpdateDescription
.
-
-
-
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 thefield
.- 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 ofMap
again. In these nestedMap
s key is id ofDFField
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 IDsfields
- Set of fields to retrieve the values from. Ifnull
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 ofMap
again. In these nestedMap
s key is id ofDFField
and value is the read data value. NestedMap
s contain only data for eachDFField
specified infields
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 onDFUpdateDescription
.- Parameters:
updateDescriptors
- The update description.readOriginalData
- If the resultDFUpdateResult
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
DFUpdateDescription
s from the parameters and the values are the results of particular updates.
-
-