You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2012/05/14 22:59:20 UTC

svn commit: r1338400 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: Delegator.java GenericDelegator.java

Author: doogie
Date: Mon May 14 20:59:20 2012
New Revision: 1338400

URL: http://svn.apache.org/viewvc?rev=1338400&view=rev
Log:
DEPRECATION: Add new findByAnd variant, that has a boolean useCache
parameter; this is the same similiar pattern that other methods have.

After all code has been modified to use this new method, the older
methods will be deprecated(and eventually replaced).

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.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=1338400&r1=1338399&r2=1338400&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java Mon May 14 20:59:20 2012
@@ -363,6 +363,26 @@ public interface Delegator {
     public 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 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
+     * @param useCache
+     *            Whether to cache the results
+     * @return List of GenericValue instances that match the query
+     */
+    public 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!

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=1338400&r1=1338399&r2=1338400&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Mon May 14 20:59:20 2012
@@ -1721,6 +1721,13 @@ public class GenericDelegator implements
     }
 
     /* (non-Javadoc)
+     * @see org.ofbiz.entity.Delegator#findByAnd(java.lang.String, java.util.Map, java.util.List, boolean)
+     */
+    public List<GenericValue> findByAnd(String entityName, Map<String, ? extends Object> fields, List<String> orderBy, boolean useCache) throws GenericEntityException {
+        return this.findList(entityName, EntityCondition.makeCondition(fields), null, orderBy, null, useCache);
+    }
+
+    /* (non-Javadoc)
      * @see org.ofbiz.entity.Delegator#find(java.lang.String, org.ofbiz.entity.condition.EntityCondition, org.ofbiz.entity.condition.EntityCondition, java.util.Set, java.util.List, org.ofbiz.entity.util.EntityFindOptions)
      */
     public EntityListIterator find(String entityName, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Set<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions) throws GenericEntityException {



Re: svn commit: r1338400 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: Delegator.java GenericDelegator.java

Posted by Adam Heath <do...@brainfood.com>.
That is a cut-n-paste from the method above, whoops. It should be removed. I'll do it much later tonight, or tomorrow.
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Adrian Crum <ad...@sandglass-software.com> wrote:

On 5/14/2012 9:59 PM, doogie@apache.org wrote:
> Author: doogie
> Date: Mon May 14 20:59:20 2012
> New Revision: 1338400
>
> URL: http://svn.apache.org/viewvc?rev=1338400&view=rev
> Log:
> DEPRECATION: Add new findByAnd variant, that has a boolean useCache
> parameter; this is the same similiar pattern that other methods have.
>
> After all code has been modified to use this new method, the older
> methods will be deprecated(and eventually replaced).
>
> Modified:
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java
> ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.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=1338400&r1=1338399&r2=1338400&view=diff
>_____________________________________________

> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java (original)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java Mon May 14 20:59:20 2012
> @@ -363,6 +363,26 @@ public interface Delegator {
> public 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 NOTE 20080502: 56 references

Umm... A new method has a note from 2008? I sense a temporal distortion.

-Adrian



Re: svn commit: r1338400 - in /ofbiz/trunk/framework/entity/src/org/ofbiz/entity: Delegator.java GenericDelegator.java

Posted by Adrian Crum <ad...@sandglass-software.com>.
On 5/14/2012 9:59 PM, doogie@apache.org wrote:
> Author: doogie
> Date: Mon May 14 20:59:20 2012
> New Revision: 1338400
>
> URL: http://svn.apache.org/viewvc?rev=1338400&view=rev
> Log:
> DEPRECATION: Add new findByAnd variant, that has a boolean useCache
> parameter; this is the same similiar pattern that other methods have.
>
> After all code has been modified to use this new method, the older
> methods will be deprecated(and eventually replaced).
>
> Modified:
>      ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java
>      ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.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=1338400&r1=1338399&r2=1338400&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java (original)
> +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/Delegator.java Mon May 14 20:59:20 2012
> @@ -363,6 +363,26 @@ public interface Delegator {
>       public 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 NOTE 20080502: 56 references

Umm... A new method has a note from 2008? I sense a temporal distortion.

-Adrian