dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22702
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10999: Analytics, improved logging, added nullpointer checks
------------------------------------------------------------
revno: 10999
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2013-05-25 15:59:49 +0200
message:
Analytics, improved logging, added nullpointer checks
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.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/DefaultQueryPlanner.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/BaseAnalyticalObject.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java 2013-05-24 11:03:32 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/BaseAnalyticalObject.java 2013-05-25 13:59:49 +0000
@@ -250,7 +250,10 @@
for ( DataElementGroup group : dataElementGroups )
{
- deGroupMap.putValue( group.getGroupSet().getDimension(), group );
+ if ( group.getGroupSet() != null )
+ {
+ deGroupMap.putValue( group.getGroupSet().getDimension(), group );
+ }
}
if ( deGroupMap.containsKey( dimension ) )
@@ -264,7 +267,10 @@
for ( OrganisationUnitGroup group : organisationUnitGroups )
{
- ouGroupMap.putValue( group.getGroupSet().getUid(), group );
+ if ( group.getGroupSet() != null )
+ {
+ ouGroupMap.putValue( group.getGroupSet().getUid(), group );
+ }
}
if ( ouGroupMap.containsKey( dimension ) )
@@ -373,7 +379,10 @@
for ( DataElementGroup group : dataElementGroups )
{
- deGroupMap.putValue( group.getGroupSet().getDimension(), group );
+ if ( group.getGroupSet() != null )
+ {
+ deGroupMap.putValue( group.getGroupSet().getDimension(), group );
+ }
}
if ( deGroupMap.containsKey( dimension ) )
@@ -385,7 +394,10 @@
for ( OrganisationUnitGroup group : organisationUnitGroups )
{
- ouGroupMap.putValue( group.getGroupSet().getUid(), group );
+ if ( group.getGroupSet() != null )
+ {
+ ouGroupMap.putValue( group.getGroupSet().getUid(), group );
+ }
}
if ( ouGroupMap.containsKey( dimension ) )
=== 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 2013-05-19 18:49:47 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/IdentifiableObjectUtils.java 2013-05-25 13:59:49 +0000
@@ -76,9 +76,12 @@
{
List<String> uids = new ArrayList<String>();
- for ( T object : objects )
+ if ( objects != null )
{
- uids.add( object.getUid() );
+ for ( T object : objects )
+ {
+ uids.add( object.getUid() );
+ }
}
return uids;
@@ -127,9 +130,12 @@
{
List<IdentifiableObject> list = new ArrayList<IdentifiableObject>();
- for ( IdentifiableObject object : objects )
+ if ( objects != null )
{
- list.add( object );
+ for ( IdentifiableObject object : objects )
+ {
+ list.add( object );
+ }
}
return list;
@@ -161,9 +167,12 @@
{
List<T> list = new ArrayList<T>();
- for ( IdentifiableObject object : collection )
+ if ( collection != null )
{
- list.add( (T) object );
+ for ( IdentifiableObject object : collection )
+ {
+ list.add( (T) object );
+ }
}
return list;
=== 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-05-24 11:48:35 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/DataQueryParams.java 2013-05-25 13:59:49 +0000
@@ -1006,7 +1006,7 @@
/**
* Retrieves the options for the the dimension or filter with the given
- * identifier.
+ * identifier. Returns null of the dimension of filter is not present.
*/
public List<NameableObject> getDimensionOrFilter( String key )
{
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultQueryPlanner.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultQueryPlanner.java 2013-05-24 18:29:35 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultQueryPlanner.java 2013-05-25 13:59:49 +0000
@@ -308,6 +308,11 @@
}
}
+ if ( subQueries.size() > queries.size() )
+ {
+ log.info( "Split on " + dimension + ": " + ( subQueries.size() / queries.size() ) );
+ }
+
return subQueries;
}
@@ -356,6 +361,11 @@
throw new IllegalQueryException( "Query does not contain any period dimension items" );
}
+ if ( queries.size() > 1 )
+ {
+ log.info( "Split on partition: " + queries.size() );
+ }
+
return queries;
}
@@ -405,6 +415,11 @@
{
throw new IllegalQueryException( "Query does not contain any period dimension items" );
}
+
+ if ( queries.size() > 1 )
+ {
+ log.info( "Split on period type: " + queries.size() );
+ }
return queries;
}
@@ -451,6 +466,11 @@
queries.add( new DataQueryParams( params ) );
return queries;
}
+
+ if ( queries.size() > 1 )
+ {
+ log.info( "Split on org unit level: " + queries.size() );
+ }
return queries;
}
@@ -524,6 +544,11 @@
query.setAggregationType( SUM );
queries.add( query );
}
+
+ if ( queries.size() > 1 )
+ {
+ log.info( "Split on aggregation type: " + queries.size() );
+ }
return queries;
}
@@ -551,6 +576,11 @@
query.setDataPeriodType( periodType );
queries.add( query );
}
+
+ if ( queries.size() > 1 )
+ {
+ log.info( "Split on data period type: " + queries.size() );
+ }
return queries;
}