← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5935: Minor cleanup of iso date stuff

 

------------------------------------------------------------
revno: 5935
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-02-13 12:41:07 +0100
message:
  Minor cleanup of iso date stuff
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/FinancialPeriodType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/QuarterlyPeriodType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/SixMonthlyPeriodType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/TwoYearlyPeriodType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/WeeklyPeriodType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/YearlyPeriodType.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/FinancialPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/FinancialPeriodType.java	2012-02-12 17:33:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/FinancialPeriodType.java	2012-02-13 11:41:07 +0000
@@ -32,6 +32,8 @@
 import java.util.Date;
 import java.util.List;
 
+import org.apache.commons.lang.NotImplementedException;
+
 /**
  * @author Lars Helge Overland
  */
@@ -160,18 +162,18 @@
     @Override
     public String getIsoDate( Period period )
     {
-        throw new UnsupportedOperationException( "Not supported yet." );
+        throw new NotImplementedException(); // TODO
     }
 
     @Override
     public Period createPeriod( String isoDate )
     {
-        throw new UnsupportedOperationException( "Not supported yet." );
+        throw new NotImplementedException(); // TODO
     }
 
     @Override
     public String getIsoFormat()
     {
-        throw new UnsupportedOperationException( "Not supported yet." );
+        throw new NotImplementedException(); // TODO
     }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/QuarterlyPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/QuarterlyPeriodType.java	2012-02-12 17:33:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/QuarterlyPeriodType.java	2012-02-13 11:41:07 +0000
@@ -48,6 +48,8 @@
      */
     private static final long serialVersionUID = -5973809094923012052L;
 
+    private static final String ISO_FORMAT = "yyyyQn";
+
     /**
      * The name of the QuarterlyPeriodType, which is "Quarterly".
      */
@@ -181,10 +183,13 @@
         return createPeriod( cal );
     }
 
+    /**
+     * n refers to the quarter, can be [1-4].
+     */
     @Override
     public String getIsoFormat()
     {
-        return "yyyyQn (n: 1-4)";
+        return ISO_FORMAT;
     }
 
     public enum Quarter

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/SixMonthlyPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/SixMonthlyPeriodType.java	2012-02-12 17:33:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/SixMonthlyPeriodType.java	2012-02-13 11:41:07 +0000
@@ -48,6 +48,8 @@
      */
     private static final long serialVersionUID = 5709134010793412705L;
 
+    private static final String ISO_FORMAT = "yyyySn";
+
     /**
      * The name of the SixMonthlyPeriodType, which is "SixMonthly".
      */
@@ -177,10 +179,13 @@
         return createPeriod( cal );
     }
 
+    /**
+     * n refers to the semester, can be [1-2].
+     */
     @Override
     public String getIsoFormat()
     {
-        return "yyyySn (n: 1-2)";
+        return ISO_FORMAT;
     }
 
     public enum Semester

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/TwoYearlyPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/TwoYearlyPeriodType.java	2012-02-12 17:33:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/TwoYearlyPeriodType.java	2012-02-13 11:41:07 +0000
@@ -32,6 +32,8 @@
 import java.util.Date;
 import java.util.List;
 
+import org.apache.commons.lang.NotImplementedException;
+
 /**
  * PeriodType for two-yearly Periods. A valid two-yearly Period has startDate
  * set to January 1st on an even year (2000, 2002, 2004, etc), and endDate set
@@ -179,18 +181,18 @@
     @Override
     public String getIsoDate( Period period )
     {
-        throw new UnsupportedOperationException( "Not supported yet." );
+        throw new NotImplementedException(); // TODO
     }
 
     @Override
     public Period createPeriod( String isoDate )
     {
-        throw new UnsupportedOperationException( "Not supported yet." );
+        throw new NotImplementedException(); // TODO
     }
 
     @Override
     public String getIsoFormat()
     {
-        return "Not supported yet.";
+        throw new NotImplementedException(); // TODO
     }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/WeeklyPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/WeeklyPeriodType.java	2012-02-12 17:33:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/WeeklyPeriodType.java	2012-02-13 11:41:07 +0000
@@ -48,6 +48,8 @@
      */
     private static final long serialVersionUID = 6466760375688564528L;
 
+    private static final String ISO_FORMAT = "yyyyWn";
+
     /**
      * The name of the WeeklyPeriodType, which is "Weekly".
      */
@@ -225,9 +227,12 @@
         return createPeriod( cal.getTime() );
     }
 
+    /**
+     * n refers to week number, can be [1-53].
+     */
     @Override
     public String getIsoFormat()
     {
-        return "yyyyWn (n: week number)";
+        return ISO_FORMAT;
     }
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/YearlyPeriodType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/YearlyPeriodType.java	2012-02-12 17:33:07 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/YearlyPeriodType.java	2012-02-13 11:41:07 +0000
@@ -47,6 +47,8 @@
      */
     private static final long serialVersionUID = 3893035414025085437L;
 
+    private static final String ISO_FORMAT = "yyyy";
+
     /**
      * The name of the YearlyPeriodType, which is "Yearly".
      */
@@ -170,6 +172,6 @@
     @Override
     public String getIsoFormat()
     {
-        return "yyyy";
+        return ISO_FORMAT;
     }
 }