dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35792
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18326: Event analytics. Aggregation type persistence.
------------------------------------------------------------
revno: 18326
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-02-18 18:42:47 +0100
message:
Event analytics. Aggregation type persistence.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml
dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml
--
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/eventchart/EventChart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java 2015-02-18 17:33:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventchart/EventChart.java 2015-02-18 17:42:47 +0000
@@ -32,6 +32,7 @@
import java.util.Date;
import java.util.List;
+import org.hisp.dhis.analytics.AggregationType;
import org.hisp.dhis.analytics.EventOutputType;
import org.hisp.dhis.chart.BaseChart;
import org.hisp.dhis.common.AnalyticsType;
@@ -106,6 +107,11 @@
private TrackedEntityAttribute attributeValueDimension;
/**
+ * Aggregation type.
+ */
+ private AggregationType aggregationType;
+
+ /**
* Dimensions to crosstabulate / use as columns.
*/
private List<String> columnDimensions = new ArrayList<>();
@@ -299,6 +305,19 @@
}
@JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public AggregationType getAggregationType()
+ {
+ return aggregationType;
+ }
+
+ public void setAggregationType( AggregationType aggregationType )
+ {
+ this.aggregationType = aggregationType;
+ }
+
+ @JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlElementWrapper( localName = "columnDimensions", namespace = DxfNamespaces.DXF_2_0 )
@JacksonXmlProperty( localName = "columnDimension", namespace = DxfNamespaces.DXF_2_0 )
@@ -369,34 +388,36 @@
if ( other.getClass().isInstance( this ) )
{
- EventChart eventChart = (EventChart) other;
+ EventChart chart = (EventChart) other;
if ( MergeStrategy.MERGE_ALWAYS.equals( strategy ) )
{
- dataElementValueDimension = eventChart.getDataElementValueDimension();
- attributeValueDimension = eventChart.getAttributeValueDimension();
- program = eventChart.getProgram();
- programStage = eventChart.getProgramStage();
- startDate = eventChart.getStartDate();
- endDate = eventChart.getEndDate();
- outputType = eventChart.getOutputType();
+ dataElementValueDimension = chart.getDataElementValueDimension();
+ attributeValueDimension = chart.getAttributeValueDimension();
+ aggregationType = chart.getAggregationType();
+ program = chart.getProgram();
+ programStage = chart.getProgramStage();
+ startDate = chart.getStartDate();
+ endDate = chart.getEndDate();
+ outputType = chart.getOutputType();
}
else if ( MergeStrategy.MERGE_IF_NOT_NULL.equals( strategy ) )
{
- dataElementValueDimension = eventChart.getDataElementValueDimension() == null ? dataElementValueDimension : eventChart.getDataElementValueDimension();
- attributeValueDimension = eventChart.getAttributeValueDimension() == null ? attributeValueDimension : eventChart.getAttributeValueDimension();
- program = eventChart.getProgram() == null ? program : eventChart.getProgram();
- programStage = eventChart.getProgramStage() == null ? programStage : eventChart.getProgramStage();
- startDate = eventChart.getStartDate() == null ? startDate : eventChart.getStartDate();
- endDate = eventChart.getEndDate() == null ? endDate : eventChart.getEndDate();
- outputType = eventChart.getOutputType() == null ? outputType : eventChart.getOutputType();
+ dataElementValueDimension = chart.getDataElementValueDimension() == null ? dataElementValueDimension : chart.getDataElementValueDimension();
+ attributeValueDimension = chart.getAttributeValueDimension() == null ? attributeValueDimension : chart.getAttributeValueDimension();
+ aggregationType = chart.getAggregationType() == null ? aggregationType : chart.getAggregationType();
+ program = chart.getProgram() == null ? program : chart.getProgram();
+ programStage = chart.getProgramStage() == null ? programStage : chart.getProgramStage();
+ startDate = chart.getStartDate() == null ? startDate : chart.getStartDate();
+ endDate = chart.getEndDate() == null ? endDate : chart.getEndDate();
+ outputType = chart.getOutputType() == null ? outputType : chart.getOutputType();
}
columnDimensions.clear();
- columnDimensions.addAll( eventChart.getColumnDimensions() );
+ columnDimensions.addAll( chart.getColumnDimensions() );
rowDimensions.clear();
- rowDimensions.addAll( eventChart.getRowDimensions() );
+ rowDimensions.addAll( chart.getRowDimensions() );
}
}
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java 2015-02-18 17:33:23 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/eventreport/EventReport.java 2015-02-18 17:42:47 +0000
@@ -32,6 +32,7 @@
import java.util.Date;
import java.util.List;
+import org.hisp.dhis.analytics.AggregationType;
import org.hisp.dhis.analytics.EventOutputType;
import org.hisp.dhis.common.BaseAnalyticalObject;
import org.hisp.dhis.common.BaseDimensionalObject;
@@ -103,6 +104,11 @@
private TrackedEntityAttribute attributeValueDimension;
/**
+ * Aggregation type.
+ */
+ private AggregationType aggregationType;
+
+ /**
* Type of data, can be aggregated values and individual cases.
*/
private String dataType;
@@ -319,6 +325,19 @@
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
+ public AggregationType getAggregationType()
+ {
+ return aggregationType;
+ }
+
+ public void setAggregationType( AggregationType aggregationType )
+ {
+ this.aggregationType = aggregationType;
+ }
+
+ @JsonProperty
+ @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
+ @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
public String getDataType()
{
return dataType;
@@ -531,51 +550,53 @@
if ( other.getClass().isInstance( this ) )
{
- EventReport eventReport = (EventReport) other;
+ EventReport report = (EventReport) other;
- rowSubTotals = eventReport.isRowSubTotals();
- colSubTotals = eventReport.isColSubTotals();
- hideEmptyRows = eventReport.isHideEmptyRows();
- rowTotals = eventReport.isRowTotals();
- colTotals = eventReport.isColTotals();
- showHierarchy = eventReport.isShowHierarchy();
- showDimensionLabels = eventReport.isShowDimensionLabels();
+ rowSubTotals = report.isRowSubTotals();
+ colSubTotals = report.isColSubTotals();
+ hideEmptyRows = report.isHideEmptyRows();
+ rowTotals = report.isRowTotals();
+ colTotals = report.isColTotals();
+ showHierarchy = report.isShowHierarchy();
+ showDimensionLabels = report.isShowDimensionLabels();
if ( MergeStrategy.MERGE_ALWAYS.equals( strategy ) )
{
- dataElementValueDimension = eventReport.getDataElementValueDimension();
- attributeValueDimension = eventReport.getAttributeValueDimension();
- dataType = eventReport.getDataType();
- program = eventReport.getProgram();
- programStage = eventReport.getProgramStage();
- startDate = eventReport.getStartDate();
- endDate = eventReport.getEndDate();
- outputType = eventReport.getOutputType();
- displayDensity = eventReport.getDisplayDensity();
- fontSize = eventReport.getFontSize();
+ dataElementValueDimension = report.getDataElementValueDimension();
+ attributeValueDimension = report.getAttributeValueDimension();
+ aggregationType = report.getAggregationType();
+ dataType = report.getDataType();
+ program = report.getProgram();
+ programStage = report.getProgramStage();
+ startDate = report.getStartDate();
+ endDate = report.getEndDate();
+ outputType = report.getOutputType();
+ displayDensity = report.getDisplayDensity();
+ fontSize = report.getFontSize();
}
else if ( MergeStrategy.MERGE_IF_NOT_NULL.equals( strategy ) )
{
- dataElementValueDimension = eventReport.getDataElementValueDimension() == null ? dataElementValueDimension : eventReport.getDataElementValueDimension();
- attributeValueDimension = eventReport.getAttributeValueDimension() == null ? attributeValueDimension : eventReport.getAttributeValueDimension();
- dataType = eventReport.getDataType() == null ? dataType : eventReport.getDataType();
- program = eventReport.getProgram() == null ? program : eventReport.getProgram();
- programStage = eventReport.getProgramStage() == null ? programStage : eventReport.getProgramStage();
- startDate = eventReport.getStartDate() == null ? startDate : eventReport.getStartDate();
- endDate = eventReport.getEndDate() == null ? endDate : eventReport.getEndDate();
- outputType = eventReport.getOutputType() == null ? outputType : eventReport.getOutputType();
- displayDensity = eventReport.getDisplayDensity() == null ? displayDensity : eventReport.getDisplayDensity();
- fontSize = eventReport.getFontSize() == null ? fontSize : eventReport.getFontSize();
+ dataElementValueDimension = report.getDataElementValueDimension() == null ? dataElementValueDimension : report.getDataElementValueDimension();
+ attributeValueDimension = report.getAttributeValueDimension() == null ? attributeValueDimension : report.getAttributeValueDimension();
+ aggregationType = report.getAggregationType() == null ? aggregationType : report.getAggregationType();
+ dataType = report.getDataType() == null ? dataType : report.getDataType();
+ program = report.getProgram() == null ? program : report.getProgram();
+ programStage = report.getProgramStage() == null ? programStage : report.getProgramStage();
+ startDate = report.getStartDate() == null ? startDate : report.getStartDate();
+ endDate = report.getEndDate() == null ? endDate : report.getEndDate();
+ outputType = report.getOutputType() == null ? outputType : report.getOutputType();
+ displayDensity = report.getDisplayDensity() == null ? displayDensity : report.getDisplayDensity();
+ fontSize = report.getFontSize() == null ? fontSize : report.getFontSize();
}
columnDimensions.clear();
- columnDimensions.addAll( eventReport.getColumnDimensions() );
+ columnDimensions.addAll( report.getColumnDimensions() );
rowDimensions.clear();
- rowDimensions.addAll( eventReport.getRowDimensions() );
+ rowDimensions.addAll( report.getRowDimensions() );
filterDimensions.clear();
- filterDimensions.addAll( eventReport.getFilterDimensions() );
+ filterDimensions.addAll( report.getFilterDimensions() );
}
}
}
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml 2015-02-18 17:33:23 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventchart/EventChart.hbm.xml 2015-02-18 17:42:47 +0000
@@ -95,6 +95,13 @@
<many-to-one name="attributeValueDimension" class="org.hisp.dhis.trackedentity.TrackedEntityAttribute"
column="attributevaluedimensionid" foreign-key="fk_eventchart_attributevaluedimensionid" />
+ <property name="aggregationType" length="40">
+ <type name="org.hibernate.type.EnumType">
+ <param name="enumClass">org.hisp.dhis.analytics.AggregationType</param>
+ <param name="type">12</param>
+ </type>
+ </property>
+
<property name="type" not-null="true" />
<list name="columnDimensions" table="eventchart_columns">
=== modified file 'dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml'
--- dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml 2015-02-18 17:33:23 +0000
+++ dhis-2/dhis-services/dhis-service-tracker/src/main/resources/org/hisp/dhis/eventreport/EventReport.hbm.xml 2015-02-18 17:42:47 +0000
@@ -95,6 +95,13 @@
<many-to-one name="attributeValueDimension" class="org.hisp.dhis.trackedentity.TrackedEntityAttribute"
column="attributevaluedimensionid" foreign-key="fk_eventreport_attributevaluedimensionid" />
+ <property name="aggregationType" length="40">
+ <type name="org.hibernate.type.EnumType">
+ <param name="enumClass">org.hisp.dhis.analytics.AggregationType</param>
+ <param name="type">12</param>
+ </type>
+ </property>
+
<property name="dataType" not-null="true" />
<list name="columnDimensions" table="eventreport_columns">