dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21667
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10318: Charts, using lowercase for variable constants
------------------------------------------------------------
revno: 10318
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-03-19 17:20:36 +0100
message:
Charts, using lowercase for variable constants
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.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/java/org/hisp/dhis/chart/impl/DefaultChartService.java
dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.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/Chart.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2013-03-15 08:41:06 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/Chart.java 2013-03-19 16:20:36 +0000
@@ -72,28 +72,21 @@
private static final Comparator<Period> PERIOD_COMPARATOR = new AscendingPeriodEndDateComparator();
- public static final String DIMENSION_PERIOD_INDICATOR = "period";
- public static final String DIMENSION_ORGANISATIONUNIT_INDICATOR = "organisationUnit";
- public static final String DIMENSION_INDICATOR_PERIOD = "indicator";
- public static final String DIMENSION_PERIOD_DATAELEMENT = "period_dataElement";
- public static final String DIMENSION_ORGANISATIONUNIT_DATAELEMENT = "organisationUnit_dataElement";
- public static final String DIMENSION_DATAELEMENT_PERIOD = "dataElement_period";
-
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_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 DIMENSION_DATA = "DATA";
- public static final String DIMENSION_PERIOD = "PERIOD";
- public static final String DIMENSION_ORGANISATIONUNIT = "ORGANISATIONUNIT";
+ public static final String DIMENSION_DATA = "data";
+ public static final String DIMENSION_PERIOD = "period";
+ public static final String DIMENSION_ORGANISATIONUNIT = "organisationunit";
private String domainAxisLabel;
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java 2013-03-15 11:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectManager.java 2013-03-19 16:20:36 +0000
@@ -45,6 +45,8 @@
void update( IdentifiableObject object );
<T extends IdentifiableObject> T get( Class<T> clazz, String uid );
+
+ <T extends IdentifiableObject> T getNoAcl( Class<T> clazz, String uid );
<T extends IdentifiableObject> T getByCode( Class<T> clazz, String code );
=== 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-03-19 11:44:28 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2013-03-19 16:20:36 +0000
@@ -269,22 +269,22 @@
// migrate charts from dimension to category, series, filter
- executeSql( "UPDATE chart SET series='PERIOD', category='DATA', filter='ORGANISATIONUNIT' WHERE dimension='indicator'" );
- executeSql( "UPDATE chart SET series='DATA', category='ORGANISATIONUNIT', filter='PERIOD' WHERE dimension='organisationUnit'" );
- executeSql( "UPDATE chart SET series='PERIOD', category='DATA', filter='ORGANISATIONUNIT' WHERE dimension='dataElement_period'" );
- executeSql( "UPDATE chart SET series='DATA', category='ORGANISATIONUNIT', filter='PERIOD' WHERE dimension='organisationUnit_dataElement'" );
- executeSql( "UPDATE chart SET series='DATA', category='PERIOD', filter='ORGANISATIONUNIT' WHERE dimension='period'" );
- executeSql( "UPDATE chart SET series='DATA', category='PERIOD', filter='ORGANISATIONUNIT' WHERE dimension='period_dataElement'" );
+ executeSql( "UPDATE chart SET series='period', category='data', filter='organisationunit' WHERE dimension='indicator'" );
+ executeSql( "UPDATE chart SET series='data', category='organisationunit', filter='period' WHERE dimension='organisationUnit'" );
+ executeSql( "UPDATE chart SET series='period', category='data', filter='organisationunit' WHERE dimension='dataElement_period'" );
+ executeSql( "UPDATE chart SET series='data', category='organisationunit', filter='period' WHERE dimension='organisationUnit_dataElement'" );
+ executeSql( "UPDATE chart SET series='data', category='period', filter='organisationunit' WHERE dimension='period'" );
+ executeSql( "UPDATE chart SET series='data', category='period', filter='organisationunit' WHERE dimension='period_dataElement'" );
- executeSql( "UPDATE chart SET type='BAR' where type='bar'" );
- executeSql( "UPDATE chart SET type='BAR' where type='bar3d'" );
- executeSql( "UPDATE chart SET type='STACKEDBAR' where type='stackedBar'" );
- executeSql( "UPDATE chart SET type='STACKEDBAR' where type='stackedBar3d'" );
- executeSql( "UPDATE chart SET type='LINE' where type='line'" );
- executeSql( "UPDATE chart SET type='LINE' where type='line3d'" );
- executeSql( "UPDATE chart SET type='PIE' where type='pie'" );
- executeSql( "UPDATE chart SET type='PIE' where type='pie3d'" );
+ executeSql( "UPDATE chart SET type='bar' where type='bar3d'" );
+ executeSql( "UPDATE chart SET type='stackedbar' where type='stackedBar'" );
+ executeSql( "UPDATE chart SET type='stackedbar' where type='stackedBar3d'" );
+ executeSql( "UPDATE chart SET type='line' where type='line3d'" );
+ executeSql( "UPDATE chart SET type='pie' where type='pie'" );
+ executeSql( "UPDATE chart SET type='pie' where type='pie3d'" );
executeSql( "UPDATE chart SET rewindRelativePeriods = false WHERE rewindRelativePeriods is null" );
+
+ executeSql( "UPDATE chart SET type=lower(type), series=lower(series), category=lower(category), filter=lower(filter)" );
executeSql( "ALTER TABLE chart ALTER COLUMN dimension DROP NOT NULL" );
executeSql( "ALTER TABLE chart RENAME COLUMN title TO name" );
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2013-03-14 10:12:47 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/chart/impl/DefaultChartService.java 2013-03-19 16:20:36 +0000
@@ -540,6 +540,10 @@
{
return getStackedBarChart( chart, dataSets[0], true );
}
+ else
+ {
+ throw new IllegalArgumentException( "Illegal or no chart type: " + chart.getType() );
+ }
if ( chart.isRegression() )
{
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java 2013-01-16 13:25:48 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/test/java/org/hisp/dhis/chart/ChartServiceTest.java 2013-03-19 16:20:36 +0000
@@ -65,7 +65,6 @@
private OrganisationUnit unitA;
private OrganisationUnit unitB;
- private OrganisationUnit unitC;
private Chart chartA;
private Chart chartB;
@@ -132,16 +131,13 @@
unitA = createOrganisationUnit( 'A' );
unitB = createOrganisationUnit( 'B' );
- unitC = createOrganisationUnit( 'C' );
organisationUnitService.addOrganisationUnit( unitA );
organisationUnitService.addOrganisationUnit( unitB );
- // organisationUnitService.addOrganisationUnit( unitC );
List<OrganisationUnit> units = new ArrayList<OrganisationUnit>();
units.add( unitA );
units.add( unitB );
- // units.add( unitC );
chartA = createChart( 'A', indicators, periods, units );
chartA.setType( Chart.TYPE_BAR );
@@ -179,7 +175,6 @@
assertEquals( chartC, chartService.getChart( idC ) );
assertTrue( equals( chartService.getChart( idA ).getIndicators(), indicatorA, indicatorB, indicatorC ) );
- // assertTrue( equals( chartService.getChart( idA ).getOrganisationUnits(), unitA, unitB, unitC ) );
assertTrue( equals( chartService.getChart( idA ).getOrganisationUnits(), unitA, unitB ) );
assertTrue( equals( chartService.getChart( idA ).getPeriods(), periodA, periodB, periodC ) );
}