← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1232: Fixed error in dxf export of categoryComboCategoryAssociations. Simplified the convertor.

 

------------------------------------------------------------
revno: 1232
committer: Bob Jolliffe <bobj@bobj-laptop>
branch nick: trunk
timestamp: Wed 2009-12-16 10:41:19 +0000
message:
  Fixed error in dxf export of categoryComboCategoryAssociations.  Simplified the convertor.
modified:
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CategoryComboCategoryAssociationConverter.java
  dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementCategoryOptionComboConverter.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription.
=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CategoryComboCategoryAssociationConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CategoryComboCategoryAssociationConverter.java	2009-11-02 09:20:10 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/CategoryComboCategoryAssociationConverter.java	2009-12-16 10:41:19 +0000
@@ -29,6 +29,8 @@
 
 import java.util.Collection;
 import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import org.amplecode.quick.BatchHandler;
 import org.amplecode.staxwax.reader.XMLReader;
@@ -52,6 +54,8 @@
 public class CategoryComboCategoryAssociationConverter
     extends AbstractGroupMemberConverter implements XMLConverter
 {
+    private static final Log log = LogFactory.getLog(CategoryComboCategoryAssociationConverter.class);
+
     public static final String COLLECTION_NAME = "categoryComboCategoryAssociations";
     public static final String ELEMENT_NAME = "categoryComboCategoryAssociation";
     
@@ -108,9 +112,7 @@
     {
         Collection<DataElementCategoryCombo> categoryCombos = categoryService.getDataElementCategoryCombos( params.getCategoryCombos() );
         
-        Collection<DataElementCategory> categories = categoryService.getDataElementCategories( params.getCategories() );
-        
-        if ( categoryCombos != null && categoryCombos.size() > 0 && categories != null && categories.size() > 0 )
+        if ( categoryCombos != null && categoryCombos.size() > 0 )
         {
             writer.openElement( COLLECTION_NAME );
             
@@ -122,8 +124,6 @@
                     
                     for ( DataElementCategory category : categoryCombo.getCategories() )
                     {
-                        if ( categories.contains( category ) )
-                        {
                             writer.openElement( ELEMENT_NAME );
                             
                             writer.writeElement( FIELD_CATEGORY_COMBO, String.valueOf( categoryCombo.getId() ) );
@@ -131,7 +131,6 @@
                             writer.writeElement( FIELD_SORT_ORDER, String.valueOf( sortOrder++ ) );
                             
                             writer.closeElement();
-                        }
                     }
                 }
             }

=== modified file 'dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementCategoryOptionComboConverter.java'
--- dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementCategoryOptionComboConverter.java	2009-10-18 22:44:41 +0000
+++ dhis-2/dhis-services/dhis-service-importexport/src/main/java/org/hisp/dhis/importexport/dxf/converter/DataElementCategoryOptionComboConverter.java	2009-12-16 10:41:19 +0000
@@ -29,6 +29,9 @@
 
 import java.util.Collection;
 import java.util.Map;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 
 import org.amplecode.staxwax.reader.XMLReader;
 import org.amplecode.staxwax.writer.XMLWriter;
@@ -51,6 +54,9 @@
 public class DataElementCategoryOptionComboConverter
     extends AbstractDataElementCategoryOptionComboConverter implements XMLConverter
 {
+
+    private static final Log log = LogFactory.getLog(DataElementCategoryOptionComboConverter.class);
+
     public static final String COLLECTION_NAME = "categoryOptionCombos";
     public static final String ELEMENT_NAME = "categoryOptionCombo";
     
@@ -133,7 +139,7 @@
                 // -------------------------------------------------------------
 
                 writer.openElement( SUB_COLLECTION_NAME );
-                
+
                 for ( DataElementCategoryOption categoryOption : categoryOptionCombo.getCategoryOptions() )
                 {
                     writer.openElement( SUB_COLLECTION_ELEMENT_NAME );


Follow ups