dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #27172
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13483: impl service methods for getting by datadimension in deGroupSet
------------------------------------------------------------
revno: 13483
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-12-30 12:02:39 +0100
message:
impl service methods for getting by datadimension in deGroupSet
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSetStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementGroupSetStore.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/dataelement/DataElementGroupSetStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSetStore.java 2013-12-30 10:11:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSetStore.java 2013-12-30 11:02:39 +0000
@@ -30,10 +30,13 @@
import org.hisp.dhis.common.GenericNameableObjectStore;
+import java.util.Collection;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
public interface DataElementGroupSetStore
extends GenericNameableObjectStore<DataElementGroupSet>
{
+ Collection<DataElementGroupSet> getByDataDimension( boolean dataDimension );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2013-11-21 09:09:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementService.java 2013-12-30 11:02:39 +0000
@@ -491,6 +491,8 @@
Collection<DataElementGroupSet> getAllDataElementGroupSets();
+ Collection<DataElementGroupSet> getDataDimensionDataElementGroupSets();
+
Collection<DataElementGroupSet> getDataElementGroupSets( Collection<Integer> identifiers );
List<DataElementGroupSet> getDataElementGroupSetsByUid( Collection<String> uids );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2013-12-30 10:11:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/DefaultDataElementService.java 2013-12-30 11:02:39 +0000
@@ -615,6 +615,12 @@
return i18n( i18nService, dataElementGroupSetStore.getAll() );
}
+ @Override
+ public Collection<DataElementGroupSet> getDataDimensionDataElementGroupSets()
+ {
+ return i18n( i18nService, dataElementGroupSetStore.getByDataDimension(true) );
+ }
+
public Collection<DataElementGroupSet> getDataElementGroupSets( final Collection<Integer> identifiers )
{
Collection<DataElementGroupSet> groupSets = getAllDataElementGroupSets();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementGroupSetStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementGroupSetStore.java 2013-12-30 10:11:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataelement/hibernate/HibernateDataElementGroupSetStore.java 2013-12-30 11:02:39 +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.HibernateDimensionalObjectStore;
import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.dataelement.DataElementGroupSetStore;
+import java.util.Collection;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
@@ -39,4 +42,13 @@
extends HibernateDimensionalObjectStore<DataElementGroupSet>
implements DataElementGroupSetStore
{
+ @Override
+ @SuppressWarnings( "unchecked" )
+ public Collection<DataElementGroupSet> getByDataDimension( boolean dataDimension )
+ {
+ Query query = getQuery( "SELECT d FROM DataElementGroupSet d WHERE d.dataDimension=:dataDimension" );
+ query.setBoolean( "dataDimension", dataDimension );
+
+ return query.list();
+ }
}