← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18199: in detailed export, include sections when exporting datasets

 

------------------------------------------------------------
revno: 18199
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-02-09 16:23:51 +0700
message:
  in detailed export, include sections when exporting datasets
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultMetaDataDependencyService.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-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultMetaDataDependencyService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultMetaDataDependencyService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultMetaDataDependencyService.java	2015-02-09 09:23:51 +0000
@@ -29,7 +29,6 @@
  */
 
 import com.fasterxml.jackson.annotation.JsonView;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hibernate.proxy.HibernateProxy;
@@ -41,6 +40,8 @@
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.Section;
 import org.hisp.dhis.expression.Expression;
 import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.indicator.Indicator;
@@ -138,7 +139,7 @@
     public Map<String, List<IdentifiableObject>> getIdentifiableObjectWithDependencyMap( Map<String, Object> identifiableObjectUidMap )
     {
         Map<String, List<IdentifiableObject>> identifiableObjectMap = getIdentifiableObjectMap( identifiableObjectUidMap );
-        
+
         Collection<IdentifiableObject> identifiableObjects = new HashSet<>();
 
         for ( Map.Entry<String, List<IdentifiableObject>> identifiableObjectEntry : identifiableObjectMap.entrySet() )
@@ -374,7 +375,7 @@
             resultSet.addAll( dataElementCategoryOptionComboSet );
             resultSet.addAll( getDependencySet( dataElementCategoryOptionComboSet ) );
 
-            return resultSet;            
+            return resultSet;
         }
         else if ( identifiableObject instanceof DataElement )
         {
@@ -402,6 +403,16 @@
 
             return resultSet;
         }
+        else if ( identifiableObject instanceof DataSet )
+        {
+            Set<Section> sectionSet = new HashSet<>();
+            sectionSet.addAll( ((DataSet) identifiableObject).getSections() );
+
+            resultSet.addAll( sectionSet );
+            resultSet.addAll( getDependencySet( sectionSet ) );
+
+            return resultSet;
+        }
         else
         {
             return resultSet;