dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #25193
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12427: Javadoc
------------------------------------------------------------
revno: 12427
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-10-04 14:27:33 +0200
message:
Javadoc
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.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/organisationunit/OrganisationUnit.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2013-10-03 13:24:21 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2013-10-04 12:27:33 +0000
@@ -616,7 +616,7 @@
* Returns a mapping between the uid and the uid parent graph of the given
* organisation units.
*/
- public static Map<String, String> getParentGrapMap( List<OrganisationUnit> organisationUnits )
+ public static Map<String, String> getParentGraphMap( List<OrganisationUnit> organisationUnits )
{
Map<String, String> map = new HashMap<String, String>();
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2013-10-03 08:22:21 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2013-10-04 12:27:33 +0000
@@ -68,6 +68,7 @@
import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.dataelement.DataElementOperand;
import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodType;
@@ -102,7 +103,7 @@
private static final DimensionItem[] DIM_OPT_ARR = new DimensionItem[0];
private static final DimensionItem[][] DIM_OPT_2D_ARR = new DimensionItem[0][];
-
+
protected List<DimensionalObject> dimensions = new ArrayList<DimensionalObject>();
protected List<DimensionalObject> filters = new ArrayList<DimensionalObject>();
@@ -111,24 +112,54 @@
private Map<MeasureFilter, Double> measureCriteria = new HashMap<MeasureFilter, Double>();
+ /**
+ * Indicates if the meta data part of the query response should be omitted.
+ */
private boolean skipMeta;
+ /**
+ * Indicates i) if the names of all ancestors of the organisation units part
+ * of the query should be included in the "names" key and ii) if the hierarchy
+ * path of all organisation units part of the query should be included as a
+ * "ouHierarchy" key in the meta-data part of the response.
+ */
private boolean hierarchyMeta;
+ /**
+ * Indicates whether the maximum number of records to include the response
+ * should be ignored.
+ */
private boolean ignoreLimit;
// -------------------------------------------------------------------------
// Transient properties
// -------------------------------------------------------------------------
+ /**
+ * The partitions containing data relevant to this query.
+ */
protected transient Partitions partitions;
+ /**
+ * The aggregation period type for this query.
+ */
protected transient String periodType;
-
+
+ /**
+ * The period type of the data values to query.
+ */
private transient PeriodType dataPeriodType;
+ /**
+ * Indicates whether to skip partitioning during query planning.
+ */
private transient boolean skipPartitioning;
+ /**
+ * Organisation units which were explicitly part of the original request.
+ */
+ private List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>();
+
// -------------------------------------------------------------------------
// Constructors
// -------------------------------------------------------------------------
@@ -153,6 +184,7 @@
params.periodType = this.periodType;
params.dataPeriodType = this.dataPeriodType;
params.skipPartitioning = this.skipPartitioning;
+ params.organisationUnits = new ArrayList<OrganisationUnit>( this.organisationUnits );
return params;
}
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2013-10-04 10:59:00 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2013-10-04 12:27:33 +0000
@@ -55,7 +55,7 @@
import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_USER_ORGUNIT;
import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_USER_ORGUNIT_CHILDREN;
import static org.hisp.dhis.organisationunit.OrganisationUnit.KEY_USER_ORGUNIT_GRANDCHILDREN;
-import static org.hisp.dhis.organisationunit.OrganisationUnit.getParentGrapMap;
+import static org.hisp.dhis.organisationunit.OrganisationUnit.getParentGraphMap;
import static org.hisp.dhis.period.PeriodType.getPeriodTypeFromIsoString;
import static org.hisp.dhis.reporttable.ReportTable.IRT2D;
import static org.hisp.dhis.reporttable.ReportTable.addIfEmpty;
@@ -249,24 +249,26 @@
Map<DataElementOperand, Double> valueMap = permutationOperandValueMap.get( permKey );
- if ( valueMap != null )
- {
- Period period = filterPeriod != null ? filterPeriod : (Period) DimensionItem.getPeriodItem( options );
-
- int days = daysBetween( period.getStartDate(), period.getEndDate() );
-
- Double value = expressionService.getIndicatorValue( indicator, period, valueMap, constantMap, days );
-
- if ( value != null )
- {
- List<DimensionItem> row = new ArrayList<DimensionItem>( options );
-
- row.add( indicatorIndex, new DimensionItem( INDICATOR_DIM_ID, indicator ) );
-
- grid.addRow();
- grid.addValues( DimensionItem.getItemIdentifiers( row ) );
- grid.addValue( MathUtils.getRounded( value ) );
- }
+ if ( valueMap == null )
+ {
+ continue;
+ }
+
+ Period period = filterPeriod != null ? filterPeriod : (Period) DimensionItem.getPeriodItem( options );
+
+ int days = daysBetween( period.getStartDate(), period.getEndDate() );
+
+ Double value = expressionService.getIndicatorValue( indicator, period, valueMap, constantMap, days );
+
+ if ( value != null )
+ {
+ List<DimensionItem> row = new ArrayList<DimensionItem>( options );
+
+ row.add( indicatorIndex, new DimensionItem( INDICATOR_DIM_ID, indicator ) );
+
+ grid.addRow();
+ grid.addValues( DimensionItem.getItemIdentifiers( row ) );
+ grid.addValue( MathUtils.getRounded( value ) );
}
}
}
@@ -386,19 +388,17 @@
Map<Object, Object> metaData = new HashMap<Object, Object>();
Map<String, String> uidNameMap = getUidNameMap( params );
- Map<String, String> cocNameMap = getCocNameMap( grid, cocIndex );
- Map<String, String> ouParentGraphMap = getParentGrapMap( asTypedList(
- params.getDimensionOrFilter( ORGUNIT_DIM_ID ), OrganisationUnit.class ) );
-
+ Map<String, String> cocNameMap = getCocNameMap( grid, cocIndex );
uidNameMap.putAll( cocNameMap );
metaData.put( NAMES_META_KEY, uidNameMap );
metaData.put( PERIOD_DIM_ID, getUids( params.getDimensionOrFilter( PERIOD_DIM_ID ) ) );
- metaData.put( ORGUNIT_DIM_ID, ouParentGraphMap );
+ metaData.put( ORGUNIT_DIM_ID, getUids( params.getDimensionOrFilter( ORGUNIT_DIM_ID ) ) );
+ metaData.put( CATEGORYOPTIONCOMBO_DIM_ID, cocNameMap.keySet() );
- if ( cocIndex != null )
+ if ( params.isHierarchyMeta() )
{
- metaData.put( CATEGORYOPTIONCOMBO_DIM_ID, cocNameMap.keySet() );
+ metaData.put( OU_HIERARCHY_KEY, getParentGraphMap( asTypedList( params.getDimensionOrFilter( ORGUNIT_DIM_ID ), OrganisationUnit.class ) ) );
}
grid.setMetaData( metaData );
@@ -988,6 +988,11 @@
return map;
}
+ /**
+ * Returns a mapping between the category option combo identifiers and names
+ * in the given grid. Returns an empty map if the grid or cocIndex parameters
+ * are null.
+ */
private Map<String, String> getCocNameMap( Grid grid, Integer cocIndex )
{
Map<String, String> metaData = new HashMap<String, String>();
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java 2013-10-04 10:59:00 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsService.java 2013-10-04 12:27:33 +0000
@@ -33,7 +33,7 @@
import static org.hisp.dhis.common.DimensionalObject.ORGUNIT_DIM_ID;
import static org.hisp.dhis.common.DimensionalObject.PERIOD_DIM_ID;
import static org.hisp.dhis.common.NameableObjectUtils.asTypedList;
-import static org.hisp.dhis.organisationunit.OrganisationUnit.getParentGrapMap;
+import static org.hisp.dhis.organisationunit.OrganisationUnit.getParentGraphMap;
import java.util.ArrayList;
import java.util.Date;
@@ -168,11 +168,13 @@
Map<Object, Object> metaData = new HashMap<Object, Object>();
Map<String, String> uidNameMap = getUidNameMap( params );
- Map<String, String> ouParentGraphMap = getParentGrapMap( asTypedList(
- params.getDimensionOrFilter( ORGUNIT_DIM_ID ), OrganisationUnit.class ) );
metaData.put( NAMES_META_KEY, uidNameMap );
- metaData.put( ORGUNIT_DIM_ID, ouParentGraphMap );
+
+ if ( params.isHierarchyMeta() )
+ {
+ metaData.put( ORGUNIT_DIM_ID, getParentGraphMap( asTypedList( params.getDimensionOrFilter( ORGUNIT_DIM_ID ), OrganisationUnit.class ) ) );
+ }
grid.setMetaData( metaData );
@@ -234,11 +236,13 @@
Map<Object, Object> metaData = new HashMap<Object, Object>();
Map<String, String> uidNameMap = getUidNameMap( params );
- Map<String, String> ouParentGraphMap = getParentGrapMap( asTypedList(
- params.getDimensionOrFilter( ORGUNIT_DIM_ID ), OrganisationUnit.class ) );
metaData.put( NAMES_META_KEY, uidNameMap );
- metaData.put( ORGUNIT_DIM_ID, ouParentGraphMap );
+
+ if ( params.isHierarchyMeta() )
+ {
+ metaData.put( ORGUNIT_DIM_ID, getParentGraphMap( asTypedList( params.getDimensionOrFilter( ORGUNIT_DIM_ID ), OrganisationUnit.class ) ) );
+ }
if ( params.isPaging() )
{