dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18809
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7984: Minor
------------------------------------------------------------
revno: 7984
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-08-29 17:13:58 +0200
message:
Minor
modified:
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/cache/AggregationCache.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/cache/MemoryAggregationCache.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/indicator/DefaultIndicatorDataMart.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-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/cache/AggregationCache.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/cache/AggregationCache.java 2012-08-29 14:44:51 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/cache/AggregationCache.java 2012-08-29 15:13:58 +0000
@@ -33,6 +33,7 @@
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
/**
* @author Lars Helge Overland
@@ -42,6 +43,8 @@
{
Collection<Integer> getIntersectingPeriods( Date startDate, Date endDate );
+ Collection<Integer> getPeriodsBetweenDatesPeriodType( final PeriodType periodType, final Date startDate, final Date endDate );
+
Collection<Integer> getPeriodsBetweenDates( Date startDate, Date endDate );
Period getPeriod( int id );
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/cache/MemoryAggregationCache.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/cache/MemoryAggregationCache.java 2012-08-29 14:44:51 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/cache/MemoryAggregationCache.java 2012-08-29 15:13:58 +0000
@@ -38,6 +38,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.system.util.ConversionUtils;
/**
@@ -119,7 +120,25 @@
return periods;
}
-
+
+ public Collection<Integer> getPeriodsBetweenDatesPeriodType( final PeriodType periodType, final Date startDate, final Date endDate )
+ {
+ final String key = periodType.getName() + SEPARATOR + startDate.toString() + SEPARATOR + endDate.toString();
+
+ Collection<Integer> periods = null;
+
+ if ( ( periods = periodBetweenDatesPeriodTypeCache.get( key ) ) != null )
+ {
+ return periods;
+ }
+
+ periods = ConversionUtils.getIdentifiers( Period.class, periodService.getPeriodsBetweenDates( periodType, startDate, endDate ) );
+
+ periodBetweenDatesPeriodTypeCache.put( key, periods );
+
+ return periods;
+ }
+
public Period getPeriod( final int id )
{
final String key = String.valueOf( id );
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/indicator/DefaultIndicatorDataMart.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/indicator/DefaultIndicatorDataMart.java 2012-07-20 11:41:57 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/indicator/DefaultIndicatorDataMart.java 2012-08-29 15:13:58 +0000
@@ -133,7 +133,7 @@
Collection<OrganisationUnit> organisationUnits, Collection<OrganisationUnitGroup> organisationUnitGroups,
Collection<DataElementOperand> operands, Class<? extends BatchHandler<AggregatedIndicatorValue>> clazz, String key )
{
- statementManager.initialise(); // Running in separate thread
+ statementManager.initialise(); // Running in separate thread // TODO initialize file statement manager
final BatchHandler<AggregatedIndicatorValue> batchHandler = batchHandlerFactory.createBatchHandler( clazz ).init();