details:   http://code.openbravo.com/erp/devel/pi/rev/6b8d6aee4849
changeset: 3743:6b8d6aee4849
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Tue Apr 28 17:08:22 2009 +0200
summary:   Made the /ws/dal webservice more flexible to allow post of xml 
documents with multiple records

details:   http://code.openbravo.com/erp/devel/pi/rev/f3e5ce67bda8
changeset: 3744:f3e5ce67bda8
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Tue Apr 28 17:08:58 2009 +0200
summary:   Fixes issue 8806: AccessLevel.ORGANIZATION ignored when resolving 
references in import

details:   http://code.openbravo.com/erp/devel/pi/rev/a993c3fc5af5
changeset: 3745:a993c3fc5af5
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Tue Apr 28 17:09:27 2009 +0200
summary:   8807: Enterprise Module Management will get into a NPE if the 
referencedata/standard directory does not exist in the module

diffstat:

 src/org/openbravo/dal/xml/EntityResolver.java                 |   2 ++
 src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData.java |  13 
+++++++++----
 src/org/openbravo/service/rest/DalWebService.java             |  16 
++++++++++------
 3 files changed, 21 insertions(+), 10 deletions(-)

diffs (62 lines):

diff --git a/src/org/openbravo/dal/xml/EntityResolver.java 
b/src/org/openbravo/dal/xml/EntityResolver.java
--- a/src/org/openbravo/dal/xml/EntityResolver.java
+++ b/src/org/openbravo/dal/xml/EntityResolver.java
@@ -226,6 +226,8 @@
       }
     } else if (al == AccessLevel.CLIENT) {
       result = searchClient(id, entity);
+    } else if (al == AccessLevel.ORGANIZATION) {
+      result = searchClientOrganization(id, entity);
     } else if (al == AccessLevel.CLIENT_ORGANIZATION) {
       // search 2 levels
       result = searchClientOrganization(id, entity);
diff --git a/src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData.java 
b/src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData.java
--- a/src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData.java
+++ b/src/org/openbravo/erpCommon/ad_forms/UpdateReferenceData.java
@@ -206,11 +206,16 @@
           File myDir = new File(strPath);
           File[] myFiles = myDir.listFiles();
           ArrayList<File> myTargetFiles = new ArrayList<File>();
-          for (int j = 0; j < myFiles.length; j++) {
-            if (myFiles[j].getName().endsWith(".xml"))
-              myTargetFiles.add(myFiles[j]);
+          // if the directory does not exist then it will throw an exception
+          if (myFiles != null) {
+            for (int j = 0; j < myFiles.length; j++) {
+              if (myFiles[j].getName().endsWith(".xml"))
+                myTargetFiles.add(myFiles[j]);
+            }
+            myFiles = myTargetFiles.toArray(myFiles);
+          } else {
+            myFiles = new File[] {};
           }
-          myFiles = myTargetFiles.toArray(myFiles);
           StringBuffer strError = new StringBuffer("");
           for (int j = 0; j < myFiles.length; j++) {
             String strXml = Utility.fileToString(myFiles[j].getPath());
diff --git a/src/org/openbravo/service/rest/DalWebService.java 
b/src/org/openbravo/service/rest/DalWebService.java
--- a/src/org/openbravo/service/rest/DalWebService.java
+++ b/src/org/openbravo/service/rest/DalWebService.java
@@ -307,12 +307,16 @@
   protected String doChangeActionXML(String path, HttpServletRequest request,
       HttpServletResponse response, ChangeAction changeAction) {
     // get the resource
-    final String segment = WebServiceUtil.getInstance().getFirstSegment(path);
-    try {
-      ModelProvider.getInstance().getEntity(segment);
-    } catch (final CheckException ce) {
-      throw new ResourceNotFoundException("Resource " + segment + " not 
found", ce);
-    }
+
+    // Disabled this check as it makes the system much more flexible....
+    // it makes it possible to post xml with multiple entities to a url like
+    // http://localhost:8080/openbravo/ws/dal
+    // final String segment = 
WebServiceUtil.getInstance().getFirstSegment(path);
+    // try {
+    // ModelProvider.getInstance().getEntity(segment);
+    // } catch (final CheckException ce) {
+    // throw new ResourceNotFoundException("Resource " + segment + " not 
found", ce);
+    // }
 
     try {
       final SAXReader reader = new SAXReader();

------------------------------------------------------------------------------
Register Now & Save for Velocity, the Web Performance & Operations 
Conference from O'Reilly Media. Velocity features a full day of 
expert-led, hands-on workshops and two days of sessions from industry 
leaders in dedicated Performance & Operations tracks. Use code vel09scf 
and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to