dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #06388
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2030: Impl method PeriodService.reloadPeriods
------------------------------------------------------------
revno: 2030
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Tue 2010-06-22 11:22:00 +0200
message:
Impl method PeriodService.reloadPeriods
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.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/PeriodService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/PeriodService.java 2010-06-22 09:22:00 +0000
@@ -195,6 +195,14 @@
Collection<Period> getPeriods( Period period, Collection<DataElement> dataElements, Collection<? extends Source> sources );
/**
+ * Enforces that each Period in the given collection is loaded in the current
+ * session. Persists the Period if it does not exist.
+ *
+ * @param periods the collection of Periods.
+ */
+ void reloadPeriods( Collection<Period> periods );
+
+ /**
* Returns a Period of type Relative. The Period will be persisted if it does
* not exist.
*
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/period/DefaultPeriodService.java 2010-06-22 09:22:00 +0000
@@ -173,6 +173,14 @@
{
return periodStore.getPeriods( period, dataElements, sources );
}
+
+ public void reloadPeriods( Collection<Period> periods )
+ {
+ for ( Period period : periods )
+ {
+ periodStore.reloadForceAddPeriod( period );
+ }
+ }
public Period getRelativePeriod( Date date, int startMonths, int endMonths )
{
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java 2010-06-08 19:47:40 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/organisationunit/OrganisationUnitServiceTest.java 2010-06-22 09:22:00 +0000
@@ -32,7 +32,6 @@
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
-import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;