svn commit: r463574 - in /incubator/ofbiz/trunk/framework/common: servicedef/services.xml src/org/ofbiz/common/FindServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r463574 - in /incubator/ofbiz/trunk/framework/common: servicedef/services.xml src/org/ofbiz/common/FindServices.java

hansbak-2
Author: hansbak
Date: Thu Oct 12 23:47:16 2006
New Revision: 463574

URL: http://svn.apache.org/viewvc?view=rev&rev=463574
Log:
in the findservices add an optional timestamp filterByDateValue for the filterByDate function

Modified:
    incubator/ofbiz/trunk/framework/common/servicedef/services.xml
    incubator/ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java

Modified: incubator/ofbiz/trunk/framework/common/servicedef/services.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/common/servicedef/services.xml?view=diff&rev=463574&r1=463573&r2=463574
==============================================================================
--- incubator/ofbiz/trunk/framework/common/servicedef/services.xml (original)
+++ incubator/ofbiz/trunk/framework/common/servicedef/services.xml Thu Oct 12 23:47:16 2006
@@ -215,6 +215,7 @@
         <attribute name="orderBy" type="String" mode="IN" optional="true"/>
         <attribute name="noConditionFind" type="String" mode="IN" optional="true"><!-- find with no condition (empty entityConditionList) only done when this is Y --></attribute>
         <attribute name="filterByDate" type="String" mode="IN" optional="true"/>
+        <attribute name="filterByDateValue" type="Timestamp" mode="IN" optional="true"/>
         <attribute name="listIt" type="org.ofbiz.entity.util.EntityListIterator" mode="OUT" optional="true"/>
         <attribute name="queryString" type="String" mode="OUT" optional="true"/>
         <attribute name="queryStringMap" type="java.util.Map" mode="OUT" optional="true"/>
@@ -228,6 +229,7 @@
         <attribute name="orderBy" type="String" mode="IN" optional="true"/>
         <attribute name="noConditionFind" type="String" mode="IN" optional="true"><!-- find with no condition (empty entityConditionList) only done when this is Y --></attribute>
         <attribute name="filterByDate" type="String" mode="IN" optional="true"/>
+        <attribute name="filterByDateValue" type="Timestamp" mode="IN" optional="true"/>
         <attribute name="viewIndex" type="Integer" mode="IN" optional="true"/>
         <attribute name="viewSize" type="Integer" mode="IN" optional="true"/>
         <attribute name="list" type="List" mode="OUT" optional="true"/>
@@ -242,6 +244,7 @@
         <attribute name="inputFields" type="java.util.Map" mode="IN" optional="false"/>
         <attribute name="orderBy" type="String" mode="IN" optional="true"/>
         <attribute name="filterByDate" type="String" mode="IN" optional="true"/>
+        <attribute name="filterByDateValue" type="Timestamp" mode="IN" optional="true"/>
         <attribute name="item" type="GenericValue" mode="OUT" optional="true"/>
         <attribute name="queryString" type="String" mode="OUT" optional="true"/>
         <attribute name="queryStringMap" type="java.util.Map" mode="OUT" optional="true"/>

Modified: incubator/ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java?view=diff&rev=463574&r1=463573&r2=463574
==============================================================================
--- incubator/ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java (original)
+++ incubator/ofbiz/trunk/framework/common/src/org/ofbiz/common/FindServices.java Thu Oct 12 23:47:16 2006
@@ -404,12 +404,13 @@
             // try finding in inputFields Map
             filterByDate = (String) inputFields.get("filterByDate");
         }
+        Timestamp filterByDateValue = (Timestamp) context.get("filterByDateValue");
 
         LocalDispatcher dispatcher = dctx.getDispatcher();
 
         Map prepareResult = null;
         try {
-            prepareResult = dispatcher.runSync("prepareFind", UtilMisc.toMap("entityName", entityName, "orderBy", orderBy, "inputFields", inputFields, "filterByDate", filterByDate, "userLogin", userLogin));
+            prepareResult = dispatcher.runSync("prepareFind", UtilMisc.toMap("entityName", entityName, "orderBy", orderBy, "inputFields", inputFields, "filterByDate", filterByDate,"filterByDateValue", filterByDateValue, "userLogin", userLogin));
         } catch (GenericServiceException gse) {
             return ServiceUtil.returnError("Error preparing conditions: " + gse.getMessage());
         }
@@ -454,6 +455,7 @@
             // try finding in inputFields Map
             filterByDate = (String) inputFields.get("filterByDate");
         }
+        Timestamp filterByDateValue = (Timestamp) context.get("filterByDateValue");
 
         // parameters run thru UtilHttp.getParameterMap
         Map queryStringMap = new HashMap();
@@ -476,8 +478,13 @@
          */
         if ((tmpList.size() > 0) || ((noConditionFind != null) && (noConditionFind.equals("Y")))) {
             if (!UtilValidate.isEmpty(filterByDate) && "Y".equals(filterByDate)) {
-                EntityCondition filterByDateCondition = EntityUtil.getFilterByDateExpr();
-                tmpList.add(filterByDateCondition);
+             if (!UtilValidate.isEmpty(filterByDateValue)) {
+             EntityCondition filterByDateCondition = EntityUtil.getFilterByDateExpr();
+             tmpList.add(filterByDateCondition);
+             } else {
+             EntityCondition filterByDateCondition = EntityUtil.getFilterByDateExpr(filterByDateValue);
+             tmpList.add(filterByDateCondition);
+             }
             }
         }
 
@@ -495,6 +502,7 @@
         Map reducedQueryStringMap = buildReducedQueryString(inputFields, entityName, delegator);
         reducedQueryStringMap.put("noConditionFind", noConditionFind);
         reducedQueryStringMap.put("filterByDate", filterByDate);
+        reducedQueryStringMap.put("filterByDateValue", filterByDateValue);
         String queryString = UtilHttp.urlEncodeArgs(reducedQueryStringMap);
         results.put("queryString", queryString);
         results.put("queryStringMap", reducedQueryStringMap);
@@ -644,7 +652,9 @@
             Debug.logInfo("Problem getting list Item" + e,module);
         }
         
-        result.put("item",item);
+        if (!UtilValidate.isEmpty(item)) {
+         result.put("item",item);
+        }
         result.remove("listIt");
         return result;
     }