← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16103: Chart sentralization

 

------------------------------------------------------------
revno: 16103
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-07-12 14:52:17 +0200
message:
  Chart sentralization
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/BaseChart.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/fieldfilter/DefaultFieldFilterService.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/parser/DefaultParserService.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/BaseChart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/BaseChart.java	2014-07-12 12:22:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/BaseChart.java	2014-07-12 12:52:17 +0000
@@ -28,15 +28,23 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.hisp.dhis.common.BaseAnalyticalObject;
 import org.hisp.dhis.common.DxfNamespaces;
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.view.DetailedView;
 import org.hisp.dhis.common.view.DimensionalView;
 import org.hisp.dhis.common.view.ExportView;
+import org.hisp.dhis.i18n.I18nFormat;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+import org.hisp.dhis.user.User;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 
@@ -59,41 +67,61 @@
     public static final String TYPE_PIE = "pie";
     public static final String TYPE_RADAR = "radar";
 
-    private String domainAxisLabel;
-
-    private String rangeAxisLabel;
-
-    private String type;
-
-    private boolean hideLegend;
-
-    private boolean regression;
-
-    private boolean hideTitle;
-
-    private boolean hideSubtitle;
-
-    private String title;
-
-    private Double targetLineValue;
-
-    private String targetLineLabel;
-
-    private Double baseLineValue;
-
-    private String baseLineLabel;
-
-    private boolean showData;
-
-    private boolean hideEmptyRows;
-
-    private Double rangeAxisMaxValue;
-
-    private Double rangeAxisMinValue;
-
-    private Integer rangeAxisSteps; // Minimum 1
-
-    private Integer rangeAxisDecimals;
+    protected String domainAxisLabel;
+
+    protected String rangeAxisLabel;
+
+    protected String type;
+
+    protected boolean hideLegend;
+
+    protected boolean regression;
+
+    protected boolean hideTitle;
+
+    protected boolean hideSubtitle;
+
+    protected String title;
+
+    protected Double targetLineValue;
+
+    protected String targetLineLabel;
+
+    protected Double baseLineValue;
+
+    protected String baseLineLabel;
+
+    protected boolean showData;
+
+    protected boolean hideEmptyRows;
+
+    protected Double rangeAxisMaxValue;
+
+    protected Double rangeAxisMinValue;
+
+    protected Integer rangeAxisSteps; // Minimum 1
+
+    protected Integer rangeAxisDecimals;
+
+    // -------------------------------------------------------------------------
+    // Dimensional properties
+    // -------------------------------------------------------------------------
+
+    protected List<String> filterDimensions = new ArrayList<String>();
+
+    // -------------------------------------------------------------------------
+    // Transient properties
+    // -------------------------------------------------------------------------
+
+    protected transient I18nFormat format;
+
+    protected transient List<Period> relativePeriods = new ArrayList<Period>();
+
+    protected transient User user;
+
+    protected transient List<OrganisationUnit> organisationUnitsAtLevel = new ArrayList<OrganisationUnit>();
+
+    protected transient List<OrganisationUnit> organisationUnitsInGroups = new ArrayList<OrganisationUnit>();
 
     // -------------------------------------------------------------------------
     // Logic
@@ -352,6 +380,20 @@
         this.rangeAxisDecimals = rangeAxisDecimals;
     }
 
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class } )
+    @JacksonXmlElementWrapper( localName = "filterDimensions", namespace = DxfNamespaces.DXF_2_0 )
+    @JacksonXmlProperty( localName = "filterDimension", namespace = DxfNamespaces.DXF_2_0 )
+    public List<String> getFilterDimensions()
+    {
+        return filterDimensions;
+    }
+
+    public void setFilterDimensions( List<String> filterDimensions )
+    {
+        this.filterDimensions = filterDimensions;
+    }
+
     // -------------------------------------------------------------------------
     // Merge with
     // -------------------------------------------------------------------------
@@ -382,7 +424,10 @@
             rangeAxisMaxValue = chart.getRangeAxisMaxValue();
             rangeAxisMinValue = chart.getRangeAxisMinValue();
             rangeAxisSteps = chart.getRangeAxisSteps();
-            rangeAxisDecimals = chart.getRangeAxisDecimals();            
+            rangeAxisDecimals = chart.getRangeAxisDecimals();
+
+            filterDimensions.clear();
+            filterDimensions.addAll( chart.getFilterDimensions() );
         }
     }
 }

=== 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	2014-07-12 12:22:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java	2014-07-12 12:52:17 +0000
@@ -48,7 +48,6 @@
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.fasterxml.jackson.annotation.JsonProperty;
 import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
 
@@ -65,22 +64,6 @@
 
     private String category;
 
-    private List<String> filterDimensions = new ArrayList<String>();
-
-    // -------------------------------------------------------------------------
-    // Transient properties
-    // -------------------------------------------------------------------------
-
-    private transient I18nFormat format;
-
-    private transient List<Period> relativePeriods = new ArrayList<Period>();
-
-    private transient User user;
-
-    private transient List<OrganisationUnit> organisationUnitsAtLevel = new ArrayList<OrganisationUnit>();
-
-    private transient List<OrganisationUnit> organisationUnitsInGroups = new ArrayList<OrganisationUnit>();
-
     // -------------------------------------------------------------------------
     // Constructors
     // -------------------------------------------------------------------------
@@ -259,20 +242,6 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlElementWrapper( localName = "filterDimensions", namespace = DxfNamespaces.DXF_2_0 )
-    @JacksonXmlProperty( localName = "filterDimension", namespace = DxfNamespaces.DXF_2_0 )
-    public List<String> getFilterDimensions()
-    {
-        return filterDimensions;
-    }
-
-    public void setFilterDimensions( List<String> filterDimensions )
-    {
-        this.filterDimensions = filterDimensions;
-    }
-
-    @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public boolean isRewindRelativePeriods()
@@ -329,9 +298,6 @@
             series = chart.getSeries();
             category = chart.getCategory();
             rewindRelativePeriods = chart.isRewindRelativePeriods();
-
-            filterDimensions.clear();
-            filterDimensions.addAll( chart.getFilterDimensions() );
         }
     }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java	2014-07-12 12:22:38 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java	2014-07-12 12:52:17 +0000
@@ -72,8 +72,6 @@
 
     private List<String> rowDimensions = new ArrayList<String>();
 
-    private List<String> filterDimensions = new ArrayList<String>();
-
     private String countType;
 
     // -------------------------------------------------------------------------
@@ -206,20 +204,6 @@
     }
 
     @JsonProperty
-    @JsonView( { DetailedView.class, ExportView.class } )
-    @JacksonXmlElementWrapper( localName = "filterDimensions", namespace = DxfNamespaces.DXF_2_0 )
-    @JacksonXmlProperty( localName = "filter", namespace = DxfNamespaces.DXF_2_0 )
-    public List<String> getFilterDimensions()
-    {
-        return filterDimensions;
-    }
-
-    public void setFilterDimensions( List<String> filterDimensions )
-    {
-        this.filterDimensions = filterDimensions;
-    }
-
-    @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
     public String getCountType()
@@ -256,9 +240,6 @@
             rowDimensions.clear();
             rowDimensions.addAll( eventChart.getRowDimensions() );
 
-            filterDimensions.clear();
-            filterDimensions.addAll( eventChart.getFilterDimensions() );
-
             countType = eventChart.getCountType();
         }
     }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/fieldfilter/DefaultFieldFilterService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/fieldfilter/DefaultFieldFilterService.java	2014-07-01 13:05:51 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/fieldfilter/DefaultFieldFilterService.java	2014-07-12 12:52:17 +0000
@@ -28,12 +28,14 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
  */
 
-import com.google.common.base.Joiner;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.annotation.PostConstruct;
+
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.PresetProvider;
 import org.hisp.dhis.dxf2.parser.ParserService;
@@ -50,20 +52,16 @@
 import org.hisp.dhis.system.util.ReflectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import javax.annotation.PostConstruct;
-import java.util.Collection;
-import java.util.List;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import com.google.common.base.Joiner;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 public class DefaultFieldFilterService implements FieldFilterService
 {
-    private static final Log log = LogFactory.getLog( DefaultFieldFilterService.class );
-
     @Autowired
     private ParserService parserService;
 
@@ -154,7 +152,6 @@
         return collectionNode;
     }
 
-    @SuppressWarnings("unchecked")
     private AbstractNode buildNode( FieldMap fieldMap, Class<?> klass, Object object )
     {
         Schema schema = schemaService.getDynamicSchema( klass );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java	2014-05-31 12:59:54 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/metadata/DefaultObjectBridge.java	2014-07-12 12:52:17 +0000
@@ -124,7 +124,7 @@
     public void init()
     {
         log.info( "Building object-bridge maps (preheatCache: " + preheatCache + ")." );
-        Timer timer = new SystemNanoTimer();
+        Timer<Long> timer = new SystemNanoTimer();
         timer.start();
 
         masterMap = Maps.newHashMap();

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/parser/DefaultParserService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/parser/DefaultParserService.java	2014-06-25 11:27:12 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/parser/DefaultParserService.java	2014-07-12 12:52:17 +0000
@@ -28,12 +28,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import com.google.common.collect.Lists;
+import java.util.List;
+
 import org.apache.commons.lang.StringUtils;
 import org.hisp.dhis.dxf2.fieldfilter.FieldMap;
 import org.hisp.dhis.dxf2.objectfilter.Filters;
 
-import java.util.List;
+import com.google.common.collect.Lists;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -125,7 +126,6 @@
         return prefixes;
     }
 
-    @SuppressWarnings("unchecked")
     private void putInMap( FieldMap fieldMap, String path )
     {
         if ( StringUtils.isEmpty( path ) )