details:   https://code.openbravo.com/erp/devel/pi/rev/8fd235980bfd
changeset: 15326:8fd235980bfd
user:      Antonio Moreno <antonio.moreno <at> openbravo.com>
date:      Thu Feb 02 13:12:58 2012 +0100
summary:   Fixed issue 13649. Exclude Audit Info will now also apply to 
children objects

diffstat:

 src/org/openbravo/dal/xml/EntityXMLConverter.java     |  19 +++++++++++++++++--
 src/org/openbravo/service/dataset/DataSetService.java |  18 +++++++++++-------
 2 files changed, 28 insertions(+), 9 deletions(-)

diffs (76 lines):

diff -r f757e34def52 -r 8fd235980bfd 
src/org/openbravo/dal/xml/EntityXMLConverter.java
--- a/src/org/openbravo/dal/xml/EntityXMLConverter.java Thu Feb 02 13:04:52 
2012 +0100
+++ b/src/org/openbravo/dal/xml/EntityXMLConverter.java Thu Feb 02 13:12:58 
2012 +0100
@@ -288,6 +288,11 @@
 
   protected void export(BaseOBObject obObject, boolean 
isAddedBecauseReferenced)
       throws SAXException {
+    export(obObject, isAddedBecauseReferenced, null);
+  }
+
+  protected void export(BaseOBObject obObject, boolean 
isAddedBecauseReferenced,
+      Boolean excludeAuditInfo) throws SAXException {
     final String entityName = DalUtil.getEntityName(obObject);
 
     final AttributesImpl entityAttrs = new AttributesImpl();
@@ -327,7 +332,10 @@
       exportableProperties = 
DataSetService.getInstance().getExportableProperties(obObject, dst,
           dst.getDataSetColumnList(), optionExportTransientInfo);
     } else {
-      exportableProperties = obObject.getEntity().getProperties();
+      exportableProperties = new 
ArrayList<Property>(obObject.getEntity().getProperties());
+      if (excludeAuditInfo != null && excludeAuditInfo) {
+        DataSetService.getInstance().removeAuditInfo(exportableProperties);
+      }
     }
 
     // export each property
@@ -429,7 +437,14 @@
         for (final Object o : childObjects) {
           // embed in the parent
           if (isOptionEmbedChildren()) {
-            export((BaseOBObject) o, false);
+            final DataSetTable dst = (getDataSet() != null && 
obObject.getEntity() != null) ? dataSetTablesByEntity
+                .get(obObject.getEntity()) : null;
+            if ((excludeAuditInfo != null && excludeAuditInfo)
+                || (dst != null && dst.isExcludeAuditInfo())) {
+              export((BaseOBObject) o, false, true);
+            } else {
+              export((BaseOBObject) o, false);
+            }
           } else {
             // add the child as a tag, the child entityname is
             // used as the tagname
diff -r f757e34def52 -r 8fd235980bfd 
src/org/openbravo/service/dataset/DataSetService.java
--- a/src/org/openbravo/service/dataset/DataSetService.java     Thu Feb 02 
13:04:52 2012 +0100
+++ b/src/org/openbravo/service/dataset/DataSetService.java     Thu Feb 02 
13:12:58 2012 +0100
@@ -454,18 +454,22 @@
 
     // Remove the auditinfo
     if (dataSetTable.isExcludeAuditInfo()) {
-      final List<Property> toRemove = new ArrayList<Property>();
-      for (final Property p : exportables) {
-        if (p.isAuditInfo()) {
-          toRemove.add(p);
-        }
-      }
-      exportables.removeAll(toRemove);
+      removeAuditInfo(exportables);
     }
 
     return exportables;
   }
 
+  public void removeAuditInfo(List<Property> properties) {
+    final List<Property> toRemove = new ArrayList<Property>();
+    for (final Property p : properties) {
+      if (p.isAuditInfo()) {
+        toRemove.add(p);
+      }
+    }
+    properties.removeAll(toRemove);
+  }
+
   // compares the content of a list by converting the id to a hex
   public static class BaseOBIDHexComparator implements Comparator<Object> {
 

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to