← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21366: Minor

 

------------------------------------------------------------
revno: 21366
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-12-07 18:40:27 +0100
message:
  Minor
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AnalyticalObjectStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateAnalyticalObjectStore.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/AnalyticalObjectStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AnalyticalObjectStore.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/AnalyticalObjectStore.java	2015-12-07 17:40:27 +0000
@@ -34,6 +34,7 @@
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
+import org.hisp.dhis.program.ProgramIndicator;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -47,6 +48,8 @@
 
     int countDataElementAnalyticalObject( DataElement dataElement );
     
+    int countProgramIndicatorAnalyticalObject( ProgramIndicator programIndicator );
+    
     int countPeriodAnalyticalObject( Period period );
     
     int countOrganisationUnitAnalyticalObject( OrganisationUnit organisationUnit );

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateAnalyticalObjectStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateAnalyticalObjectStore.java	2015-06-26 17:02:18 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/hibernate/HibernateAnalyticalObjectStore.java	2015-12-07 17:40:27 +0000
@@ -37,6 +37,7 @@
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
+import org.hisp.dhis.program.ProgramIndicator;
 
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -74,6 +75,15 @@
     }
 
     @Override
+    public int countProgramIndicatorAnalyticalObject( ProgramIndicator programIndicator )
+    {
+        Query query = getQuery( "select count(distinct c) from " + clazz.getName() + " c join c.dataDimensionItems d where d.programIndicator = :programIndicator" );
+        query.setEntity( "dataSet", programIndicator );
+
+        return ((Long) query.uniqueResult()).intValue();
+    }
+    
+    @Override
     public int countPeriodAnalyticalObject( Period period )
     {
         Query query = getQuery( "select count(distinct c) from " + clazz.getName() + " c where :period in elements(c.periods)" );