You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2015/09/20 10:37:52 UTC

svn commit: r1704108 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: Delegator.java GenericDelegator.java util/EntitySaxReader.java util/EntityStoreOptions.java

Author: jleroux
Date: Sun Sep 20 08:37:51 2015
New Revision: 1704108

URL: http://svn.apache.org/viewvc?rev=1704108&view=rev
Log:
A patch from Martin Becker from a Gareth Carter's idea for "Fix deprecation issues in framework/entity" https://issues.apache.org/jira/browse/OFBIZ-5361

As reported Adam:
It appears that the storeAll() variants are being refactor; basically, the useCache parameter is being removed.  However, this has caused the entity engine to have deprecation with itself.

Gareth suggested:
What about new method that allows passing in an options object
storeAll(List<GenericValue> values, StoreOptions options) ?
You can deprecate the old methods without changes
Moving forward, you would just need to add new values to the StoreOptions class rather than adding new parameters to the existing one
I am not sure about the name StoreOptions though, EntityOptions ?

Martin contributed the implementation and suggested EntityStoreOptions for the new class name.
Ha created a patch which removes the use of deprecated API and the deprecated API itself from Delegator and GenericDelegator.
Introduced the EntityStoreOptions class as mentioned in a comment before to substitute the createDummyFks parameter of storeAll method to avoid ambiguous API after removing the deprecated doCacheClear parameter.
The decryptFieldValue method, just defined deprecated by Jacopo is left there as deprecated. Only the "old" deprecated methods where removed.

Gil Portenseigne supplied a pure svn patch, actually I had conflicting pending changes locally which prevented me to apply Martin's original patch

Added:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityStoreOptions.java   (with props)
Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java?rev=1704108&r1=1704107&r2=1704108&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java Sun Sep 20 08:37:51 2015
@@ -42,6 +42,7 @@ import org.ofbiz.entity.util.Distributed
 import org.ofbiz.entity.util.EntityCrypto;
 import org.ofbiz.entity.util.EntityFindOptions;
 import org.ofbiz.entity.util.EntityListIterator;
+import org.ofbiz.entity.util.EntityStoreOptions;
 import org.ofbiz.entity.util.SequenceUtil;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -157,22 +158,6 @@ public interface Delegator {
      * Creates a Entity in the form of a GenericValue and write it to the
      * datasource
      *
-     * @param primaryKey
-     *            The GenericPK to create a value in the datasource from
-     * @param doCacheClear
-     *            boolean that specifies whether or not to automatically clear
-     *            cache entries related to this operation. This should always be
-     *            <code>true</code> - otherwise you will lose data integrity.
-     * @return GenericValue instance containing the new instance
-     * @deprecated use {@link #create(GenericPK primaryKey)}
-     */
-    @Deprecated
-    GenericValue create(GenericPK primaryKey, boolean doCacheClear) throws GenericEntityException;
-
-    /**
-     * Creates a Entity in the form of a GenericValue and write it to the
-     * datasource
-     *
      * @param value
      *            The GenericValue to create a value in the datasource from
      * @return GenericValue instance containing the new instance
@@ -181,22 +166,6 @@ public interface Delegator {
 
     /**
      * Creates a Entity in the form of a GenericValue and write it to the
-     * datasource
-     *
-     * @param value
-     *            The GenericValue to create a value in the datasource from
-     * @param doCacheClear
-     *            boolean that specifies whether or not to automatically clear
-     *            cache entries related to this operation. This should always be
-     *            <code>true</code> - otherwise you will lose data integrity.
-     * @return GenericValue instance containing the new instance
-     * @deprecated use {@link #create(GenericValue value)}
-     */
-    @Deprecated
-    GenericValue create(GenericValue value, boolean doCacheClear) throws GenericEntityException;
-
-    /**
-     * Creates a Entity in the form of a GenericValue and write it to the
      * database
      *
      * @return GenericValue instance containing the new instance
@@ -222,22 +191,6 @@ public interface Delegator {
     GenericValue createOrStore(GenericValue value) throws GenericEntityException;
 
     /**
-     * Creates or stores an Entity
-     *
-     * @param value
-     *            The GenericValue instance containing the new or existing
-     *            instance
-     * @param doCacheClear
-     *            boolean that specifies whether or not to automatically clear
-     *            cache entries related to this operation. This should always be
-     *            <code>true</code> - otherwise you will lose data integrity.
-     * @return GenericValue instance containing the new or updated instance
-     * @deprecated use {@link #createOrStore(GenericValue value)}
-     */
-    @Deprecated
-    GenericValue createOrStore(GenericValue value, boolean doCacheClear) throws GenericEntityException;
-
-    /**
      * Sets the sequenced ID (for entity with one primary key field ONLY), and
      * then does a create in the database as normal. The reason to do it this
      * way is that it will retry and fix the sequence if somehow the sequencer
@@ -258,31 +211,15 @@ public interface Delegator {
     GenericValue createSingle(String entityName, Object singlePkValue) throws GenericEntityException;
 
     @Deprecated
-    void decryptFields(GenericEntity entity) throws GenericEntityException;
-
-    @Deprecated
-    void decryptFields(List<? extends GenericEntity> entities) throws GenericEntityException;
-
-    @Deprecated
-    void encryptFields(GenericEntity entity) throws GenericEntityException;
-
-    @Deprecated
-    void encryptFields(List<? extends GenericEntity> entities) throws GenericEntityException;
-
-    @Deprecated
     Object decryptFieldValue(String entityName, String encValue) throws EntityCryptoException;
 
     Object decryptFieldValue(String entityName, ModelField.EncryptMethod encryptMethod, String encValue) throws EntityCryptoException;
 
-    @Deprecated
-    Object encryptFieldValue(String entityName, Object fieldValue) throws EntityCryptoException;
-
     Object encryptFieldValue(String entityName, ModelField.EncryptMethod encryptMethod, Object fieldValue) throws EntityCryptoException;
 
     /**
      * Finds GenericValues by the conditions specified in the EntityCondition
-     * object, the the EntityCondition javadoc for more details. NOTE 20080502:
-     * 3 references
+     * object, the the EntityCondition javadoc for more details.
      *
      * @param entityName
      *            The name of the Entity as defined in the entity XML file
@@ -324,91 +261,6 @@ public interface Delegator {
 
     /**
      * Finds Generic Entity records by all of the specified fields (ie: combined
-     * using AND) NOTE 20080502: 264 references
-     *
-     * @param entityName
-     *            The Name of the Entity as defined in the entity XML file
-     * @param fields
-     *            The fields of the named entity to query by with their
-     *            corresponding values
-     * @return List of GenericValue instances that match the query
-     * @deprecated use {@link #findByAnd(String, Map, List, boolean)}
-     */
-    @Deprecated
-    List<GenericValue> findByAnd(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException;
-
-    /**
-     * Finds Generic Entity records by all of the specified fields (ie: combined
-     * using AND) NOTE 20080502: 72 references
-     *
-     * @param entityName
-     *            The Name of the Entity as defined in the entity XML file
-     * @param fields
-     *            The fields of the named entity to query by with their
-     *            corresponding values
-     * @param orderBy
-     *            The fields of the named entity to order the query by;
-     *            optionally add a " ASC" for ascending or " DESC" for
-     *            descending
-     * @return List of GenericValue instances that match the query
-     * @deprecated use {@link #findByAnd(String, Map, List, boolean)}
-     */
-    @Deprecated
-    List<GenericValue> findByAnd(String entityName, Map<String, ? extends Object> fields, List<String> orderBy) throws GenericEntityException;
-
-    /**
-     * Finds Generic Entity records by all of the specified fields (ie: combined
-     * using AND) NOTE 20080502: 1 references
-     *
-     * @param entityName
-     *            The Name of the Entity as defined in the entity XML file
-     * @param fields
-     *            The fields of the named entity to query by with their
-     *            corresponding values
-     * @return List of GenericValue instances that match the query
-     * @deprecated use {@link #findByAnd(String, Map, List, boolean)}
-     */
-    @Deprecated
-    List<GenericValue> findByAnd(String entityName, Object... fields) throws GenericEntityException;
-
-    /**
-     * Finds Generic Entity records by all of the specified fields (ie: combined
-     * using AND), looking first in the cache; uses orderBy for lookup, but only
-     * keys results on the entityName and fields NOTE 20080502: 91 references
-     *
-     * @param entityName
-     *            The Name of the Entity as defined in the entity XML file
-     * @param fields
-     *            The fields of the named entity to query by with their
-     *            corresponding values
-     * @return List of GenericValue instances that match the query
-     * @deprecated use {@link #findByAnd(String, Map, List, boolean)}
-     */
-    @Deprecated
-    List<GenericValue> findByAndCache(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException;
-
-    /**
-     * Finds Generic Entity records by all of the specified fields (ie: combined
-     * using AND), looking first in the cache; uses orderBy for lookup, but only
-     * keys results on the entityName and fields NOTE 20080502: 56 references
-     *
-     * @param entityName
-     *            The Name of the Entity as defined in the entity XML file
-     * @param fields
-     *            The fields of the named entity to query by with their
-     *            corresponding values
-     * @param orderBy
-     *            The fields of the named entity to order the query by;
-     *            optionally add a " ASC" for ascending or " DESC" for
-     *            descending
-     * @return List of GenericValue instances that match the query
-     * @deprecated use {@link #findByAnd(String, Map, List, boolean)}
-     */
-    @Deprecated
-    List<GenericValue> findByAndCache(String entityName, Map<String, ? extends Object> fields, List<String> orderBy) throws GenericEntityException;
-
-    /**
-     * Finds Generic Entity records by all of the specified fields (ie: combined
      * using AND), looking first in the cache; uses orderBy for lookup, but only
      * keys results on the entityName and fields
      *
@@ -428,54 +280,8 @@ public interface Delegator {
     List<GenericValue> findByAnd(String entityName, Map<String, ? extends Object> fields, List<String> orderBy, boolean useCache) throws GenericEntityException;
 
     /**
-     * Find a Generic Entity by its Primary Key NOTE 20080502: 550 references
-     * (20080503 521 left); needs to be deprecated, should use findOne instead,
-     * but lots of stuff to replace!
-     *
-     * @param entityName
-     *            The Name of the Entity as defined in the entity XML file
-     * @param fields
-     *            The fields of the named entity to query by with their
-     *            corresponding values
-     * @return The GenericValue corresponding to the primaryKey
-     * @deprecated use {@link #findOne(String, Map, boolean)}
-     */
-    @Deprecated
-    GenericValue findByPrimaryKey(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException;
-
-    /**
-     * Find a CACHED Generic Entity by its Primary Key NOTE 20080502: 218
-     * references
-     *
-     * @param entityName
-     *            The Name of the Entity as defined in the entity XML file
-     * @param fields
-     *            The fields of the named entity to query by with their
-     *            corresponding values
-     * @return The GenericValue corresponding to the primaryKey
-     * @deprecated use {@link #findOne(String, Map, boolean)}
-     */
-    @Deprecated
-    GenericValue findByPrimaryKeyCache(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException;
-
-    /**
-     * Find a CACHED Generic Entity by its Primary Key NOTE 20080502: 2
-     * references
-     *
-     * @param entityName
-     *            The Name of the Entity as defined in the entity XML file
-     * @param fields
-     *            The fields of the named entity to query by with their
-     *            corresponding values
-     * @return The GenericValue corresponding to the primaryKey
-     * @deprecated use {@link #findOne(String, boolean, Object...)}
-     */
-    @Deprecated
-    GenericValue findByPrimaryKeyCache(String entityName, Object... fields) throws GenericEntityException;
-
-    /**
      * Find a Generic Entity by its Primary Key and only returns the values
-     * requested by the passed keys (names) NOTE 20080502: 3 references
+     * requested by the passed keys (names).
      *
      * @param primaryKey
      *            The primary key to find by.
@@ -487,14 +293,20 @@ public interface Delegator {
     GenericValue findByPrimaryKeyPartial(GenericPK primaryKey, Set<String> keys) throws GenericEntityException;
 
     /**
-     * NOTE 20080502: 2 references
+     * Gets the hit count of GenericValues for the given EntityCondition objects.
+     * 
+     * @param entityName
+     * @param whereEntityCondition
+     * @param havingEntityCondition
+     * @param findOptions
+     * @return long value with hit count
+     * @throws GenericEntityException
      */
     long findCountByCondition(String entityName, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, EntityFindOptions findOptions) throws GenericEntityException;
 
     /**
      * Finds GenericValues by the conditions specified in the EntityCondition
-     * object, the the EntityCondition javadoc for more details. NOTE 20080502:
-     * 12 references
+     * object, the the EntityCondition javadoc for more details.
      *
      * @param entityName
      *            The name of the Entity as defined in the entity XML file
@@ -518,8 +330,7 @@ public interface Delegator {
 
     /**
      * Finds GenericValues by the conditions specified in the EntityCondition
-     * object, the the EntityCondition javadoc for more details. NOTE 20080502:
-     * 9 references
+     * object, the the EntityCondition javadoc for more details.
      *
      * @param dynamicViewEntity
      *            The DynamicViewEntity to use for the entity model for this
@@ -561,7 +372,7 @@ public interface Delegator {
     GenericValue findOne(String entityName, boolean useCache, Object... fields) throws GenericEntityException;
 
     /**
-     * Find a Generic Entity by its Primary Key NOTE 20080502: 6 references
+     * Find a Generic Entity by its Primary Key
      *
      * @param entityName
      *            The Name of the Entity as defined in the entity XML file
@@ -720,7 +531,7 @@ public interface Delegator {
     /**
      * Get the named Related Entity for the GenericValue from the persistent
      * store across another Relation. Helps to get related Values in a
-     * multi-to-multi relationship. NOTE 20080502: 3 references
+     * multi-to-multi relationship.
      *
      * @param relationNameOne
      *            String containing the relation name which is the combination
@@ -799,47 +610,6 @@ public interface Delegator {
 
     /**
      * Get the named Related Entity for the GenericValue from the persistent
-     * store NOTE 20080502: 5 references
-     *
-     * @param relationName
-     *            String containing the relation name which is the combination
-     *            of relation.title and relation.rel-entity-name as specified in
-     *            the entity XML definition file
-     * @param byAndFields
-     *            the fields that must equal in order to keep; may be null
-     * @param orderBy
-     *            The fields of the named entity to order the query by; may be
-     *            null; optionally add a " ASC" for ascending or " DESC" for
-     *            descending
-     * @param value
-     *            GenericValue instance containing the entity
-     * @return List of GenericValue instances as specified in the relation
-     *         definition
-     * @deprecated use {@link #getRelated(String, Map, List, GenericValue, boolean)}
-     */
-    @Deprecated
-    List<GenericValue> getRelated(String relationName, Map<String, ? extends Object> byAndFields, List<String> orderBy, GenericValue value) throws GenericEntityException;
-
-    /**
-     * Get the named Related Entity for the GenericValue from the persistent
-     * store, checking first in the cache to see if the desired value is there
-     * NOTE 20080502: 4 references
-     *
-     * @param relationName
-     *            String containing the relation name which is the combination
-     *            of relation.title and relation.rel-entity-name as specified in
-     *            the entity XML definition file
-     * @param value
-     *            GenericValue instance containing the entity
-     * @return List of GenericValue instances as specified in the relation
-     *         definition
-     * @deprecated use {@link #getRelated(String, Map, List, GenericValue, boolean)}
-     */
-    @Deprecated
-    List<GenericValue> getRelatedCache(String relationName, GenericValue value) throws GenericEntityException;
-
-    /**
-     * Get the named Related Entity for the GenericValue from the persistent
      * store
      *
      * @param relationName
@@ -862,8 +632,7 @@ public interface Delegator {
     List<GenericValue> getRelated(String relationName, Map<String, ? extends Object> byAndFields, List<String> orderBy, GenericValue value, boolean useCache) throws GenericEntityException;
 
     /**
-     * Get a dummy primary key for the named Related Entity for the GenericValue
-     * NOTE 20080502: 2 references
+     * Get a dummy primary key for the named Related Entity for the GenericValue.
      *
      * @param relationName
      *            String containing the relation name which is the combination
@@ -879,29 +648,6 @@ public interface Delegator {
     GenericPK getRelatedDummyPK(String relationName, Map<String, ? extends Object> byAndFields, GenericValue value) throws GenericEntityException;
 
     /**
-     * Get related entity where relation is of type one, uses findOne
-     * NOTE 20080502: 7 references
-     *
-     * @throws IllegalArgumentException
-     *             if the list found has more than one item
-     * @deprecated use {@link #getRelatedOne(String, GenericValue, boolean)}
-     */
-    @Deprecated
-    GenericValue getRelatedOne(String relationName, GenericValue value) throws GenericEntityException;
-
-    /**
-     * Get related entity where relation is of type one, uses findOne
-     * checking first in the cache to see if the desired value is there NOTE
-     * 20080502: 1 references
-     *
-     * @throws IllegalArgumentException
-     *             if the list found has more than one item
-     * @deprecated use {@link #getRelatedOne(String, GenericValue, boolean)}
-     */
-    @Deprecated
-    GenericValue getRelatedOneCache(String relationName, GenericValue value) throws GenericEntityException;
-
-    /**
      * Get related entity where relation is of type one, uses findByPrimaryKey
      *
      * @param relationName
@@ -982,20 +728,6 @@ public interface Delegator {
     void refresh(GenericValue value) throws GenericEntityException;
 
     /**
-     * Refresh the Entity for the GenericValue from the persistent store
-     *
-     * @param value
-     *            GenericValue instance containing the entity to refresh
-     * @param doCacheClear
-     *            boolean that specifies whether or not to automatically clear
-     *            cache entries related to this operation. This should always be
-     *            <code>true</code> - otherwise you will lose data integrity.
-     * @deprecated use {@link #refresh(GenericValue value)}
-     */
-    @Deprecated
-    void refresh(GenericValue value, boolean doCacheClear) throws GenericEntityException;
-
-    /**
      * Refresh the Entity for the GenericValue from the cache
      *
      * @param value
@@ -1024,30 +756,6 @@ public interface Delegator {
      */
     int removeAll(List<? extends GenericEntity> dummyPKs) throws GenericEntityException;
 
-    /**
-     * Remove the Entities from the List from the persistent store. <br/>The
-     * List contains GenericEntity objects, can be either GenericPK or
-     * GenericValue. <br/>If a certain entity contains a complete primary key,
-     * the entity in the datasource corresponding to that primary key will be
-     * removed, this is like a removeByPrimary Key. <br/>On the other hand, if a
-     * certain entity is an incomplete or non primary key, if will behave like
-     * the removeByAnd method. <br/>These updates all happen in one transaction,
-     * so they will either all succeed or all fail, if the data source supports
-     * transactions.
-     *
-     * @param dummyPKs
-     *            Collection of GenericEntity instances containing the entities
-     *            or by and fields to remove
-     * @param doCacheClear
-     *            boolean that specifies whether or not to automatically clear
-     *            cache entries related to this operation. This should always be
-     *            <code>true</code> - otherwise you will lose data integrity.
-     * @return int representing number of rows effected by this operation
-     * @deprecated use {@link #removeAll(List<? extends GenericEntity> dummyPKs)}
-     */
-    @Deprecated
-    int removeAll(List<? extends GenericEntity> dummyPKs, boolean doCacheClear) throws GenericEntityException;
-
     int removeAll(String entityName) throws GenericEntityException;
 
     /**
@@ -1056,23 +764,6 @@ public interface Delegator {
      *
      * @param entityName
      *            The Name of the Entity as defined in the entity XML file
-     * @param doCacheClear
-     *            boolean that specifies whether or not to automatically clear
-     *            cache entries related to this operation. This should always be
-     *            <code>true</code> - otherwise you will lose data integrity.
-     * @param fields
-     *            The fields of the named entity to query by with their
-     *            corresponding values
-     * @return int representing number of rows effected by this operation
-     */
-    int removeByAnd(String entityName, boolean doCacheClear, Object... fields) throws GenericEntityException;
-
-    /**
-     * Removes/deletes Generic Entity records found by all of the specified
-     * fields (ie: combined using AND)
-     *
-     * @param entityName
-     *            The Name of the Entity as defined in the entity XML file
      * @param fields
      *            The fields of the named entity to query by with their
      *            corresponding values
@@ -1089,25 +780,6 @@ public interface Delegator {
      * @param fields
      *            The fields of the named entity to query by with their
      *            corresponding values
-     * @param doCacheClear
-     *            boolean that specifies whether or not to automatically clear
-     *            cache entries related to this operation. This should always be
-     *            <code>true</code> - otherwise you will lose data integrity.
-     * @return int representing number of rows effected by this operation
-     * @deprecated use {@link #removeByAnd(String entityName, Map<String, ? extends Object> fields)}
-     */
-    @Deprecated
-    int removeByAnd(String entityName, Map<String, ? extends Object> fields, boolean doCacheClear) throws GenericEntityException;
-
-    /**
-     * Removes/deletes Generic Entity records found by all of the specified
-     * fields (ie: combined using AND)
-     *
-     * @param entityName
-     *            The Name of the Entity as defined in the entity XML file
-     * @param fields
-     *            The fields of the named entity to query by with their
-     *            corresponding values
      * @return int representing number of rows effected by this operation
      */
     int removeByAnd(String entityName, Object... fields) throws GenericEntityException;
@@ -1124,23 +796,6 @@ public interface Delegator {
     int removeByCondition(String entityName, EntityCondition condition) throws GenericEntityException;
 
     /**
-     * Removes/deletes Generic Entity records found by the condition
-     *
-     * @param entityName
-     *            The Name of the Entity as defined in the entity XML file
-     * @param condition
-     *            The condition used to restrict the removing
-     * @param doCacheClear
-     *            boolean that specifies whether or not to automatically clear
-     *            cache entries related to this operation. This should always be
-     *            <code>true</code> - otherwise you will lose data integrity.
-     * @return int representing number of rows effected by this operation
-     * @deprecated use {@link #removeByCondition(String entityName, EntityCondition condition)}
-     */
-    @Deprecated
-    int removeByCondition(String entityName, EntityCondition condition, boolean doCacheClear) throws GenericEntityException;
-
-    /**
      * Remove a Generic Entity corresponding to the primaryKey
      *
      * @param primaryKey
@@ -1150,21 +805,6 @@ public interface Delegator {
     int removeByPrimaryKey(GenericPK primaryKey) throws GenericEntityException;
 
     /**
-     * Remove a Generic Entity corresponding to the primaryKey
-     *
-     * @param primaryKey
-     *            The primary key of the entity to remove.
-     * @param doCacheClear
-     *            boolean that specifies whether or not to automatically clear
-     *            cache entries related to this operation. This should always be
-     *            <code>true</code> - otherwise you will lose data integrity.
-     * @return int representing number of rows effected by this operation
-     * @deprecated use {@link #removeByPrimaryKey(GenericPK primaryKey)} 
-     */
-    @Deprecated
-    int removeByPrimaryKey(GenericPK primaryKey, boolean doCacheClear) throws GenericEntityException;
-
-    /**
      * Remove the named Related Entity for the GenericValue from the persistent
      * store
      *
@@ -1179,26 +819,6 @@ public interface Delegator {
     int removeRelated(String relationName, GenericValue value) throws GenericEntityException;
 
     /**
-     * Remove the named Related Entity for the GenericValue from the persistent
-     * store
-     *
-     * @param relationName
-     *            String containing the relation name which is the combination
-     *            of relation.title and relation.rel-entity-name as specified in
-     *            the entity XML definition file
-     * @param value
-     *            GenericValue instance containing the entity
-     * @param doCacheClear
-     *            boolean that specifies whether or not to automatically clear
-     *            cache entries related to this operation. This should always be
-     *            <code>true</code> - otherwise you will lose data integrity.
-     * @return int representing number of rows effected by this operation
-     * @deprecated use {@link #removeRelated(String relationName, GenericValue value)}
-     */
-    @Deprecated
-    int removeRelated(String relationName, GenericValue value, boolean doCacheClear) throws GenericEntityException;
-
-    /**
      * Remove a Generic Value from the database
      *
      * @param value
@@ -1207,21 +827,6 @@ public interface Delegator {
      */
     int removeValue(GenericValue value) throws GenericEntityException;
 
-    /**
-     * Remove a Generic Value from the database
-     *
-     * @param value
-     *            The GenericValue object of the entity to remove.
-     * @param doCacheClear
-     *            boolean that specifies whether or not to automatically clear
-     *            cache entries related to this operation. This should always be
-     *            <code>true</code> - otherwise you will lose data integrity.
-     * @return int representing number of rows effected by this operation
-     * @deprecated use {@link #removeValue(GenericValue value)} 
-     */
-    @Deprecated
-    int removeValue(GenericValue value, boolean doCacheClear) throws GenericEntityException;
-
     void rollback();
 
     void setDistributedCacheClear(DistributedCacheClear distributedCacheClear);
@@ -1253,21 +858,6 @@ public interface Delegator {
     int store(GenericValue value) throws GenericEntityException;
 
     /**
-     * Store the Entity from the GenericValue to the persistent store
-     *
-     * @param value
-     *            GenericValue instance containing the entity
-     * @param doCacheClear
-     *            boolean that specifies whether or not to automatically clear
-     *            cache entries related to this operation. This should always be
-     *            <code>true</code> - otherwise you will lose data integrity.
-     * @return int representing number of rows effected by this operation
-     * @deprecated use {@link #store(GenericValue value)} 
-     */
-    @Deprecated
-    int store(GenericValue value, boolean doCacheClear) throws GenericEntityException;
-
-    /**
      * Store the Entities from the List GenericValue instances to the persistent
      * store. <br/>This is different than the normal store method in that the
      * store method only does an update, while the storeAll method checks to see
@@ -1294,43 +884,16 @@ public interface Delegator {
      * transactions. This is just like to othersToStore feature of the
      * GenericEntity on a create or store.
      *
+     * @param storeOptions
+     *            An instance of EntityStoreOptions that specifies advanced store
+     *            options or null for default values.
+     *            See the EntityStoreOptions JavaDoc for more details.
      * @param values
      *            List of GenericValue instances containing the entities to
      *            store
-     * @param doCacheClear
-     *            boolean that specifies whether or not to automatically clear
-     *            cache entries related to this operation. This should always be
-     *            <code>true</code> - otherwise you will lose data integrity.
      * @return int representing number of rows effected by this operation
-     * @deprecated use {@link #storeAll(List<GenericValue> values)} 
      */
-    @Deprecated
-    int storeAll(List<GenericValue> values, boolean doCacheClear) throws GenericEntityException;
-
-    /**
-     * Store the Entities from the List GenericValue instances to the persistent
-     * store. <br/>This is different than the normal store method in that the
-     * store method only does an update, while the storeAll method checks to see
-     * if each entity exists, then either does an insert or an update as
-     * appropriate. <br/>These updates all happen in one transaction, so they
-     * will either all succeed or all fail, if the data source supports
-     * transactions. This is just like to othersToStore feature of the
-     * GenericEntity on a create or store.
-     *
-     * @param values
-     *            List of GenericValue instances containing the entities to
-     *            store
-     * @param doCacheClear
-     *            boolean that specifies whether or not to automatically clear
-     *            cache entries related to this operation. This should always be
-     *            <code>true</code> - otherwise you will lose data integrity.
-     * @param createDummyFks
-     *            boolean that specifies whether or not to automatically create
-     *            "dummy" place holder FKs
-     * @return int representing number of rows effected by this operation
-     * @deprecated use {@link #storeAll(GenericValue value, boolean createDummyFks)} 
-     */
-    int storeAll(List<GenericValue> values, boolean doCacheClear, boolean createDummyFks) throws GenericEntityException;
+    int storeAll(List<GenericValue> values, EntityStoreOptions storeOptions) throws GenericEntityException;
 
     /**
      * Store a group of values
@@ -1345,31 +908,10 @@ public interface Delegator {
      * @throws GenericEntityException
      */
     int storeByCondition(String entityName, Map<String, ? extends Object> fieldsToSet, EntityCondition condition) throws GenericEntityException;
-
-    /**
-     * Store a group of values
-     *
-     * @param entityName
-     *            The name of the Entity as defined in the entity XML file
-     * @param fieldsToSet
-     *            The fields of the named entity to set in the database
-     * @param condition
-     *            The condition that restricts the list of stored values
-     * @param doCacheClear
-     *            boolean that specifies whether or not to automatically clear
-     *            cache entries related to this operation. This should always be
-     *            <code>true</code> - otherwise you will lose data integrity.
-     * @return int representing number of rows effected by this operation
-     * @throws GenericEntityException
-     * @deprecated use {@link #storeByCondition(String entityName, Map<String, ? extends Object> fieldsToSet, EntityCondition condition)}
-     */
-    @Deprecated
-    int storeByCondition(String entityName, Map<String, ? extends Object> fieldsToSet, EntityCondition condition, boolean doCacheClear) throws GenericEntityException;
    
     /**
      * Get use of Distributed Cache Clear mechanism status
      * @return boolean true if this delegator uses a Distributed Cache Clear mechanism 
      */
-    boolean useDistributedCacheClear();
-    
+    boolean useDistributedCacheClear();   
 }

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=1704108&r1=1704107&r2=1704108&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Sun Sep 20 08:37:51 2015
@@ -78,6 +78,7 @@ import org.ofbiz.entity.util.EntityCrypt
 import org.ofbiz.entity.util.EntityFindOptions;
 import org.ofbiz.entity.util.EntityListIterator;
 import org.ofbiz.entity.util.EntityQuery;
+import org.ofbiz.entity.util.EntityStoreOptions;
 import org.ofbiz.entity.util.SequenceUtil;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -709,21 +710,11 @@ public class GenericDelegator implements
      */
     @Override
     public GenericValue create(GenericPK primaryKey) throws GenericEntityException {
-        return this.create(primaryKey, true);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#create(org.ofbiz.entity.GenericPK, boolean)
-     * @deprecated use {@link #create(GenericPK primaryKey)}
-     */
-    @Override
-    @Deprecated
-    public GenericValue create(GenericPK primaryKey, boolean doCacheClear) throws GenericEntityException {
         if (primaryKey == null) {
             throw new GenericEntityException("Cannot create from a null primaryKey");
         }
 
-        return this.create(GenericValue.create(primaryKey), doCacheClear);
+        return this.create(GenericValue.create(primaryKey));
     }
 
     /* (non-Javadoc)
@@ -745,7 +736,7 @@ public class GenericDelegator implements
         ModelEntity entity = this.getModelReader().getModelEntity(entityName);
         GenericValue genericValue = GenericValue.create(this, entity, fields);
 
-        return this.create(genericValue, true);
+        return this.create(genericValue);
     }
 
     /* (non-Javadoc)
@@ -759,15 +750,7 @@ public class GenericDelegator implements
         ModelEntity entity = this.getModelReader().getModelEntity(entityName);
         GenericValue genericValue = GenericValue.create(this, entity, singlePkValue);
 
-        return this.create(genericValue, true);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#create(org.ofbiz.entity.GenericValue)
-     */
-    @Override
-    public GenericValue create(GenericValue value) throws GenericEntityException {
-        return this.create(value, true);
+        return this.create(genericValue);
     }
 
     /* (non-Javadoc)
@@ -775,9 +758,6 @@ public class GenericDelegator implements
      */
     @Override
     public GenericValue createSetNextSeqId(GenericValue value) throws GenericEntityException {
-        @Deprecated
-        boolean doCacheClear = true;
-
         if (value == null) {
             throw new GenericEntityException("Cannot create a null value");
         }
@@ -848,12 +828,11 @@ public class GenericDelegator implements
             if (value != null) {
                 value.setDelegator(this);
                 if (value.lockEnabled()) {
-                    refresh(value, doCacheClear);
+                    refresh(value);
                 } else {
-                    if (doCacheClear) {
-                        ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_CLEAR, EntityEcaHandler.OP_CREATE, value, false);
-                        this.clearCacheLine(value);
-                    }
+                    // doCacheClear
+                    ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_CLEAR, EntityEcaHandler.OP_CREATE, value, false);
+                    this.clearCacheLine(value);
                 }
             }
 
@@ -869,12 +848,10 @@ public class GenericDelegator implements
     }
 
     /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#create(org.ofbiz.entity.GenericValue, boolean)
-     * @deprecated use {@link #create(GenericValue value)}
+     * @see org.ofbiz.entity.Delegator#create(org.ofbiz.entity.GenericValue)
      */
     @Override
-    @Deprecated
-    public GenericValue create(GenericValue value, boolean doCacheClear) throws GenericEntityException {
+    public GenericValue create(GenericValue value) throws GenericEntityException {
         boolean beganTransaction = false;
         try {
             if (alwaysUseTransaction) {
@@ -907,12 +884,11 @@ public class GenericDelegator implements
             if (value != null) {
                 value.setDelegator(this);
                 if (value.lockEnabled()) {
-                    refresh(value, doCacheClear);
+                    refresh(value);
                 } else {
-                    if (doCacheClear) {
-                        ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_CLEAR, EntityEcaHandler.OP_CREATE, value, false);
-                        this.clearCacheLine(value);
-                    }
+                    // doCacheClear
+                    ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_CLEAR, EntityEcaHandler.OP_CREATE, value, false);
+                    this.clearCacheLine(value);
                 }
             }
 
@@ -928,12 +904,10 @@ public class GenericDelegator implements
     }
 
     /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#createOrStore(org.ofbiz.entity.GenericValue, boolean)
-     * @deprecated use {@link #createOrStore(GenericValue value)}
+     * @see org.ofbiz.entity.Delegator#createOrStore(org.ofbiz.entity.GenericValue)
      */
     @Override
-    @Deprecated
-    public GenericValue createOrStore(GenericValue value, boolean doCacheClear) throws GenericEntityException {
+    public GenericValue createOrStore(GenericValue value) throws GenericEntityException {
         boolean beganTransaction = false;
         try {
             if (alwaysUseTransaction) {
@@ -942,9 +916,9 @@ public class GenericDelegator implements
 
             GenericValue checkValue = this.findOne(value.getEntityName(), value.getPrimaryKey(), false);
             if (checkValue != null) {
-                this.store(value, doCacheClear);
+                this.store(value);
             } else {
-                this.create(value, doCacheClear);
+                this.create(value);
             }
             if (value.lockEnabled()) {
                 this.refresh(value);
@@ -959,14 +933,6 @@ public class GenericDelegator implements
         }
     }
 
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#createOrStore(org.ofbiz.entity.GenericValue)
-     */
-    @Override
-    public GenericValue createOrStore(GenericValue value) throws GenericEntityException {
-        return createOrStore(value, true);
-    }
-
     protected void saveEntitySyncRemoveInfo(GenericEntity dummyPK) throws GenericEntityException {
         // don't store remove info on entities where it is disabled
         if (dummyPK.getModelEntity().getNoAutoStamp() || this.testRollbackInProgress) {
@@ -1001,17 +967,6 @@ public class GenericDelegator implements
      */
     @Override
     public int removeByPrimaryKey(GenericPK primaryKey) throws GenericEntityException {
-        int retVal = this.removeByPrimaryKey(primaryKey, true);
-        return retVal;
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#removeByPrimaryKey(org.ofbiz.entity.GenericPK, boolean)
-     * @deprecated use {@link #removeByPrimaryKey(GenericPK primaryKey)}
-     */
-    @Override
-    @Deprecated
-    public int removeByPrimaryKey(GenericPK primaryKey, boolean doCacheClear) throws GenericEntityException {
         boolean beganTransaction = false;
         try {
             if (alwaysUseTransaction) {
@@ -1035,10 +990,10 @@ public class GenericDelegator implements
                 removedEntity = this.findOne(primaryKey.getEntityName(), primaryKey, false);
             }
             int num = helper.removeByPrimaryKey(primaryKey);
-            if (doCacheClear) {
-                ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_CLEAR, EntityEcaHandler.OP_REMOVE, primaryKey, false);
-                this.clearCacheLine(primaryKey);
-            }
+
+            // doCacheClear
+            ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_CLEAR, EntityEcaHandler.OP_REMOVE, primaryKey, false);
+            this.clearCacheLine(primaryKey);
 
             this.saveEntitySyncRemoveInfo(primaryKey);
 
@@ -1064,16 +1019,6 @@ public class GenericDelegator implements
      */
     @Override
     public int removeValue(GenericValue value) throws GenericEntityException {
-        return this.removeValue(value, true);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#removeValue(org.ofbiz.entity.GenericValue, boolean)
-     * @deprecated use {@link #removeValue(GenericValue value)}
-     */
-    @Override
-    @Deprecated
-    public int removeValue(GenericValue value, boolean doCacheClear) throws GenericEntityException {
         // NOTE: this does not call the GenericDelegator.removeByPrimaryKey method because it has more information to pass to the ECA rule hander
         boolean beganTransaction = false;
         try {
@@ -1101,10 +1046,10 @@ public class GenericDelegator implements
             int num = helper.removeByPrimaryKey(value.getPrimaryKey());
             // Need to call removedFromDatasource() here because the helper calls removedFromDatasource() on the PK instead of the GenericEntity.
             value.removedFromDatasource();
-            if (doCacheClear) {
-                ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_CLEAR, EntityEcaHandler.OP_REMOVE, value, false);
-                this.clearCacheLine(value);
-            }
+
+            // doCacheClear
+            ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_CLEAR, EntityEcaHandler.OP_REMOVE, value, false);
+            this.clearCacheLine(value);
 
 
             if (testMode) {
@@ -1139,28 +1084,8 @@ public class GenericDelegator implements
      */
     @Override
     public int removeByAnd(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException {
-        return this.removeByAnd(entityName, fields, true);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#removeByAnd(java.lang.String, boolean, java.lang.Object)
-     * @deprecated use {@link #removeByAnd(String entityName, Object... fields)}
-     */
-    @Override
-    @Deprecated
-    public int removeByAnd(String entityName, boolean doCacheClear, Object... fields) throws GenericEntityException {
-        return removeByAnd(entityName, UtilMisc.<String, Object>toMap(fields), doCacheClear);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#removeByAnd(java.lang.String, java.util.Map, boolean)
-     * @deprecated use {@link #removeByAnd(String entityName, Map<String, ? extends Object> fields)}}
-     */
-    @Override
-    @Deprecated
-    public int removeByAnd(String entityName, Map<String, ? extends Object> fields, boolean doCacheClear) throws GenericEntityException {
         EntityCondition ecl = EntityCondition.makeCondition(fields);
-        return removeByCondition(entityName, ecl, doCacheClear);
+        return removeByCondition(entityName, ecl);
     }
 
     /* (non-Javadoc)
@@ -1168,16 +1093,6 @@ public class GenericDelegator implements
      */
     @Override
     public int removeByCondition(String entityName, EntityCondition condition) throws GenericEntityException {
-        return this.removeByCondition(entityName, condition, true);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#removeByCondition(java.lang.String, org.ofbiz.entity.condition.EntityCondition, boolean)
-     * @deprecated use {@link #removeByCondition(String entityName, EntityCondition condition)}
-     */
-    @Override
-    @Deprecated
-    public int removeByCondition(String entityName, EntityCondition condition, boolean doCacheClear) throws GenericEntityException {
         boolean beganTransaction = false;
         try {
             if (alwaysUseTransaction) {
@@ -1193,7 +1108,7 @@ public class GenericDelegator implements
             }
 
             int rowsAffected = helper.removeByCondition(this, modelEntity, condition);
-            if (rowsAffected > 0 && doCacheClear) {
+            if (rowsAffected > 0) {
                 this.clearCacheLine(entityName);
             }
 
@@ -1217,16 +1132,6 @@ public class GenericDelegator implements
      */
     @Override
     public int removeRelated(String relationName, GenericValue value) throws GenericEntityException {
-        return this.removeRelated(relationName, value, true);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#removeRelated(java.lang.String, org.ofbiz.entity.GenericValue, boolean)
-     * @deprecated use {@link #removeRelated(String relationName, GenericValue value)}
-     */
-    @Override
-    @Deprecated
-    public int removeRelated(String relationName, GenericValue value, boolean doCacheClear) throws GenericEntityException {
         ModelEntity modelEntity = value.getModelEntity();
         ModelRelation relation = modelEntity.getRelation(relationName);
 
@@ -1239,7 +1144,7 @@ public class GenericDelegator implements
             fields.put(keyMap.getRelFieldName(), value.get(keyMap.getFieldName()));
         }
 
-        return this.removeByAnd(relation.getRelEntityName(), fields, doCacheClear);
+        return this.removeByAnd(relation.getRelEntityName(), fields);
     }
 
     /* (non-Javadoc)
@@ -1247,20 +1152,9 @@ public class GenericDelegator implements
      */
     @Override
     public void refresh(GenericValue value) throws GenericEntityException {
-        this.refresh(value, true);
-    }
+        // always clear cache before the operation
+        clearCacheLine(value);
 
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#refresh(org.ofbiz.entity.GenericValue, boolean)
-     * @deprecated use {@link #refresh(GenericValue value)}
-     */
-    @Override
-    @Deprecated
-    public void refresh(GenericValue value, boolean doCacheClear) throws GenericEntityException {
-        if (doCacheClear) {
-            // always clear cache before the operation
-            clearCacheLine(value);
-        }
         GenericPK pk = value.getPrimaryKey();
         GenericValue newValue = this.findOne(pk.getEntityName(), pk, false);
         value.refreshFromValue(newValue);
@@ -1281,16 +1175,6 @@ public class GenericDelegator implements
      */
     @Override
     public int storeByCondition(String entityName, Map<String, ? extends Object> fieldsToSet, EntityCondition condition) throws GenericEntityException {
-        return storeByCondition(entityName, fieldsToSet, condition, true);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#storeByCondition(java.lang.String, java.util.Map, org.ofbiz.entity.condition.EntityCondition, boolean)
-     * @deprecated use {@link #storeByCondition(String entityName, Map<String, ? extends Object> fieldsToSet, EntityCondition condition)}
-     */
-    @Override
-    @Deprecated
-    public int storeByCondition(String entityName, Map<String, ? extends Object> fieldsToSet, EntityCondition condition, boolean doCacheClear) throws GenericEntityException {
         boolean beganTransaction = false;
         try {
             if (alwaysUseTransaction) {
@@ -1306,7 +1190,7 @@ public class GenericDelegator implements
             }
 
             int rowsAffected =  helper.storeByCondition(this, modelEntity, fieldsToSet, condition);
-            if (rowsAffected > 0 && doCacheClear) {
+            if (rowsAffected > 0) {
                 this.clearCacheLine(entityName);
             }
 
@@ -1330,16 +1214,6 @@ public class GenericDelegator implements
      */
     @Override
     public int store(GenericValue value) throws GenericEntityException {
-        return this.store(value, true);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#store(org.ofbiz.entity.GenericValue, boolean)
-     * @deprecated use {@link #store(GenericValue value)}
-     */
-    @Override
-    @Deprecated
-    public int store(GenericValue value, boolean doCacheClear) throws GenericEntityException {
         boolean beganTransaction = false;
         try {
             if (alwaysUseTransaction) {
@@ -1364,17 +1238,17 @@ public class GenericDelegator implements
             }
 
             int retVal = helper.store(value);
-            if (doCacheClear) {
-                ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_CLEAR, EntityEcaHandler.OP_STORE, value, false);
-                this.clearCacheLine(value);
-            }
+
+            // doCacheClear
+            ecaRunner.evalRules(EntityEcaHandler.EV_CACHE_CLEAR, EntityEcaHandler.OP_STORE, value, false);
+            this.clearCacheLine(value);
 
             if (testMode) {
                 storeForTestRollback(new TestOperation(OperationType.UPDATE, updatedEntity));
             }
             // refresh the valueObject to get the new version
             if (value.lockEnabled()) {
-                refresh(value, doCacheClear);
+                refresh(value);
             }
 
             ecaRunner.evalRules(EntityEcaHandler.EV_RETURN, EntityEcaHandler.OP_STORE, value, false);
@@ -1393,30 +1267,21 @@ public class GenericDelegator implements
      */
     @Override
     public int storeAll(List<GenericValue> values) throws GenericEntityException {
-        return this.storeAll(values, true);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#storeAll(java.util.List, boolean)
-     * @deprecated use {@link #storeAll(List<GenericValue> values)}
-     * TODO: JLR 2013-09-19 - doCacheClear refactoring: to be removed and replaced by  storeAll(List<GenericValue> values, boolean createDummyFks)
-     */
-    @Override
-    @Deprecated
-    public int storeAll(List<GenericValue> values, boolean doCacheClear) throws GenericEntityException {
-        return this.storeAll(values, doCacheClear, false);
+        return this.storeAll(values, new EntityStoreOptions());
     }
 
     /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#storeAll(java.util.List, boolean, boolean)
-     * TODO: JLR 2013-09-19 - doCacheClear refactoring: to be changed to storeAll(List<GenericValue> values, boolean createDummyFks)
+     * @see org.ofbiz.entity.Delegator#storeAll(java.util.List, org.ofbiz.entity.util.EntityStoreOptions)
      */
     @Override
-    public int storeAll(List<GenericValue> values, boolean doCacheClear, boolean createDummyFks) throws GenericEntityException {
+    public int storeAll(List<GenericValue> values, EntityStoreOptions storeOptions) throws GenericEntityException {
         if (values == null) {
             return 0;
         }
 
+        // if no store options passed, use default
+        if (storeOptions == null) storeOptions = new EntityStoreOptions();
+
         int numberChanged = 0;
 
         boolean beganTransaction = false;
@@ -1441,10 +1306,10 @@ public class GenericDelegator implements
                 }
 
                 if (existing == null) {
-                    if (createDummyFks) {
+                    if (storeOptions.isCreateDummyFks()) {
                         value.checkFks(true);
                     }
-                    this.create(value, doCacheClear);
+                    this.create(value);
                     numberChanged++;
                 } else {
                     // don't send fields that are the same, and if no fields have changed, update nothing
@@ -1466,10 +1331,10 @@ public class GenericDelegator implements
                     }
 
                     if (atLeastOneField) {
-                        if (createDummyFks) {
+                        if (storeOptions.isCreateDummyFks()) {
                             value.checkFks(true);
                         }
-                        numberChanged += this.store(toStore, doCacheClear);
+                        numberChanged += this.store(toStore);
                     }
                 }
             }
@@ -1496,16 +1361,6 @@ public class GenericDelegator implements
      */
     @Override
     public int removeAll(List<? extends GenericEntity> dummyPKs) throws GenericEntityException {
-        return this.removeAll(dummyPKs, true);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#removeAll(java.util.List, boolean)
-     * @deprecated use {@link #removeAll(List<? extends GenericEntity> dummyPKs)}
-     */
-    @Override
-    @Deprecated
-    public int removeAll(List<? extends GenericEntity> dummyPKs, boolean doCacheClear) throws GenericEntityException {
         if (dummyPKs == null) {
             return 0;
         }
@@ -1516,9 +1371,9 @@ public class GenericDelegator implements
         try {
             for (GenericEntity value: dummyPKs) {
                 if (value.containsPrimaryKey()) {
-                    numRemoved += this.removeByPrimaryKey(value.getPrimaryKey(), doCacheClear);
+                    numRemoved += this.removeByPrimaryKey(value.getPrimaryKey());
                 } else {
-                    numRemoved += this.removeByAnd(value.getEntityName(), value.getAllFields(), doCacheClear);
+                    numRemoved += this.removeByAnd(value.getEntityName(), value.getAllFields());
                 }
             }
             TransactionUtil.commit(beganTransaction);
@@ -1605,36 +1460,6 @@ public class GenericDelegator implements
     }
 
     /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#findByPrimaryKey(java.lang.String, java.util.Map)
-     * @deprecated use {@link #findOne(String, Map, boolean)}
-     */
-    @Override
-    @Deprecated
-    public GenericValue findByPrimaryKey(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException {
-        return findOne(entityName, fields, false);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#findByPrimaryKeyCache(java.lang.String, java.lang.Object)
-     * @deprecated use {@link #findOne(String, boolean, Object...)}
-     */
-    @Override
-    @Deprecated
-    public GenericValue findByPrimaryKeyCache(String entityName, Object... fields) throws GenericEntityException {
-        return findByPrimaryKeyCache(entityName, UtilMisc.<String, Object>toMap(fields));
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#findByPrimaryKeyCache(java.lang.String, java.util.Map)
-     * @deprecated use {@link #findOne(String, Map, boolean)}
-     */
-    @Override
-    @Deprecated
-    public GenericValue findByPrimaryKeyCache(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException {
-        return findOne(entityName, fields, true);
-    }
-
-    /* (non-Javadoc)
      * @see org.ofbiz.entity.Delegator#findByPrimaryKeyPartial(org.ofbiz.entity.GenericPK, java.util.Set)
      */
     @Override
@@ -1683,59 +1508,6 @@ public class GenericDelegator implements
     }
 
     /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#findByAnd(java.lang.String, java.lang.Object)
-     * @deprecated use {@link #findByAnd(String, Map, List, boolean)}
-     */
-    @Override
-    @Deprecated
-    public List<GenericValue> findByAnd(String entityName, Object... fields) throws GenericEntityException {
-        EntityCondition ecl = EntityCondition.makeCondition(UtilMisc.<String, Object>toMap(fields));
-        return this.findList(entityName, ecl, null, null, null, false);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#findByAnd(java.lang.String, java.util.Map)
-     * @deprecated use {@link #findByAnd(String, Map, List, boolean)}
-     */
-    @Override
-    @Deprecated
-    public List<GenericValue> findByAnd(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException {
-        EntityCondition ecl = EntityCondition.makeCondition(fields);
-        return this.findList(entityName, ecl, null, null, null, false);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#findByAnd(java.lang.String, java.util.Map, java.util.List)
-     * @deprecated use {@link #findByAnd(String, Map, List, boolean)}
-     */
-    @Override
-    @Deprecated
-    public List<GenericValue> findByAnd(String entityName, Map<String, ? extends Object> fields, List<String> orderBy) throws GenericEntityException {
-        EntityCondition ecl = EntityCondition.makeCondition(fields);
-        return this.findList(entityName, ecl, null, orderBy, null, false);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#findByAndCache(java.lang.String, java.util.Map)
-     * @deprecated use {@link #findByAnd(String, Map, List, boolean)}
-     */
-    @Override
-    @Deprecated
-    public List<GenericValue> findByAndCache(String entityName, Map<String, ? extends Object> fields) throws GenericEntityException {
-        return this.findList(entityName, EntityCondition.makeCondition(fields), null, null, null, true);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#findByAndCache(java.lang.String, java.util.Map, java.util.List)
-     * @deprecated use {@link #findByAnd(String, Map, List, boolean)}
-     */
-    @Override
-    @Deprecated
-    public List<GenericValue> findByAndCache(String entityName, Map<String, ? extends Object> fields, List<String> orderBy) throws GenericEntityException {
-        return this.findList(entityName, EntityCondition.makeCondition(fields), null, orderBy, null, true);
-    }
-
-    /* (non-Javadoc)
      * @see org.ofbiz.entity.Delegator#findByAnd(java.lang.String, java.util.Map, java.util.List, boolean)
      */
     @Override
@@ -1931,16 +1703,6 @@ public class GenericDelegator implements
     }
 
     /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#getRelated(java.lang.String, java.util.Map, java.util.List, org.ofbiz.entity.GenericValue)
-     * @deprecated use {@link #getRelated(String, Map, List, GenericValue, boolean)}
-     */
-    @Override
-    @Deprecated
-    public List<GenericValue> getRelated(String relationName, Map<String, ? extends Object> byAndFields, List<String> orderBy, GenericValue value) throws GenericEntityException {
-        return getRelated(relationName, byAndFields, orderBy, value, false);
-    }
-
-    /* (non-Javadoc)
      * @see org.ofbiz.entity.Delegator#getRelated(java.lang.String, java.util.Map, java.util.List, org.ofbiz.entity.GenericValue, boolean)
      */
     @Override
@@ -1992,36 +1754,6 @@ public class GenericDelegator implements
     }
 
     /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#getRelatedCache(java.lang.String, org.ofbiz.entity.GenericValue)
-     * @deprecated use {@link #getRelated(String, Map, List, GenericValue, boolean)}
-     */
-    @Override
-    @Deprecated
-    public List<GenericValue> getRelatedCache(String relationName, GenericValue value) throws GenericEntityException {
-        return getRelated(relationName, null, null, value, true);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#getRelatedOne(java.lang.String, org.ofbiz.entity.GenericValue, boolean)
-     * @deprecated use {@link #getRelatedOne(String, GenericValue, boolean)}
-     */
-    @Override
-    @Deprecated
-    public GenericValue getRelatedOne(String relationName, GenericValue value) throws GenericEntityException {
-        return this.getRelatedOne(relationName, value, false);
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#getRelatedOneCache(java.lang.String, org.ofbiz.entity.GenericValue, boolean)
-     * @deprecated use {@link #getRelatedOne(String, GenericValue, boolean)}
-     */
-    @Override
-    @Deprecated
-    public GenericValue getRelatedOneCache(String relationName, GenericValue value) throws GenericEntityException {
-        return this.getRelatedOne(relationName, value, true);
-    }
-
-    /* (non-Javadoc)
      * @see org.ofbiz.entity.Delegator#getRelatedOne(java.lang.String, org.ofbiz.entity.GenericValue, boolean)
      */
     @Override
@@ -2641,31 +2373,6 @@ public class GenericDelegator implements
         }
     }
 
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#encryptFields(java.util.List)
-     */
-    @Override
-    @Deprecated
-    public void encryptFields(List<? extends GenericEntity> entities) throws GenericEntityException {
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#encryptFields(org.ofbiz.entity.GenericEntity)
-     */
-    @Override
-    @Deprecated
-    public void encryptFields(GenericEntity entity) throws GenericEntityException {
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#encryptFieldValue(java.lang.String, java.lang.Object)
-     */
-    @Override
-    @Deprecated
-    public Object encryptFieldValue(String entityName, Object fieldValue) throws EntityCryptoException {
-        return encryptFieldValue(entityName, null, fieldValue);
-    }
-
     @Override
     public Object encryptFieldValue(String entityName, ModelField.EncryptMethod encryptMethod, Object fieldValue) throws EntityCryptoException {
         if (encryptMethod == null) {
@@ -2701,22 +2408,6 @@ public class GenericDelegator implements
     }
 
     /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#decryptFields(java.util.List)
-     */
-    @Override
-    @Deprecated
-    public void decryptFields(List<? extends GenericEntity> entities) throws GenericEntityException {
-    }
-
-    /* (non-Javadoc)
-     * @see org.ofbiz.entity.Delegator#decryptFields(org.ofbiz.entity.GenericEntity)
-     */
-    @Override
-    @Deprecated
-    public void decryptFields(GenericEntity entity) throws GenericEntityException {
-    }
-
-    /* (non-Javadoc)
      * @see org.ofbiz.entity.Delegator#setEntityCrypto(org.ofbiz.entity.util.EntityCrypto)
      */
     @Override

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java?rev=1704108&r1=1704107&r2=1704108&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java Sun Sep 20 08:37:51 2015
@@ -326,7 +326,7 @@ public class EntitySaxReader implements
         if (this.checkDataOnly) {
             EntityDataAssert.checkValueList(valuesToWrite, delegator, this.getMessageList());
         } else {
-            delegator.storeAll(valuesToWrite, doCacheClear, createDummyFks);
+            delegator.storeAll(valuesToWrite, new EntityStoreOptions(createDummyFks));
         }
     }
 
@@ -495,7 +495,7 @@ public class EntitySaxReader implements
                             if (Action.DELETE == currentAction) {
                                 valuesToDelete.add(currentValue);
                                 if (valuesToDelete.size() >= valuesPerWrite) {
-                                    delegator.removeAll(valuesToDelete, doCacheClear);
+                                    delegator.removeAll(valuesToDelete);
                                     valuesToDelete.clear();
                                 }
                             } else {

Added: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityStoreOptions.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityStoreOptions.java?rev=1704108&view=auto
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityStoreOptions.java (added)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityStoreOptions.java Sun Sep 20 08:37:51 2015
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *******************************************************************************/
+package org.ofbiz.entity.util;
+
+/**
+ * Contains a number of variables used to select certain advanced options for storing GenericEntities.
+ */
+@SuppressWarnings("serial")
+public class EntityStoreOptions implements java.io.Serializable {
+
+    /** Option for creating missing referenced values as dummy (pk-only) entries */
+    protected boolean createDummyFks = false;
+
+    /**
+     * Default constructor. Defaults are as follows: createDummyFks = false
+     */
+    public EntityStoreOptions() {
+    }
+
+    /**
+     * Optional constructor with options to specify.
+     * 
+     * @param createDummyFks
+     */
+    public EntityStoreOptions(boolean createDummyFks) {
+        this.createDummyFks = createDummyFks;
+    }
+
+    /**
+     * If true, missing entries in FK referenced entities will be created while storing the given GenericValues.
+     * 
+     * @return boolean
+     */
+    public boolean isCreateDummyFks() {
+        return createDummyFks;
+    }
+
+    /**
+     * If true, missing entries in FK referenced entities will be created while storing the given GenericValues.
+     * 
+     * @param createDummyFks
+     */
+    public void setCreateDummyFks(boolean createDummyFks) {
+        this.createDummyFks = createDummyFks;
+    }
+}

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityStoreOptions.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityStoreOptions.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityStoreOptions.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain