Fixed issue 29946: Inactive records cannot be retrieved using dal WebServices.
authorNaroa Iriarte <naroa.iriarte@openbravo.com>
Tue, 02 Jun 2015 10:30:04 +0200
changeset 26850 c5cd8102fff8
parent 26849 637e72a7231b
child 26851 27fb6276d4ad
Fixed issue 29946: Inactive records cannot be retrieved using dal WebServices.

It is possible to get the inactive records using JSON WebServices for example, as:

http://localhost:8080/openbravo/org.openbravo.service.json.jsonrest/Country?_noActiveFilter=true

But it is not possible to get the inactive records using dal WebServices.
As it would be interesting to have the choice of showing the inactive records too, as it is possible in the
JSON WebServices, a condition which checks if the "_noActiveFilter" has been included in the "DalWebService"
class.
Now it is possible to chose if one wants to get the inactive fields or not, as in the JSON WebServices:

http://localhost:8080/openbravo/ws/dal/Country?_noActiveFilter=false // The inactive records are not shown.

http://localhost:8080/openbravo/ws/dal/Country?_noActiveFilter=true //The inactive records are shown.
src/org/openbravo/service/rest/DalWebService.java
--- a/src/org/openbravo/service/rest/DalWebService.java	Tue Jun 02 01:40:11 2015 +0000
+++ b/src/org/openbravo/service/rest/DalWebService.java	Tue Jun 02 10:30:04 2015 +0200
@@ -79,6 +79,7 @@
   public static final String PARAMETER_EXCEL = "excel";
   // Parameter to specify the list of properties to be returned
   public static final String PARAMETER_PROPERTIES = "_selectedProperties";
+  public static final String PARAMETER_NO_ACTIVE_FILTER = "_noActiveFilter";
 
   /**
    * Performs the GET REST operation. This service handles multiple types of request: the request
@@ -153,6 +154,11 @@
         final OBQuery<BaseOBObject> obq = OBDal.getInstance().createQuery(entityName,
             whereOrderByClause);
 
+        if (request.getParameter(PARAMETER_NO_ACTIVE_FILTER) != null
+            && request.getParameter(PARAMETER_NO_ACTIVE_FILTER).equals("true")) {
+          obq.setFilterOnActive(false);
+        }
+
         if (firstResult != null) {
           try {
             obq.setFirstResult(Integer.parseInt(firstResult));