@java.lang.SuppressWarnings("unused") public interface EntityFind extends SimpleEtlExtractor, java.ioSerializable
Used to setup various options for an entity find (query). All methods to set options modify the option then return this modified object to allow method call chaining. It is important to note that this object is not immutable and is modified internally, and returning EntityFind is just a self reference for convenience. Even after a query a find object can be modified and then used to perform another query.
Type Params | Return Type | Name and description |
---|---|---|
|
public EntityFind |
condition(java.lang.String fieldName, java.lang.Object value) Add a field to the find (where clause). |
|
public EntityFind |
condition(java.lang.String fieldName, ComparisonOperator operator, java.lang.Object value) Compare the named field to the value using the operator. |
|
public EntityFind |
condition(java.lang.String fieldName, java.lang.String operator, java.lang.Object value) |
|
public EntityFind |
condition(java.util.Map<java.lang.String, java.lang.Object> fields) Add a Map of fields to the find (where clause). |
|
public EntityFind |
condition(EntityCondition condition) Add a EntityCondition to the find (where clause). |
|
public EntityFind |
conditionDate(java.lang.String fromFieldName, java.lang.String thruFieldName, java.sql.Timestamp compareStamp) Add conditions for the standard effective date query pattern including from field is null or earlier than or equal to compareStamp and thru field is null or later than or equal to compareStamp. |
|
public EntityFind |
conditionToField(java.lang.String fieldName, ComparisonOperator operator, java.lang.String toFieldName) Compare a field to another field using the operator. |
|
public long |
count() Runs a find with current options to get a count of matching records. |
|
public long |
deleteAll() Delete entity records that match a condition. |
|
public EntityFind |
disableAuthz() Disable authorization for this find |
|
public EntityFind |
distinct(boolean distinct) Specifies whether the values returned should be filtered to remove duplicate values. |
|
public EntityFind |
entity(java.lang.String entityName) The Name of the Entity to use, as defined in an entity XML file. |
|
public EntityFind |
fetchSize(java.lang.Integer fetchSize) The JDBC fetch size for this query. |
|
public EntityFind |
forUpdate(boolean forUpdate) Lock the selected record so only this transaction can change it until it is ended. |
|
public boolean |
getDistinct() |
|
public java.lang.String |
getEntity() |
|
public java.lang.Integer |
getFetchSize() |
|
public boolean |
getForUpdate() |
|
public boolean |
getHasCondition() |
|
public boolean |
getHasHavingCondition() |
|
public EntityCondition |
getHavingEntityCondition() Get the current having EntityCondition. |
|
public java.lang.Integer |
getLimit() |
|
public java.lang.Integer |
getMaxRows() |
|
public java.lang.Integer |
getOffset() |
|
public java.util.List<java.lang.String> |
getOrderBy() |
|
public int |
getPageIndex() For use with searchFormInputs when paginated. |
|
public int |
getPageSize() For use with searchFormInputs when paginated. |
|
public java.util.ArrayList<java.lang.String> |
getQueryTextList() If supported by underlying data source get the text (SQL, etc) used for the find query. |
|
public int |
getResultSetConcurrency() |
|
public int |
getResultSetType() |
|
public java.util.List<java.lang.String> |
getSelectFields() |
|
public boolean |
getUseCache() |
|
public EntityCondition |
getWhereEntityCondition() Get the current where EntityCondition. |
|
public EntityFind |
havingCondition(EntityCondition condition) Add a EntityCondition to the having clause of the find. |
|
public EntityListIterator |
iterator() Runs a find with current options and returns an EntityListIterator object which retains an open JDBC Connection and ResultSet until closed. |
|
public EntityFind |
limit(java.lang.Integer limit) The limit, ie max number of rows to return. |
|
public EntityList |
list() Runs a find with current options to get a list of records. |
|
public java.util.List<java.util.Map<java.lang.String, java.lang.Object>> |
listMaster(java.lang.String name) Runs a find with current options to get a list of records, then for each result gets all related/dependent entities according to the named master definition (default name is 'default') |
|
public EntityDynamicView |
makeEntityDynamicView() Make a dynamic view object to use instead of the entity name (if used the entity name will be ignored). |
|
public EntityFind |
maxRows(java.lang.Integer maxRows) The JDBC max rows for this query. |
|
public EntityFind |
offset(java.lang.Integer offset) The offset, ie the starting row to return. |
|
public EntityFind |
offset(int pageIndex, int pageSize) Specify the offset in terms of page index and size. |
|
public EntityValue |
one() Runs a find with current options to get a single record by primary key. |
|
public java.util.Map<java.lang.String, java.lang.Object> |
oneMaster(java.lang.String name) Runs a find with current options to get a single record by primary key, then gets all related/dependent entities according to the named master definition (default name is 'default'). |
|
public EntityFind |
orderBy(java.lang.String orderByFieldName) A field of the find entity to order the query by. |
|
public EntityFind |
orderBy(java.util.List<java.lang.String> orderByFieldNames) Each List entry is passed to the orderBy(String orderByFieldName) method, see it for details. |
|
public EntityFind |
requireSearchFormParameters(boolean req) If true don't do find (return empty list or null) when there are no search form parameters |
|
public EntityFind |
resultSetConcurrency(int resultSetConcurrency) Specifies whether or not the ResultSet can be updated. |
|
public EntityFind |
resultSetType(int resultSetType) Specifies how the ResultSet will be traversed. |
|
public EntityFind |
searchFormInputs(java.lang.String inputFieldsMapName, java.lang.String defaultOrderBy, boolean alwaysPaginate) Adds conditions for the fields found in the inputFieldsMapName Map. |
|
public EntityFind |
searchFormMap(java.util.Map<java.lang.String, java.lang.Object> inputFieldsMap, java.util.Map<java.lang.String, java.lang.Object> defaultParameters, java.lang.String skipFields, java.lang.String defaultOrderBy, boolean alwaysPaginate) |
|
public EntityFind |
selectField(java.lang.String fieldToSelect) The field of the named entity to get from the database. |
|
public EntityFind |
selectFields(java.util.Collection<java.lang.String> fieldsToSelect) The fields of the named entity to get from the database; if empty or null all fields will be retrieved. |
|
public boolean |
shouldCache() Determine if this find should be cached by the various options on entity definition and EntityFind |
|
public long |
updateAll(java.util.Map<java.lang.String, java.lang.Object> fieldsToSet) Update a set of values that match a condition. |
|
public EntityFind |
useCache(java.lang.Boolean useCache) Look in the cache before finding in the datasource. |
|
public EntityFind |
useClone(boolean uc) Use a clone of the configured datasource, if at least one clone is configured |
Add a field to the find (where clause). If a field has been set with the same name, this will replace that field's value. If any other constraints are already in place this will be ANDed to them.
Compare the named field to the value using the operator.
Add a Map of fields to the find (where clause).
If a field has been set with the same name and any of the Map keys, this will replace that field's value.
Fields set in this way will be combined with other conditions (if applicable) just before doing the query.
This will do conversions if needed from Strings to field types as needed, and will only get keys that match
entity fields. In other words, it does the same thing as:
EntityValue.setFields(fields, true, null, null)
Add a EntityCondition to the find (where clause).
Add conditions for the standard effective date query pattern including from field is null or earlier than or equal to compareStamp and thru field is null or later than or equal to compareStamp.
Compare a field to another field using the operator.
Runs a find with current options to get a count of matching records.
Delete entity records that match a condition.
Disable authorization for this find
Specifies whether the values returned should be filtered to remove duplicate values. Default is false.
The Name of the Entity to use, as defined in an entity XML file.
The JDBC fetch size for this query. Default (null) will fall back to datasource settings. This is not the fetch as in the OFFSET/FETCH SQL clause (use limit for that), and is rather the JDBC fetch to determine how many rows to get back on each round-trip to the database. Only applicable for list() and iterator() finds.
Lock the selected record so only this transaction can change it until it is ended. If this is set when the find is done the useCache setting will be ignored as this will always get the data from the database. Default is false.
Get the current having EntityCondition.
For use with searchFormInputs when paginated. Equals offset (default 0) divided by page size.
For use with searchFormInputs when paginated. Equals limit (default 20; exists for consistency/convenience along with getPageIndex()).
If supported by underlying data source get the text (SQL, etc) used for the find query. Will have multiple values if multiple queries done with this find.
Get the current where EntityCondition.
Add a EntityCondition to the having clause of the find. If any having constraints are already in place this will be ANDed to them.
Runs a find with current options and returns an EntityListIterator object which retains an open JDBC Connection and ResultSet until closed. This method ignores the cache setting and always gets results from the database. The returned EntityListIterator must be closed when you are done with it using the close() method in a finally block to ensure it is closed regardless of exceptions. For example:
EntityListIterator eli = entityFind.iterator(); try { EntityValue ev; while ((ev = eli.next()) != null) { // do stuff with ev } } finally { eli.close(); }
The limit, ie max number of rows to return. Default (null) means all rows. Only applicable for list() and iterator() finds.
Runs a find with current options to get a list of records.
Runs a find with current options to get a list of records, then for each result gets all related/dependent entities according to the named master definition (default name is 'default')
Make a dynamic view object to use instead of the entity name (if used the entity name will be ignored). If called multiple times will return the same object.
The JDBC max rows for this query. Default (null) will fall back to datasource settings. This is the maximum number of rows the ResultSet will keep in memory at any given time before releasing them and if requested they are retrieved from the database again. Only applicable for list() and iterator() finds.
The offset, ie the starting row to return. Default (null) means start from the first actual row. Only applicable for list() and iterator() finds.
Specify the offset in terms of page index and size. Actual offset is pageIndex * pageSize.
Runs a find with current options to get a single record by primary key.
Runs a find with current options to get a single record by primary key, then gets all related/dependent entities according to the named master definition (default name is 'default').
A field of the find entity to order the query by. Optionally add a " ASC" to the end or "+" to the beginning for ascending, or " DESC" to the end of "-" to the beginning for descending. If any other order by fields have already been specified this will be added to the end of the list. The String may be a comma-separated list of field names. Only fields that actually exist on the entity will be added to the order by list.
Each List entry is passed to the orderBy(String orderByFieldName) method, see it for details.
If true don't do find (return empty list or null) when there are no search form parameters
Specifies whether or not the ResultSet can be updated. Available values: ResultSet.CONCUR_READ_ONLY (default) or ResultSet.CONCUR_UPDATABLE. Should pretty much always be ResultSet.CONCUR_READ_ONLY with the Entity Facade since updates are generally done as separate operations. Defaults to CONCUR_READ_ONLY.
Specifies how the ResultSet will be traversed. Available values: ResultSet.TYPE_FORWARD_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE (default) or ResultSet.TYPE_SCROLL_SENSITIVE. See the java.sql.ResultSet JavaDoc for more information. If you want it to be fast, use the common option: ResultSet.TYPE_FORWARD_ONLY. For partial results where you want to jump to an index make sure to use TYPE_SCROLL_INSENSITIVE. Defaults to ResultSet.TYPE_SCROLL_INSENSITIVE.
Adds conditions for the fields found in the inputFieldsMapName Map. The fields and special fields with suffixes supported are the same as the *-find fields in the XML Forms. This means that you can use this to process the data from the various inputs generated by XML Forms. The suffixes include things like *_op for operators and *_ic for ignore case. For historical reference, this does basically what the Apache OFBiz prepareFind service does.
inputFieldsMapName
- The map to get form fields from. If empty will look at the ec.web.parameters map if
the web facade is available, otherwise the current context (ec.context).defaultOrderBy
- If there is not an orderByField parameter this is used instead.alwaysPaginate
- If true pagination offset/limit will be set even if there is no pageIndex parameter.The field of the named entity to get from the database. If any select fields have already been specified this will be added to the set.
The fields of the named entity to get from the database; if empty or null all fields will be retrieved.
Determine if this find should be cached by the various options on entity definition and EntityFind
Update a set of values that match a condition.
fieldsToSet
- The fields of the named entity to set in the databaseLook in the cache before finding in the datasource. Defaults to setting on entity definition.
Use a clone of the configured datasource, if at least one clone is configured