dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33983
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17419: minor update in idObjectUtils, add another method for getting local periods by period / calendar
------------------------------------------------------------
revno: 17419
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
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() ) );
}
/**