← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2242: Added method needed by mobile code (needs to be verified)

 

------------------------------------------------------------
revno: 2242
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-09-27 12:42:46 +0530
message:
  Added method needed by mobile code (needs to be verified)
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.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/user/UserStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserStore.java	2010-09-23 16:02:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserStore.java	2010-09-27 07:12:46 +0000
@@ -89,6 +89,14 @@
     Collection<User> getUsersWithoutOrganisationUnit();
 
     /**
+     * Returns a Collection of Users which are having given Phone number.
+     * 
+     * @param phoneNumber
+     * @return a Collection of Users.
+     */
+    Collection<User> getUsersByPhoneNumber( String phoneNumber );
+
+    /**
      * Deletes a User.
      * 
      * @param user the User to delete.

=== 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	2010-09-23 16:02:44 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/user/hibernate/HibernateUserStore.java	2010-09-27 07:12:46 +0000
@@ -161,6 +161,18 @@
         return users;
     }
 
+    @SuppressWarnings("unchecked")
+    public Collection<User> getUsersByPhoneNumber( String phoneNumber )
+    {
+        String hql = "from User u where u.phoneNumber = :phoneNumber";
+        
+        Query query = sessionFactory.getCurrentSession().createQuery( hql );
+        query.setString( "phoneNumber", phoneNumber );
+        
+        return query.list();
+    }
+    
+
     public void deleteUser( User user )
     {
         Session session = sessionFactory.getCurrentSession();