← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16765: use fromIso(date) in various places

 

------------------------------------------------------------
revno: 16765
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-09-22 12:21:44 +0700
message:
  use fromIso(date) in various places
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsTable.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java
  dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetReportParamsAction.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/i18n/I18nFormat.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java	2014-08-29 10:02:21 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/i18n/I18nFormat.java	2014-09-22 05:21:44 +0000
@@ -237,8 +237,8 @@
         Date periodStartDate = period.getStartDate();
         Date periodEndDate = period.getEndDate();
 
-        DateTimeUnit start = PeriodType.getCalendar().fromIso( DateTimeUnit.fromJdkDate( periodStartDate ) );
-        DateTimeUnit end = PeriodType.getCalendar().fromIso( DateTimeUnit.fromJdkDate( periodEndDate ) );
+        DateTimeUnit start = PeriodType.getCalendar().fromIso( periodStartDate );
+        DateTimeUnit end = PeriodType.getCalendar().fromIso( periodEndDate );
 
         String startDate;
         String endDate;

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsTable.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsTable.java	2014-09-18 16:01:06 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsTable.java	2014-09-22 05:21:44 +0000
@@ -28,13 +28,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import java.util.List;
-
 import org.hisp.dhis.calendar.DateTimeUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.program.Program;
 
+import java.util.List;
+
 /**
  * @author Lars Helge Overland
  */
@@ -43,9 +43,9 @@
     private String baseName;
 
     private List<String[]> dimensionColumns;
-    
+
     private Period period;
-    
+
     private Program program;
 
     // -------------------------------------------------------------------------
@@ -61,14 +61,14 @@
         this.baseName = baseName;
         this.dimensionColumns = dimensionColumns;
     }
-    
+
     public AnalyticsTable( String baseName, List<String[]> dimensionColumns, Period period )
     {
         this.baseName = baseName;
         this.dimensionColumns = dimensionColumns;
         this.period = period;
     }
-    
+
     public AnalyticsTable( String baseName, List<String[]> dimensionColumns, Period period, Program program )
     {
         this.baseName = baseName;
@@ -84,34 +84,34 @@
     public String getTableName()
     {
         String name = baseName;
-        
+
         if ( period != null )
         {
-            name += "_" + PeriodType.getCalendar().fromIso( DateTimeUnit.fromJdkDate( period.getStartDate() ) ).getYear();
+            name += "_" + PeriodType.getCalendar().fromIso( period.getStartDate() ).getYear();
         }
-        
+
         if ( program != null )
         {
             name += "_" + program.getUid();
         }
-        
+
         return name;
     }
-    
+
     public String getTempTableName()
     {
         String name = baseName + AnalyticsTableManager.TABLE_TEMP_SUFFIX;
 
         if ( period != null )
         {
-            name += "_" + PeriodType.getCalendar().fromIso( DateTimeUnit.fromJdkDate( period.getStartDate() ) ).getYear();
+            name += "_" + PeriodType.getCalendar().fromIso( period.getStartDate() ).getYear();
         }
-        
+
         if ( program != null )
         {
             name += "_" + program.getUid();
         }
-        
+
         return name;
     }
 
@@ -119,12 +119,12 @@
     {
         return period != null;
     }
-    
+
     public boolean hasProgram()
     {
         return program != null;
     }
-    
+
     @Override
     public String toString()
     {

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java	2014-08-29 10:02:21 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/PartitionUtils.java	2014-09-22 05:21:44 +0000
@@ -78,8 +78,8 @@
 
         Partitions partitions = new Partitions();
 
-        int startYear = PeriodType.getCalendar().fromIso( DateTimeUnit.fromJdkDate( period.getStartDate() ) ).getYear();
-        int endYear = PeriodType.getCalendar().fromIso( DateTimeUnit.fromJdkDate( period.getEndDate() ) ).getYear();
+        int startYear = PeriodType.getCalendar().fromIso( period.getStartDate() ).getYear();
+        int endYear = PeriodType.getCalendar().fromIso( period.getEndDate() ).getYear();
 
         while ( startYear <= endYear )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java	2014-08-29 10:02:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/GetOrganisationUnitAction.java	2014-09-22 05:21:44 +0000
@@ -211,15 +211,13 @@
 
         if ( organisationUnit.getOpeningDate() != null )
         {
-            DateTimeUnit dateTimeUnit = DateTimeUnit.fromJdkDate( organisationUnit.getOpeningDate() );
-            dateTimeUnit = calendarService.getSystemCalendar().fromIso( dateTimeUnit );
+            DateTimeUnit dateTimeUnit = calendarService.getSystemCalendar().fromIso( organisationUnit.getOpeningDate() );
             openingDate = calendarService.getSystemCalendar().formattedDate( dateTimeUnit );
         }
 
         if ( organisationUnit.getClosedDate() != null )
         {
-            DateTimeUnit dateTimeUnit = DateTimeUnit.fromJdkDate( organisationUnit.getClosedDate() );
-            dateTimeUnit = calendarService.getSystemCalendar().fromIso( dateTimeUnit );
+            DateTimeUnit dateTimeUnit = calendarService.getSystemCalendar().fromIso( organisationUnit.getClosedDate() );
             closedDate = calendarService.getSystemCalendar().formattedDate( dateTimeUnit );
         }
 

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetReportParamsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetReportParamsAction.java	2014-09-21 09:05:07 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/tablecreator/action/GetReportParamsAction.java	2014-09-22 05:21:44 +0000
@@ -207,7 +207,7 @@
                 }
                 else
                 {
-                    DateTimeUnit dateTimeUnit = calendar.fromIso( DateTimeUnit.fromJdkDate( period_.getStartDate() ) );
+                    DateTimeUnit dateTimeUnit = calendar.fromIso( period_.getStartDate() );
                     period.setUid( period_.getPeriodType().getIsoDate( dateTimeUnit ) );
                     period.setDisplayName( format.formatPeriod( period_ ) );
                 }