Author: adrianc
Date: Wed Dec 29 23:32:26 2010
New Revision: 1053771
URL: http://svn.apache.org/viewvc?rev=1053771&view=rev
Log:
All find services return a list size.
Modified:
ofbiz/trunk/framework/common/servicedef/services.xml
ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java
Modified: ofbiz/trunk/framework/common/servicedef/services.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/servicedef/services.xml?rev=1053771&r1=1053770&r2=1053771&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/servicedef/services.xml (original)
+++ ofbiz/trunk/framework/common/servicedef/services.xml Wed Dec 29 23:32:26
2010
@@ -225,6 +225,7 @@ under the License.
<attribute name="noConditionFind" type="String" mode="IN"
optional="true"><!-- find with no condition (empty entityConditionList) only
done when this is Y --></attribute>
<attribute name="distinct" type="String" mode="IN"
optional="true"><!-- distinct find only done when this is Y --></attribute>
<attribute name="listIt"
type="org.ofbiz.entity.util.EntityListIterator" mode="OUT" optional="true"/>
+ <attribute name="listSize" type="Integer" mode="OUT" optional="true"/>
</service>
<service name="performFind" auth="false" engine="java"
invoke="performFind" location="org.ofbiz.common.FindServices">
@@ -241,6 +242,7 @@ under the License.
<attribute name="viewIndex" type="Integer" mode="IN" optional="true"/>
<attribute name="viewSize" type="Integer" mode="IN" optional="true"/>
<attribute name="listIt"
type="org.ofbiz.entity.util.EntityListIterator" mode="OUT" optional="true"/>
+ <attribute name="listSize" type="Integer" mode="OUT" optional="true"/>
<attribute name="queryString" type="String" mode="OUT"
optional="true"/>
<attribute name="queryStringMap" type="java.util.Map" mode="OUT"
optional="true"/>
</service>
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java?rev=1053771&r1=1053770&r2=1053771&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java
(original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java Wed Dec
29 23:32:26 2010
@@ -510,6 +510,7 @@ public class FindServices {
Map<String, Object> results = ServiceUtil.returnSuccess();
results.put("listIt", executeResult.get("listIt"));
+ results.put("listSize", executeResult.get("listSize"));
results.put("queryString", prepareResult.get("queryString"));
results.put("queryStringMap", prepareResult.get("queryStringMap"));
return results;
@@ -605,10 +606,12 @@ public class FindServices {
Delegator delegator = dctx.getDelegator();
// Retrieve entities - an iterator over all the values
EntityListIterator listIt = null;
+ int listSize = 0;
try {
if (noConditionFind || (entityConditionList != null &&
entityConditionList.getConditionListSize() > 0)) {
listIt = delegator.find(entityName, entityConditionList, null,
fieldSet, orderByList,
new EntityFindOptions(true,
EntityFindOptions.TYPE_SCROLL_INSENSITIVE, EntityFindOptions.CONCUR_READ_ONLY,
-1, maxRows, distinct));
+ listSize = listIt.getResultsSizeAfterPartialList();
}
} catch (GenericEntityException e) {
return ServiceUtil.returnError("Error running Find on the [" +
entityName + "] entity: " + e.getMessage());
@@ -616,6 +619,7 @@ public class FindServices {
Map<String, Object> results = ServiceUtil.returnSuccess();
results.put("listIt", listIt);
+ results.put("listSize", listSize);
return results;
}