details:   /erp/devel/pi/rev/a488a723e624
changeset: 11361:a488a723e624
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Thu Mar 24 19:51:33 2011 +0100
summary:   Fixed issue 16320. Datasets shouldn't have formal changes when 
reexported.
Two changes have been made:
- Children BaseOBObjects will be sorted in the same way as their parents 
already were.
- List properties will now be generated with a defined order, as the Entities 
will now be created following a defined order

diffstat:

 src/org/openbravo/base/model/ModelProvider.java   |  9 ++++++++-
 src/org/openbravo/dal/xml/EntityXMLConverter.java |  8 ++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)

diffs (65 lines):

diff -r 1f543286dd0c -r a488a723e624 
src/org/openbravo/base/model/ModelProvider.java
--- a/src/org/openbravo/base/model/ModelProvider.java   Thu Mar 24 18:32:06 
2011 +0100
+++ b/src/org/openbravo/base/model/ModelProvider.java   Thu Mar 24 19:51:33 
2011 +0100
@@ -24,6 +24,8 @@
 import java.sql.ResultSet;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -153,6 +155,11 @@
       log.debug("Read model from db");
 
       tables = list(initsession, Table.class);
+      Collections.sort(tables, new Comparator<Table>() {
+        public int compare(Table t1, Table t2) {
+          return t1.getName().compareTo(t2.getName());
+        }
+      });
 
       referencesById = new HashMap<String, Reference>();
       final List<Reference> references = list(initsession, Reference.class);
@@ -207,7 +214,7 @@
       entitiesByTableName = new HashMap<String, Entity>();
       entitiesByTableId = new HashMap<String, Entity>();
       entitiesWithTreeType = new ArrayList<Entity>();
-      for (final Table t : tablesByTableName.values()) {
+      for (final Table t : tables) {
         log.debug("Building model for table " + t.getTableName());
         final Entity e = new Entity();
         e.initialize(t);
diff -r 1f543286dd0c -r a488a723e624 
src/org/openbravo/dal/xml/EntityXMLConverter.java
--- a/src/org/openbravo/dal/xml/EntityXMLConverter.java Thu Mar 24 18:32:06 
2011 +0100
+++ b/src/org/openbravo/dal/xml/EntityXMLConverter.java Thu Mar 24 19:51:33 
2011 +0100
@@ -23,6 +23,7 @@
 import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -58,6 +59,7 @@
 import org.openbravo.model.ad.utility.DataSetTable;
 import org.openbravo.model.ad.utility.TreeNode;
 import org.openbravo.service.dataset.DataSetService;
+import org.openbravo.service.dataset.DataSetService.BaseOBIDHexComparator;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.AttributesImpl;
 
@@ -417,8 +419,10 @@
         xmlHandler.startElement("", "", p.getName(), propertyAttrs);
 
         // get all the children and export each child
-        final Collection<?> c = (Collection<?>) value;
-        for (final Object o : c) {
+        final Collection<BaseOBObject> c = (Collection<BaseOBObject>) value;
+        List<BaseOBObject> childObjects = new ArrayList<BaseOBObject>(c);
+        Collections.sort(childObjects, new BaseOBIDHexComparator());
+        for (final Object o : childObjects) {
           // embed in the parent
           if (isOptionEmbedChildren()) {
             export((BaseOBObject) o, false);

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to