From 14db0dbfda606bb4b2a6aaff7db6c2fccd0e729b Mon Sep 17 00:00:00 2001 From: Adam Heath Date: Mon, 14 May 2012 20:59:20 +0000 Subject: [PATCH] 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). git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1338400 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/ofbiz/entity/Delegator.java | 20 +++++++++++++++++++ .../org/ofbiz/entity/GenericDelegator.java | 7 +++++++ 2 files changed, 27 insertions(+) diff --git a/framework/entity/src/org/ofbiz/entity/Delegator.java b/framework/entity/src/org/ofbiz/entity/Delegator.java index fbaa9b7da9..9d02e73257 100644 --- a/framework/entity/src/org/ofbiz/entity/Delegator.java +++ b/framework/entity/src/org/ofbiz/entity/Delegator.java @@ -362,6 +362,26 @@ public interface Delegator { */ public List findByAndCache(String entityName, Map fields, List 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 findByAnd(String entityName, Map fields, List 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, diff --git a/framework/entity/src/org/ofbiz/entity/GenericDelegator.java b/framework/entity/src/org/ofbiz/entity/GenericDelegator.java index 02f39e1bbc..4026402027 100644 --- a/framework/entity/src/org/ofbiz/entity/GenericDelegator.java +++ b/framework/entity/src/org/ofbiz/entity/GenericDelegator.java @@ -1720,6 +1720,13 @@ public class GenericDelegator implements Delegator { 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) + */ + public List findByAnd(String entityName, Map fields, List 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) */