------------------------------------------------------------
revno: 17419
committer: Morten Olav Hansen <[email protected]>
branch nick: dhis2
timestamp: Tue 2014-11-11 14:15:34 +0545
message:
  minor update in idObjectUtils, add another method for getting local periods 
by period / calendar
modified:
  
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.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/common/IdentifiableObjectUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java	2014-11-11 08:13:46 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java	2014-11-11 08:30:34 +0000
@@ -138,21 +138,31 @@
     /**
      * Returns a local period identifier for a specific date / periodType / calendar.
      *
-     * @param date Date to create from
+     * @param date       Date to create from
      * @param periodType PeriodType to create from
-     * @param calendar Calendar to create from
+     * @param calendar   Calendar to create from
      * @return Period identifier based on given calendar
      */
     public static String getLocalPeriod( Date date, PeriodType periodType, Calendar calendar )
     {
-        Period period = periodType.createPeriod( date, calendar );
+        return getLocalPeriod( periodType.createPeriod( date, calendar ), calendar );
+    }
 
+    /**
+     * Returns a local period identifier for a specific period / calendar.
+     *
+     * @param period   the list of periods.
+     * @param calendar the calendar to use for generation of iso periods.
+     * @return Period identifier based on given calendar
+     */
+    public static String getLocalPeriod( Period period, Calendar calendar )
+    {
         if ( calendar.isIso8601() )
         {
             return period.getIsoDate();
         }
 
-        return periodType.getIsoDate( calendar.fromIso( period.getStartDate() ) );
+        return period.getPeriodType().getIsoDate( calendar.fromIso( period.getStartDate() ) );
     }
 
     /**

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to