dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #00309
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 98: dhis-service-datamart: Added some comments.
------------------------------------------------------------
revno: 98
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Fri 2009-03-20 13:54:19 +0100
message:
dhis-service-datamart: Added some comments.
modified:
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageBoolAggregator.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumBoolAggregator.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumIntAggregator.java
dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/dataelement/DefaultDataElementDataMart.java
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageBoolAggregator.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageBoolAggregator.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageBoolAggregator.java 2009-03-20 12:54:19 +0000
@@ -127,20 +127,20 @@
value = 0.0;
relevantDays = 0.0;
- if ( currentStartDate.compareTo( startDate ) >= 0 && currentEndDate.compareTo( endDate ) <= 0 )
+ if ( currentStartDate.compareTo( startDate ) >= 0 && currentEndDate.compareTo( endDate ) <= 0 ) // Value is within period
{
relevantDays = getDays( currentEndDate ) - getDays( currentStartDate );
}
- else if ( currentStartDate.compareTo( startDate ) <= 0 && currentEndDate.compareTo( endDate ) >= 0 )
+ else if ( currentStartDate.compareTo( startDate ) <= 0 && currentEndDate.compareTo( endDate ) >= 0 ) // Value spans whole period
{
relevantDays = getDays( endDate ) - getDays( startDate );
}
- else if ( currentStartDate.compareTo( startDate ) <= 0 && currentEndDate.compareTo( startDate ) >= 0
+ else if ( currentStartDate.compareTo( startDate ) <= 0 && currentEndDate.compareTo( startDate ) >= 0 // Value spans period start
&& currentEndDate.compareTo( endDate ) <= 0 )
{
relevantDays = getDays( currentEndDate ) - getDays( startDate );
}
- else if ( currentStartDate.compareTo( startDate ) >= 0 && currentStartDate.compareTo( endDate ) <= 0
+ else if ( currentStartDate.compareTo( startDate ) >= 0 && currentStartDate.compareTo( endDate ) <= 0 // Value spans period end
&& currentEndDate.compareTo( endDate ) >= 0 )
{
relevantDays = getDays( endDate ) - getDays( currentStartDate );
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/AverageIntAggregator.java 2009-03-20 12:54:19 +0000
@@ -144,21 +144,21 @@
relevantDays = 0.0;
- if ( currentStartDate.compareTo( startDate ) >= 0 && currentEndDate.compareTo( endDate ) <= 0 )
+ if ( currentStartDate.compareTo( startDate ) >= 0 && currentEndDate.compareTo( endDate ) <= 0 ) // Value is within period
{
relevantDays = getDays( currentEndDate ) - getDays( currentStartDate );
}
- else if ( currentStartDate.compareTo( startDate ) <= 0 && currentEndDate.compareTo( endDate ) >= 0 )
+ else if ( currentStartDate.compareTo( startDate ) <= 0 && currentEndDate.compareTo( endDate ) >= 0 ) // Value spans whole period
{
relevantDays = getDays( endDate ) - getDays( startDate );
}
else if ( currentStartDate.compareTo( startDate ) <= 0 && currentEndDate.compareTo( startDate ) >= 0
- && currentEndDate.compareTo( endDate ) <= 0 )
+ && currentEndDate.compareTo( endDate ) <= 0 ) // Value spans period start
{
relevantDays = getDays( currentEndDate ) - getDays( startDate );
}
else if ( currentStartDate.compareTo( startDate ) >= 0 && currentStartDate.compareTo( endDate ) <= 0
- && currentEndDate.compareTo( endDate ) >= 0 )
+ && currentEndDate.compareTo( endDate ) >= 0 ) // Value spans period end
{
relevantDays = getDays( endDate ) - getDays( currentStartDate );
}
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumBoolAggregator.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumBoolAggregator.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumBoolAggregator.java 2009-03-20 12:54:19 +0000
@@ -126,24 +126,24 @@
relevantDays = 0;
factor = 0;
- if ( currentStartDate.compareTo( startDate ) >= 0 && currentEndDate.compareTo( endDate ) <= 0 )
+ if ( currentStartDate.compareTo( startDate ) >= 0 && currentEndDate.compareTo( endDate ) <= 0 ) // Value is within period
{
relevantDays = ( getDays( endDate ) - getDays( startDate ) );
factor = 1;
}
- else if ( currentStartDate.compareTo( startDate ) <= 0 && currentEndDate.compareTo( endDate ) >= 0 )
+ else if ( currentStartDate.compareTo( startDate ) <= 0 && currentEndDate.compareTo( endDate ) >= 0 ) // Value spans whole period
{
relevantDays = ( getDays( endDate ) - getDays( startDate ) );
factor = relevantDays / duration;
}
else if ( currentStartDate.compareTo( startDate ) <= 0 && currentEndDate.compareTo( startDate ) >= 0
- && currentEndDate.compareTo( endDate ) <= 0 )
+ && currentEndDate.compareTo( endDate ) <= 0 ) // Value spans period start
{
relevantDays = ( getDays( currentEndDate ) - getDays( startDate ) );
factor = relevantDays / duration;
}
else if ( currentStartDate.compareTo( startDate ) >= 0 && currentStartDate.compareTo( endDate ) <= 0
- && currentEndDate.compareTo( endDate ) >= 0 )
+ && currentEndDate.compareTo( endDate ) >= 0 ) // Value spans period end
{
relevantDays = ( getDays( endDate ) - getDays( currentStartDate ) );
factor = relevantDays / duration;
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumIntAggregator.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumIntAggregator.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/aggregation/dataelement/SumIntAggregator.java 2009-03-20 12:54:19 +0000
@@ -140,29 +140,29 @@
relevantDays = 0;
factor = 0;
- if ( currentStartDate.compareTo( startDate ) >= 0 && currentEndDate.compareTo( endDate ) <= 0 )
+ if ( currentStartDate.compareTo( startDate ) >= 0 && currentEndDate.compareTo( endDate ) <= 0 ) // Value is within period
{
relevantDays = getDays( endDate ) - getDays( startDate );
factor = 1;
}
- else if ( currentStartDate.compareTo( startDate ) <= 0 && currentEndDate.compareTo( endDate ) >= 0 )
+ else if ( currentStartDate.compareTo( startDate ) <= 0 && currentEndDate.compareTo( endDate ) >= 0 ) // Value spans whole period
{
relevantDays = getDays( endDate ) - getDays( startDate );
factor = relevantDays / duration;
}
else if ( currentStartDate.compareTo( startDate ) <= 0 && currentEndDate.compareTo( startDate ) >= 0
- && currentEndDate.compareTo( endDate ) <= 0 )
+ && currentEndDate.compareTo( endDate ) <= 0 ) // Value spans period start
{
relevantDays = getDays( currentEndDate ) - getDays( startDate );
factor = relevantDays / duration;
}
else if ( currentStartDate.compareTo( startDate ) >= 0 && currentStartDate.compareTo( endDate ) <= 0
- && currentEndDate.compareTo( endDate ) >= 0 )
+ && currentEndDate.compareTo( endDate ) >= 0 ) // Value spans period end
{
relevantDays = getDays( endDate ) - getDays( currentStartDate );
factor = relevantDays / duration;
}
-
+
value = value * factor;
existingValue = totalSums.containsKey( entry.getKey() ) ? totalSums.get( entry.getKey() )[ 0 ] : 0;
=== modified file 'dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/dataelement/DefaultDataElementDataMart.java'
--- dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/dataelement/DefaultDataElementDataMart.java 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-services/dhis-service-datamart-default/src/main/java/org/hisp/dhis/datamart/dataelement/DefaultDataElementDataMart.java 2009-03-20 12:54:19 +0000
@@ -129,10 +129,8 @@
{
value.clear();
- Operand operand = entry.getKey();
-
- value.setDataElementId( operand.getDataElementId() );
- value.setCategoryOptionComboId( operand.getOptionComboId() );
+ value.setDataElementId( entry.getKey().getDataElementId() );
+ value.setCategoryOptionComboId( entry.getKey().getOptionComboId() );
value.setPeriodId( period.getId() );
value.setPeriodTypeId( periodType.getId() );
value.setOrganisationUnitId( unit.getId() );
@@ -155,7 +153,7 @@
// Id-to-object methods
// -------------------------------------------------------------------------
- private Collection<Period> getPeriods( Collection<Integer> periodIds )
+ private Collection<Period> getPeriods( final Collection<Integer> periodIds )
{
final Set<Period> periods = new HashSet<Period>( periodIds.size() );
@@ -167,7 +165,7 @@
return periods;
}
- private Collection<OrganisationUnit> getOrganisationUnits( Collection<Integer> organisationUnitIds )
+ private Collection<OrganisationUnit> getOrganisationUnits( final Collection<Integer> organisationUnitIds )
{
final Set<OrganisationUnit> organisationUnits = new HashSet<OrganisationUnit>( organisationUnitIds.size() );
--
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.