dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #05287
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1739: Fixed bug <Data browser does not use period names>
------------------------------------------------------------
revno: 1739
committer: hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Tue 2010-04-06 17:05:28 +0700
message:
Fixed bug <Data browser does not use period names>
- Added new resource bundle key 'format.date.custome' which is used for defined the format date in data browser output.
Fixed bug <Data browser drilldown>
- Working on process and still have a long discussion with Jason about re-solving this one
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/jdbc/StatementManagerDataBrowserStore.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java
dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties
dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_vi_VN.properties
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelTemplateList.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/SearchAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataBrowserResult.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties
--
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/i18n/I18nFormat.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java 2010-04-06 10:05:28 +0000
@@ -51,13 +51,13 @@
}
/**
- * Constructor should only be used for testing purposes. Use
+ * Constructor should only be used for testing purposes. Use
* I18nManager.getI18nFormat for normal use.
*/
public I18nFormat()
- {
+ {
}
-
+
// -------------------------------------------------------------------------
// Init
// -------------------------------------------------------------------------
@@ -141,6 +141,16 @@
return commonFormatting( date, resourceBundle.getString( "format.date" ) );
}
+ public String formatDateByCustome( Date date )
+ {
+ if ( date == null )
+ {
+ return null;
+ }
+
+ return commonFormatting( date, resourceBundle.getString( "format.date.custome" ) );
+ }
+
public String formatTime( Date date )
{
if ( date == null )
=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/jdbc/StatementManagerDataBrowserStore.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/jdbc/StatementManagerDataBrowserStore.java 2009-08-24 13:55:25 +0000
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/databrowser/jdbc/StatementManagerDataBrowserStore.java 2010-04-06 10:05:28 +0000
@@ -15,6 +15,8 @@
/**
* @author joakibj, martinwa, briane, eivinhb
* @version $Id$
+ * @modifier Dang Duy Hieu
+ * @since 2010-04-06
*/
public class StatementManagerDataBrowserStore
implements DataBrowserStore
@@ -22,7 +24,7 @@
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
-
+
private StatementManager statementManager;
public void setStatementManager( StatementManager statementManager )
@@ -33,7 +35,7 @@
// -------------------------------------------------------------------------
// DataBrowserStore implementation
// -------------------------------------------------------------------------
-
+
public DataBrowserTable getDataSetsBetweenPeriods( List<Integer> betweenPeriodIds )
{
StatementHolder holder = statementManager.getHolder();
@@ -46,13 +48,13 @@
try
{
StringBuffer sqlsb = new StringBuffer();
- sqlsb.append( "SELECT d.datasetid AS ID, d.name AS DataSet, count(*) AS Count " );
+ sqlsb.append( "(SELECT d.datasetid AS ID, d.name AS DataSet, count(*) AS Counts_of_aggregated_values " );
sqlsb.append( "FROM datavalue dv " );
sqlsb.append( "JOIN datasetmembers dsm ON (dv.dataelementid = dsm.dataelementid) " );
sqlsb.append( "JOIN dataset d ON (d.datasetid = dsm.datasetid) " );
sqlsb.append( "WHERE dv.periodid IN " + splitListHelper( betweenPeriodIds ) + " " );
sqlsb.append( "GROUP BY d.datasetid, d.name " );
- sqlsb.append( "ORDER BY Count DESC" );
+ sqlsb.append( "ORDER BY Counts_of_aggregated_values DESC)" );
String sql = sqlsb.toString();
@@ -78,9 +80,9 @@
{
holder.close();
}
-
+
return table;
- }
+ }
public DataBrowserTable getDataElementGroupsBetweenPeriods( List<Integer> betweenPeriodIds )
{
@@ -91,13 +93,14 @@
try
{
StringBuffer sqlsb = new StringBuffer();
- sqlsb.append( "SELECT d.dataelementgroupid AS ID, d.name AS DataElementGroup, count(*) AS Count " );
+ sqlsb
+ .append( "(SELECT d.dataelementgroupid AS ID, d.name AS DataElementGroup, count(*) AS Counts_of_aggregated_values " );
sqlsb.append( "FROM datavalue dv " );
- sqlsb
- .append( "JOIN dataelementgroupmembers degm ON (dv.dataelementid = degm.dataelementid) JOIN dataelementgroup d ON (d.dataelementgroupid = degm.dataelementgroupid) " );
+ sqlsb.append( "JOIN dataelementgroupmembers degm ON (dv.dataelementid = degm.dataelementid)" );
+ sqlsb.append( "JOIN dataelementgroup d ON (d.dataelementgroupid = degm.dataelementgroupid) " );
sqlsb.append( "WHERE dv.periodid IN " + splitListHelper( betweenPeriodIds ) + " " );
sqlsb.append( "GROUP BY d.dataelementgroupid, d.name " );
- sqlsb.append( "ORDER BY Count DESC;" );
+ sqlsb.append( "ORDER BY Count DESC)" );
String sql = sqlsb.toString();
@@ -122,7 +125,7 @@
{
holder.close();
}
-
+
return table;
}
@@ -132,18 +135,18 @@
DataBrowserTable table = null;
String sql = "";
-
+
try
{
StringBuffer sqlsb = new StringBuffer();
- sqlsb.append( "SELECT oug.orgunitgroupid, oug.name, Count(*) as ant " );
- sqlsb.append( "FROM orgunitgroup oug " );
- sqlsb.append( "Join orgunitgroupmembers ougm ON oug.orgunitgroupid = ougm.orgunitgroupid " );
- sqlsb.append( "Join organisationunit ou ON ougm.organisationunitid = ou.organisationunitid " );
- sqlsb.append( "Join datavalue dv ON ou.organisationunitid = dv.sourceid " );
+ sqlsb.append( "(SELECT oug.orgunitgroupid, oug.name, Count(*) as Counts_of_aggregated_values " );
+ sqlsb.append( "FROM orgunitgroup oug " );
+ sqlsb.append( "JOIN orgunitgroupmembers ougm ON oug.orgunitgroupid = ougm.orgunitgroupid " );
+ sqlsb.append( "JOIN organisationunit ou ON ougm.organisationunitid = ou.organisationunitid " );
+ sqlsb.append( "JOIN datavalue dv ON ou.organisationunitid = dv.sourceid " );
sqlsb.append( "WHERE dv.periodid IN " + splitListHelper( betweenPeriodIds ) + " " );
- sqlsb.append( "GROUP BY oug.orgunitgroupid, oug.name ORDER BY ant desc " );
+ sqlsb.append( "GROUP BY oug.orgunitgroupid, oug.name ORDER BY Counts_of_aggregated_values DESC) " );
sql = sqlsb.toString();
@@ -168,7 +171,7 @@
{
holder.close();
}
-
+
return table;
}
@@ -180,13 +183,13 @@
try
{
StringBuffer sqlsb = new StringBuffer();
- sqlsb.append( "SELECT de.dataelementid, de.name AS Name " );
+ sqlsb.append( "(SELECT de.dataelementid, de.name AS Name " );
sqlsb.append( "FROM dataelement de JOIN datavalue dv ON (de.dataelementid = dv.dataelementid) " );
sqlsb.append( "JOIN datasetmembers dsm ON (de.dataelementid = dsm.dataelementid) " );
- sqlsb.append( "WHERE dsm.datasetid = " + dataSetId + " AND dv.periodid IN "
- + splitListHelper( betweenPeriods ) + " " );
+ sqlsb.append( "WHERE dsm.datasetid = '" + dataSetId + "' " );
+ sqlsb.append( "AND dv.periodid IN " + splitListHelper( betweenPeriods ) + " " );
sqlsb.append( "GROUP BY de.dataelementid, de.name " );
- sqlsb.append( "ORDER BY de.name " );
+ sqlsb.append( "ORDER BY de.name) " );
String sql = sqlsb.toString();
@@ -215,20 +218,20 @@
StatementHolder holder = statementManager.getHolder();
StringBuffer sqlsb = new StringBuffer();
- String sql = "";
-
+ String sql = "";
+
try
{
- sqlsb.append( "SELECT deg.dataelementgroupid, deg.name AS DataElementGroup " );
+ sqlsb.append( "(SELECT deg.dataelementgroupid, deg.name AS DataElementGroup " );
sqlsb.append( "FROM dataelementgroup deg " );
- sqlsb.append( "Join dataelementgroupmembers degm ON deg.dataelementgroupid = degm.dataelementgroupid " );
- sqlsb.append( "Join datavalue dv ON degm.dataelementid = dv.dataelementid " );
- sqlsb.append( "Join organisationunit ou ON dv.sourceid = ou.organisationunitid " );
- sqlsb.append( "Join orgunitgroupmembers ougm ON ou.organisationunitid = ougm.organisationunitid " );
- sqlsb.append( "WHERE ougm.orgunitgroupid = '" + orgUnitGroupId + "' AND dv.periodid IN "
- + splitListHelper( betweenPeriods ) + " " );
+ sqlsb.append( "JOIN dataelementgroupmembers degm ON deg.dataelementgroupid = degm.dataelementgroupid " );
+ sqlsb.append( "JOIN datavalue dv ON degm.dataelementid = dv.dataelementid " );
+ sqlsb.append( "JOIN organisationunit ou ON dv.sourceid = ou.organisationunitid " );
+ sqlsb.append( "JOIN orgunitgroupmembers ougm ON ou.organisationunitid = ougm.organisationunitid " );
+ sqlsb.append( "WHERE ougm.orgunitgroupid = '" + orgUnitGroupId + "' " );
+ sqlsb.append( "AND dv.periodid IN " + splitListHelper( betweenPeriods ) + " " );
sqlsb.append( "GROUP BY deg.dataelementgroupid, deg.name " );
- sqlsb.append( "ORDER BY deg.name ASC " );
+ sqlsb.append( "ORDER BY deg.name ASC) " );
sql = sqlsb.toString();
@@ -259,13 +262,13 @@
try
{
StringBuffer sqlsb = new StringBuffer();
- sqlsb.append( "SELECT de.dataelementid, de.name AS Name " );
+ sqlsb.append( "(SELECT de.dataelementid, de.name AS Name " );
sqlsb.append( "FROM dataelement de JOIN datavalue dv ON (de.dataelementid = dv.dataelementid) " );
sqlsb.append( "JOIN dataelementgroupmembers degm ON (de.dataelementid = degm.dataelementid) " );
- sqlsb.append( "WHERE degm.dataelementgroupid = " + dataElementGroupId + " AND dv.periodid IN "
- + splitListHelper( betweenPeriods ) + " " );
+ sqlsb.append( "WHERE degm.dataelementgroupid = '" + dataElementGroupId + "' " );
+ sqlsb.append( "AND dv.periodid IN " + splitListHelper( betweenPeriods ) + " " );
sqlsb.append( "GROUP BY de.dataelementid, de.name " );
- sqlsb.append( "ORDER BY de.name " );
+ sqlsb.append( "ORDER BY de.name) " );
String sql = sqlsb.toString();
@@ -289,6 +292,7 @@
}
}
+ // THE PROBLEM IS HERE >>> STILL WORKING
public void setStructureForOrgUnitBetweenPeriods( DataBrowserTable table, Integer orgUnitParent,
List<Integer> betweenPeriods )
{
@@ -297,9 +301,13 @@
try
{
StringBuffer sqlsb = new StringBuffer();
- sqlsb.append( "SELECT o.organisationunitid, o.name AS OrganisationUnit " );
+ sqlsb.append( "(SELECT o.organisationunitid, o.name AS OrganisationUnit " );
sqlsb.append( "FROM organisationunit o " );
- sqlsb.append( "WHERE o.parentid = " + orgUnitParent + "" );
+ sqlsb.append( "JOIN datavalue as dv ON (o.organisationunitid = dv.sourceid) " );
+ sqlsb.append( "WHERE o.parentid = '" + orgUnitParent + "' " );
+ sqlsb.append( "AND dv.periodid IN " + splitListHelper( betweenPeriods ) + " " );
+ sqlsb.append( "GROUP BY o.organisationunitid, o.name " );
+ sqlsb.append( "ORDER BY o.name)" );
String sql = sqlsb.toString();
@@ -324,21 +332,26 @@
}
}
- public void setDataElementStructureForOrgUnitBetweenPeriods( DataBrowserTable table, Integer orgUnitId, List<Integer> betweenPeriods)
+ public void setDataElementStructureForOrgUnitBetweenPeriods( DataBrowserTable table, Integer orgUnitId,
+ List<Integer> betweenPeriods )
{
+ // Please do not delete this testing ...
+ System.out.println( "\n\n\n TESTING IN [setDataElementStructureForOrgUnitBetweenPeriods] :: " );
+
StatementHolder holder = statementManager.getHolder();
-
+
try
{
StringBuffer sqlsb = new StringBuffer();
- sqlsb.append( "SELECT de.dataelementid, de.name AS DataElementGroup " );
+ sqlsb.append( "(SELECT de.dataelementid, de.name AS DataElement " );
sqlsb.append( "FROM dataelement AS de " );
- sqlsb.append( "Inner Join datavalue AS dv ON (de.dataelementid = dv.dataelementid) " );
- sqlsb.append( "Inner Join datasetmembers AS dsm ON (de.dataelementid = dsm.dataelementid) " );
- sqlsb.append( "Inner Join organisationunit ON dv.sourceid = organisationunit.organisationunitid " );
- sqlsb.append( "WHERE organisationunit.organisationunitid = " + orgUnitId + " " );
+ sqlsb.append( "INNER JOIN datavalue AS dv ON (de.dataelementid = dv.dataelementid) " );
+ sqlsb.append( "INNER JOIN datasetmembers AS dsm ON (de.dataelementid = dsm.dataelementid) " );
+ sqlsb.append( "INNER JOIN organisationunit AS o ON (dv.sourceid = o.organisationunitid) " );
+ sqlsb.append( "WHERE o.organisationunitid = '" + orgUnitId + "' " );
+ sqlsb.append( "AND dv.periodid IN " + splitListHelper( betweenPeriods ) + " " );
sqlsb.append( "GROUP BY de.dataelementid, de.name " );
- sqlsb.append( "ORDER BY de.name " );
+ sqlsb.append( "ORDER BY de.name) " );
String sql = sqlsb.toString();
@@ -348,8 +361,12 @@
TimeUtils.stop();
table.incrementQueryCount();
- table.addColumnName("DataElement");
+ table.addColumnName( "DataElement" );
table.createStructure( resultSet );
+
+ // TEST TABLE
+ // Please do not delete this testing ...
+ System.out.println( "\nTABLE For OrgUnit option:= " + table );
}
catch ( SQLException e )
{
@@ -360,11 +377,12 @@
holder.close();
}
}
-
- public Integer setCountDataElementsForDataSetBetweenPeriods( DataBrowserTable table, Integer dataSetId, List<Integer> betweenPeriodIds)
+
+ public Integer setCountDataElementsForDataSetBetweenPeriods( DataBrowserTable table, Integer dataSetId,
+ List<Integer> betweenPeriodIds )
{
StatementHolder holder = statementManager.getHolder();
-
+
// Here we uses a for loop to create one big sql statement using UNION.
// This is done because the count and GROUP BY parts of this query can't
// be done in another way. The alternative to this method is to actually
@@ -375,23 +393,24 @@
StringBuffer sqlsb = new StringBuffer();
int i = 0;
- for ( Integer periodid : betweenPeriodIds )
+ for ( Integer periodId : betweenPeriodIds )
{
i++;
- sqlsb.append( "(SELECT de.dataelementid, de.name AS DataElement, count(*) AS Count, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
+ sqlsb
+ .append( "(SELECT de.dataelementid, de.name AS DataElement, Count(dv.value) AS Counts_of_aggregated_values, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
sqlsb.append( "FROM dataelement de JOIN datavalue dv ON (de.dataelementid = dv.dataelementid) " );
sqlsb.append( "JOIN datasetmembers dsm ON (de.dataelementid = dsm.dataelementid) " );
sqlsb.append( "JOIN period p ON (dv.periodid = p.periodid) " );
- sqlsb.append( "WHERE dsm.datasetid = " + dataSetId + " AND dv.periodid = " + periodid + " " );
- sqlsb.append( "GROUP BY de.dataelementid, de.name, p.periodid, p.startDate )" );
+ sqlsb.append( "WHERE dsm.datasetid = '" + dataSetId + "' AND dv.periodid = '" + periodId + "' " );
+ sqlsb.append( "GROUP BY de.dataelementid, de.name, p.periodid, p.startDate)" );
if ( i == betweenPeriodIds.size() )
- sqlsb.append( "ORDER BY PeriodId ");
+ sqlsb.append( "ORDER BY PeriodId " );
else
- sqlsb.append( " UNION ");
+ sqlsb.append( " UNION " );
}
-
+
try
{
TimeUtils.start();
@@ -401,7 +420,7 @@
table.incrementQueryCount();
- numResults = table.addColumnToAllRows( resultSet );
+ numResults = table.addColumnToAllRows( resultSet );
}
catch ( SQLException e )
{
@@ -427,16 +446,16 @@
for ( Integer periodid : betweenPeriodIds )
{
i++;
-
+
sqlsb
- .append( "(SELECT de.dataelementid, de.name AS DataElement, count(*) AS Count, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
+ .append( "(SELECT de.dataelementid, de.name AS DataElement, count(dv.value) AS Counts_of_aggregated_values, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
sqlsb.append( "FROM dataelement de JOIN datavalue dv ON (de.dataelementid = dv.dataelementid) " );
sqlsb.append( "JOIN dataelementgroupmembers degm ON (de.dataelementid = degm.dataelementid) " );
sqlsb.append( "JOIN period p ON (dv.periodid = p.periodid) " );
- sqlsb.append( "WHERE degm.dataelementgroupid = " + dataElementGroupId + " AND dv.periodid = " + periodid
- + " " );
+ sqlsb.append( "WHERE degm.dataelementgroupid = '" + dataElementGroupId + "' " );
+ sqlsb.append( "AND dv.periodid = '" + periodid + "' " );
sqlsb.append( "GROUP BY de.dataelementid, de.name, p.periodid, p.startDate) " );
-
+
if ( i == betweenPeriodIds.size() )
sqlsb.append( "ORDER BY PeriodId " );
else
@@ -465,7 +484,7 @@
return numResults;
}
-
+
public Integer setCountDataElementGroupsForOrgUnitGroupBetweenPeriods( DataBrowserTable table,
Integer orgUnitGroupId, List<Integer> betweenPeriodIds )
{
@@ -473,21 +492,21 @@
Integer numResults = 0;
StringBuffer sqlsb = new StringBuffer();
-
+
int i = 0;
for ( Integer periodid : betweenPeriodIds )
{
i++;
sqlsb
- .append( " (SELECT deg.dataelementgroupid, deg.name, Count(*) AS Count, p.periodid AS PeriodId, p.startdate AS ColumnHeader " );
+ .append( " (SELECT deg.dataelementgroupid, deg.name, Count(dv.value) AS Counts_of_aggregated_values, p.periodid AS PeriodId, p.startdate AS ColumnHeader " );
sqlsb.append( "FROM dataelementgroup AS deg " );
sqlsb
- .append( "Inner Join dataelementgroupmembers AS degm ON deg.dataelementgroupid = degm.dataelementgroupid " );
- sqlsb.append( "Inner Join datavalue AS dv ON degm.dataelementid = dv.dataelementid " );
- sqlsb.append( "Inner Join period AS p ON dv.periodid = p.periodid " );
- sqlsb.append( "Inner Join organisationunit AS ou ON dv.sourceid = ou.organisationunitid " );
- sqlsb.append( "Inner Join orgunitgroupmembers AS ougm ON ou.organisationunitid = ougm.organisationunitid " );
+ .append( "INNER JOIN dataelementgroupmembers AS degm ON deg.dataelementgroupid = degm.dataelementgroupid " );
+ sqlsb.append( "INNER JOIN datavalue AS dv ON degm.dataelementid = dv.dataelementid " );
+ sqlsb.append( "INNER JOIN period AS p ON dv.periodid = p.periodid " );
+ sqlsb.append( "INNER JOIN organisationunit AS ou ON dv.sourceid = ou.organisationunitid " );
+ sqlsb.append( "INNER JOIN orgunitgroupmembers AS ougm ON ou.organisationunitid = ougm.organisationunitid " );
sqlsb
.append( "WHERE p.periodid = '" + periodid + "' AND ougm.orgunitgroupid = '" + orgUnitGroupId + "' " );
sqlsb.append( "GROUP BY deg.dataelementgroupid,deg.name,p.periodid,p.startdate) " );
@@ -534,14 +553,14 @@
for ( Integer periodid : betweenPeriodIds )
{
i++;
-
+
sqlsb
- .append( "(SELECT o.organisationunitid, o.name AS OrganisationUnit, count(*) AS Count, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
+ .append( "(SELECT o.organisationunitid, o.name AS OrganisationUnit, Count(dv.value) AS Counts_of_aggregated_values, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
sqlsb.append( "FROM organisationunit o JOIN datavalue dv ON (o.organisationunitid = dv.sourceid) " );
sqlsb.append( "JOIN period p ON (dv.periodid = p.periodid) " );
- sqlsb.append( "WHERE o.parentid = " + orgUnitParent + " AND dv.periodid = " + periodid + " " );
- sqlsb.append( "GROUP BY o.organisationunitid, o.name, p.periodid, p.startDate ) " );
-
+ sqlsb.append( "WHERE o.parentid = '" + orgUnitParent + "' AND dv.periodid = '" + periodid + "' " );
+ sqlsb.append( "GROUP BY o.organisationunitid, o.name, p.periodid, p.startDate) " );
+
if ( i == betweenPeriodIds.size() )
sqlsb.append( "ORDER BY PeriodId " );
else
@@ -570,32 +589,35 @@
}
return numResults;
- }
+ }
public Integer setCountDataElementsForOrgUnitBetweenPeriods( DataBrowserTable table, Integer orgUnitId,
List<Integer> betweenPeriodIds )
{
+ // Please do not delete this testing ...
+ System.out.println( "\n\n\n TESTING IN [setCountDataElementsForOrgUnitBetweenPeriods] :: " );
+
StatementHolder holder = statementManager.getHolder();
Integer numResults = 0;
StringBuffer sqlsb = new StringBuffer();
int i = 0;
- for ( Integer periodid : betweenPeriodIds )
+ for ( Integer periodId : betweenPeriodIds )
{
i++;
-
+
sqlsb
- .append( "(SELECT de.dataelementid, de.name AS DataElementGroup, count(*) AS Count, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
+ .append( "(SELECT de.dataelementid, de.name AS DataElementGroup, Count(dv.value) AS Counts_of_aggregated_values, p.periodid AS PeriodId, p.startDate AS ColumnHeader " );
sqlsb.append( "FROM dataelement AS de " );
- sqlsb.append( "Inner Join datavalue AS dv ON (de.dataelementid = dv.dataelementid) " );
- sqlsb.append( "Inner Join datasetmembers AS dsm ON (de.dataelementid = dsm.dataelementid) " );
- sqlsb.append( "Inner Join organisationunit ON dv.sourceid = organisationunit.organisationunitid " );
+ sqlsb.append( "INNER JOIN datavalue AS dv ON (de.dataelementid = dv.dataelementid) " );
+ sqlsb.append( "INNER JOIN datasetmembers AS dsm ON (de.dataelementid = dsm.dataelementid) " );
+ sqlsb.append( "INNER JOIN organisationunit As o ON (dv.sourceid = o.organisationunitid) " );
sqlsb.append( "JOIN period p ON (dv.periodid = p.periodid) " );
- sqlsb.append( "WHERE organisationunit.organisationunitid = " + orgUnitId + " AND " );
- sqlsb.append( "dv.periodid = " + periodid + " " );
- sqlsb.append( "GROUP BY de.dataelementid, de.name, p.periodid, p.startDate ) " );
-
+ sqlsb.append( "WHERE o.organisationunitid = '" + orgUnitId + "' " );
+ sqlsb.append( "AND dv.periodid = '" + periodId + "' " );
+ sqlsb.append( "GROUP BY de.dataelementid, de.name, p.periodid, p.startDate)" );
+
if ( i == betweenPeriodIds.size() )
sqlsb.append( "ORDER BY PeriodId " );
else
@@ -623,18 +645,18 @@
}
return numResults;
- }
-
+ }
+
// -------------------------------------------------------------------------
// Supportive methods
// -------------------------------------------------------------------------
/**
- * Splits a list of integers by by comma. Use this method if you have a
- * list that will be used in f.ins. a WHERE xxx IN (list) clause in SQL.
+ * Splits a list of integers by by comma. Use this method if you have a list
+ * that will be used in f.ins. a WHERE xxx IN (list) clause in SQL.
*
- * @param List<Integer> list of Integers
- * @return the list as a string splitted by a comma.
+ * @param List<Integer> list of Integers
+ * @return the list as a string splitted by a comma.
*/
private String splitListHelper( List<Integer> list )
{
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java 2010-02-08 10:56:08 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/DateUtils.java 2010-04-06 10:05:28 +0000
@@ -33,6 +33,7 @@
import java.util.Date;
import org.apache.commons.validator.DateValidator;
+import org.hisp.dhis.i18n.I18nFormat;
import org.joda.time.DateTime;
import org.joda.time.Days;
@@ -351,6 +352,35 @@
}
/**
+ * This method converts a string from the date format "yyyy-MM-dd" to
+ * "MMM-yy" of any format which belongs to each locale.
+ *
+ * @param date is the string to be converted.
+ * @return converted string if the date is valid, else the original string
+ * is returned
+ */
+ public static String convertDate( String dateString, I18nFormat i18nFormat )
+ {
+ if ( !dateIsValid( dateString ) )
+ {
+ return dateString;
+ }
+
+ SimpleDateFormat dateFormat = new SimpleDateFormat( DEFAULT_DATE_FORMAT );
+
+ try
+ {
+ Date date = dateFormat.parse( dateString );
+
+ return i18nFormat.formatDateByCustome( date );
+ }
+ catch ( ParseException pe )
+ {
+ throw new RuntimeException( "Date string could not be parsed: " + dateString );
+ }
+ }
+
+ /**
* This method adds days to a date
*
* @param date the date.
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 2010-04-01 09:31:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties 2010-04-06 10:05:28 +0000
@@ -1,13 +1,14 @@
#-- Date Formats --------------------------------------------------------------#
-format.date = yyyy-MM-dd
-format.date.label = yyyy-mm-dd
-format.time = HH:mm
-format.time.label = hh:mm
-format.datetime = yyyy-MM-dd HH:mm
-format.datetime.label = yyyy-mm-dd hh:mm
-format.date.label.jquery = yy-mm-dd
+format.date = yyyy-MM-dd
+format.date.label = yyyy-mm-dd
+format.date.custome = MMM-yy
+format.time = HH:mm
+format.time.label = hh:mm
+format.datetime = yyyy-MM-dd HH:mm
+format.datetime.label = yyyy-mm-dd hh:mm
+format.date.label.jquery = yy-mm-dd
#-- dhis-wp -------------------------------------------------------------------#
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_vi_VN.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_vi_VN.properties 2010-04-01 09:31:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global_vi_VN.properties 2010-04-06 10:05:28 +0000
@@ -2,6 +2,7 @@
format.date = dd-MM-yyyy
format.date.label = dd-mm-yyyy
+format.date.custome = MMM-yy
format.time = HH:mm
format.time.label = hh:mm
format.datetime = dd-MM-yyyy HH:mm
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties 2010-03-25 08:15:35 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties 2010-04-06 10:05:28 +0000
@@ -200,7 +200,6 @@
use_only_letters_numbers_dot_only = Please enter Letters, Numbers for file's name and Dot for extension only
cell_exist = Exist one cell same sheet, row and column with this.
update_successful = Updating is success !
-cell_exist = Exist one cell same sheet, row and column with this.
download = Download
upload_file_null = Upload file null
file_type_not_supported = File type not supported
@@ -217,4 +216,4 @@
translation_translate = Translate
template_using = File is using
template_pending = File is pending
-expression_not_well_formed = Expression is not well formed
\ No newline at end of file
+expression_not_well_formed = Expression is not well-formed
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties 2010-03-24 02:56:06 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties 2010-04-06 10:05:28 +0000
@@ -202,12 +202,13 @@
cell_exist = \u0110\u00e3 t\u1ed3n t\u1ea1i m\u1ed9t excel item c\u00f3 c\u00f9ng d\u00f2ng, c\u1ed9t v\u00e0 sheet.
update_successful = C\u1eadp nh\u1eadt th\u00e0nh c\u00f4ng !
download = T\u1ea3i v\u1ec1
-override_confirm = File template n\u00e0y \u0111\u00e3 t\u1ed3n t\u1ea1i. B\u1ea1n c\u00f3 mu\u1ed1n ghi \u0111\u00e8 hay ko ?
-template_using = \u0110ANG s\u1eed d\u1ee5ng t\u1eadp tin n\u00e0y
-template_pending = CH\u01afA s\u1eed d\u1ee5ng t\u1eadp tin n\u00e0y
+override_confirm = B\u1ea1n c\u00f3 mu\u1ed1n ghi \u0111\u00e8 t\u1eadp tin m\u1eabu n\u00e0y kh\u00f4ng?
+template_using = \u0110ANG s\u1eed d\u1ee5ng
+template_pending = CH\u01afA s\u1eed d\u1ee5ng
intro_configuration = Thi\u1ebft l\u1eadp \u0111\u01b0\u1eddng d\u1eabn ch\u1ec9 t\u1edbi thu m\u1ee5c l\u01b0u tr\u1eef c\u00e1c t\u1eadp tin excel m\u1eabu. V\u00ed d\u1ee5: C:\\ABC
intro_reports = T\u1ea1o m\u1edbi, c\u1eadp nh\u1eadt, xem v\u00e0 x\u00f3a c\u00e1c B\u00e1o c\u00e1o excel. M\u1ed9t b\u00e1o c\u00e1o excel ch\u1ee9a nhi\u1ec1u ph\u1ea7n t\u1eed excel. B\u00e1o c\u00e1o excel c\u00f3 th\u1ec3 thu\u1ed9c nhi\u1ec1u lo\u1ea1i b\u00e1o c\u00e1o kh\u00e1c nhau. Cho ph\u00e9p g\u00e1n b\u00e1o c\u00e1o excel cho m\u1ed9t hay nhi\u1ec1u \u0111\u01a1n v\u1ecb ho\u1eb7c nh\u00f3m \u0111\u01a1n v\u1ecb v\u00e0 m\u1ed9t s\u1ed1 t\u00f9y ch\u1ecdn kh\u00e1c.
intro_data_status = Ch\u1ee9c n\u0103ng n\u00e0y d\u00f9ng \u0111\u1ec3 xem tr\u1ea1ng th\u00e1i nh\u1eadp d\u1eef li\u1ec7u (D\u1eef li\u1ec7u \u0111\u01b0\u1ee3c nh\u1eadp xong hay ch\u01b0a ho\u1eb7c s\u1ed1 li\u1ec7u n\u00e0o c\u00f2n thi\u1ebfu v.v...).
intro_clean_up = Ch\u1ee9c n\u0103ng n\u00e0y cho ph\u00e9p ng\u01b0\u1eddi d\u00f9ng x\u00f3a c\u00e1c t\u1eadp tin t\u1ea1m sinh ra trong qu\u00e1 tr\u00ecnh sinh b\u00e1o c\u00e1o ho\u1eb7c xem tr\u01b0\u1edbc b\u00e1o c\u00e1o.
intro_excel_item = T\u1ea1o m\u1edbi, c\u1eadp nh\u1eadt, xem v\u00e0o x\u00f3a c\u00e1c ph\u1ea7n t\u1eed excel cho qu\u00e1 tr\u00ecnh import d\u1eef li\u1ec7u t\u1eeb t\u1eadp tin excel. Ph\u1ea7n t\u1eed excel n\u00e0y c\u00f3 ch\u1ee9c n\u0103ng g\u1ea7n gi\u1ed1ng v\u1edbi ph\u1ea7n t\u1eed excel trong m\u1ed9t b\u00e1o c\u00e1o excel.
-intro_excel_template_management = T\u1ea3i ,\u0111\u1ed5i t\u00ean, t\u00ecm ki\u1ebfm, t\u1ea3i v\u1ec1 v\u00e0 x\u00f3a c\u00e1c t\u1eadp tin c\u00f3 \u0111u\u00f4i m\u1edf r\u1ed9ng .xls ho\u1eb7c .xlsx. Ng\u01b0\u1eddi d\u00f9ng c\u00f3 th\u1ec3 nh\u1eadn bi\u1ebft t\u1eadp tin n\u00e0o \u0111ang \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng v\u00e0 t\u1eadp tin n\u00e0o ch\u01b0a d\u00f9ng \u0111\u1ebfn. Cho ph\u00e9p t\u1ef1 \u0111\u1ed9ng c\u1eadp nh\u1eadt l\u1ea1i h\u1ec7 th\u1ed1ng b\u00e1o c\u00e1o excel khi t\u00ean t\u1eadp tin \u0111ang s\u1eed d\u1ee5ng thay \u0111\u1ed5i.
\ No newline at end of file
+intro_excel_template_management = T\u1ea3i ,\u0111\u1ed5i t\u00ean, t\u00ecm ki\u1ebfm, t\u1ea3i v\u1ec1 v\u00e0 x\u00f3a c\u00e1c t\u1eadp tin c\u00f3 \u0111u\u00f4i m\u1edf r\u1ed9ng .xls ho\u1eb7c .xlsx. Ng\u01b0\u1eddi d\u00f9ng c\u00f3 th\u1ec3 nh\u1eadn bi\u1ebft t\u1eadp tin n\u00e0o \u0111ang \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng v\u00e0 t\u1eadp tin n\u00e0o ch\u01b0a d\u00f9ng \u0111\u1ebfn. Cho ph\u00e9p t\u1ef1 \u0111\u1ed9ng c\u1eadp nh\u1eadt l\u1ea1i h\u1ec7 th\u1ed1ng b\u00e1o c\u00e1o excel khi t\u00ean t\u1eadp tin \u0111ang s\u1eed d\u1ee5ng thay \u0111\u1ed5i.
+expression_not_well_formed = Bi\u1ec3u th\u1ee9c kh\u00f4ng \u0111\u00fang/ch\u01b0a h\u1ee3p l\u1ec7
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelTemplateList.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelTemplateList.vm 2010-03-10 10:28:44 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/excelTemplateList.vm 2010-04-06 10:05:28 +0000
@@ -45,11 +45,12 @@
#end
</td>
<td align="left">
+ <a href="javascript:mode = 'edit'; openEditExcelTemplate( '$templateFileName' );" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
+ <a href="downloadExcelTemplate.action?fileName=$templateFileName" title="$i18n.getString( 'download' )"><img src="images/download.png" alt="$i18n.getString( 'download' )"></a>
#if( $encoder.htmlEncode( $value ) == 'false' )
<a href="javascript:deleteExcelTemplate('$templateFileName');" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
#end
- <a href="javascript:mode = 'edit'; openEditExcelTemplate( '$templateFileName' );" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
- <a href="downloadExcelTemplate.action?fileName=$templateFileName" title="$i18n.getString( 'download' )"><img src="images/download.png" alt="$i18n.getString( 'download' )"></a>
+
</td>
</tr>
#end
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/SearchAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/SearchAction.java 2010-04-03 09:35:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/databrowser/SearchAction.java 2010-04-06 10:05:28 +0000
@@ -52,6 +52,7 @@
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.PeriodType;
+import org.hisp.dhis.period.comparator.AscendingPeriodComparator;
import org.hisp.dhis.system.util.DateUtils;
import org.hisp.dhis.util.SessionUtils;
@@ -62,6 +63,8 @@
/**
* @author espenjac, joakibj, briane, eivinhb
* @version $Id$
+ * @modifier Dang Duy Hieu
+ * @since 2010-04-06
*/
public class SearchAction
implements Action
@@ -78,7 +81,7 @@
private static final String KEY_DATABROWSERTABLE = "dataBrowserTableResults";
- private static final String HYPHEN = " - ";
+ private static final String DASH = " - ";
// -------------------------------------------------------------------------
// Dependencies
@@ -462,7 +465,6 @@
}
else
{
-
dataBrowserTable = dataBrowserService.getDataElementGroupsInPeriod( fromDate, toDate, periodType );
}
}
@@ -503,7 +505,8 @@
// Set DataBrowserTable variable for PDF export
setExportPDFVariables();
- // Get format standard for periods which appropriate with from date, to date and period type
+ // Get format standard for periods which appropriate with from date, to
+ // date and period type
fromToDate = getFromToDateFormat( periodType, fromDate, toDate );
if ( fromToDate == null )
@@ -577,7 +580,8 @@
for ( MetaValue col : allColumnsConverted )
{
- col.setName( DateUtils.convertDate( col.getName() ) );
+ //col.setName( DateUtils.convertDate( col.getName() ) );
+ col.setName( DateUtils.convertDate( col.getName(), format ) );
}
}
@@ -605,6 +609,9 @@
List<Period> periods = new ArrayList<Period>( periodService.getPeriodsBetweenDates( periodType, date1,
date2 ) );
+ // Please do not delete this testing ...
+ System.out.println( "\n\nFIRST Periods:: " + periods );
+
if ( periods.isEmpty() )
{
CalendarPeriodType calendarPeriodType = (CalendarPeriodType) periodType;
@@ -613,6 +620,11 @@
periods.add( calendarPeriodType.createPeriod( date2 ) );
}
+ Collections.sort( periods, new AscendingPeriodComparator() );
+
+ // Please do not delete this testing ...
+ System.out.println( "\n\nTHEN Periods:: " + periods );
+
return periods;
}
catch ( ParseException e )
@@ -630,10 +642,10 @@
for ( Period period : periods )
{
String sTemp = format.formatPeriod( period );
-
+
if ( !stringFormatDate.contains( sTemp ) )
{
- stringFormatDate += HYPHEN + sTemp;
+ stringFormatDate += DASH + sTemp;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataBrowserResult.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataBrowserResult.vm 2010-03-17 06:07:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/dataBrowserResult.vm 2010-04-06 10:05:28 +0000
@@ -119,6 +119,7 @@
<strong>$i18n.getString( "period_type" ):</strong> $periodTypeId
#elseif ( $fromToDate != "" )
<strong>$i18n.getString( "from_date" ):</strong> $fromToDate
+ <br/>
<strong>$i18n.getString( "period_type" ):</strong> $periodTypeId
#else
<strong>$i18n.getString( "from_date" ):</strong> $fromDate
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2010-03-30 04:36:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2010-04-06 10:05:28 +0000
@@ -303,7 +303,7 @@
select_indicator = Please select indicator
annualized = Annualized
could_not_save = Could not save
-object_not_deleted_associated_by_objects = Object not deleted becuause it is associated by objects of type
+object_not_deleted_associated_by_objects = Object not deleted because it is associated by objects of type
hide_warning = Hide warning
please_enter_name = Please enter name !
group_ready_exist = Group ready exist
Follow ups