dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20909
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9761: Made stores return list and not collection
------------------------------------------------------------
revno: 9761
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-02-07 15:40:18 +0700
message:
Made stores return list and not collection
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericNameableObjectStore.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLockExceptionStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java
dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.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/GenericIdentifiableObjectStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java 2013-02-04 14:57:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericIdentifiableObjectStore.java 2013-02-07 08:40:18 +0000
@@ -64,34 +64,34 @@
T getByCode( String code );
/**
- * Retrieves a Collection of all objects (sorted on name).
+ * Retrieves a List of all objects (sorted on name).
*
- * @return a Collection of all objects.
+ * @return a List of all objects.
*/
- Collection<T> getAllOrderedName();
+ List<T> getAllOrderedName();
/**
* Retrieves the objects determined by the given first result and max result.
*
* @param first the first result object to return.
* @param max the max number of result objects to return.
- * @return collection of objects.
+ * @return list of objects.
*/
- Collection<T> getAllOrderedName( int first, int max );
+ List<T> getAllOrderedName( int first, int max );
/**
- * Retrieves a Collection of objects where the name is equal the given name.
+ * Retrieves a List of objects where the name is equal the given name.
*
* @param name the name.
- * @return a Collection of objects.
+ * @return a List of objects.
*/
List<T> getAllEqName( String name );
/**
- * Retrieves a Collection of objects where the name is equal the given name (ignore case).
+ * Retrieves a List of objects where the name is equal the given name (ignore case).
*
* @param name the name.
- * @return a Collection of objects.
+ * @return a List of objects.
*/
List<T> getAllEqNameIgnoreCase( String name );
@@ -107,12 +107,12 @@
int getCountEqNameNoAcl( String name );
/**
- * Retrieves a Collection of objects where the name is like the given name.
+ * Retrieves a List of objects where the name is like the given name.
*
* @param name the name.
- * @return a Collection of objects.
+ * @return a List of objects.
*/
- Collection<T> getAllLikeName( String name );
+ List<T> getAllLikeName( String name );
/**
* Retrieves the objects determined by the given first result and max result.
@@ -120,7 +120,7 @@
*
* @param first the first result object to return.
* @param max the max number of result objects to return.
- * @return collection of objects.
+ * @return List of objects.
*/
List<T> getAllOrderedLastUpdated( int first, int max );
@@ -131,9 +131,9 @@
* @param name the name which result object names must be like.
* @param first the first result object to return.
* @param max the max number of result objects to return.
- * @return collection of objects.
+ * @return List of objects.
*/
- Collection<T> getAllLikeNameOrderedName( String name, int first, int max );
+ List<T> getAllLikeNameOrderedName( String name, int first, int max );
/**
* Gets the count of objects which name is like the given name.
@@ -144,9 +144,9 @@
int getCountLikeName( String name );
/**
- * Retrieves a list of objects referenced by the given collection of uids.
+ * Retrieves a list of objects referenced by the given List of uids.
*
- * @param uids a collection of uids.
+ * @param uids a List of uids.
* @return a list of objects.
*/
List<T> getByUid( Collection<String> uids );
@@ -190,7 +190,7 @@
* @param user the user.
* @return list of objects.
*/
- Collection<T> getByUser( User user );
+ List<T> getByUser( User user );
/**
* Retrieves objects which are accessible to the given user, which includes
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericNameableObjectStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericNameableObjectStore.java 2013-02-04 14:57:16 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericNameableObjectStore.java 2013-02-07 08:40:18 +0000
@@ -27,7 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import java.util.Collection;
import java.util.List;
/**
@@ -57,18 +56,18 @@
int getCountEqShortNameNoAcl( String shortName );
/**
- * Retrieves a Collection of objects where the name is like the given name.
+ * Retrieves a List of objects where the name is like the given name.
*
* @param shortName the name.
- * @return a Collection of objects.
+ * @return a List of objects.
*/
List<T> getAllEqShortName( String shortName );
/**
- * Retrieves a Collection of objects where the name is like the given name (ignore case).
+ * Retrieves a List of objects where the name is like the given name (ignore case).
*
* @param shortName the name.
- * @return a Collection of objects.
+ * @return a List of objects.
*/
List<T> getAllEqShortNameIgnoreCase( String shortName );
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericStore.java 2013-01-16 13:50:06 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/GenericStore.java 2013-02-07 08:40:18 +0000
@@ -28,6 +28,7 @@
*/
import java.util.Collection;
+import java.util.List;
/**
* @author Lars Helge Overland
@@ -73,11 +74,11 @@
T load( int id );
/**
- * Retrieves a Collection of all objects.
+ * Retrieves a List of all objects.
*
- * @return a Collection of all objects.
+ * @return a List of all objects.
*/
- Collection<T> getAll();
+ List<T> getAll();
/**
* Removes the given object instance.
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLockExceptionStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLockExceptionStore.java 2013-01-14 21:35:56 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/hibernate/HibernateLockExceptionStore.java 2013-02-07 08:40:18 +0000
@@ -45,7 +45,7 @@
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
-import java.util.Collection;
+import java.util.List;
/**
* @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
@@ -93,11 +93,11 @@
}
@Override
- public Collection<LockException> getCombinations()
+ public List<LockException> getCombinations()
{
final String sql = "select distinct datasetid, periodid from lockexception";
- final Collection<LockException> lockExceptions = new ArrayList<LockException>();
+ final List<LockException> lockExceptions = new ArrayList<LockException>();
jdbcTemplate.query( sql, new RowCallbackHandler()
{
@@ -135,7 +135,7 @@
@Override
@SuppressWarnings("unchecked")
- public Collection<LockException> getAllOrderedName( int first, int max )
+ public List<LockException> getAllOrderedName( int first, int max )
{
Criteria criteria = getCriteria();
criteria.setFirstResult( first );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java 2013-01-24 04:15:05 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java 2013-02-07 08:40:18 +0000
@@ -28,10 +28,6 @@
*/
-import java.util.Collection;
-import java.util.Iterator;
-
-
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.criterion.Order;
@@ -41,6 +37,10 @@
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserStore;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
/**
* @author Nguyen Hong Duc
@@ -54,8 +54,8 @@
// -------------------------------------------------------------------------
@Override
- @SuppressWarnings( "unchecked" )
- public Collection<User> getAllOrderedName( int first, int max )
+ @SuppressWarnings("unchecked")
+ public List<User> getAllOrderedName( int first, int max )
{
Criteria criteria = getCriteria();
criteria.addOrder( Order.asc( "surname" ) ).addOrder( Order.asc( "firstName" ) );
@@ -65,8 +65,8 @@
}
@Override
- @SuppressWarnings( "unchecked" )
- public Collection<User> getAllLikeNameOrderedName( String name, int first, int max )
+ @SuppressWarnings("unchecked")
+ public List<User> getAllLikeNameOrderedName( String name, int first, int max )
{
Criteria criteria = getCriteria();
criteria.add( Restrictions.or( Restrictions.ilike( "surname", "%" + name + "%" ),
@@ -77,9 +77,9 @@
return criteria.list();
}
- public Collection<User> getUsersWithoutOrganisationUnit()
+ public List<User> getUsersWithoutOrganisationUnit()
{
- Collection<User> users = getAll();
+ List<User> users = getAll();
Iterator<User> iterator = users.iterator();
@@ -94,8 +94,8 @@
return users;
}
- @SuppressWarnings( "unchecked" )
- public Collection<User> getUsersByPhoneNumber( String phoneNumber )
+ @SuppressWarnings("unchecked")
+ public List<User> getUsersByPhoneNumber( String phoneNumber )
{
String hql = "from User u where u.phoneNumber = :phoneNumber";
@@ -105,8 +105,8 @@
return query.list();
}
- @SuppressWarnings( "unchecked" )
- public Collection<User> getUsersByOrganisationUnits( Collection<OrganisationUnit> orgunits )
+ @SuppressWarnings("unchecked")
+ public List<User> getUsersByOrganisationUnits( Collection<OrganisationUnit> orgunits )
{
String hql = "select distinct u from User u join u.organisationUnits o where o.id in (:ids)";
@@ -121,15 +121,14 @@
}
@Override
- @SuppressWarnings( "unchecked" )
- public Collection<User> getUsersByName( String name )
+ @SuppressWarnings("unchecked")
+ public List<User> getUsersByName( String name )
{
Criteria criteria = getCriteria();
criteria.add( Restrictions.or( Restrictions.ilike( "surname", "%" + name + "%" ),
Restrictions.ilike( "firstName", "%" + name + "%" ) ) );
criteria.addOrder( Order.asc( "surname" ) ).addOrder( Order.asc( "firstName" ) );
-
- return criteria.list();
+
+ return criteria.list();
}
-
}
=== modified file 'dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java'
--- dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2013-02-04 14:57:16 +0000
+++ dhis-2/dhis-support/dhis-support-hibernate/src/main/java/org/hisp/dhis/hibernate/HibernateGenericStore.java 2013-02-07 08:40:18 +0000
@@ -366,7 +366,7 @@
@Override
@SuppressWarnings("unchecked")
- public final Collection<T> getAll()
+ public final List<T> getAll()
{
Query query = sharingEnabled() ? getQueryAllACL() : getQueryAll();
@@ -516,8 +516,8 @@
}
@Override
- @SuppressWarnings( "unchecked" )
- public Collection<T> getAllLikeName( String name )
+ @SuppressWarnings("unchecked")
+ public List<T> getAllLikeName( String name )
{
Query query = sharingEnabled() ? getQueryAllLikeNameACL( name ) : getQueryAllLikeName( name );
@@ -549,7 +549,7 @@
@Override
@SuppressWarnings("unchecked")
- public final Collection<T> getAllOrderedName()
+ public final List<T> getAllOrderedName()
{
Query query = sharingEnabled() ? getQueryAllOrderedNameACL() : getQueryAllOrderedName();
@@ -577,7 +577,7 @@
@Override
@SuppressWarnings("unchecked")
- public Collection<T> getAllOrderedName( int first, int max )
+ public List<T> getAllOrderedName( int first, int max )
{
Query query = sharingEnabled() ? getQueryAllOrderedNameACL() : getQueryAllOrderedName();
@@ -620,7 +620,7 @@
@Override
@SuppressWarnings("unchecked")
- public Collection<T> getAllLikeNameOrderedName( String name, int first, int max )
+ public List<T> getAllLikeNameOrderedName( String name, int first, int max )
{
Query query = sharingEnabled() ? getQueryAllLikeNameOrderedNameACL( name ) : getQueryAllLikeNameOrderedName( name );
@@ -839,7 +839,7 @@
@Override
@SuppressWarnings("unchecked")
- public Collection<T> getByUser( User user )
+ public List<T> getByUser( User user )
{
Query query = getQuery( "from " + clazz.getName() + " c where user = :user" );
query.setEntity( "user", user );