dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41122
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20940: simplified generics in QueryService/QueryEngine, added javadocs, removed obsolete Result* classes...
------------------------------------------------------------
revno: 20940
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-11-04 10:03:17 +0700
message:
simplified generics in QueryService/QueryEngine, added javadocs, removed obsolete Result* classes (now returns a list instead)
removed:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/MutableResult.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/Result.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/ResultTransformers.java
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/QueryEngine.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/QueryService.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/ResultTransformer.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/CriteriaQueryEngine.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/DefaultQueryService.java
dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/query/QueryServiceTest.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramStageController.java
dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.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
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/MutableResult.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/MutableResult.java 2015-02-18 13:08:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/MutableResult.java 1970-01-01 00:00:00 +0000
@@ -1,49 +0,0 @@
-package org.hisp.dhis.query;
-
-/*
- * Copyright (c) 2004-2015, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.hisp.dhis.common.IdentifiableObject;
-
-import java.util.List;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class MutableResult extends Result
-{
- public MutableResult( List<? extends IdentifiableObject> items )
- {
- super( items );
- }
-
- public void setItems( List<? extends IdentifiableObject> items )
- {
- this.items = items;
- }
-}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/QueryEngine.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/QueryEngine.java 2015-03-20 03:00:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/QueryEngine.java 2015-11-04 03:03:17 +0000
@@ -35,7 +35,20 @@
*/
public interface QueryEngine<T>
{
+ /**
+ * Return objects matching given query, T typed according to QueryEngine
+ * implementation.
+ *
+ * @param query Query instance to use
+ * @return Matching objects
+ */
List<T> query( Query query );
+ /**
+ * Returns how many objects matches the given query.
+ *
+ * @param query Query instance to use
+ * @return N number of matching objects
+ */
int count( Query query );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/QueryService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/QueryService.java 2015-03-20 03:00:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/QueryService.java 2015-11-04 03:03:17 +0000
@@ -28,6 +28,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.common.IdentifiableObject;
+
import java.util.List;
/**
@@ -35,11 +37,41 @@
*/
public interface QueryService
{
- Result query( Query query );
-
- Result query( Query query, ResultTransformer transformer );
-
+ /**
+ * Return objects matching given query, T typed according to QueryEngine
+ * implementation.
+ *
+ * @param query Query instance to use
+ * @return Matching objects
+ */
+ List<? extends IdentifiableObject> query( Query query );
+
+ /**
+ * Return objects matching given query, T typed according to QueryEngine
+ * implementation.
+ *
+ * @param query Query instance to use
+ * @param transformer ResultTransformer to use for mutating the result
+ * @return Matching objects
+ */
+ List<? extends IdentifiableObject> query( Query query, ResultTransformer transformer );
+
+ /**
+ * Returns how many objects matches the given query.
+ *
+ * @param query Query instance to use
+ * @return N number of matching objects
+ */
int count( Query query );
+ /**
+ * Create a query instance from a given set of filters (property:operator:value), and
+ * a list of orders.
+ *
+ * @param klass Type of object you want to query
+ * @param filters List of filters to use as basis for query instance
+ * @param orders List of orders to use for query
+ * @return New query instance using provided filters/orders
+ */
Query getQueryFromUrl( Class<?> klass, List<String> filters, List<Order> orders );
}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/Result.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/Result.java 2015-02-18 13:08:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/Result.java 1970-01-01 00:00:00 +0000
@@ -1,71 +0,0 @@
-package org.hisp.dhis.query;
-
-/*
- * Copyright (c) 2004-2015, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import com.google.common.base.MoreObjects;
-import org.hisp.dhis.common.IdentifiableObject;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class Result
-{
- protected List<? extends IdentifiableObject> items = new ArrayList<>();
-
- public Result()
- {
- }
-
- public Result( List<? extends IdentifiableObject> items )
- {
- this.items = items;
- }
-
- public List<? extends IdentifiableObject> getItems()
- {
- return items;
- }
-
- public int size()
- {
- return items == null ? 0 : items.size();
- }
-
-
- @Override
- public String toString()
- {
- return MoreObjects.toStringHelper( this )
- .add( "items", items )
- .toString();
- }
-}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/ResultTransformer.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/ResultTransformer.java 2015-02-18 13:08:37 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/ResultTransformer.java 2015-11-04 03:03:17 +0000
@@ -28,10 +28,13 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import java.util.List;
+
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
-public interface ResultTransformer
+@FunctionalInterface
+public interface ResultTransformer<T>
{
- Result transform( MutableResult result );
+ List<T> transform( List<T> result );
}
=== removed file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/ResultTransformers.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/ResultTransformers.java 2015-02-23 11:17:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/query/ResultTransformers.java 1970-01-01 00:00:00 +0000
@@ -1,75 +0,0 @@
-package org.hisp.dhis.query;
-
-/*
- * Copyright (c) 2004-2015, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
- */
-public class ResultTransformers implements ResultTransformer
-{
- private List<ResultTransformer> resultTransformers = new ArrayList<>();
-
- public ResultTransformers( ResultTransformer... resultTransformers )
- {
- Collections.addAll( this.resultTransformers, resultTransformers );
- }
-
- public ResultTransformers( List<ResultTransformer> resultTransformers )
- {
- this.resultTransformers = resultTransformers;
- }
-
- @Override
- public Result transform( MutableResult mutableResult )
- {
- Result result = mutableResult;
-
- for ( ResultTransformer resultTransformer : resultTransformers )
- {
- result = resultTransformer.transform( new MutableResult( result.getItems() ) );
- }
-
- return result;
- }
-
- public ResultTransformer add( ResultTransformer... resultTransformers )
- {
- Collections.addAll( this.resultTransformers, resultTransformers );
- return this;
- }
-
- public static ResultTransformer from( ResultTransformer... resultTransformers )
- {
- return new ResultTransformers( resultTransformers );
- }
-}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/CriteriaQueryEngine.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/CriteriaQueryEngine.java 2015-09-13 17:45:53 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/CriteriaQueryEngine.java 2015-11-04 03:03:17 +0000
@@ -45,9 +45,12 @@
import java.util.Map;
/**
+ * Implementation of QueryEngine that uses Hibernate Criteria and
+ * supports idObjects only.
+ *
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
-public class CriteriaQueryEngine<T> implements QueryEngine<T>
+public class CriteriaQueryEngine<T extends IdentifiableObject> implements QueryEngine
{
@Autowired
private final List<HibernateGenericStore<T>> hibernateGenericStores = new ArrayList<>();
@@ -289,7 +292,7 @@
return null;
}
- org.hibernate.criterion.Order criteriaOrder = null;
+ org.hibernate.criterion.Order criteriaOrder;
if ( order.isAscending() )
{
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/DefaultQueryService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/DefaultQueryService.java 2015-09-21 09:17:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/query/DefaultQueryService.java 2015-11-04 03:03:17 +0000
@@ -46,32 +46,33 @@
*
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
*/
-public class DefaultQueryService<T extends IdentifiableObject> implements QueryService
+public class DefaultQueryService implements QueryService
{
@Autowired
- private QueryEngine<T> queryEngine;
+ private QueryEngine<? extends IdentifiableObject> queryEngine;
@Autowired
private SchemaService schemaService;
@Override
- public Result query( Query query )
+ @SuppressWarnings( "unchecked" )
+ public List<? extends IdentifiableObject> query( Query query )
{
- List<T> objects = queryEngine.query( query );
- return new Result( objects );
+ return queryEngine.query( query );
}
@Override
- public Result query( Query query, ResultTransformer transformer )
+ @SuppressWarnings( "unchecked" )
+ public List<? extends IdentifiableObject> query( Query query, ResultTransformer transformer )
{
- List<T> objects = queryEngine.query( query );
+ List<? extends IdentifiableObject> objects = queryEngine.query( query );
if ( transformer != null )
{
- return transformer.transform( new MutableResult( objects ) );
+ return transformer.transform( objects );
}
- return new Result( objects );
+ return objects;
}
@Override
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/query/QueryServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/query/QueryServiceTest.java 2015-09-23 10:48:14 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/query/QueryServiceTest.java 2015-11-04 03:03:17 +0000
@@ -28,13 +28,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Collection;
-import java.util.Iterator;
-
+import com.google.common.collect.Lists;
import org.hisp.dhis.DhisSpringTest;
import org.hisp.dhis.common.IdentifiableObject;
import org.hisp.dhis.common.IdentifiableObjectManager;
@@ -46,7 +40,11 @@
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import static org.junit.Assert.*;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -116,9 +114,7 @@
{
createDataElements();
Query query = Query.from( schemaService.getDynamicSchema( DataElement.class ) );
- Result result = queryService.query( query );
-
- assertEquals( 6, result.size() );
+ assertEquals( 6, queryService.query( query ).size() );
}
@Test
@@ -126,9 +122,7 @@
{
createDataElements();
Query query = queryService.getQueryFromUrl( DataElement.class, Lists.<String>newArrayList(), Lists.<Order>newArrayList() );
- Result result = queryService.query( query );
-
- assertEquals( 6, result.size() );
+ assertEquals( 6, queryService.query( query ).size() );
}
@Test
@@ -154,10 +148,10 @@
createDataElements();
Query query = Query.from( schemaService.getDynamicSchema( DataElement.class ) );
query.add( Restrictions.eq( "id", "deabcdefghA" ) );
- Result result = queryService.query( query );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
- assertEquals( 1, result.size() );
- assertEquals( "deabcdefghA", result.getItems().get( 0 ).getUid() );
+ assertEquals( 1, objects.size() );
+ assertEquals( "deabcdefghA", objects.get( 0 ).getUid() );
}
@Test
@@ -165,10 +159,10 @@
{
createDataElements();
Query query = queryService.getQueryFromUrl( DataElement.class, Lists.newArrayList( "id:eq:deabcdefghA" ), Lists.<Order>newArrayList() );
- Result result = queryService.query( query );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
- assertEquals( 1, result.size() );
- assertEquals( "deabcdefghA", result.getItems().get( 0 ).getUid() );
+ assertEquals( 1, objects.size() );
+ assertEquals( "deabcdefghA", objects.get( 0 ).getUid() );
}
@Test
@@ -177,16 +171,16 @@
createDataElements();
Query query = Query.from( schemaService.getDynamicSchema( DataElement.class ) );
query.add( Restrictions.ne( "id", "deabcdefghA" ) );
- Result result = queryService.query( query );
-
- assertEquals( 5, result.size() );
-
- assertFalse( collectionContainsUid( result.getItems(), "deabcdefghA" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghB" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghC" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghD" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghE" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghF" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 5, objects.size() );
+
+ assertFalse( collectionContainsUid( objects, "deabcdefghA" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghB" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghC" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghD" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghE" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghF" ) );
}
@Test
@@ -194,16 +188,16 @@
{
createDataElements();
Query query = queryService.getQueryFromUrl( DataElement.class, Lists.newArrayList( "id:ne:deabcdefghA" ), Lists.<Order>newArrayList() );
- Result result = queryService.query( query );
-
- assertEquals( 5, result.size() );
-
- assertFalse( collectionContainsUid( result.getItems(), "deabcdefghA" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghB" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghC" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghD" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghE" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghF" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 5, objects.size() );
+
+ assertFalse( collectionContainsUid( objects, "deabcdefghA" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghB" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghC" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghD" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghE" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghF" ) );
}
@Test
@@ -212,10 +206,10 @@
createDataElements();
Query query = Query.from( schemaService.getDynamicSchema( DataElement.class ) );
query.add( Restrictions.like( "name", "%F" ) );
- Result result = queryService.query( query );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
- assertEquals( 1, result.size() );
- assertEquals( "deabcdefghF", result.getItems().get( 0 ).getUid() );
+ assertEquals( 1, objects.size() );
+ assertEquals( "deabcdefghF", objects.get( 0 ).getUid() );
}
@Test
@@ -223,10 +217,10 @@
{
createDataElements();
Query query = queryService.getQueryFromUrl( DataElement.class, Lists.newArrayList( "name:like:F" ), Lists.<Order>newArrayList() );
- Result result = queryService.query( query );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
- assertEquals( 1, result.size() );
- assertEquals( "deabcdefghF", result.getItems().get( 0 ).getUid() );
+ assertEquals( 1, objects.size() );
+ assertEquals( "deabcdefghF", objects.get( 0 ).getUid() );
}
@Test
@@ -235,13 +229,13 @@
createDataElements();
Query query = Query.from( schemaService.getDynamicSchema( DataElement.class ) );
query.add( Restrictions.gt( "created", Year.parseYear( "2003" ).getStart() ) );
- Result result = queryService.query( query );
-
- assertEquals( 3, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghD" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghE" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghF" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 3, objects.size() );
+
+ assertTrue( collectionContainsUid( objects, "deabcdefghD" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghE" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghF" ) );
}
@Test
@@ -249,13 +243,13 @@
{
createDataElements();
Query query = queryService.getQueryFromUrl( DataElement.class, Lists.newArrayList( "created:gt:2003" ), Lists.<Order>newArrayList() );
- Result result = queryService.query( query );
-
- assertEquals( 3, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghD" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghE" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghF" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 3, objects.size() );
+
+ assertTrue( collectionContainsUid( objects, "deabcdefghD" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghE" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghF" ) );
}
@Test
@@ -264,12 +258,12 @@
createDataElements();
Query query = Query.from( schemaService.getDynamicSchema( DataElement.class ) );
query.add( Restrictions.lt( "created", Year.parseYear( "2003" ).getStart() ) );
- Result result = queryService.query( query );
-
- assertEquals( 2, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghA" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghB" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 2, objects.size() );
+
+ assertTrue( collectionContainsUid( objects, "deabcdefghA" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghB" ) );
}
@Test
@@ -277,12 +271,12 @@
{
createDataElements();
Query query = queryService.getQueryFromUrl( DataElement.class, Lists.newArrayList( "created:lt:2003" ), Lists.<Order>newArrayList() );
- Result result = queryService.query( query );
-
- assertEquals( 2, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghA" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghB" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 2, objects.size() );
+
+ assertTrue( collectionContainsUid( objects, "deabcdefghA" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghB" ) );
}
@Test
@@ -291,14 +285,14 @@
createDataElements();
Query query = Query.from( schemaService.getDynamicSchema( DataElement.class ) );
query.add( Restrictions.ge( "created", Year.parseYear( "2003" ).getStart() ) );
- Result result = queryService.query( query );
-
- assertEquals( 4, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghC" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghD" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghE" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghF" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 4, objects.size() );
+
+ assertTrue( collectionContainsUid( objects, "deabcdefghC" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghD" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghE" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghF" ) );
}
@Test
@@ -306,14 +300,14 @@
{
createDataElements();
Query query = queryService.getQueryFromUrl( DataElement.class, Lists.newArrayList( "created:ge:2003" ), Lists.<Order>newArrayList() );
- Result result = queryService.query( query );
-
- assertEquals( 4, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghC" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghD" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghE" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghF" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 4, objects.size() );
+
+ assertTrue( collectionContainsUid( objects, "deabcdefghC" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghD" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghE" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghF" ) );
}
@Test
@@ -322,13 +316,13 @@
createDataElements();
Query query = Query.from( schemaService.getDynamicSchema( DataElement.class ) );
query.add( Restrictions.le( "created", Year.parseYear( "2003" ).getStart() ) );
- Result result = queryService.query( query );
-
- assertEquals( 3, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghA" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghB" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghC" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 3, objects.size() );
+
+ assertTrue( collectionContainsUid( objects, "deabcdefghA" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghB" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghC" ) );
}
@Test
@@ -336,13 +330,13 @@
{
createDataElements();
Query query = queryService.getQueryFromUrl( DataElement.class, Lists.newArrayList( "created:le:2003" ), Lists.<Order>newArrayList() );
- Result result = queryService.query( query );
-
- assertEquals( 3, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghA" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghB" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghC" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 3, objects.size() );
+
+ assertTrue( collectionContainsUid( objects, "deabcdefghA" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghB" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghC" ) );
}
@Test
@@ -351,13 +345,13 @@
createDataElements();
Query query = Query.from( schemaService.getDynamicSchema( DataElement.class ) );
query.add( Restrictions.between( "created", Year.parseYear( "2003" ).getStart(), Year.parseYear( "2005" ).getStart() ) );
- Result result = queryService.query( query );
-
- assertEquals( 3, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghC" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghD" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghE" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 3, objects.size() );
+
+ assertTrue( collectionContainsUid( objects, "deabcdefghC" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghD" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghE" ) );
}
@Test
@@ -366,12 +360,12 @@
createDataElements();
Query query = Query.from( schemaService.getDynamicSchema( DataElement.class ) );
query.add( Restrictions.in( "id", Lists.newArrayList( "deabcdefghD", "deabcdefghF" ) ) );
- Result result = queryService.query( query );
-
- assertEquals( 2, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghD" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghF" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 2, objects.size() );
+
+ assertTrue( collectionContainsUid( objects, "deabcdefghD" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghF" ) );
}
@Test
@@ -380,37 +374,11 @@
createDataElements();
Query query = Query.from( schemaService.getDynamicSchema( DataElement.class ) );
- Result result = queryService.query( query, result1 -> new Result() );
-
- assertEquals( 0, result.size() );
-
- result = queryService.query( query, result1 -> new Result( result1.getItems() ) );
-
- assertEquals( 6, result.size() );
-
- result = queryService.query( query, result1 -> {
- Iterator<? extends IdentifiableObject> iterator = result1.getItems().iterator();
-
- while ( iterator.hasNext() )
- {
- IdentifiableObject identifiableObject = iterator.next();
-
- if ( identifiableObject.getUid().equals( "deabcdefghD" ) )
- {
- iterator.remove();
- }
- }
-
- return result1;
- } );
-
- assertEquals( 5, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghA" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghB" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghC" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghE" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghF" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query, result1 -> new ArrayList() );
+ assertEquals( 0, objects.size() );
+
+ objects = queryService.query( query, result1 -> result1 );
+ assertEquals( 6, objects.size() );
}
@Test
@@ -421,16 +389,16 @@
Query query = Query.from( schema );
query.addOrder( new Order( schema.getProperty( "name" ), false ) );
- Result result = queryService.query( query );
-
- assertEquals( 6, result.size() );
-
- assertEquals( "deabcdefghF", result.getItems().get( 0 ).getUid() );
- assertEquals( "deabcdefghE", result.getItems().get( 1 ).getUid() );
- assertEquals( "deabcdefghD", result.getItems().get( 2 ).getUid() );
- assertEquals( "deabcdefghC", result.getItems().get( 3 ).getUid() );
- assertEquals( "deabcdefghB", result.getItems().get( 4 ).getUid() );
- assertEquals( "deabcdefghA", result.getItems().get( 5 ).getUid() );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 6, objects.size() );
+
+ assertEquals( "deabcdefghF", objects.get( 0 ).getUid() );
+ assertEquals( "deabcdefghE", objects.get( 1 ).getUid() );
+ assertEquals( "deabcdefghD", objects.get( 2 ).getUid() );
+ assertEquals( "deabcdefghC", objects.get( 3 ).getUid() );
+ assertEquals( "deabcdefghB", objects.get( 4 ).getUid() );
+ assertEquals( "deabcdefghA", objects.get( 5 ).getUid() );
}
@Test
@@ -441,16 +409,16 @@
Query query = Query.from( schema );
query.addOrder( new Order( schema.getProperty( "name" ), true ) );
- Result result = queryService.query( query );
-
- assertEquals( 6, result.size() );
-
- assertEquals( "deabcdefghA", result.getItems().get( 0 ).getUid() );
- assertEquals( "deabcdefghB", result.getItems().get( 1 ).getUid() );
- assertEquals( "deabcdefghC", result.getItems().get( 2 ).getUid() );
- assertEquals( "deabcdefghD", result.getItems().get( 3 ).getUid() );
- assertEquals( "deabcdefghE", result.getItems().get( 4 ).getUid() );
- assertEquals( "deabcdefghF", result.getItems().get( 5 ).getUid() );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 6, objects.size() );
+
+ assertEquals( "deabcdefghA", objects.get( 0 ).getUid() );
+ assertEquals( "deabcdefghB", objects.get( 1 ).getUid() );
+ assertEquals( "deabcdefghC", objects.get( 2 ).getUid() );
+ assertEquals( "deabcdefghD", objects.get( 3 ).getUid() );
+ assertEquals( "deabcdefghE", objects.get( 4 ).getUid() );
+ assertEquals( "deabcdefghF", objects.get( 5 ).getUid() );
}
@Test
@@ -461,16 +429,16 @@
Query query = Query.from( schema );
query.addOrder( new Order( schema.getProperty( "created" ), false ) );
- Result result = queryService.query( query );
-
- assertEquals( 6, result.size() );
-
- assertEquals( "deabcdefghF", result.getItems().get( 0 ).getUid() );
- assertEquals( "deabcdefghE", result.getItems().get( 1 ).getUid() );
- assertEquals( "deabcdefghD", result.getItems().get( 2 ).getUid() );
- assertEquals( "deabcdefghC", result.getItems().get( 3 ).getUid() );
- assertEquals( "deabcdefghB", result.getItems().get( 4 ).getUid() );
- assertEquals( "deabcdefghA", result.getItems().get( 5 ).getUid() );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 6, objects.size() );
+
+ assertEquals( "deabcdefghF", objects.get( 0 ).getUid() );
+ assertEquals( "deabcdefghE", objects.get( 1 ).getUid() );
+ assertEquals( "deabcdefghD", objects.get( 2 ).getUid() );
+ assertEquals( "deabcdefghC", objects.get( 3 ).getUid() );
+ assertEquals( "deabcdefghB", objects.get( 4 ).getUid() );
+ assertEquals( "deabcdefghA", objects.get( 5 ).getUid() );
}
@Test
@@ -481,16 +449,16 @@
Query query = Query.from( schema );
query.addOrder( new Order( schema.getProperty( "created" ), true ) );
- Result result = queryService.query( query );
-
- assertEquals( 6, result.size() );
-
- assertEquals( "deabcdefghA", result.getItems().get( 0 ).getUid() );
- assertEquals( "deabcdefghB", result.getItems().get( 1 ).getUid() );
- assertEquals( "deabcdefghC", result.getItems().get( 2 ).getUid() );
- assertEquals( "deabcdefghD", result.getItems().get( 3 ).getUid() );
- assertEquals( "deabcdefghE", result.getItems().get( 4 ).getUid() );
- assertEquals( "deabcdefghF", result.getItems().get( 5 ).getUid() );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 6, objects.size() );
+
+ assertEquals( "deabcdefghA", objects.get( 0 ).getUid() );
+ assertEquals( "deabcdefghB", objects.get( 1 ).getUid() );
+ assertEquals( "deabcdefghC", objects.get( 2 ).getUid() );
+ assertEquals( "deabcdefghD", objects.get( 3 ).getUid() );
+ assertEquals( "deabcdefghE", objects.get( 4 ).getUid() );
+ assertEquals( "deabcdefghF", objects.get( 5 ).getUid() );
}
@Test
@@ -504,9 +472,9 @@
conjunction.add( Restrictions.eq( "id", "deabcdefghF" ) );
query.add( conjunction );
- Result result = queryService.query( query );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
- assertEquals( 0, result.size() );
+ assertEquals( 0, objects.size() );
}
@Test
@@ -520,12 +488,12 @@
disjunction.add( Restrictions.eq( "id", "deabcdefghF" ) );
query.add( disjunction );
- Result result = queryService.query( query );
-
- assertEquals( 2, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghD" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghF" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 2, objects.size() );
+
+ assertTrue( collectionContainsUid( objects, "deabcdefghD" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghF" ) );
}
@Test
@@ -537,13 +505,13 @@
query.add( Restrictions.ge( "created", Year.parseYear( "2002" ).getStart() ) );
query.add( Restrictions.le( "created", Year.parseYear( "2004" ).getStart() ) );
- Result result = queryService.query( query );
-
- assertEquals( 3, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghB" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghC" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghD" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 3, objects.size() );
+
+ assertTrue( collectionContainsUid( objects, "deabcdefghB" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghC" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghD" ) );
}
@Test
@@ -557,13 +525,13 @@
conjunction.add( Restrictions.le( "created", Year.parseYear( "2004" ).getStart() ) );
query.add( conjunction );
- Result result = queryService.query( query );
-
- assertEquals( 3, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghB" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghC" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghD" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 3, objects.size() );
+
+ assertTrue( collectionContainsUid( objects, "deabcdefghB" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghC" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghD" ) );
}
@Test
@@ -573,16 +541,16 @@
Query query = Query.from( schemaService.getDynamicSchema( DataElement.class ) );
query.add( Restrictions.isNull( "categoryCombo" ) );
- Result result = queryService.query( query );
-
- assertEquals( 6, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghA" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghB" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghC" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghD" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghE" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghF" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 6, objects.size() );
+
+ assertTrue( collectionContainsUid( objects, "deabcdefghA" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghB" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghC" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghD" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghE" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghF" ) );
}
@Test
@@ -590,15 +558,15 @@
{
createDataElements();
Query query = queryService.getQueryFromUrl( DataElement.class, Lists.newArrayList( "categoryCombo:null" ), Lists.<Order>newArrayList() );
- Result result = queryService.query( query );
-
- assertEquals( 6, result.size() );
-
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghA" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghB" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghC" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghD" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghE" ) );
- assertTrue( collectionContainsUid( result.getItems(), "deabcdefghF" ) );
+ List<? extends IdentifiableObject> objects = queryService.query( query );
+
+ assertEquals( 6, objects.size() );
+
+ assertTrue( collectionContainsUid( objects, "deabcdefghA" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghB" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghC" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghD" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghE" ) );
+ assertTrue( collectionContainsUid( objects, "deabcdefghF" ) );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2015-11-01 13:27:57 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AbstractCrudController.java 2015-11-04 03:03:17 +0000
@@ -888,11 +888,11 @@
query.setFirstResult( pager.getOffset() );
query.setMaxResults( pager.getPageSize() );
- entityList = (List<T>) queryService.query( query ).getItems();
+ entityList = (List<T>) queryService.query( query );
}
else
{
- entityList = (List<T>) queryService.query( query ).getItems();
+ entityList = (List<T>) queryService.query( query );
}
return entityList;
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramController.java 2015-09-24 08:32:10 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramController.java 2015-11-04 03:03:17 +0000
@@ -101,11 +101,11 @@
query.setFirstResult( pager.getOffset() );
query.setMaxResults( pager.getPageSize() );
- entityList = (List<Program>) queryService.query( query ).getItems();
+ entityList = (List<Program>) queryService.query( query );
}
else
{
- entityList = (List<Program>) queryService.query( query ).getItems();
+ entityList = (List<Program>) queryService.query( query );
}
if ( userFilter )
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramStageController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramStageController.java 2015-07-03 04:08:33 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/event/ProgramStageController.java 2015-11-04 03:03:17 +0000
@@ -94,11 +94,11 @@
query.setFirstResult( pager.getOffset() );
query.setMaxResults( pager.getPageSize() );
- entityList = (List<ProgramStage>) queryService.query( query ).getItems();
+ entityList = (List<ProgramStage>) queryService.query( query );
}
else
{
- entityList = (List<ProgramStage>) queryService.query( query ).getItems();
+ entityList = (List<ProgramStage>) queryService.query( query );
}
return entityList;
=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java 2015-10-26 00:15:36 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/organisationunit/OrganisationUnitController.java 2015-11-04 03:03:17 +0000
@@ -134,11 +134,11 @@
query.setFirstResult( pager.getOffset() );
query.setMaxResults( pager.getPageSize() );
- entityList = (List<OrganisationUnit>) queryService.query( query ).getItems();
+ entityList = (List<OrganisationUnit>) queryService.query( query );
}
else
{
- entityList = (List<OrganisationUnit>) queryService.query( query ).getItems();
+ entityList = (List<OrganisationUnit>) queryService.query( query );
}
return entityList;