[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 16484: Fixed bug - The details icon in aggregate query builder result form doesn't work.

2014-08-24 Thread noreply

revno: 16484
committer: Tran Chau
branch nick: dhis2
timestamp: Sun 2014-08-24 19:31:24 +0700
message:
  Fixed bug - The details icon in aggregate query builder result form doesn't 
work.
modified:
  
dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java
  
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/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-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java'
--- dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java	2014-08-15 07:40:20 +
+++ dhis-2/dhis-services/dhis-service-eventreporting/src/main/java/org/hisp/dhis/caseaggregation/hibernate/HibernateCaseAggregationConditionStore.java	2014-08-24 12:31:24 +
@@ -247,11 +247,43 @@
 grid.addHeader( new GridHeader( i18n.getString( colName ), false, true ) );
 }
 
-grid.addRows( rs );
+addRows( rs, grid );
 
 return grid;
 }
 
+public void addRows( SqlRowSet rs, Grid grid )
+{
+int cols = rs.getMetaData().getColumnCount();
+String idValue = "";
+int index = 1;
+while ( rs.next() )
+{
+	grid.addRow();
+	for ( int i = 1; i <= cols; i++ )
+{
+	Object value = rs.getObject( i );
+	if( i==1 )
+	{
+		if( !value.toString().equals(idValue) )
+			{
+				grid.addValue( index );
+				idValue = value.toString();
+				index ++;
+			}
+		else
+		{
+			grid.addValue( "" );
+		}
+	}
+	else
+	{
+		grid.addValue( value );
+	}
+}
+}
+}
+
 public void insertAggregateValue( String expression, String operator, Integer dataElementId, Integer optionComboId, int attributeOptioncomboId, 
 Integer deSumId, Collection orgunitIds, Period period )
 {
@@ -947,7 +979,7 @@
 String sql = "SELECT ";
 
 boolean hasDataelement = hasDataelementCriteria( caseExpression );
-
+boolean hasEntityInstance = hasEntityInstanceCriteria( caseExpression );
 Collection orgunitIds = new HashSet<>();
 orgunitIds.add( orgunitId );
 
@@ -958,27 +990,33 @@
 DateUtils.getMediumDateString( period.getStartDate() ),
 DateUtils.getMediumDateString( period.getEndDate() ) );
 }
+else  if ( hasDataelement )
+{
+sql += "pdv.programstageinstanceid as event, pdv.value,pgs.name as program_stage, psi.executiondate as report_date,";
+}
 else
 {
-if ( hasDataelement )
-{
-sql += "pdv.value,pgs.name as program_stage, psi.executiondate as report_date,";
-}
+	 sql += "p.trackedentityinstanceid,p.trackedentityid,ou.name";
 }
 
 sql = sql.substring( 0, sql.length() - 1 );
 sql += " FROM ";
 
+if( hasEntityInstance )
+{
+	sql += " INNER JOIN trackedentityinstance p on p.trackedentityinstanceid=pi.trackedentityinstanceid ";
+}
+
 if ( hasDataelement )
 {
-sql += " programinstance as pi INNER JOIN trackedentityinstance p on p.trackedentityinstanceid=pi.trackedentityinstanceid";
+sql += " programinstance as pi ";
 sql += " INNER JOIN programstageinstance psi ON pi.programinstanceid=psi.programinstanceid ";
 sql += " INNER JOIN organisationunit ou ON ou.organisationunitid=psi.organisationunitid ";
 sql += " INNER JOIN trackedentitydatavalue pdv ON pdv.programstageinstanceid=psi.programstageinstanceid ";
 sql += " INNER JOIN program pg ON pg.programid=pi.programid ";
 sql += " INNER JOIN programstage pgs ON pgs.programid=pg.programid ";
 }
-else
+else if( !hasEntityInstance )
 {
 sql += " programinstance as pi INNER JOIN trackedentityinstance p on p.trackedentityinstanceid=pi.trackedentityinstanceid";
 sql += " INNER JOIN organisationunit ou ON ou.organisationunitid=p.organisationunitid ";

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2014-07

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 16485: Moving tests from dhis-support-jdbc-test into dhis-service-core. Removed project dhis-support-jdb...

2014-08-24 Thread noreply

revno: 16485
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Sun 2014-08-24 15:57:12 +0200
message:
  Moving tests from dhis-support-jdbc-test into dhis-service-core. Removed 
project dhis-support-jdbc-test.
removed:
  dhis-2/dhis-support/dhis-support-jdbc-test/
  dhis-2/dhis-support/dhis-support-jdbc-test/pom.xml
  dhis-2/dhis-support/dhis-support-jdbc-test/src/
  dhis-2/dhis-support/dhis-support-jdbc-test/src/test/
  dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/
  dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/
  dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/
  dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/external/
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/external/location/
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/external/location/LocationManagerTest.java
  dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/CompleteDataSetRegistrationBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataDictionaryBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryComboBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryOptionBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementGroupBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementGroupSetBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataSetBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataValueBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/GroupSetBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/ImportDataValueBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorGroupBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorGroupSetBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/IndicatorTypeBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/OrganisationUnitGroupBatchHandlerTest.java
  
dhis-2/dhis-support/dhis-support-jdbc-test/src/test/java/org/hisp/dhis/jdbc/batchhandler/PeriodBatchHandlerTest.java
added:
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/external/
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/external/location/
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/external/location/LocationManagerTest.java
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/CompleteDataSetRegistrationBatchHandlerTest.java
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataDictionaryBatchHandlerTest.java
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementBatchHandlerTest.java
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryBatchHandlerTest.java
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryComboBatchHandlerTest.java
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementCategoryOptionBatchHandlerTest.java
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandler/DataElementGroupBatchHandlerTest.java
  
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/jdbc/batchhandle

[Dhis2-devs] Dashboard previews are not showing the categories for event charts in the correct order...

2014-08-24 Thread Jose Garcia Muñoz
Dear dev2 community

In the dashboard previews, the categories for event charts are not being
showed in the order they have been defined.

For example the age groups in this preview...

[image: Inline image 1]


... should be rendered as follows ... (in the event chart the order is
correct)

[image: Inline image 2]

Thanks
Jose
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] Individual Records Aggregation failure

2014-08-24 Thread Tran Chau
Hi Prosper.

I need to check something first with you.
After you do the manual aggregation query builder run, do you see the data
values on the data entry form?
If you do see them on the data entry form, that means the data have been
moved successfully.
If so, and when you run analytics at this point and did not get any data in
pivot table, that sounds like it is analytics problem, not aggregation
problem.

Also, on your automatic aggregation, do you see those data in the data
entry?


Best regards,

Châu Thu Trân
HISP Viet Nam
Email: tran.hispviet...@gmail.com


On Sat, Aug 23, 2014 at 1:54 PM, Prosper BT  wrote:

> Dear Abyot and Team,
>
> We are running two instances one with 2.15 build 15206 and 2.16 build 16332,
> on the two instance we have built aggregate queries using the aggregate
> query build and set the automatic aggregation and analytic to run.
>
> We have been testing this for now over a week and the automatic
> aggregation is not working on both versions, later alone the analytics.
>
> When we aggregate manually and save the data, aggregate are accessible
> through data entry apart from the daily ones and when we further run
> analytics manually we dont get any  data in data set reports, pivot tables,
> visualizer and GIS.
>
> Could this be a bug? Emma can share the logs,
> smgl.dhis2.org and wemr.ug
>
> Regards
>
> --
> Prosper Behumbiize, MPH
> Phone:+256 414 320076
> Cell: +256 772 139037
>  +256 752 751776
>
>
> ___
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@lists.launchpad.net
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 16486: Data export. Optimized the way organisation units are retrieved.

2014-08-24 Thread noreply

revno: 16486
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Sun 2014-08-24 17:24:33 +0200
message:
  Data export. Optimized the way organisation units are retrieved.
modified:
  
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetService.java
  
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetStore.java
  
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java
  
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/SpringDataValueSetStore.java
  
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueSetController.java
  
dhis-2/dhis-web/dhis-web-importexport/src/main/java/org/hisp/dhis/importexport/action/datavalue/ExportDataValueAction.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-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetService.java	2014-07-10 16:06:48 +
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetService.java	2014-08-24 15:24:33 +
@@ -42,19 +42,22 @@
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.scheduling.TaskId;
 
+/**
+ * @author Lars Helge Overland
+ */
 public interface DataValueSetService
 {
-void writeDataValueSet( String dataSet, String period, String orgUnit, OutputStream out );
+void writeDataValueSetXml( String dataSet, String period, String orgUnit, OutputStream out );
 
-void writeDataValueSet( Set dataSets, Date startDate, Date endDate, Set orgUnits, OutputStream out );
+void writeDataValueSetXml( Set dataSets, Date startDate, Date endDate, Set orgUnits, boolean includeChildren, OutputStream out );
 
 void writeDataValueSetJson( String ds, String period, String ou, OutputStream outputStream );
 
-void writeDataValueSetJson( Set dataSet, Date startDate, Date endDate, Set ous, OutputStream outputStream );
+void writeDataValueSetJson( Set dataSet, Date startDate, Date endDate, Set ous, boolean includeChildren, OutputStream outputStream );
 
 void writeDataValueSetJson( Date lastUpdated, OutputStream outputStream );
 
-void writeDataValueSetCsv( Set dataSets, Date startDate, Date endDate, Set orgUnits, Writer writer );
+void writeDataValueSetCsv( Set dataSets, Date startDate, Date endDate, Set orgUnits, boolean includeChildren, Writer writer );
 
 RootNode getDataValueSetTemplate( DataSet dataSet, Period period, List orgUnits,
 boolean writeComments, String ouScheme, String deScheme );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetStore.java	2014-08-14 05:46:19 +
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DataValueSetStore.java	2014-08-24 15:24:33 +
@@ -42,13 +42,13 @@
  */
 public interface DataValueSetStore
 {
-public void writeDataValueSetXml(Set dataSets, Date completeDate, Period period, OrganisationUnit orgUnit,
- Set periods, Set orgUnits, OutputStream out);
-
-public void writeDataValueSetCsv(Set periods, Set orgUnits, Writer writer);
-
-public void writeDataValueSetJson(Set dataSets, Date completeDate, Period period, OrganisationUnit orgUnit,
-  Set periods, Set orgUnits, OutputStream out);
+public void writeDataValueSetXml( Set dataSets, Date completeDate, Period period,
+OrganisationUnit orgUnit, Set periods, Set orgUnits, OutputStream out );
+
+public void writeDataValueSetCsv( Set dataSets, Set periods, Set orgUnits, Writer writer );
+
+public void writeDataValueSetJson( Set dataSets, Date completeDate, Period period,
+OrganisationUnit orgUnit, Set periods, Set orgUnits, OutputStream out );
 
 void writeDataValueSetJson( Date lastUpdated, OutputStream outputStream );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java	2014-08-20 14:33:02 +
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/DefaultDataValueSetService.java	2014-08-24 15:24:33 +
@@ -58,6 +58,7 @@
 import org.h

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 16487: Data value sets, removed unused method

2014-08-24 Thread noreply

revno: 16487
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Sun 2014-08-24 17:38:01 +0200
message:
  Data value sets, removed unused method
modified:
  
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueSetController.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-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueSetController.java	2014-08-24 15:24:33 +
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueSetController.java	2014-08-24 15:38:01 +
@@ -87,17 +87,6 @@
 // Get
 // -
 
-@RequestMapping( method = RequestMethod.GET, produces = { CONTENT_TYPE_HTML, CONTENT_TYPE_TEXT } )
-public String getDataValueSets( Model model ) throws Exception
-{
-DataValueSets dataValueSets = new DataValueSets();
-dataValueSets.getDataValueSets().add( new DataValueSet() );
-
-model.addAttribute( "model", dataValueSets );
-
-return "dataValueSets";
-}
-
 @RequestMapping( method = RequestMethod.GET, produces = CONTENT_TYPE_XML )
 public void getDataValueSetXml(
 @RequestParam Set dataSet,

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 16488: Web api, dataValueSets, optimized how org units are being retrieved

2014-08-24 Thread noreply

revno: 16488
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Sun 2014-08-24 17:45:25 +0200
message:
  Web api, dataValueSets, optimized how org units are being retrieved
modified:
  
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueSetController.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-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueSetController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueSetController.java	2014-08-24 15:38:01 +
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/DataValueSetController.java	2014-08-24 15:45:25 +
@@ -28,10 +28,27 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.webapi.utils.ContextUtils.CONTENT_TYPE_CSV;
+import static org.hisp.dhis.webapi.utils.ContextUtils.CONTENT_TYPE_JSON;
+import static org.hisp.dhis.webapi.utils.ContextUtils.CONTENT_TYPE_XML;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.Date;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.common.IdentifiableObjectUtils;
-import org.hisp.dhis.dxf2.datavalueset.DataValueSet;
 import org.hisp.dhis.dxf2.datavalueset.DataValueSetService;
 import org.hisp.dhis.dxf2.importsummary.ImportSummary;
 import org.hisp.dhis.dxf2.metadata.ImportOptions;
@@ -39,7 +56,6 @@
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.webapi.utils.ContextUtils;
 import org.hisp.dhis.webapi.view.ClassPathUriResolver;
-import org.hisp.dhis.webapi.webdomain.DataValueSets;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.format.annotation.DateTimeFormat;
@@ -51,23 +67,6 @@
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamResult;
-import javax.xml.transform.stream.StreamSource;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
-
-import static org.hisp.dhis.webapi.utils.ContextUtils.*;
-
 @Controller
 @RequestMapping( value = DataValueSetController.RESOURCE_PATH )
 public class DataValueSetController
@@ -113,10 +112,8 @@
 else
 {
 log.info( "Get XML bulk data value set for start date: " + startDate + ", end date: " + endDate );
-
-Set ous = getOrganisationUnits( orgUnit, children );
 
-dataValueSetService.writeDataValueSetXml( dataSet, startDate, endDate, ous, false, response.getOutputStream() );
+dataValueSetService.writeDataValueSetXml( dataSet, startDate, endDate, orgUnit, children, response.getOutputStream() );
 }
 }
 
@@ -146,10 +143,8 @@
 else
 {
 log.info( "Get JSON bulk data value set for start date: " + startDate + ", end date: " + endDate );
-
-Set ous = getOrganisationUnits( orgUnit, children );
 
-dataValueSetService.writeDataValueSetJson( dataSet, startDate, endDate, ous, false, response.getOutputStream() );
+dataValueSetService.writeDataValueSetJson( dataSet, startDate, endDate, orgUnit, children, response.getOutputStream() );
 }
 }
 
@@ -164,27 +159,9 @@
 {
 log.info( "Get CSV bulk data value set for start date: " + startDate + ", end date: " + endDate );
 
-Set ous = getOrganisationUnits( orgUnit, children );
-
 response.setContentType( CONTENT_TYPE_CSV );
-dataValueSetService.writeDataValueSetCsv( dataSet, startDate, endDate, ous, false, response.getWriter() );
-}
-
-private Set getOrganisationUnits( Set orgUnits, boolean children )
-{
- 

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 16489: Calendar, performance improvement. In createPeriod, not going through expensive instantiation of ...

2014-08-24 Thread noreply

revno: 16489
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Sun 2014-08-24 19:10:16 +0200
message:
  Calendar, performance improvement. In createPeriod, not going through 
expensive instantiation of gregorian calendar but getting DateUnit directly 
from Date. in fromJdkDate, avoid instantiating a second DateTime and rather use 
constructor.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/DateUnit.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.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/calendar/DateUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/DateUnit.java	2014-08-22 05:35:40 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/DateUnit.java	2014-08-24 17:10:16 +
@@ -238,6 +238,18 @@
 }
 
 /**
+ * Converts from Joda-Time DateTime to DateUnit
+ *
+ * @param dateTime DateTime object
+ * @param iso8601 whether date time is iso8601
+ * @return Populated DateUnit object
+ */
+public static DateUnit fromDateTime( DateTime dateTime, boolean iso8601 )
+{
+return new DateUnit( dateTime.getYear(), dateTime.getMonthOfYear(), dateTime.getDayOfMonth(), dateTime.getDayOfWeek(), iso8601 );
+}
+
+/**
  * Converts from JDK Calendar to DateUnit
  *
  * @param calendar JDK Calendar object
@@ -257,8 +269,7 @@
  */
 public static DateUnit fromJdkDate( Date date )
 {
-DateUnit dateUnit = fromDateTime( new DateTime( date.getTime() ) );
-return new DateUnit( dateUnit, true );
+return fromDateTime( new DateTime( date.getTime() ), true );
 }
 
 @Override

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java	2014-08-21 07:47:06 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java	2014-08-24 17:10:16 +
@@ -242,9 +242,7 @@
  */
 public Period createPeriod( Date date, org.hisp.dhis.calendar.Calendar calendar )
 {
-Calendar cal = createCalendarInstance( date );
-
-return createPeriod( calendar.fromIso( DateUnit.fromJdkCalendar( cal ) ), calendar );
+return createPeriod( calendar.fromIso( DateUnit.fromJdkDate( date ) ), calendar );
 }
 
 public Period toIsoPeriod( DateUnit start, DateUnit end )

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


Re: [Dhis2-devs] Individual Records Aggregation failure

2014-08-24 Thread Prosper BT
Thanks Tran

Yes when I run manual aggregation I get the data in data entry I think for
tracker aggregation what is not working is the automatic scheduling.

I guess  for the analytics is running Emma and team will help check out
logs.

Regards
 On 24 Aug 2014 18:07, "Tran Chau"  wrote:

> Hi Prosper.
>
> I need to check something first with you.
> After you do the manual aggregation query builder run, do you see the data
> values on the data entry form?
> If you do see them on the data entry form, that means the data have been
> moved successfully.
> If so, and when you run analytics at this point and did not get any data
> in pivot table, that sounds like it is analytics problem, not aggregation
> problem.
>
> Also, on your automatic aggregation, do you see those data in the data
> entry?
>
>
> Best regards,
> 
> Châu Thu Trân
> HISP Viet Nam
> Email: tran.hispviet...@gmail.com
>
>
> On Sat, Aug 23, 2014 at 1:54 PM, Prosper BT  wrote:
>
>> Dear Abyot and Team,
>>
>> We are running two instances one with 2.15 build 15206 and 2.16 build 16332,
>> on the two instance we have built aggregate queries using the aggregate
>> query build and set the automatic aggregation and analytic to run.
>>
>> We have been testing this for now over a week and the automatic
>> aggregation is not working on both versions, later alone the analytics.
>>
>> When we aggregate manually and save the data, aggregate are accessible
>> through data entry apart from the daily ones and when we further run
>> analytics manually we dont get any  data in data set reports, pivot tables,
>> visualizer and GIS.
>>
>> Could this be a bug? Emma can share the logs,
>> smgl.dhis2.org and wemr.ug
>>
>> Regards
>>
>> --
>> Prosper Behumbiize, MPH
>> Phone:+256 414 320076
>> Cell: +256 772 139037
>>  +256 752 751776
>>
>>
>> ___
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to : dhis2-devs@lists.launchpad.net
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 16490: Calendar, performance improvement. Populating the isoDate property while creating periods. This h...

2014-08-24 Thread noreply

revno: 16490
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Sun 2014-08-24 19:53:31 +0200
message:
  Calendar, performance improvement. Populating the isoDate property while 
creating periods. This has lower cost compared to calculating it later since 
the start date unit is already converted during period creation.
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java
  
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/SpringDataValueSetStore.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/period/Period.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java	2014-08-05 11:19:29 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java	2014-08-24 17:53:31 +
@@ -77,6 +77,11 @@
  * Required. Must be unique together with startDate.
  */
 private Date endDate;
+
+/**
+ * Transient string holding the ISO representation of the period.
+ */
+private transient String isoPeriod;
 
 // -
 // Constructors
@@ -93,6 +98,7 @@
 this.startDate = period.getStartDate();
 this.endDate = period.getEndDate();
 this.name = period.getName();
+this.isoPeriod = period.getIsoDate();
 }
 
 protected Period( PeriodType periodType, Date startDate, Date endDate )
@@ -102,6 +108,14 @@
 this.endDate = endDate;
 }
 
+protected Period( PeriodType periodType, Date startDate, Date endDate, String isoPeriod )
+{
+this.periodType = periodType;
+this.startDate = startDate;
+this.endDate = endDate;
+this.isoPeriod = isoPeriod;
+}
+
 // -
 // Logic
 // -
@@ -131,13 +145,13 @@
 }
 
 /**
- * Returns an ISO8601 formatted string version of the period
+ * Returns an ISO8601 formatted string version of the period.
  *
  * @return the period string
  */
 public String getIsoDate()
 {
-return periodType.getIsoDate( this );
+return isoPeriod != null ? isoPeriod : periodType.getIsoDate( this );
 }
 
 /**

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java	2014-08-24 17:10:16 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java	2014-08-24 17:53:31 +
@@ -29,6 +29,7 @@
  */
 
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+
 import org.hisp.dhis.calendar.CalendarService;
 import org.hisp.dhis.calendar.DateInterval;
 import org.hisp.dhis.calendar.DateUnit;
@@ -37,6 +38,7 @@
 import org.hisp.dhis.calendar.PeriodTypeParser;
 import org.hisp.dhis.calendar.impl.Iso8601Calendar;
 import org.hisp.dhis.common.DxfNamespaces;
+import org.hisp.dhis.common.Timer;
 
 import java.io.Serializable;
 import java.util.ArrayList;
@@ -241,8 +243,10 @@
  * @return the valid Period based on the given date
  */
 public Period createPeriod( Date date, org.hisp.dhis.calendar.Calendar calendar )
-{
-return createPeriod( calendar.fromIso( DateUnit.fromJdkDate( date ) ), calendar );
+{
+DateUnit unit = DateUnit.fromJdkDate( date );
+
+return createPeriod( calendar.fromIso( unit ), calendar );
 }
 
 public Period toIsoPeriod( DateUnit start, DateUnit end )
@@ -254,7 +258,10 @@
 
 protected Period toIsoPeriod( DateUnit start, DateUnit end, org.hisp.dhis.calendar.Calendar calendar )
 {
-return new Period( this, calendar.toIso( start ).toJdkDate(), calendar.toIso( end ).toJdkDate() );
+DateUnit from = calendar.toIso( start );
+DateUnit to = calendar.toIso( end );
+
+return new Period( this, from.toJdkDate(), to.toJdkDate(), getIsoDate( from ) );
 }
 
 public Period toIsoPeriod( DateUnit dateUnit )
@@ -424,7 +431,7 @@
 final DateUnit from = cal.toIso( dateInterval.getFrom() );
 final DateUnit to = cal.toIso( dateInterval.getTo() );
 
-return new Period( this, from.toJdkDate(), to.toJdkDate() );
+return new Period( this, from.toJdkDate(), to.toJdkDate(), getIsoDate( from ) );
 }
 
 /**
@@ -437,7 +444,7 @@
 {
 return getIsoDate( createLocalDateUnitInstance( period.getStartDate() ) );
 }
-
+
 /**
  * Returns an iso8601 

Re: [Dhis2-devs] Individual Records Aggregation failure

2014-08-24 Thread Ola Hodne Titlestad
Do you get anything in the tomcat log during the automated aggregation
process?

Ola
--

--
Ola Hodne Titlestad (Mr)
HISP
Department of Informatics
University of Oslo

Mobile: +47 48069736
Home address: Eftasåsen 68, 0687 Oslo, Norway. Googlemaps link



On 24 August 2014 19:13, Prosper BT  wrote:

> Thanks Tran
>
> Yes when I run manual aggregation I get the data in data entry I think for
> tracker aggregation what is not working is the automatic scheduling.
>
> I guess  for the analytics is running Emma and team will help check out
> logs.
>
> Regards
>  On 24 Aug 2014 18:07, "Tran Chau"  wrote:
>
>> Hi Prosper.
>>
>> I need to check something first with you.
>> After you do the manual aggregation query builder run, do you see the
>> data values on the data entry form?
>> If you do see them on the data entry form, that means the data have been
>> moved successfully.
>> If so, and when you run analytics at this point and did not get any data
>> in pivot table, that sounds like it is analytics problem, not aggregation
>> problem.
>>
>> Also, on your automatic aggregation, do you see those data in the data
>> entry?
>>
>>
>> Best regards,
>> 
>> Châu Thu Trân
>> HISP Viet Nam
>> Email: tran.hispviet...@gmail.com
>>
>>
>> On Sat, Aug 23, 2014 at 1:54 PM, Prosper BT  wrote:
>>
>>> Dear Abyot and Team,
>>>
>>> We are running two instances one with 2.15 build 15206 and 2.16 build 16332,
>>> on the two instance we have built aggregate queries using the aggregate
>>> query build and set the automatic aggregation and analytic to run.
>>>
>>> We have been testing this for now over a week and the automatic
>>> aggregation is not working on both versions, later alone the analytics.
>>>
>>> When we aggregate manually and save the data, aggregate are accessible
>>> through data entry apart from the daily ones and when we further run
>>> analytics manually we dont get any  data in data set reports, pivot tables,
>>> visualizer and GIS.
>>>
>>> Could this be a bug? Emma can share the logs,
>>> smgl.dhis2.org and wemr.ug
>>>
>>> Regards
>>>
>>> --
>>> Prosper Behumbiize, MPH
>>> Phone:+256 414 320076
>>> Cell: +256 772 139037
>>>  +256 752 751776
>>>
>>>
>>> ___
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to : dhis2-devs@lists.launchpad.net
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 16491: Calendar. Impl class PeriodCache which provides a cache for createPeriod( date, calendar). Using ...

2014-08-24 Thread noreply

revno: 16491
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Sun 2014-08-24 23:04:36 +0200
message:
  Calendar. Impl class PeriodCache which provides a cache for createPeriod( 
date, calendar). Using cache to improve performance in data export and period 
resource tables.
added:
  
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/cache/
  
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/cache/PeriodCache.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java
  
dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java
  
dhis-2/dhis-services/dhis-service-administration/src/main/resources/META-INF/dhis/beans.xml
  
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/SpringDataValueSetStore.java
  dhis-2/dhis-support/dhis-support-system/pom.xml
  
dhis-2/dhis-support/dhis-support-system/src/main/resources/META-INF/dhis/beans.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/period/PeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java	2014-08-24 17:53:31 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java	2014-08-24 21:04:36 +
@@ -38,7 +38,6 @@
 import org.hisp.dhis.calendar.PeriodTypeParser;
 import org.hisp.dhis.calendar.impl.Iso8601Calendar;
 import org.hisp.dhis.common.DxfNamespaces;
-import org.hisp.dhis.common.Timer;
 
 import java.io.Serializable;
 import java.util.ArrayList;

=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java'
--- dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java	2014-08-15 07:40:20 +
+++ dhis-2/dhis-services/dhis-service-administration/src/main/java/org/hisp/dhis/resourcetable/DefaultResourceTableService.java	2014-08-24 21:04:36 +
@@ -28,6 +28,20 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.resourcetable.ResourceTableStore.TABLE_NAME_CATEGORY_OPTION_COMBO_NAME;
+import static org.hisp.dhis.resourcetable.ResourceTableStore.TABLE_NAME_DATA_ELEMENT_STRUCTURE;
+import static org.hisp.dhis.resourcetable.ResourceTableStore.TABLE_NAME_DATE_PERIOD_STRUCTURE;
+import static org.hisp.dhis.resourcetable.ResourceTableStore.TABLE_NAME_ORGANISATION_UNIT_STRUCTURE;
+import static org.hisp.dhis.resourcetable.ResourceTableStore.TABLE_NAME_PERIOD_STRUCTURE;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.calendar.Calendar;
@@ -58,18 +72,8 @@
 import org.hisp.dhis.resourcetable.statement.CreateCategoryTableStatement;
 import org.hisp.dhis.sqlview.SqlView;
 import org.hisp.dhis.sqlview.SqlViewService;
+import org.hisp.dhis.system.cache.PeriodCache;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.Assert;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.hisp.dhis.resourcetable.ResourceTableStore.*;
 
 /**
  * @author Lars Helge Overland
@@ -138,7 +142,14 @@
 {
 this.sqlViewService = sqlViewService;
 }
+
+private PeriodCache periodCache;
 
+public void setPeriodCache( PeriodCache periodCache )
+{
+this.periodCache = periodCache;
+}
+
 // -
 // OrganisationUnitStructure
 // -
@@ -437,11 +448,11 @@
 List batchArgs = new ArrayList<>();
 
 Date startDate = new Cal( 1975, 1, 1, true ).time(); //TODO
-Date endDate = new Cal( 2030, 1, 1, true ).time();
+Date endDate = new Cal( 2025, 1, 1, true ).time();
 
 List days = new DailyPeriodType().generatePeriods( startDate, endDate );
 
-Calendar cal = PeriodType.getCalendar();
+Calendar calendar = PeriodType.getCalendar();
 
 for ( Period day : days )
 {
@@ -451,11 +462,7 @@
 
 for ( PeriodType periodType : periodTypes )
 {
-Period period = periodType.createPeriod( day.getStartDate(), cal );
-
-   

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 16492: Data export. Changed from using spring jdbc queryForRowSet to using RowCallbackHandler in order t...

2014-08-24 Thread noreply

revno: 16492
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Sun 2014-08-24 23:24:08 +0200
message:
  Data export. Changed from using spring jdbc queryForRowSet to using 
RowCallbackHandler in order to stream output
modified:
  
dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/SpringDataValueSetStore.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-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/SpringDataValueSetStore.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/SpringDataValueSetStore.java	2014-08-24 21:04:36 +
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/datavalueset/SpringDataValueSetStore.java	2014-08-24 21:24:08 +
@@ -34,6 +34,8 @@
 
 import java.io.OutputStream;
 import java.io.Writer;
+import java.sql.ResultSet;
+import java.sql.SQLException;
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashSet;
@@ -52,7 +54,7 @@
 import org.hisp.dhis.system.util.StreamUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.support.rowset.SqlRowSet;
+import org.springframework.jdbc.core.RowCallbackHandler;
 
 import com.csvreader.CsvWriter;
 
@@ -80,9 +82,7 @@
 {
 DataValueSet dataValueSet = new StreamingDataValueSet( XMLFactory.getXMLWriter( out ) );
 
-SqlRowSet sqlRowSet = jdbcTemplate.queryForRowSet( getDataValueSql( dataSets, periods, orgUnits ) );
-
-writeDataValueSet( sqlRowSet, dataSets, completeDate, period, orgUnit, periods, orgUnits, dataValueSet );
+writeDataValueSet( getDataValueSql( dataSets, periods, orgUnits ), dataSets, completeDate, period, orgUnit, periods, orgUnits, dataValueSet );
 
 StreamUtils.closeOutputStream( out );
 }
@@ -93,9 +93,7 @@
 {
 DataValueSet dataValueSet = new StreamingJsonDataValueSet( outputStream );
 
-SqlRowSet sqlRowSet = jdbcTemplate.queryForRowSet( getDataValueSql( dataSets, periods, orgUnits ) );
-
-writeDataValueSet( sqlRowSet, dataSets, completeDate, period, orgUnit, periods, orgUnits, dataValueSet );
+writeDataValueSet( getDataValueSql( dataSets, periods, orgUnits ), dataSets, completeDate, period, orgUnit, periods, orgUnits, dataValueSet );
 
 StreamUtils.closeOutputStream( outputStream );
 }
@@ -105,9 +103,7 @@
 {
 DataValueSet dataValueSet = new StreamingCsvDataValueSet( new CsvWriter( writer, CSV_DELIM ) );
 
-SqlRowSet sqlRowSet = jdbcTemplate.queryForRowSet( getDataValueSql( dataSets, periods, orgUnits ) );
-
-writeDataValueSet( sqlRowSet, dataSets, null, null, null, periods, orgUnits, dataValueSet );
+writeDataValueSet( getDataValueSql( dataSets, periods, orgUnits ), dataSets, null, null, null, periods, orgUnits, dataValueSet );
 }
 
 @Override
@@ -126,43 +122,44 @@
 "join categoryoptioncombo aoc on (dv.attributeoptioncomboid=aoc.categoryoptioncomboid) " +
 "where dv.lastupdated >= '" + DateUtils.getLongDateString( lastUpdated ) + "'";
 
-SqlRowSet rowSet = jdbcTemplate.queryForRowSet( sql );
-
-writeDataValueSet( rowSet, null, null, null, null, null, null, dataValueSet );
+writeDataValueSet( sql, null, null, null, null, null, null, dataValueSet );
 }
 
-private void writeDataValueSet( SqlRowSet rowSet, Set dataSets, Date completeDate, Period period,
-OrganisationUnit orgUnit, Set periods, Set orgUnits, DataValueSet dataValueSet )
+private void writeDataValueSet( String sql, Set dataSets, Date completeDate, Period period,
+OrganisationUnit orgUnit, Set periods, Set orgUnits, final DataValueSet dataValueSet )
 {
 dataValueSet.setDataSet( dataSets.size() == 1 ? dataSets.iterator().next().getUid() : null );
 dataValueSet.setCompleteDate( getLongDateString( completeDate ) );
 dataValueSet.setPeriod( period != null ? period.getIsoDate() : null );
 dataValueSet.setOrgUnit( orgUnit != null ? orgUnit.getUid() : null );
 
-Calendar calendar = PeriodType.getCalendar();
+final Calendar calendar = PeriodType.getCalendar();
 
-while ( rowSet.next() )
+jdbcTemplate.query( sql, new RowCallbackHandler()
 {
-DataValue dataValue = dataValueSet.getDataValueInstance();
-PeriodType pt = PeriodType.getPeriodTypeByName( rowSet.getString( "ptname" ) );
-
-dataValue.setDataElement( rowSet.getString( "deuid" ) );
-dataValue.setPeriod( periodCache.getIsoPeriod( pt, rowSe

[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 16493: Translations

2014-08-24 Thread noreply

revno: 16493
committer: Lars Helge Overland 
branch nick: dhis2
timestamp: Mon 2014-08-25 00:46:25 +0200
message:
  Translations
modified:
  
dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/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-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties	2014-05-13 18:18:04 +
+++ dhis-2/dhis-web/dhis-web-importexport/src/main/resources/org/hisp/dhis/importexport/i18n_module.properties	2014-08-24 22:46:25 +
@@ -9,18 +9,18 @@
 from=From
 to=To
 period=Period
-selected_data_elements=Selected Data Elements
-available_data_elements=Available Data Elements
+selected_data_elements=Selected data elements
+available_data_elements=Available data elements
 move_selected=Move selected
 move_all=Move all
 remove_selected=Remove selected
 remove_all=Remove all
 indicators=Indicators
 datavalues=Data values
-available_datasets=Available Datasets
-selected_datasets=Selected Datasets
-available_indicators=Available Indicators
-selected_indicators=Selected Indicators
+available_datasets=Available data sets
+selected_datasets=Selected data sets
+available_indicators=Available indicators
+selected_indicators=Selected indicators
 level=Level
 clear=Clear
 dhis14_import=DHIS 1.4 Import
@@ -37,7 +37,7 @@
 up=Up
 specify_file=Please specify a file
 data_sets=Data sets
-include_datavalues=Include Datavalues
+include_datavalues=Include Data Values
 file=File
 elements=Elements
 data=Data
@@ -51,9 +51,9 @@
 dataelement=Data element
 indicator=Indicator
 indicator_group=Indicator group
-dataset=Dataset
+dataset=Data set
 organisationunit=Organisation unit
-data_export=DXF Datavalue Export
+data_export=DXF Data Value Export
 datavalue_export=Data Export
 metadata_export=DXF Metadata Export
 data_export=Data Export
@@ -103,7 +103,7 @@
 xls_metadata_export=XLS Metadata Export
 version=Version
 status=Status
-data_type=Data typemain
+data_type=Data type
 validation_rules=Validation rules
 saved=Saved
 last_updated=Last updated
@@ -114,7 +114,7 @@
 data_value=Data Value
 data_value_daily=Daily Data Value
 dhis14_file_configuration=DHIS 1.4 File Configuration
-data_file=Datafile
+data_file=Data file
 user_name=Username
 password=Password
 levels=Levels
@@ -185,9 +185,9 @@
 select_organisation_unit=Please select at least one organisation unit
 select_startdate=Please select a start date
 select_enddate=Please select an end date
-select_datasets=Please select at least one dataset
+select_datasets=Please select at least one data set
 select_one_or_more_object_types=Please select one or more object types
-geo_code=Geocode
+geo_code=Geo code
 view_all=View all
 data_dictionaries=Data dictionaries
 report_table=Report table
@@ -225,9 +225,6 @@
 table_name=Table name
 mode=Mode
 regression=Regression
-do_indicators=Do indicators
-do_category_option_combos=Crosstab category option combos
-do_periods=Crosstab periods
 reporting_month=Reporting month
 last_3_months=Last 3 months
 last_6_months=Last 6 months
@@ -431,9 +428,9 @@
 available_reports=Available Reports
 selected_reports=Selected Reports
 
-sql_views=Sql views
-available_sqlViews=Available Sql Views
-selected_sqlViews=Selected Sql Views
+sql_views=SQL views
+available_sqlViews=Available SQL Views
+selected_sqlViews=Selected SQL Views
 
 available_userGroups=Available User Groups
 selected_userGroups=Selected User Groups

___
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp


[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 16494: javadoc update on TimeUnit

2014-08-24 Thread noreply

revno: 16494
committer: Morten Olav Hansen 
branch nick: dhis2
timestamp: Mon 2014-08-25 13:03:36 +0700
message:
  javadoc update on TimeUnit
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.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/period/PeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java	2014-08-24 21:04:36 +
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodType.java	2014-08-25 06:03:36 +
@@ -29,7 +29,8 @@
  */
 
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
 import org.hisp.dhis.calendar.CalendarService;
 import org.hisp.dhis.calendar.DateInterval;
 import org.hisp.dhis.calendar.DateUnit;
@@ -47,6 +48,9 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
 
 /**
  * The superclass of all PeriodTypes.
@@ -57,6 +61,23 @@
 public abstract class PeriodType
 implements Serializable
 {
+// cache for speeding up period lookup, uses calendar.name() + periodType.getName() + date.toString() as key
+private static Cache periodCache = CacheBuilder.newBuilder()
+.expireAfterWrite( 5, TimeUnit.MINUTES )
+.initialCapacity( 5000 )
+.maximumSize( 3 )
+.build();
+
+private String getCacheKey( Date date )
+{
+return getCalendar().name() + "-" + getName() + "-" + date.toString();
+}
+
+private String getCacheKey( org.hisp.dhis.calendar.Calendar calendar, Date date )
+{
+return calendar.name() + "-" + getName() + "-" + date.toString();
+}
+
 /**
  * Determines if a de-serialized file is compatible with this class.
  */
@@ -219,15 +240,30 @@
  * @param date the date which is contained by the created period.
  * @return the valid Period based on the given date
  */
-public Period createPeriod( Date date )
+public Period createPeriod( final Date date )
 {
-return createPeriod( createCalendarInstance( date ) );
+try
+{
+return periodCache.get( getCacheKey( date ), new Callable()
+{
+@Override
+public Period call() throws Exception
+{
+return createPeriod( createCalendarInstance( date ) );
+}
+} );
+}
+catch ( ExecutionException ignored )
+{
+}
+
+return null;
 }
 
 public Period createPeriod( Calendar cal )
 {
 org.hisp.dhis.calendar.Calendar calendar = getCalendar();
-
+
 return createPeriod( calendar.fromIso( DateUnit.fromJdkCalendar( cal ) ), calendar );
 }
 
@@ -237,21 +273,34 @@
  * method is intended for use in situations where a huge number of of periods
  * will be generated and its desirable to re-use the calendar.
  *
- * @param date the date which is contained by the created period.
+ * @param date the date which is contained by the created period.
  * @param calendar the calendar implementation to use.
  * @return the valid Period based on the given date
  */
-public Period createPeriod( Date date, org.hisp.dhis.calendar.Calendar calendar )
-{
-DateUnit unit = DateUnit.fromJdkDate( date );
-
-return createPeriod( calendar.fromIso( unit ), calendar );
+public Period createPeriod( final Date date, final org.hisp.dhis.calendar.Calendar calendar )
+{
+try
+{
+return periodCache.get( getCacheKey( calendar, date ), new Callable()
+{
+@Override
+public Period call() throws Exception
+{
+return createPeriod( calendar.fromIso( DateUnit.fromJdkDate( date ) ), calendar );
+}
+} );
+}
+catch ( ExecutionException ignored )
+{
+}
+
+return null;
 }
 
 public Period toIsoPeriod( DateUnit start, DateUnit end )
 {
 org.hisp.dhis.calendar.Calendar cal = getCalendar();
-
+
 return toIsoPeriod( start, end, cal );
 }
 
@@ -259,15 +308,15 @@
 {
 DateUnit from = calendar.toIso( start );
 DateUnit to = calendar.toIso( end );
-
-return new Period( this, from.toJdkDate(), to.toJdkDate(), getIsoDate( from ) );
+
+return new Period( this, from.toJdkDate(), to.toJdkDate(), getIsoDate( from )