Interface GenericHelper
-
- All Known Implementing Classes:
GenericHelperDAO
,ReadOnlyHelperDAO
public interface GenericHelper
Generic Entity Helper Class
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
checkDataSource(java.util.Map<java.lang.String,ModelEntity> modelEntities, java.util.List<java.lang.String> messages, boolean addMissing)
Check the datasource to make sure the entity definitions are correct, optionally adding missing entities or fields on the serverGenericValue
create(GenericValue value)
Creates a Entity in the form of a GenericValue and write it to the databasejava.util.List<GenericValue>
findAllByPrimaryKeys(java.util.List<GenericPK> primaryKeys)
Find a number of Generic Value objects by their Primary Keys, all at oncejava.util.List<GenericValue>
findByMultiRelation(GenericValue value, ModelRelation modelRelationOne, ModelEntity modelEntityOne, ModelRelation modelRelationTwo, ModelEntity modelEntityTwo, java.util.List<java.lang.String> orderBy)
GenericValue
findByPrimaryKey(GenericPK primaryKey)
Find a Generic Entity by its Primary KeyGenericValue
findByPrimaryKeyPartial(GenericPK primaryKey, java.util.Set<java.lang.String> keys)
Find a Generic Entity by its Primary Key and only returns the values requested by the passed keys (names)long
findCountByCondition(Delegator delegator, ModelEntity modelEntity, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, java.util.List<ModelField> selectFields, EntityFindOptions findOptions)
long
findCountByCondition(Delegator delegator, ModelEntity modelEntity, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, EntityFindOptions findOptions)
EntityListIterator
findListIteratorByCondition(Delegator delegator, ModelEntity modelEntity, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, java.util.Collection<java.lang.String> fieldsToSelect, java.util.List<java.lang.String> orderBy, EntityFindOptions findOptions)
Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.java.lang.String
getHelperName()
Gets the name of the server configuration that corresponds to this helperint
removeByCondition(Delegator delegator, ModelEntity modelEntity, EntityCondition condition)
Removes/deletes Generic Entity records found by all the specified conditionint
removeByPrimaryKey(GenericPK primaryKey)
Remove a Generic Entity corresponding to the primaryKeyint
store(GenericValue value)
Store the Entity from the GenericValue to the persistent storeint
storeByCondition(Delegator delegator, ModelEntity modelEntity, java.util.Map<java.lang.String,? extends java.lang.Object> fieldsToSet, EntityCondition condition)
Stores a group of values in a single query
-
-
-
Method Detail
-
getHelperName
java.lang.String getHelperName()
Gets the name of the server configuration that corresponds to this helper- Returns:
- server configuration name
-
create
GenericValue create(GenericValue value) throws GenericEntityException
Creates a Entity in the form of a GenericValue and write it to the database- Returns:
- GenericValue instance containing the new instance
- Throws:
GenericEntityException
-
findByPrimaryKey
GenericValue findByPrimaryKey(GenericPK primaryKey) throws GenericEntityException
Find a Generic Entity by its Primary Key- Parameters:
primaryKey
- The primary key to find by.- Returns:
- The GenericValue corresponding to the primaryKey
- Throws:
GenericEntityException
-
findByPrimaryKeyPartial
GenericValue findByPrimaryKeyPartial(GenericPK primaryKey, java.util.Set<java.lang.String> keys) throws GenericEntityException
Find a Generic Entity by its Primary Key and only returns the values requested by the passed keys (names)- Parameters:
primaryKey
- The primary key to find by.keys
- The keys, or names, of the values to retrieve; only these values will be retrieved- Returns:
- The GenericValue corresponding to the primaryKey
- Throws:
GenericEntityException
-
findAllByPrimaryKeys
java.util.List<GenericValue> findAllByPrimaryKeys(java.util.List<GenericPK> primaryKeys) throws GenericEntityException
Find a number of Generic Value objects by their Primary Keys, all at once- Parameters:
primaryKeys
- A List of primary keys to find by.- Returns:
- List of GenericValue objects corresponding to the passed primaryKey objects
- Throws:
GenericEntityException
-
removeByPrimaryKey
int removeByPrimaryKey(GenericPK primaryKey) throws GenericEntityException
Remove a Generic Entity corresponding to the primaryKey- Parameters:
primaryKey
- The primary key of the entity to remove.- Returns:
- int representing number of rows effected by this operation
- Throws:
GenericEntityException
-
findByMultiRelation
java.util.List<GenericValue> findByMultiRelation(GenericValue value, ModelRelation modelRelationOne, ModelEntity modelEntityOne, ModelRelation modelRelationTwo, ModelEntity modelEntityTwo, java.util.List<java.lang.String> orderBy) throws GenericEntityException
- Throws:
GenericEntityException
-
findListIteratorByCondition
EntityListIterator findListIteratorByCondition(Delegator delegator, ModelEntity modelEntity, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, java.util.Collection<java.lang.String> fieldsToSelect, java.util.List<java.lang.String> orderBy, EntityFindOptions findOptions) throws GenericEntityException
Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.- Parameters:
modelEntity
- The ModelEntity of the Entity as defined in the entity XML filewhereEntityCondition
- The EntityCondition object that specifies how to constrain this query before any groupings are done (if this is a view entity with group-by aliases)havingEntityCondition
- The EntityCondition object that specifies how to constrain this query after any groupings are done (if this is a view entity with group-by aliases)fieldsToSelect
- The fields of the named entity to get from the database; if empty or null all fields will be retreivedorderBy
- The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descendingfindOptions
- An instance of EntityFindOptions that specifies advanced query options. See the EntityFindOptions JavaDoc for more details.- Returns:
- EntityListIterator representing the result of the query: NOTE THAT THIS MUST BE CLOSED WHEN YOU ARE DONE WITH IT (preferably in a finally block), AND DON'T LEAVE IT OPEN TOO LONG BECAUSE IT WILL MAINTAIN A DATABASE CONNECTION.
- Throws:
GenericEntityException
-
findCountByCondition
long findCountByCondition(Delegator delegator, ModelEntity modelEntity, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, EntityFindOptions findOptions) throws GenericEntityException
- Throws:
GenericEntityException
-
findCountByCondition
long findCountByCondition(Delegator delegator, ModelEntity modelEntity, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, java.util.List<ModelField> selectFields, EntityFindOptions findOptions) throws GenericEntityException
- Throws:
GenericEntityException
-
removeByCondition
int removeByCondition(Delegator delegator, ModelEntity modelEntity, EntityCondition condition) throws GenericEntityException
Removes/deletes Generic Entity records found by all the specified condition- Parameters:
modelEntity
- The ModelEntity of the Entity as defined in the entity XML filecondition
- The condition that restricts the list of removed values- Returns:
- int representing number of rows effected by this operation
- Throws:
GenericEntityException
-
storeByCondition
int storeByCondition(Delegator delegator, ModelEntity modelEntity, java.util.Map<java.lang.String,? extends java.lang.Object> fieldsToSet, EntityCondition condition) throws GenericEntityException
Stores a group of values in a single query- Parameters:
modelEntity
- The ModelEntity of the Entity as defined in the entity XML filefieldsToSet
- The fields of the named entity to set in the databasecondition
- The condition that restricts the list of updated values- Returns:
- int representing number of rows effected by this operation
- Throws:
GenericEntityException
-
store
int store(GenericValue value) throws GenericEntityException
Store the Entity from the GenericValue to the persistent store- Parameters:
value
- GenericValue instance containing the entity- Returns:
- int representing number of rows effected by this operation
- Throws:
GenericEntityException
-
checkDataSource
void checkDataSource(java.util.Map<java.lang.String,ModelEntity> modelEntities, java.util.List<java.lang.String> messages, boolean addMissing) throws GenericEntityException
Check the datasource to make sure the entity definitions are correct, optionally adding missing entities or fields on the server- Parameters:
modelEntities
- Map of entityName names and ModelEntity valuesmessages
- List to put any result messages inaddMissing
- Flag indicating whether or not to add missing entities and fields on the server- Throws:
GenericEntityException
-
-