← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13485: impl getByDataDimension on ouGroupSetStore/Service

 

------------------------------------------------------------
revno: 13485
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-12-30 12:12:53 +0100
message:
  impl getByDataDimension on ouGroupSetStore/Service
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSetStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitGroupSetStore.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/OrganisationUnitGroupService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupService.java	2013-11-29 13:31:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupService.java	2013-12-30 11:12:53 +0000
@@ -230,6 +230,8 @@
      */
     Collection<OrganisationUnitGroupSet> getAllOrganisationUnitGroupSets();
 
+    Collection<OrganisationUnitGroupSet> getDataDimensionOrganisationUnitGroupSets();
+
     /**
      * Returns all compulsory OrganisationUnitGroupSets.
      * 

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSetStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSetStore.java	2013-12-30 11:08:52 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSetStore.java	2013-12-30 11:12:53 +0000
@@ -30,10 +30,13 @@
 
 import org.hisp.dhis.common.GenericNameableObjectStore;
 
+import java.util.Collection;
+
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
 public interface OrganisationUnitGroupSetStore
     extends GenericNameableObjectStore<OrganisationUnitGroupSet>
 {
+    Collection<OrganisationUnitGroupSet> getByDataDimension( boolean dataDimension );
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java	2013-12-30 11:08:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/DefaultOrganisationUnitGroupService.java	2013-12-30 11:12:53 +0000
@@ -264,6 +264,12 @@
         return i18n( i18nService, organisationUnitGroupSetStore.getAll() );
     }
 
+    @Override
+    public Collection<OrganisationUnitGroupSet> getDataDimensionOrganisationUnitGroupSets()
+    {
+        return i18n( i18nService, organisationUnitGroupSetStore.getByDataDimension(true) );
+    }
+
     public Collection<OrganisationUnitGroupSet> getCompulsoryOrganisationUnitGroupSets()
     {
         Collection<OrganisationUnitGroupSet> groupSets = new ArrayList<OrganisationUnitGroupSet>();

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitGroupSetStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitGroupSetStore.java	2013-12-30 11:08:52 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/organisationunit/hibernate/HibernateOrganisationUnitGroupSetStore.java	2013-12-30 11:12:53 +0000
@@ -28,10 +28,13 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hibernate.Query;
 import org.hisp.dhis.common.hibernate.HibernateIdentifiableObjectStore;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupSetStore;
 
+import java.util.Collection;
+
 /**
  * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
  */
@@ -39,4 +42,12 @@
     extends HibernateIdentifiableObjectStore<OrganisationUnitGroupSet>
     implements OrganisationUnitGroupSetStore
 {
+    @Override
+    public Collection<OrganisationUnitGroupSet> getByDataDimension( boolean dataDimension )
+    {
+        Query query = getQuery( "SELECT d FROM OrganisationUnitGroupSet d WHERE d.dataDimension=:dataDimension" );
+        query.setBoolean( "dataDimension", dataDimension );
+
+        return query.list();
+    }
 }