=== added 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 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/BaseChart.java 2014-07-12 12:22:38 +0000 @@ -0,0 +1,388 @@ +package org.hisp.dhis.chart; + +/* + * Copyright (c) 2004-2014, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +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 com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonView; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; +import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; + +/** + * @author Lars Helge Overland + */ +@JacksonXmlRootElement( localName = "baseChart", namespace = DxfNamespaces.DXF_2_0 ) +public abstract class BaseChart + extends BaseAnalyticalObject +{ + public static final String SIZE_NORMAL = "normal"; + public static final String SIZE_WIDE = "wide"; + public static final String SIZE_TALL = "tall"; + public static final String TYPE_COLUMN = "column"; + public static final String TYPE_STACKED_COLUMN = "stackedcolumn"; + public static final String TYPE_BAR = "bar"; + public static final String TYPE_STACKED_BAR = "stackedbar"; + public static final String TYPE_LINE = "line"; + public static final String TYPE_AREA = "area"; + 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; + + // ------------------------------------------------------------------------- + // Logic + // ------------------------------------------------------------------------- + + public boolean isType( String type ) + { + return this.type != null && this.type.equalsIgnoreCase( type ); + } + + public boolean isTargetLine() + { + return targetLineValue != null; + } + + public boolean isBaseLine() + { + return baseLineValue != null; + } + + // ------------------------------------------------------------------------- + // Getters and setters + // ------------------------------------------------------------------------- + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public String getDomainAxisLabel() + { + return domainAxisLabel; + } + + public void setDomainAxisLabel( String domainAxisLabel ) + { + this.domainAxisLabel = domainAxisLabel; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public String getRangeAxisLabel() + { + return rangeAxisLabel; + } + + public void setRangeAxisLabel( String rangeAxisLabel ) + { + this.rangeAxisLabel = rangeAxisLabel; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public String getType() + { + return type; + } + + public void setType( String type ) + { + this.type = type; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public boolean isHideLegend() + { + return hideLegend; + } + + public void setHideLegend( boolean hideLegend ) + { + this.hideLegend = hideLegend; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public boolean isRegression() + { + return regression; + } + + public void setRegression( boolean regression ) + { + this.regression = regression; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public boolean isHideTitle() + { + return hideTitle; + } + + public void setHideTitle( boolean hideTitle ) + { + this.hideTitle = hideTitle; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public boolean isHideSubtitle() + { + return hideSubtitle; + } + + public void setHideSubtitle( Boolean hideSubtitle ) + { + this.hideSubtitle = hideSubtitle; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public String getTitle() + { + return this.title; + } + + public void setTitle( String title ) + { + this.title = title; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public Double getTargetLineValue() + { + return targetLineValue; + } + + public void setTargetLineValue( Double targetLineValue ) + { + this.targetLineValue = targetLineValue; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public String getTargetLineLabel() + { + return targetLineLabel; + } + + public void setTargetLineLabel( String targetLineLabel ) + { + this.targetLineLabel = targetLineLabel; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public Double getBaseLineValue() + { + return baseLineValue; + } + + public void setBaseLineValue( Double baseLineValue ) + { + this.baseLineValue = baseLineValue; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public String getBaseLineLabel() + { + return baseLineLabel; + } + + public void setBaseLineLabel( String baseLineLabel ) + { + this.baseLineLabel = baseLineLabel; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public boolean isShowData() + { + return showData; + } + + public void setShowData( boolean showData ) + { + this.showData = showData; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public boolean isHideEmptyRows() + { + return hideEmptyRows; + } + + public void setHideEmptyRows( boolean hideEmptyRows ) + { + this.hideEmptyRows = hideEmptyRows; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public Double getRangeAxisMaxValue() + { + return rangeAxisMaxValue; + } + + public void setRangeAxisMaxValue( Double rangeAxisMaxValue ) + { + this.rangeAxisMaxValue = rangeAxisMaxValue; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public Double getRangeAxisMinValue() + { + return rangeAxisMinValue; + } + + public void setRangeAxisMinValue( Double rangeAxisMinValue ) + { + this.rangeAxisMinValue = rangeAxisMinValue; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public Integer getRangeAxisSteps() + { + return rangeAxisSteps; + } + + public void setRangeAxisSteps( Integer rangeAxisSteps ) + { + this.rangeAxisSteps = rangeAxisSteps; + } + + @JsonProperty + @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) + @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) + public Integer getRangeAxisDecimals() + { + return rangeAxisDecimals; + } + + public void setRangeAxisDecimals( Integer rangeAxisDecimals ) + { + this.rangeAxisDecimals = rangeAxisDecimals; + } + + // ------------------------------------------------------------------------- + // Merge with + // ------------------------------------------------------------------------- + + @Override + public void mergeWith( IdentifiableObject other ) + { + super.mergeWith( other ); + + if ( other.getClass().isInstance( this ) ) + { + BaseChart chart = (BaseChart) other; + + domainAxisLabel = chart.getDomainAxisLabel(); + rangeAxisLabel = chart.getRangeAxisLabel(); + type = chart.getType(); + hideLegend = chart.isHideLegend(); + regression = chart.isRegression(); + hideTitle = chart.isHideTitle(); + hideSubtitle = chart.isHideSubtitle(); + title = chart.getTitle(); + targetLineValue = chart.getTargetLineValue(); + targetLineLabel = chart.getTargetLineLabel(); + baseLineValue = chart.getBaseLineValue(); + baseLineLabel = chart.getBaseLineLabel(); + showData = chart.isShowData(); + hideEmptyRows = chart.isHideEmptyRows(); + rangeAxisMaxValue = chart.getRangeAxisMaxValue(); + rangeAxisMinValue = chart.getRangeAxisMinValue(); + rangeAxisSteps = chart.getRangeAxisSteps(); + rangeAxisDecimals = chart.getRangeAxisDecimals(); + } + } +} === 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-04-25 11:25:16 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2014-07-12 12:22:38 +0000 @@ -28,13 +28,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -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; -import org.hisp.dhis.common.BaseAnalyticalObject; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + import org.hisp.dhis.common.DimensionalObject; import org.hisp.dhis.common.DxfNamespaces; import org.hisp.dhis.common.IdentifiableObject; @@ -48,83 +45,28 @@ import org.hisp.dhis.period.Period; import org.hisp.dhis.user.User; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; +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; /** * @author Lars Helge Overland */ @JacksonXmlRootElement( localName = "chart", namespace = DxfNamespaces.DXF_2_0 ) public class Chart - extends BaseAnalyticalObject + extends BaseChart { private static final long serialVersionUID = 2570074075484545534L; - public static final String SIZE_NORMAL = "normal"; - - public static final String SIZE_WIDE = "wide"; - - public static final String SIZE_TALL = "tall"; - - public static final String TYPE_COLUMN = "column"; - - public static final String TYPE_STACKED_COLUMN = "stackedcolumn"; - - public static final String TYPE_BAR = "bar"; - - public static final String TYPE_STACKED_BAR = "stackedbar"; - - public static final String TYPE_LINE = "line"; - - public static final String TYPE_AREA = "area"; - - public static final String TYPE_PIE = "pie"; - - public static final String TYPE_RADAR = "radar"; // Spider web - - private String domainAxisLabel; - - private String rangeAxisLabel; - - private String type; - private String series; private String category; private List filterDimensions = new ArrayList(); - 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; // min 1 - - private Integer rangeAxisDecimals; - // ------------------------------------------------------------------------- // Transient properties // ------------------------------------------------------------------------- @@ -276,21 +218,6 @@ this.filterDimensions.add( filter ); } - public boolean isType( String type ) - { - return this.type != null && this.type.equalsIgnoreCase( type ); - } - - public boolean isTargetLine() - { - return targetLineValue != null; - } - - public boolean isBaseLine() - { - return baseLineValue != null; - } - public int getWidth() { return 700; @@ -306,45 +233,6 @@ // ------------------------------------------------------------------------- @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getDomainAxisLabel() - { - return domainAxisLabel; - } - - public void setDomainAxisLabel( String domainAxisLabel ) - { - this.domainAxisLabel = domainAxisLabel; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getRangeAxisLabel() - { - return rangeAxisLabel; - } - - public void setRangeAxisLabel( String rangeAxisLabel ) - { - this.rangeAxisLabel = rangeAxisLabel; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getType() - { - return type; - } - - public void setType( String type ) - { - this.type = type; - } - - @JsonProperty @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getSeries() @@ -387,149 +275,6 @@ @JsonProperty @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public boolean isHideLegend() - { - return hideLegend; - } - - public void setHideLegend( boolean hideLegend ) - { - this.hideLegend = hideLegend; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public boolean isRegression() - { - return regression; - } - - public void setRegression( boolean regression ) - { - this.regression = regression; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Double getTargetLineValue() - { - return targetLineValue; - } - - public void setTargetLineValue( Double targetLineValue ) - { - this.targetLineValue = targetLineValue; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getTargetLineLabel() - { - return targetLineLabel; - } - - public void setTargetLineLabel( String targetLineLabel ) - { - this.targetLineLabel = targetLineLabel; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Double getBaseLineValue() - { - return baseLineValue; - } - - public void setBaseLineValue( Double baseLineValue ) - { - this.baseLineValue = baseLineValue; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getBaseLineLabel() - { - return baseLineLabel; - } - - public void setBaseLineLabel( String baseLineLabel ) - { - this.baseLineLabel = baseLineLabel; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public boolean isHideTitle() - { - return hideTitle; - } - - public void setHideTitle( boolean hideTitle ) - { - this.hideTitle = hideTitle; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public boolean isHideSubtitle() - { - return hideSubtitle; - } - - public void setHideSubtitle( Boolean hideSubtitle ) - { - this.hideSubtitle = hideSubtitle; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getTitle() - { - return this.title; - } - - public void setTitle( String title ) - { - this.title = title; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public boolean isShowData() - { - return showData; - } - - public void setShowData( boolean showData ) - { - this.showData = showData; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public boolean isHideEmptyRows() - { - return hideEmptyRows; - } - - public void setHideEmptyRows( boolean hideEmptyRows ) - { - this.hideEmptyRows = hideEmptyRows; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public boolean isRewindRelativePeriods() { return rewindRelativePeriods; @@ -540,58 +285,6 @@ this.rewindRelativePeriods = rewindRelativePeriods; } - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Double getRangeAxisMaxValue() - { - return rangeAxisMaxValue; - } - - public void setRangeAxisMaxValue( Double rangeAxisMaxValue ) - { - this.rangeAxisMaxValue = rangeAxisMaxValue; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Double getRangeAxisMinValue() - { - return rangeAxisMinValue; - } - - public void setRangeAxisMinValue( Double rangeAxisMinValue ) - { - this.rangeAxisMinValue = rangeAxisMinValue; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Integer getRangeAxisSteps() - { - return rangeAxisSteps; - } - - public void setRangeAxisSteps( Integer rangeAxisSteps ) - { - this.rangeAxisSteps = rangeAxisSteps; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Integer getRangeAxisDecimals() - { - return rangeAxisDecimals; - } - - public void setRangeAxisDecimals( Integer rangeAxisDecimals ) - { - this.rangeAxisDecimals = rangeAxisDecimals; - } - // ------------------------------------------------------------------------- // Getters and setters for transient properties // ------------------------------------------------------------------------- @@ -633,27 +326,9 @@ { Chart chart = (Chart) other; - domainAxisLabel = chart.getDomainAxisLabel(); - rangeAxisLabel = chart.getRangeAxisLabel(); - type = chart.getType(); series = chart.getSeries(); category = chart.getCategory(); - hideLegend = chart.isHideLegend(); - regression = chart.isRegression(); - hideTitle = chart.isHideTitle(); - hideSubtitle = chart.isHideSubtitle(); - title = chart.getTitle(); - targetLineValue = chart.getTargetLineValue(); - targetLineLabel = chart.getTargetLineLabel(); - baseLineValue = chart.getBaseLineValue(); - baseLineLabel = chart.getBaseLineLabel(); - showData = chart.isShowData(); - hideEmptyRows = chart.isHideEmptyRows(); rewindRelativePeriods = chart.isRewindRelativePeriods(); - rangeAxisMaxValue = chart.getRangeAxisMaxValue(); - rangeAxisMinValue = chart.getRangeAxisMinValue(); - rangeAxisSteps = chart.getRangeAxisSteps(); - rangeAxisDecimals = chart.getRangeAxisDecimals(); 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-06-17 13:24:01 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java 2014-07-12 12:22:38 +0000 @@ -32,7 +32,7 @@ import java.util.Date; import java.util.List; -import org.hisp.dhis.common.BaseAnalyticalObject; +import org.hisp.dhis.chart.BaseChart; import org.hisp.dhis.common.BaseIdentifiableObject; import org.hisp.dhis.common.DxfNamespaces; import org.hisp.dhis.common.IdentifiableObject; @@ -54,31 +54,12 @@ /** * @author Jan Henrik Overland */ - public class EventChart - extends BaseAnalyticalObject + extends BaseChart { - public static final String COUNT_TYPE_EVENTS = "events"; - public static final String COUNT_TYPE_TRACKED_ENTITY_INSTANCES = "tracked_entity_instances"; - public static final String TYPE_COLUMN = "column"; - - public static final String TYPE_STACKED_COLUMN = "stackedcolumn"; - - public static final String TYPE_BAR = "bar"; - - public static final String TYPE_STACKED_BAR = "stackedbar"; - - public static final String TYPE_LINE = "line"; - - public static final String TYPE_AREA = "area"; - - public static final String TYPE_PIE = "pie"; - - public static final String TYPE_RADAR = "radar"; // Spider web - private Program program; private ProgramStage programStage; @@ -87,50 +68,14 @@ private Date endDate; - private String type; - private List columnDimensions = new ArrayList(); private List rowDimensions = new ArrayList(); private List filterDimensions = new ArrayList(); - private boolean hideEmptyRows; - private String countType; - private String domainAxisLabel; - - private String rangeAxisLabel; - - 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 Double rangeAxisMaxValue; - - private Double rangeAxisMinValue; - - private Integer rangeAxisSteps; // min 1 - - private Integer rangeAxisDecimals; - // ------------------------------------------------------------------------- // Constructors // ------------------------------------------------------------------------- @@ -233,19 +178,6 @@ } @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getType() - { - return type; - } - - public void setType( String type ) - { - this.type = type; - } - - @JsonProperty @JsonView( { DetailedView.class, ExportView.class } ) @JacksonXmlElementWrapper( localName = "columnDimensions", namespace = DxfNamespaces.DXF_2_0 ) @JacksonXmlProperty( localName = "column", namespace = DxfNamespaces.DXF_2_0 ) @@ -290,19 +222,6 @@ @JsonProperty @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public boolean isHideEmptyRows() - { - return hideEmptyRows; - } - - public void setHideEmptyRows( boolean hideEmptyRows ) - { - this.hideEmptyRows = hideEmptyRows; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) public String getCountType() { return countType; @@ -313,214 +232,6 @@ this.countType = countType; } - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getDomainAxisLabel() - { - return domainAxisLabel; - } - - public void setDomainAxisLabel( String domainAxisLabel ) - { - this.domainAxisLabel = domainAxisLabel; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getRangeAxisLabel() - { - return rangeAxisLabel; - } - - public void setRangeAxisLabel( String rangeAxisLabel ) - { - this.rangeAxisLabel = rangeAxisLabel; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public boolean isHideLegend() - { - return hideLegend; - } - - public void setHideLegend( boolean hideLegend ) - { - this.hideLegend = hideLegend; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public boolean isRegression() - { - return regression; - } - - public void setRegression( boolean regression ) - { - this.regression = regression; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public boolean isHideTitle() - { - return hideTitle; - } - - public void setHideTitle( boolean hideTitle ) - { - this.hideTitle = hideTitle; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public boolean isHideSubtitle() - { - return hideSubtitle; - } - - public void setHideSubtitle( Boolean hideSubtitle ) - { - this.hideSubtitle = hideSubtitle; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getTitle() - { - return this.title; - } - - public void setTitle( String title ) - { - this.title = title; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Double getTargetLineValue() - { - return targetLineValue; - } - - public void setTargetLineValue( Double targetLineValue ) - { - this.targetLineValue = targetLineValue; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getTargetLineLabel() - { - return targetLineLabel; - } - - public void setTargetLineLabel( String targetLineLabel ) - { - this.targetLineLabel = targetLineLabel; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Double getBaseLineValue() - { - return baseLineValue; - } - - public void setBaseLineValue( Double baseLineValue ) - { - this.baseLineValue = baseLineValue; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public String getBaseLineLabel() - { - return baseLineLabel; - } - - public void setBaseLineLabel( String baseLineLabel ) - { - this.baseLineLabel = baseLineLabel; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public boolean isShowData() - { - return showData; - } - - public void setShowData( boolean showData ) - { - this.showData = showData; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Double getRangeAxisMaxValue() - { - return rangeAxisMaxValue; - } - - public void setRangeAxisMaxValue( Double rangeAxisMaxValue ) - { - this.rangeAxisMaxValue = rangeAxisMaxValue; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Double getRangeAxisMinValue() - { - return rangeAxisMinValue; - } - - public void setRangeAxisMinValue( Double rangeAxisMinValue ) - { - this.rangeAxisMinValue = rangeAxisMinValue; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Integer getRangeAxisSteps() - { - return rangeAxisSteps; - } - - public void setRangeAxisSteps( Integer rangeAxisSteps ) - { - this.rangeAxisSteps = rangeAxisSteps; - } - - @JsonProperty - @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } ) - @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) - public Integer getRangeAxisDecimals() - { - return rangeAxisDecimals; - } - - public void setRangeAxisDecimals( Integer rangeAxisDecimals ) - { - this.rangeAxisDecimals = rangeAxisDecimals; - } - // ------------------------------------------------------------------------- // Merge with // ------------------------------------------------------------------------- @@ -538,7 +249,6 @@ programStage = eventChart.getProgramStage(); startDate = eventChart.getStartDate(); endDate = eventChart.getEndDate(); - type = eventChart.getType(); columnDimensions.clear(); columnDimensions.addAll( eventChart.getColumnDimensions() ); @@ -549,24 +259,7 @@ filterDimensions.clear(); filterDimensions.addAll( eventChart.getFilterDimensions() ); - hideEmptyRows = eventChart.isHideEmptyRows(); countType = eventChart.getCountType(); - domainAxisLabel = eventChart.getDomainAxisLabel(); - rangeAxisLabel = eventChart.getRangeAxisLabel(); - hideLegend = eventChart.isHideLegend(); - regression = eventChart.isRegression(); - hideTitle = eventChart.isHideTitle(); - hideSubtitle = eventChart.isHideSubtitle(); - title = eventChart.getTitle(); - targetLineValue = eventChart.getTargetLineValue(); - targetLineLabel = eventChart.getTargetLineLabel(); - baseLineValue = eventChart.getBaseLineValue(); - baseLineLabel = eventChart.getBaseLineLabel(); - showData = eventChart.isShowData(); - rangeAxisMaxValue = eventChart.getRangeAxisMaxValue(); - rangeAxisMinValue = eventChart.getRangeAxisMinValue(); - rangeAxisSteps = eventChart.getRangeAxisSteps(); - rangeAxisDecimals = eventChart.getRangeAxisDecimals(); } } }