details:   https://code.openbravo.com/erp/devel/pi/rev/713f4b92501d
changeset: 20302:713f4b92501d
user:      David Baz Fayos <david.baz <at> openbravo.com>
date:      Thu May 09 13:10:02 2013 +0200
summary:   Fixed issue 23778: added 'bobFetchTransformation' method to 
'DefaultJsonDataService'

diffstat:

 
modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
 |  15 ++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diffs (32 lines):

diff -r d685ef0795fa -r 713f4b92501d 
modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
--- 
a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
     Thu May 09 12:13:33 2013 +0200
+++ 
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java
     Thu May 09 13:10:02 2013 +0200
@@ -254,6 +254,8 @@
           bobs = queryService.list();
         }
 
+        bobs = bobFetchTransformation(bobs, parameters);
+
         if (preventCountOperation) {
           count = bobs.size() + startRow;
           // computedMaxResults is one too much, if we got one to much then 
correct
@@ -711,6 +713,19 @@
     public abstract void write(JSONObject json);
   }
 
+  protected List<BaseOBObject> bobFetchTransformation(List<BaseOBObject> bobs,
+      Map<String, String> parameters) {
+    // If is override, take into account:
+    // * If the number of the returned bobs change, there could be problems 
because endRow and
+    // totalRows parameters will be out-of-sync with that the requester 
expects, and some values can
+    // be missing in the following fetches. If there is no pagination (all 
values are returned at
+    // once), there is no problem.
+    // * If any bob is modified, the original entity is being modified, so a 
good practice could be
+    // clone the bob (using DalUtil.copy, for example) before modify it, and 
then return the clone.
+
+    return bobs;
+  }
+
   protected String doPreAction(Map<String, String> parameters, String content,
       DataSourceAction action) {
     try {

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to