Revision: 4115
Author:   solomax666
Date:     Sat Aug 27 06:20:51 2011
Log:      - Adding users on Organisation page is fixed
http://code.google.com/p/openmeetings/source/detail?r=4115

Modified:
/branches/dev/injection/src/app/org/openmeetings/app/data/user/Organisationmanagement.java /branches/dev/injection/src/app/org/openmeetings/app/data/user/Usermanagement.java /branches/dev/injection/src/app/org/openmeetings/app/remote/UserService.java

=======================================
--- /branches/dev/injection/src/app/org/openmeetings/app/data/user/Organisationmanagement.java Sat Aug 27 03:44:23 2011 +++ /branches/dev/injection/src/app/org/openmeetings/app/data/user/Organisationmanagement.java Sat Aug 27 06:20:51 2011
@@ -555,23 +555,6 @@
                }
                return null;
        }
-
-       @SuppressWarnings("unused")
-       private boolean checkUserContainsOrganisation(long users_id,
-                       long organisation_id) {
-               try {
-                       Users us = usersDao.getUser(users_id);
-                       for (@SuppressWarnings("rawtypes")
-                       Iterator it = us.getOrganisation_users().iterator(); 
it.hasNext();) {
-                               Organisation_Users orguser = 
(Organisation_Users) it.next();
-                               if 
(orguser.getOrganisation().getOrganisation_id() == organisation_id)
-                                       return true;
-                       }
-               } catch (Exception ex2) {
-                       log.error("[checkUserContainsOrganisation]", ex2);
-               }
-               return false;
-       }

        public SearchResult getUsersSearchResultByOrganisationId(
                        long organisation_id, int start, int max, String 
orderby,
@@ -580,9 +563,8 @@

                        SearchResult sResult = new SearchResult();
                        sResult.setObjectName(Users.class.getName());
-                       sResult.setRecords(this
-                                       
.selectMaxUsersByOrganisationId(organisation_id));
-                       
sResult.setResult(this.getUsersByOrganisationId(organisation_id,
+                       
sResult.setRecords(selectMaxUsersByOrganisationId(organisation_id));
+                       
sResult.setResult(getUsersByOrganisationId(organisation_id,
                                        start, max, orderby, asc));
                        return sResult;

@@ -620,14 +602,17 @@
         * @param asc
         * @return
         */
-       @SuppressWarnings("rawtypes")
-       public List getUsersByOrganisationId(long organisation_id, int start,
+ public List<Users> getUsersByOrganisationId(long organisation_id, int start,
                        int max, String orderby, boolean asc) {
                try {
-                       // get all users
-                       String hql = "select c from Organisation_Users c "
-                                       + "where c.deleted = 'false' "
-                                       + "AND c.organisation.organisation_id = 
:organisation_id ";
+                       String hql =
+                               "SELECT c FROM Users c "
+                               + "WHERE c.deleted = 'false' "
+                               + "AND c.user_id IN ("
+                               + "        SELECT ou.user_id FROM Organisation_Users 
ou "
+                               + " WHERE ou.deleted = 'false' "
+                               + "                AND 
ou.organisation.organisation_id = :organisation_id "
+                               + ")";
                        if (orderby.startsWith("c.")) {
                                hql += "ORDER BY " + orderby;
                        } else {
@@ -643,23 +628,9 @@
                        q.setParameter("organisation_id", organisation_id);
                        q.setFirstResult(start);
                        q.setMaxResults(max);
-                       @SuppressWarnings("unchecked")
-                       List<Organisation_Users> userOrg = q.getResultList();
-                       List<Users> userL = new LinkedList<Users>();
-                       for (Iterator<Organisation_Users> it = 
userOrg.iterator(); it
-                                       .hasNext();) {
-                               Organisation_Users us = it.next();
-
-                               // Only add this single Organization add this 
point cause
-                               // cause all the other are not needed at this 
point
-                               Users user = usersDao.getUser(us.getUser_id());
-
-                               user.setOrganisation_users(new 
LinkedList<Organisation_Users>());
-                               user.getOrganisation_users().add(us);
-
-                               userL.add(user);
-                       }
-                       // Collections.sort(userL,new 
UsersFirstnameComperator());
+
+                       @SuppressWarnings("unchecked")
+                       List<Users> userL = q.getResultList();
                        return userL;
                } catch (Exception ex2) {
                        log.error("[getUsersByOrganisationId]", ex2);
=======================================
--- /branches/dev/injection/src/app/org/openmeetings/app/data/user/Usermanagement.java Sat Aug 27 03:27:19 2011 +++ /branches/dev/injection/src/app/org/openmeetings/app/data/user/Usermanagement.java Sat Aug 27 06:20:51 2011
@@ -225,8 +225,7 @@
                return null;
        }

-       @SuppressWarnings("rawtypes")
-       public List getUserByMod(Long user_level, long user_id) {
+       public List<Users> getUserByMod(Long user_level, long user_id) {
                return null;
        }

=======================================
--- /branches/dev/injection/src/app/org/openmeetings/app/remote/UserService.java Tue Aug 23 12:37:01 2011 +++ /branches/dev/injection/src/app/org/openmeetings/app/remote/UserService.java Sat Aug 27 06:20:51 2011
@@ -25,11 +25,13 @@
 import org.openmeetings.app.data.user.dao.UserContactsDaoImpl;
 import org.openmeetings.app.data.user.dao.UsersDaoImpl;
 import org.openmeetings.app.persistence.beans.adresses.Adresses;
+import org.openmeetings.app.persistence.beans.domain.Organisation;
 import org.openmeetings.app.persistence.beans.lang.Fieldlanguagesvalues;
 import org.openmeetings.app.persistence.beans.recording.RoomClient;
 import org.openmeetings.app.persistence.beans.rooms.Rooms;
 import org.openmeetings.app.persistence.beans.user.PrivateMessageFolder;
 import org.openmeetings.app.persistence.beans.user.PrivateMessages;
+import org.openmeetings.app.persistence.beans.user.Salutations;
 import org.openmeetings.app.persistence.beans.user.UserContacts;
 import org.openmeetings.app.persistence.beans.user.Users;
 import org.openmeetings.app.remote.red5.ClientListManager;
@@ -163,7 +165,7 @@
         * @param SID
         * @return
         */
-       public List getUserSalutations(String SID, long language_id) {
+ public List<Salutations> getUserSalutations(String SID, long language_id) {
                return salutationmanagement.getUserSalutations(language_id);
        }

@@ -180,7 +182,7 @@
         * @param asc
         * @return
         */
-       public List searchUser(String SID, String searchcriteria,
+       public List<Users> searchUser(String SID, String searchcriteria,
                        String searchstring, int max, int start, String 
orderby, boolean asc) {
                Long users_id = sessionManagement.checkSession(SID);
                Long user_level = userManagement.getUserLevelByID(users_id);
@@ -199,15 +201,13 @@
         * @param asc
         * @return
         */
-       public List getOrgUserList(String SID, long organisation_id, int start,
+ public List<Users> getOrgUserList(String SID, long organisation_id, int start,
                        int max, String orderby, boolean asc) {
-               Long users_id = sessionManagement.checkSession(SID);
-               Long user_level = userManagement.getUserLevelByID(users_id);
                return 
organisationmanagement.getUsersByOrganisationId(organisation_id,
                                start, max, orderby, asc);
        }

-       public List getUserListByModForm(String SID) {
+       public List<Users> getUserListByModForm(String SID) {
                Long users_id = sessionManagement.checkSession(SID);
                Long user_level = userManagement.getUserLevelByID(users_id);
                return userManagement.getUserByMod(user_level, users_id);
@@ -224,7 +224,7 @@
         * @param asc
         * @return
         */
-       public List getOrganisationListByUser(String SID, long client_user,
+ public List<Organisation> getOrganisationListByUser(String SID, long client_user,
                        int start, int max, String orderby, boolean asc) {
                Long users_id = sessionManagement.checkSession(SID);
                long user_level = userManagement.getUserLevelByID(users_id);
@@ -243,7 +243,7 @@
         * @param asc
         * @return
         */
-       public List getRestOrganisationListByUser(String SID, long client_user,
+ public List<Organisation> getRestOrganisationListByUser(String SID, long client_user,
                        int start, int max, String orderby, boolean asc) {
                Long users_id = sessionManagement.checkSession(SID);
                Long user_level = userManagement.getUserLevelByID(users_id);
@@ -288,8 +288,6 @@
         */
        public SearchResult getAllUserBySearchRange(String SID, String search,
                        int start, int max, String orderby, boolean asc) {
-               Long users_id = sessionManagement.checkSession(SID);
-               Long user_level = userManagement.getUserLevelByID(users_id);
                return userManagement.getAllUserByRange(search, start, max, 
orderby,
                                asc);
        }

--
You received this message because you are subscribed to the Google Groups 
"OpenMeetings developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/openmeetings-dev?hl=en.

Reply via email to