← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14969: add support for calendar conversion using year, month, day

 

------------------------------------------------------------
revno: 14969
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-04-24 22:06:52 +0545
message:
  add support for calendar conversion using year, month, day
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/AbstractCalendar.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/DateUnit.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/AbstractCalendar.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/AbstractCalendar.java	2014-04-24 15:46:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/AbstractCalendar.java	2014-04-24 16:21:52 +0000
@@ -33,4 +33,15 @@
  */
 public abstract class AbstractCalendar implements Calendar
 {
+    @Override
+    public DateUnit toIso( int year, int month, int day )
+    {
+        return toIso( new DateUnit( year, month, day ) );
+    }
+
+    @Override
+    public DateUnit fromIso( int year, int month, int day )
+    {
+        return fromIso( new DateUnit( year, month, day ) );
+    }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java	2014-04-24 15:46:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java	2014-04-24 16:21:52 +0000
@@ -33,7 +33,11 @@
  */
 public interface Calendar
 {
+    DateUnit toIso( int year, int month, int day );
+
     DateUnit toIso( DateUnit dateUnit );
 
+    DateUnit fromIso( int year, int month, int day );
+
     DateUnit fromIso( DateUnit dateUnit );
 }

=== 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-04-24 15:46:24 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/DateUnit.java	2014-04-24 16:21:52 +0000
@@ -58,9 +58,7 @@
 
     public DateUnit( int year, int month, int day, int dayOfWeek )
     {
-        this.year = year;
-        this.month = month;
-        this.day = day;
+        this( year, month, day );
         this.dayOfWeek = dayOfWeek;
     }