dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22418
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10763: WIP, Chart, made chart model support multiple filters
------------------------------------------------------------
revno: 10763
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2013-05-05 20:08:08 +0200
message:
WIP, Chart, made chart model support multiple filters
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.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/chart/Chart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2013-04-30 12:40:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2013-05-05 18:08:08 +0000
@@ -98,7 +98,7 @@
private String category;
- private String filter;
+ private List<String> filters = new ArrayList<String>();
private boolean hideLegend;
@@ -180,14 +180,14 @@
public NameableObject filter()
{
- List<NameableObject> list = dimensionToList( filter );
+ List<NameableObject> list = dimensionToList( filters.get( 0 ) ); //TODO
return list != null && !list.isEmpty() ? list.iterator().next() : null;
}
public String generateTitle()
{
- if ( DIMENSION_PERIOD.equals( filter ) )
+ if ( DIMENSION_PERIOD.equals( filters.get( 0 ) ) )
{
return format.formatPeriod( getAllPeriods().get( 0 ) );
}
@@ -316,7 +316,8 @@
{
this.series = series;
this.category = category;
- this.filter = filter;
+ this.filters.clear();
+ this.filters.add( filter ); //TODO
}
public boolean hasIndicators()
@@ -438,17 +439,28 @@
this.category = category;
}
+ public List<String> getFilters()
+ {
+ return filters;
+ }
+
+ public void setFilters( List<String> filters )
+ {
+ this.filters = filters;
+ }
+
@JsonProperty
@JsonView( {DetailedView.class, ExportView.class} )
@JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
public String getFilter()
{
- return filter;
+ return filters.get( 0 ); //TODO
}
public void setFilter( String filter )
{
- this.filter = filter;
+ this.filters.clear();
+ this.filters.add( filter ); //TODO
}
@JsonProperty
@@ -747,8 +759,8 @@
rangeAxisLabel = chart.getRangeAxisLabel() == null ? rangeAxisLabel : chart.getRangeAxisLabel();
type = chart.getType() == null ? type : chart.getType();
series = chart.getSeries() == null ? series : chart.getSeries();
- category = chart.getCategory() == null ? category : chart.getCategory();
- filter = chart.getFilter() == null ? filter : chart.getFilter();
+ category = chart.getCategory() == null ? category : chart.getCategory();
+ setFilter( chart.getFilter() == null ? getFilter() : chart.getFilter() ); //TODO
hideLegend = chart.isHideLegend();
regression = chart.isRegression();
hideSubtitle = chart.isHideSubtitle();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2013-04-30 12:24:05 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2013-05-05 18:08:08 +0000
@@ -457,7 +457,10 @@
executeSql( "update chart set showdata = false where showdata is null" );
executeSql( "update chart set userorganisationunitchildren = false where userorganisationunitchildren is null" );
executeSql( "update chart set userorganisationunit = false where userorganisationunit is null" );
-
+
+ executeSql( "insert into chart_filters (chartid, sort_order, filter) select chartid, 0, filter from chart" );
+ executeSql( "alter table chart drop column filter" );
+
executeSql( "update users set selfregistered = false where selfregistered is null" );
executeSql( "update users set disabled = false where disabled is null" );
executeSql( "update dataentryform set format = 1 where format is null" );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml 2013-03-14 11:08:04 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/resources/org/hisp/dhis/chart/hibernate/Chart.hbm.xml 2013-05-05 18:08:08 +0000
@@ -32,7 +32,12 @@
<property name="category" />
- <property name="filter" />
+ <list name="filters" table="chart_filters">
+ <cache usage="read-write" />
+ <key column="chartid" />
+ <list-index column="sort_order" base="0" />
+ <element type="string" column="filter" />
+ </list>
<property name="hideLegend" />