dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26283
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13026: include datasets that are connected through ou.ougroup.dataSets in data-entry
------------------------------------------------------------
revno: 13026
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-11-26 11:48:36 +0100
message:
include datasets that are connected through ou.ougroup.dataSets in data-entry
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.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/OrganisationUnitStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java 2013-11-01 08:11:31 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitStore.java 2013-11-26 10:48:36 +0000
@@ -123,6 +123,8 @@
Map<Integer, Set<Integer>> getOrganisationUnitDataSetAssocationMap();
+ Map<Integer, Set<Integer>> getOrganisationUnitGroupDataSetAssocationMap();
+
Set<Integer> getOrganisationUnitIdsWithoutData();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2013-11-06 12:24:02 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitService.java 2013-11-26 10:48:36 +0000
@@ -554,6 +554,7 @@
public OrganisationUnitDataSetAssociationSet getOrganisationUnitDataSetAssociationSet()
{
Map<Integer, Set<Integer>> associationSet = organisationUnitStore.getOrganisationUnitDataSetAssocationMap();
+ associationSet.putAll( organisationUnitStore.getOrganisationUnitGroupDataSetAssocationMap() );
filterUserDataSets( associationSet );
filterChildOrganisationUnits( associationSet );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java 2013-11-01 08:11:31 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitStore.java 2013-11-26 10:48:36 +0000
@@ -216,6 +216,37 @@
return map;
}
+ @Override
+ public Map<Integer, Set<Integer>> getOrganisationUnitGroupDataSetAssocationMap()
+ {
+ final String sql = "select ougds.datasetid, ou.organisationunitid from orgunitgroupdatasets ougds " +
+ "left join orgunitgroupmembers ougm on ougds.orgunitgroupid=ougm.orgunitgroupid " +
+ "left join organisationunit ou on ou.organisationunitid=ougm.organisationunitid";
+
+ final Map<Integer, Set<Integer>> map = new HashMap<Integer, Set<Integer>>();
+
+ jdbcTemplate.query( sql, new RowCallbackHandler()
+ {
+ public void processRow( ResultSet rs ) throws SQLException
+ {
+ int dataSetId = rs.getInt( 1 );
+ int organisationUnitId = rs.getInt( 2 );
+
+ Set<Integer> dataSets = map.get( organisationUnitId );
+
+ if ( dataSets == null )
+ {
+ dataSets = new HashSet<Integer>();
+ map.put( organisationUnitId, dataSets );
+ }
+
+ dataSets.add( dataSetId );
+ }
+ } );
+
+ return map;
+ }
+
public Set<Integer> getOrganisationUnitIdsWithoutData()
{
final String sql = "select organisationunitid from organisationunit ou where not exists (" +