Update of 
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms
In directory 
james.mmbase.org:/tmp/cvs-serv5380/community/src/java/com/finalist/cmsc/community/forms

Modified Files:
        PersonForShow.java SearchConditionalUserAction.java 
Log Message:
CMSC-996 code improve.


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms
See also: http://www.mmbase.org/jira/browse/CMSC-996


Index: PersonForShow.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/PersonForShow.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- PersonForShow.java  27 Jul 2008 07:46:37 -0000      1.1
+++ PersonForShow.java  30 Jul 2008 09:52:38 -0000      1.2
@@ -10,6 +10,7 @@
        private String email;
        private String groups;
        private Long authId;
+   private boolean inGroup;
 
        public String getFullname() {
                return fullname;
@@ -52,4 +53,11 @@
        }
 
        
+   public boolean isInGroup() {
+      return inGroup;
+   }
+
+   public void setInGroup(boolean inGroup) {
+      this.inGroup = inGroup;
+   }
 }


Index: SearchConditionalUserAction.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/community/forms/SearchConditionalUserAction.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- SearchConditionalUserAction.java    30 Jul 2008 05:15:30 -0000      1.6
+++ SearchConditionalUserAction.java    30 Jul 2008 09:52:38 -0000      1.7
@@ -29,6 +29,8 @@
 
        public ActionForward execute(ActionMapping actionMapping, ActionForm 
actionForm, HttpServletRequest request, HttpServletResponse response)
                        throws Exception {
+      PagingUtils.initStatusHolder(request);
+      PagingStatusHolder holder = PagingUtils.getStatusHolder();
 
                String groupName = request.getParameter("groupName");
                SearchForm searchform = (SearchForm) actionForm;
@@ -52,17 +54,21 @@
                        map.put("group", groupName);
                        map.put("strict", "strict");
                }
-           PagingUtils.initStatusHolder(request);
-           PagingStatusHolder holder = PagingUtils.getStatusHolder();
+
+
+
                List<Person> persons;
                int totalCount = 0;
                if (map.size() > 0) {
-                       persons = getPersonService().getAssociatedPersons(map, 
holder);
+         persons = getPersonService().getAssociatedPersons(map);
                        totalCount = 
getPersonService().getAssociatedPersonsNum(map, holder);
-               } else {
+      }
+      else {
                        persons = getPersonService().getAllPeople(holder);
                        totalCount = getPersonService().countAllPersons();
                }
+
+
                request.setAttribute("personForShow", convertToVO(persons));
                request.setAttribute("totalCount", totalCount);
                request.setAttribute("newsletterId", 
request.getParameter("newsletterId"));
@@ -80,12 +86,15 @@
                List<PersonForShow> perShow;
                perShow = new ArrayList<PersonForShow>();
                for (Person p : persons) {
+         String username = 
getAuthenticationService().getAuthenticationById(p.getAuthenticationId()).getUserId();
+
                        PersonForShow per = new PersonForShow();
-                       per.setFullname("" + p.getFirstName() + " " + 
p.getLastName());
+         per.setFullname(p.getFullName());
                        per.setEmail(p.getEmail());
-                       
per.setUsername(getAuthenticationService().getAuthenticationById(p.getAuthenticationId()).getUserId());
+         per.setUsername(username);
+
                        String groupsName = "";
-         Set<String> authorityNames = 
getAuthorityService().getAuthorityNamesForUser(getAuthenticationService().getAuthenticationById(p.getAuthenticationId()).getUserId());
+         Set<String> authorityNames = 
getAuthorityService().getAuthorityNamesForUser(username);
                        if (authorityNames.size() >= 1) {
                                Iterator iter = authorityNames.iterator();
                                while (iter.hasNext()) {
@@ -93,7 +102,8 @@
                                }
                                groupsName = groupsName.substring(0, 
groupsName.length() - 2);
                                per.setGroups(groupsName);
-                       } else {
+         }
+         else {
                                per.setGroups("");
                        }
                        per.setAuthId(p.getAuthenticationId());
_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to