← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10784: Added parent graph to chart web api

 

------------------------------------------------------------
revno: 10784
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-05-09 16:55:04 +0200
message:
  Added parent graph to chart web api
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.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-api/src/main/java/org/hisp/dhis/chart/Chart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java	2013-05-09 14:04:30 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java	2013-05-09 14:55:04 +0000
@@ -37,7 +37,9 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.hisp.dhis.common.BaseDimensionalObject;
 import org.hisp.dhis.common.BaseIdentifiableObject;
@@ -175,6 +177,8 @@
     
     private transient List<DimensionalObject> filters = new ArrayList<DimensionalObject>();
     
+    private Map<String, String> parentGraphMap = new HashMap<String, String>();
+    
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -218,6 +222,11 @@
         {
             filters.addAll( getDimensionalObjectList( filter ) );
         }
+        
+        for ( OrganisationUnit organisationUnit : organisationUnits )
+        {
+            parentGraphMap.put( organisationUnit.getUid(), organisationUnit.getParentGraph() );
+        }
     }
     
     private List<DimensionalObject> getDimensionalObjectList( String dimension )
@@ -888,7 +897,19 @@
     public void setFilters( List<DimensionalObject> filters )
     {
         this.filters = filters;
-    }    
+    }
+
+    @JsonProperty
+    @JsonView({ DetailedView.class, ExportView.class })
+    public Map<String, String> getParentGraphMap()
+    {
+        return parentGraphMap;
+    }
+
+    public void setParentGraphMap( Map<String, String> parentGraphMap )
+    {
+        this.parentGraphMap = parentGraphMap;
+    }
 
     // -------------------------------------------------------------------------
     // Merge with

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2013-04-24 11:44:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java	2013-05-09 14:55:04 +0000
@@ -1680,6 +1680,18 @@
         this.categoryOptionCombos = categoryOptionCombos;
     }
 
+    @JsonProperty
+    @JsonView({ DetailedView.class, ExportView.class })
+    public Map<String, String> getParentGraphMap()
+    {
+        return parentGraphMap;
+    }
+
+    public void setParentGraphMap( Map<String, String> parentGraphMap )
+    {
+        this.parentGraphMap = parentGraphMap;
+    }
+
     @Override
     public void mergeWith( IdentifiableObject other )
     {
@@ -1736,16 +1748,4 @@
             filterDimensions.addAll( reportTable.getFilterDimensions() );
         }
     }
-
-    @JsonProperty
-    @JsonView({ DetailedView.class, ExportView.class })
-    public Map<String, String> getParentGraphMap()
-    {
-        return parentGraphMap;
-    }
-
-    public void setParentGraphMap( Map<String, String> parentGraphMap )
-    {
-        this.parentGraphMap = parentGraphMap;
-    }
 }