← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5793: (DV) Overwrite favorite bug fixed + Chart target line bug fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 5793 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-01-23 13:38:23 +0100
message:
  (DV) Overwrite favorite bug fixed + Chart target line bug fixed.
modified:
  dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.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-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java	2012-01-19 14:21:19 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java	2012-01-23 12:36:17 +0000
@@ -80,7 +80,7 @@
     {
         this.organisationUnitService = organisationUnitService;
     }
-    
+
     private CurrentUserService currentUserService;
 
     public void setCurrentUserService( CurrentUserService currentUserService )
@@ -210,23 +210,23 @@
     {
         this.organisationUnitIds = organisationUnitIds;
     }
-    
+
     private Boolean system;
 
     public void setSystem( Boolean system )
     {
         this.system = system;
     }
-    
+
     private Boolean trendLine;
-    
+
     public void setTrendLine( Boolean trendLine )
     {
         this.trendLine = trendLine;
     }
-    
+
     private Boolean hideSubtitle;
-    
+
     public void setHideSubtitle( Boolean hideSubtitle )
     {
         this.hideSubtitle = hideSubtitle;
@@ -238,28 +238,28 @@
     {
         this.hideLegend = hideLegend;
     }
-    
+
     private Boolean userOrganisationUnit;
 
     public void setUserOrganisationUnit( Boolean userOrganisationUnit )
     {
         this.userOrganisationUnit = userOrganisationUnit;
     }
-    
+
     private String domainAxisLabel;
 
     public void setDomainAxisLabel( String domainAxisLabel )
     {
         this.domainAxisLabel = domainAxisLabel;
     }
-    
+
     private String rangeAxisLabel;
 
     public void setRangeAxisLabel( String rangeAxisLabel )
     {
         this.rangeAxisLabel = rangeAxisLabel;
     }
-    
+
     private Double targetLineValue;
 
     public void setTargetLineValue( Double targetLineValue )
@@ -316,19 +316,14 @@
         {
             chart.setFilter( filter );
         }
-
-        if ( indicatorIds != null )
-        {
-            chart.setIndicators( new ArrayList<Indicator>( indicatorService.getIndicators( indicatorIds ) ) );
-        }
-
-        if ( dataElementIds != null )
-        {
-            chart.setDataElements( new ArrayList<DataElement>( dataElementService.getDataElements( dataElementIds ) ) );
-        }
-
-        if ( lastMonth || last12Months || lastQuarter || last4Quarters || lastSixMonth || last2SixMonths
-            || thisYear || last5Years )
+        
+        chart.setIndicators( indicatorIds != null ? new ArrayList<Indicator>( indicatorService.getIndicators( indicatorIds ) ) : new ArrayList<Indicator>() );
+
+        chart.setDataElements( dataElementIds != null ? new ArrayList<DataElement>( dataElementService
+            .getDataElements( dataElementIds ) ) : new ArrayList<DataElement>() );
+
+        if ( lastMonth || last12Months || lastQuarter || last4Quarters || lastSixMonth || last2SixMonths || thisYear
+            || last5Years )
         {
             RelativePeriods rp = new RelativePeriods();
             rp.setReportingMonth( lastMonth );
@@ -348,47 +343,48 @@
             chart.setOrganisationUnits( new ArrayList<OrganisationUnit>( organisationUnitService
                 .getOrganisationUnits( organisationUnitIds ) ) );
         }
-        
+
         if ( system == null )
         {
             chart.setUser( currentUserService.getCurrentUser() );
         }
-        
+
         if ( trendLine != null )
         {
             chart.setRegression( trendLine );
         }
-        
+
         if ( hideSubtitle != null )
         {
             chart.setHideSubtitle( hideSubtitle );
         }
-        
+
         if ( hideLegend != null )
         {
             chart.setHideLegend( hideLegend );
         }
-        
+
         if ( userOrganisationUnit != null )
         {
             chart.setUserOrganisationUnit( userOrganisationUnit );
         }
-        
+
         if ( domainAxisLabel != null )
         {
             chart.setDomainAxisLabel( domainAxisLabel );
         }
-        
+
         if ( rangeAxisLabel != null )
         {
             chart.setRangeAxisLabel( rangeAxisLabel );
         }
-        
+
         if ( targetLineValue != null )
         {
+            chart.setTargetLine( true );
             chart.setTargetLineValue( targetLineValue );
         }
-        
+
         if ( targetLineLabel != null )
         {
             chart.setTargetLineLabel( targetLineLabel );