← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15871: add new constructor for cal, allows to set iso parameter of dataUnit, useful if the period you ar...

 

------------------------------------------------------------
revno: 15871
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-06-27 15:25:39 +0700
message:
  add new constructor for cal, allows to set iso parameter of dataUnit, useful if the period you are working with is already in iso and you don't want to convert it first
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Cal.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/Cal.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Cal.java	2014-05-14 09:22:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Cal.java	2014-06-27 08:25:39 +0000
@@ -79,6 +79,17 @@
     }
 
     /**
+     * @param year    the year starting at AD 1.
+     * @param month   the month starting at 1.
+     * @param day     the day of the month starting at 1.
+     * @param iso8601 is this period an iso period
+     */
+    public Cal( int year, int month, int day, boolean iso8601 )
+    {
+        dateUnit = new DateUnit( year, month, day, iso8601 );
+    }
+
+    /**
      * @param date the date.
      */
     public Cal( Date date )
@@ -97,6 +108,7 @@
 
     /**
      * Adds the given amount of time to the given calendar field.
+     *
      * @param field  the calendar field.
      * @param amount the amount of time.
      */
@@ -117,6 +129,7 @@
 
     /**
      * Subtracts the given amount of time to the given calendar field.
+     *
      * @param field  the calendar field.
      * @param amount the amount of time.
      */
@@ -137,6 +150,7 @@
 
     /**
      * Returns the value of the given calendar field.
+     *
      * @param field the field.
      */
     public int get( int field )
@@ -146,6 +160,7 @@
 
     /**
      * Returns the current year.
+     *
      * @return current year
      */
     public int getYear()
@@ -155,6 +170,7 @@
 
     /**
      * Sets the current time.
+     *
      * @param year  the year starting at AD 1.
      * @param month the month starting at 1.
      * @param day   the day of the month starting at 1.
@@ -167,6 +183,7 @@
 
     /**
      * Sets the current month and day.
+     *
      * @param month the month starting at 1.
      * @param day   the day of the month starting at 1.
      */
@@ -179,6 +196,7 @@
 
     /**
      * Sets the current time.
+     *
      * @param date the date to base time on.
      */
     public Cal set( Date date )