Class ReadOnlyHelperDAO
- java.lang.Object
-
- org.apache.ofbiz.entity.datasource.ReadOnlyHelperDAO
-
- All Implemented Interfaces:
GenericHelper
public class ReadOnlyHelperDAO extends java.lang.Object implements GenericHelper
Read Only Entity Helper Class
-
-
Field Summary
Fields Modifier and Type Field Description protected GenericDAO
genericDAO
protected GenericHelperInfo
helperInfo
static java.lang.String
module
-
Constructor Summary
Constructors Constructor Description ReadOnlyHelperDAO(GenericHelperInfo helperInfo)
-
Method Summary
All Methods Instance Methods Concrete 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)
Read only, no creation realize on the databasejava.util.List<GenericValue>
findAllByPrimaryKeys(java.util.List<GenericPK> primaryKeys)
Find a number of Generic Value objects by their Primary Keys, all at once This is done here for the DAO GenericHelper; for a client-server helper it would be done on the server side to reduce network round trips.java.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)
Read only, no remove realize on the databaseint
removeByPrimaryKey(GenericPK primaryKey)
Read only, no remove realize on the databaseint
store(GenericValue value)
Read only, no store realize on the databaseint
storeByCondition(Delegator delegator, ModelEntity modelEntity, java.util.Map<java.lang.String,? extends java.lang.Object> fieldsToSet, EntityCondition condition)
Read only, no store realize on the database
-
-
-
Field Detail
-
module
public static final java.lang.String module
-
genericDAO
protected GenericDAO genericDAO
-
helperInfo
protected GenericHelperInfo helperInfo
-
-
Constructor Detail
-
ReadOnlyHelperDAO
public ReadOnlyHelperDAO(GenericHelperInfo helperInfo)
-
-
Method Detail
-
getHelperName
public java.lang.String getHelperName()
Description copied from interface:GenericHelper
Gets the name of the server configuration that corresponds to this helper- Specified by:
getHelperName
in interfaceGenericHelper
- Returns:
- server configuration name
-
create
public GenericValue create(GenericValue value) throws GenericEntityException
Read only, no creation realize on the database- Specified by:
create
in interfaceGenericHelper
- Returns:
- null
- Throws:
GenericEntityException
-
findByPrimaryKey
public GenericValue findByPrimaryKey(GenericPK primaryKey) throws GenericEntityException
Find a Generic Entity by its Primary Key- Specified by:
findByPrimaryKey
in interfaceGenericHelper
- Parameters:
primaryKey
- The primary key to find by.- Returns:
- The GenericValue corresponding to the primaryKey
- Throws:
GenericEntityException
-
findByPrimaryKeyPartial
public 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)- Specified by:
findByPrimaryKeyPartial
in interfaceGenericHelper
- 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
public 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 This is done here for the DAO GenericHelper; for a client-server helper it would be done on the server side to reduce network round trips.- Specified by:
findAllByPrimaryKeys
in interfaceGenericHelper
- Parameters:
primaryKeys
- A List of primary keys to find by.- Returns:
- List of GenericValue objects corresponding to the passed primaryKey objects
- Throws:
GenericEntityException
-
removeByPrimaryKey
public int removeByPrimaryKey(GenericPK primaryKey) throws GenericEntityException
Read only, no remove realize on the database- Specified by:
removeByPrimaryKey
in interfaceGenericHelper
- Parameters:
primaryKey
- The primary key of the entity to remove.- Returns:
- 0
- Throws:
GenericEntityException
-
findListIteratorByCondition
public 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.- Specified by:
findListIteratorByCondition
in interfaceGenericHelper
- 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, AND DON'T LEAVE IT OPEN TOO LONG BEACUSE IT WILL MAINTAIN A DATABASE CONNECTION.
- Throws:
GenericEntityException
-
findByMultiRelation
public java.util.List<GenericValue> findByMultiRelation(GenericValue value, ModelRelation modelRelationOne, ModelEntity modelEntityOne, ModelRelation modelRelationTwo, ModelEntity modelEntityTwo, java.util.List<java.lang.String> orderBy) throws GenericEntityException
- Specified by:
findByMultiRelation
in interfaceGenericHelper
- Throws:
GenericEntityException
-
findCountByCondition
public long findCountByCondition(Delegator delegator, ModelEntity modelEntity, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, EntityFindOptions findOptions) throws GenericEntityException
- Specified by:
findCountByCondition
in interfaceGenericHelper
- Throws:
GenericEntityException
-
findCountByCondition
public long findCountByCondition(Delegator delegator, ModelEntity modelEntity, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, java.util.List<ModelField> selectFields, EntityFindOptions findOptions) throws GenericEntityException
- Specified by:
findCountByCondition
in interfaceGenericHelper
- Throws:
GenericEntityException
-
removeByCondition
public int removeByCondition(Delegator delegator, ModelEntity modelEntity, EntityCondition condition) throws GenericEntityException
Read only, no remove realize on the database- Specified by:
removeByCondition
in interfaceGenericHelper
modelEntity
- The ModelEntity of the Entity as defined in the entity XML filecondition
- The condition that restricts the list of removed values- Returns:
- 0
- Throws:
GenericEntityException
-
store
public int store(GenericValue value) throws GenericEntityException
Read only, no store realize on the database- Specified by:
store
in interfaceGenericHelper
- Parameters:
value
- GenericValue instance containing the entity- Returns:
- 0
- Throws:
GenericEntityException
-
storeByCondition
public int storeByCondition(Delegator delegator, ModelEntity modelEntity, java.util.Map<java.lang.String,? extends java.lang.Object> fieldsToSet, EntityCondition condition) throws GenericEntityException
Read only, no store realize on the database- Specified by:
storeByCondition
in interfaceGenericHelper
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:
- 0
- Throws:
GenericEntityException
-
checkDataSource
public 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- Specified by:
checkDataSource
in interfaceGenericHelper
- 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 by force to false on read only mode- Throws:
GenericEntityException
-
-