← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12297: EventQueryParams, changed from constructor to instance method

 

------------------------------------------------------------
revno: 12297
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2013-09-29 17:30:34 +0200
message:
  EventQueryParams, changed from constructor to instance method
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryParams.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/EventQueryPlanner.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-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryParams.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryParams.java	2013-09-28 16:27:09 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/EventQueryParams.java	2013-09-29 15:30:34 +0000
@@ -93,22 +93,26 @@
     {
     }
     
-    public EventQueryParams( EventQueryParams params )
+    public EventQueryParams instance()
     {
-        this.program = params.getProgram();
-        this.programStage = params.getProgramStage();
-        this.startDate = params.getStartDate();
-        this.endDate = params.getEndDate();
-        this.items = new ArrayList<QueryItem>( params.getItems() );
-        this.dimensions = new ArrayList<DimensionalObject>( params.getDimensions() );            
-        this.asc = new ArrayList<String>( params.getAsc() );
-        this.desc = new ArrayList<String>( params.getDesc() );
-        this.organisationUnitMode = params.getOrganisationUnitMode();
-        this.tableName = params.getTableName();
-        this.page = params.getPage();
-        this.pageSize = params.getPageSize();
-        this.periodType = params.getPeriodType();
-        this.organisationUnitLevel = params.getOrganisationUnitLevel();
+        EventQueryParams params = new EventQueryParams();
+        
+        params.program = this.program;
+        params.programStage = this.programStage;
+        params.startDate = this.startDate;
+        params.endDate = this.endDate;
+        params.items = new ArrayList<QueryItem>( this.items );
+        params.dimensions = new ArrayList<DimensionalObject>( this.dimensions );            
+        params.asc = new ArrayList<String>( this.asc );
+        params.desc = new ArrayList<String>( this.desc );
+        params.organisationUnitMode = this.organisationUnitMode;
+        params.tableName = this.tableName;
+        params.page = this.page;
+        params.pageSize = this.pageSize;
+        params.periodType = this.periodType;
+        params.organisationUnitLevel = this.organisationUnitLevel;
+        
+        return params;
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/EventQueryPlanner.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/EventQueryPlanner.java	2013-09-28 16:27:09 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/EventQueryPlanner.java	2013-09-29 15:30:34 +0000
@@ -160,7 +160,7 @@
         
         for ( Integer level : levelOrgUnitMap.keySet() )
         {
-            EventQueryParams query = new EventQueryParams( params );
+            EventQueryParams query = params.instance();
             query.setOrganisationUnits( levelOrgUnitMap.get( level ) );
             query.setOrganisationUnitLevel( level );
             queries.add( query );
@@ -171,7 +171,7 @@
     
     private static EventQueryParams getQuery( EventQueryParams params, Date startDate, Date endDate, Program program )
     {
-        EventQueryParams query = new EventQueryParams( params );
+        EventQueryParams query = params.instance();
         query.setStartDate( startDate );
         query.setEndDate( endDate );
         query.setTableName( TABLE_BASE_NAME + year( startDate ) + "_" + program.getUid() );