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

Modified Files:
        Authentication.java AuthenticationHibernateService.java 
        AuthenticationService.java Authority.java 
        AuthorityHibernateService.java AuthorityService.java 
        Permission.java PermissionService.java 
        UserDetailsHibernateService.java UserNotFoundException.java 
Log Message:
CMSC-899,Check and improve all lists according to guideline,delete tab character


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


Index: Authentication.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/security/Authentication.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- Authentication.java 22 Sep 2008 07:25:30 -0000      1.6
+++ Authentication.java 23 Sep 2008 07:12:57 -0000      1.7
@@ -1,12 +1,11 @@
 /*
-
-This software is OSI Certified Open Source Software.
-OSI Certified is a certification mark of the Open Source Initiative.
-
-The license (Mozilla version 1.0) can be read at the MMBase site.
-See http://www.MMBase.org/license
-
-*/
+ * 
+ * This software is OSI Certified Open Source Software. OSI Certified is a 
certification mark of the Open Source
+ * Initiative.
+ * 
+ * The license (Mozilla version 1.0) can be read at the MMBase site. See 
http://www.MMBase.org/license
+ * 
+ */
 package com.finalist.cmsc.services.community.security;
 
 import java.io.Serializable;
@@ -32,14 +31,16 @@
 
     private static final long serialVersionUID = 1L;
     
-    /** Authentication id
+   /**
+    * Authentication id
      *
      */
     @Id
     @GeneratedValue
     private Long id;
     
-    /** account used for login
+   /**
+    * account used for login
      * 
      */
     @Column(unique = true)
@@ -50,16 +51,13 @@
     private boolean enabled;
     
     @ManyToMany
-    @JoinTable(
-        name = "authentication_authorities",
-        joinColumns = [EMAIL PROTECTED](name = "authentication_id")},
-        inverseJoinColumns = [EMAIL PROTECTED](name = "authority_id")}
-    )
-    private Set<Authority> authorities = new HashSet<Authority>();
+   @JoinTable(name = "authentication_authorities", joinColumns = { 
@JoinColumn(name = "authentication_id") }, inverseJoinColumns = { 
@JoinColumn(name = "authority_id") })
+   private Set < Authority > authorities = new HashSet < Authority >();
     
     public Long getId() {
         return id;
     }
+
     public void setId(Long id) {
         this.id = id;
     }
@@ -67,6 +65,7 @@
     public String getUserId() {
         return userId;
     }
+
     public void setUserId(String userId) {
         this.userId = userId;
     }
@@ -74,6 +73,7 @@
     public String getPassword() {
         return password;
     }
+
     public void setPassword(String password) {
         this.password = password;
     }
@@ -81,58 +81,53 @@
     public boolean isEnabled() {
         return enabled;
     }
+
     public void setEnabled(boolean enabled) {
         this.enabled = enabled;
     }
     
-    public Set<Authority> getAuthorities() { 
+   public Set < Authority > getAuthorities() {
         return authorities; 
     }
+
     public void addAuthority(Authority authority) {
         if (authority == null) throw new IllegalArgumentException("Null 
authority!");
         authorities.add(authority);
         authority.getAuthentications().add(this);
     }
+
     public void removeAuthority(Authority authority) {
         if (authority == null) throw new IllegalArgumentException("Null 
authority!");
         authorities.remove(authority);
         authority.getAuthentications().remove(this);
     }
+
        @Override
        public int hashCode() {
                final int prime = 31;
                int result = 1;
-               result = prime * result
-                               + ((password == null) ? 0 : 
password.hashCode());
-               result = prime * result
-                               + ((userId == null) ? 0 : userId.hashCode());
+      result = prime * result + ((password == null) ? 0 : password.hashCode());
+      result = prime * result + ((userId == null) ? 0 : userId.hashCode());
                return result;
        }
+
        @Override
        public boolean equals(Object obj) {
-               if (this == obj)
-                       return true;
-               if (obj == null)
-                       return false;
-               if (getClass() != obj.getClass())
-                       return false;
+      if (this == obj) return true;
+      if (obj == null) return false;
+      if (getClass() != obj.getClass()) return false;
                final Authentication other = (Authentication) obj;
                if (password == null) {
-                       if (other.password != null)
-                               return false;
-               } else if (!password.equals(other.password))
-                       return false;
+         if (other.password != null) return false;
+      } else if (!password.equals(other.password)) return false;
                if (userId == null) {
-                       if (other.userId != null)
-                               return false;
-               } else if (!userId.equals(other.userId))
-                       return false;
+         if (other.userId != null) return false;
+      } else if (!userId.equals(other.userId)) return false;
                return true;
        }
        
-       public void setAuthorities(Set<Authority> authorities) {
+   public void setAuthorities(Set < Authority > authorities) {
                this.authorities = authorities;
        }
     
-    
 }


Index: AuthenticationHibernateService.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/security/AuthenticationHibernateService.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- AuthenticationHibernateService.java 4 Aug 2008 06:55:57 -0000       1.12
+++ AuthenticationHibernateService.java 23 Sep 2008 07:12:57 -0000      1.13
@@ -1,11 +1,10 @@
 /*
-
- This software is OSI Certified Open Source Software.
- OSI Certified is a certification mark of the Open Source Initiative.
-
- The license (Mozilla version 1.0) can be read at the MMBase site.
- See http://www.MMBase.org/license
-
+ * 
+ * This software is OSI Certified Open Source Software. OSI Certified is a 
certification mark of the Open Source
+ * Initiative.
+ * 
+ * The license (Mozilla version 1.0) can be read at the MMBase site. See 
http://www.MMBase.org/license
+ * 
  */
 package com.finalist.cmsc.services.community.security;
 
@@ -102,11 +101,12 @@
                authentication.addAuthority(authority);
                getSession().flush();
        }
-       //addAuthorityToUserByAuthenticationId is just makeup 
addAuthorityToUser fuction
+
+   // addAuthorityToUserByAuthenticationId is just makeup addAuthorityToUser 
fuction
        @Transactional
        public void addAuthorityToUserByAuthenticationId(String 
AuthenticationId, String authorityName) {
-               //Long Authenticationid=Long.getLong(AuthenticationId);
-               Long Authenticationid=Long.parseLong(AuthenticationId);
+      // Long Authenticationid=Long.getLong(AuthenticationId);
+      Long Authenticationid = Long.parseLong(AuthenticationId);
                Authentication authentication = 
getAuthenticationById(Authenticationid);
                Authority authority = 
authorityService.findAuthorityByName(authorityName);
                authentication.addAuthority(authority);
@@ -163,21 +163,22 @@
 
        /** [EMAIL PROTECTED] */
        @Transactional(readOnly = true)
-       public List<Authentication> findAuthentications() {
+   public List < Authentication > findAuthentications() {
                Criteria criteria = 
getSession().createCriteria(Authentication.class);
                return findAuthenticationListByCriteria(criteria);
        }
 
        /** [EMAIL PROTECTED] */
        @Transactional(readOnly = true)
-       public List<Authentication> findAuthenticationsForAuthority(String 
name) {
-               Criteria criteria = 
getSession().createCriteria(Authentication.class).createCriteria("authorities").add(Restrictions.eq("name",
 name));
+   public List < Authentication > findAuthenticationsForAuthority(String name) 
{
+      Criteria criteria = 
getSession().createCriteria(Authentication.class).createCriteria("authorities").add(
+            Restrictions.eq("name", name));
                return findAuthenticationListByCriteria(criteria);
        }
 
        @SuppressWarnings("unchecked")
-       private List<Authentication> findAuthenticationListByCriteria(Criteria 
criteria) {
-               List<Authentication> result = new ArrayList<Authentication>();
+   private List < Authentication > findAuthenticationListByCriteria(Criteria 
criteria) {
+      List < Authentication > result = new ArrayList < Authentication >();
                List authenticationList = criteria.list();
                for (Iterator iter = authenticationList.iterator(); 
iter.hasNext();) {
                        Authentication authentication = (Authentication) 
iter.next();
@@ -201,9 +202,10 @@
        public Authentication createAuthentication(Authentication 
authentication) {
                return createAuthentication(authentication.getUserId(), 
authentication.getPassword());
        }
+
    @Transactional
        public void removeAuthenticationFromAuthority(String authId, String 
groupName) {
-               Long id=Long.decode(authId);
+      Long id = Long.decode(authId);
                Authentication authentication = getAuthenticationById(id);
            Authority authority = 
authorityService.findAuthorityByName(groupName);
            authentication.removeAuthority(authority);


Index: AuthenticationService.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/security/AuthenticationService.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- AuthenticationService.java  4 Aug 2008 06:55:57 -0000       1.10
+++ AuthenticationService.java  23 Sep 2008 07:12:57 -0000      1.11
@@ -1,11 +1,10 @@
 /*
-
-This software is OSI Certified Open Source Software.
-OSI Certified is a certification mark of the Open Source Initiative.
-
-The license (Mozilla version 1.0) can be read at the MMBase site.
-See http://www.MMBase.org/license
-
+ * 
+ * This software is OSI Certified Open Source Software. OSI Certified is a 
certification mark of the Open Source
+ * Initiative.
+ * 
+ * The license (Mozilla version 1.0) can be read at the MMBase site. See 
http://www.MMBase.org/license
+ * 
  */
 package com.finalist.cmsc.services.community.security;
 
@@ -25,8 +24,7 @@
        Authentication createAuthentication(String userId, String password);
 
        /**
-        * Update the login information for the authentication (typically 
called by
-        * the user)
+    * Update the login information for the authentication (typically called by 
the user)
         * 
         * @param userId
         * @param oldPassword
@@ -35,8 +33,7 @@
        void updateAuthentication(String userId, String oldPassword, String 
newPassword);
 
        /**
-        * Set the login information for an authentication (typically called by 
an
-        * admin user)
+    * Set the login information for an authentication (typically called by an 
admin user)
         * 
         * @param userId
         * @param newPassword
@@ -44,9 +41,8 @@
        void updateAuthenticationPassword(String userId, String newPassword);
 
        /**
-        * Delete an authentication entry 
-        * TODO if a authentication is deleted, what should happen with the 
user's 
-        * content (in other systems)?
+    * Delete an authentication entry TODO if a authentication is deleted, what 
should happen with the user's content (in
+    * other systems)?
         * 
         * @param id
         */
@@ -114,14 +110,14 @@
         * @param authority
         * @return list authentications
         */
-       List<Authentication> findAuthenticationsForAuthority(String name);
+   List < Authentication > findAuthenticationsForAuthority(String name);
 
        /**
         * Finds all authentications
         * 
         * @return list authentications
         */
-       List<Authentication> findAuthentications();
+   List < Authentication > findAuthentications();
 
        /**
         * Finds an authentication id for this userId
@@ -140,6 +136,7 @@
        Authentication getAuthenticationById(Long authenticationId);
 
        public Authentication createAuthentication(Authentication 
authentication);
+
     public void removeAuthenticationFromAuthority(String authId, String 
groupName);
 
     public void addAuthorityToUserByAuthenticationId(String authId, String 
groupName);


Index: Authority.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/security/Authority.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- Authority.java      22 Sep 2008 07:27:15 -0000      1.4
+++ Authority.java      23 Sep 2008 07:12:57 -0000      1.5
@@ -1,12 +1,11 @@
 /*
-
-This software is OSI Certified Open Source Software.
-OSI Certified is a certification mark of the Open Source Initiative.
-
-The license (Mozilla version 1.0) can be read at the MMBase site.
-See http://www.MMBase.org/license
-
-*/
+ * 
+ * This software is OSI Certified Open Source Software. OSI Certified is a 
certification mark of the Open Source
+ * Initiative.
+ * 
+ * The license (Mozilla version 1.0) can be read at the MMBase site. See 
http://www.MMBase.org/license
+ * 
+ */
 package com.finalist.cmsc.services.community.security;
 
 import java.io.Serializable;
@@ -39,14 +38,15 @@
     private String name;
     
     @ManyToMany(fetch = FetchType.EAGER, mappedBy = "authorities")
-    private Set<Authentication> authentications = new 
HashSet<Authentication>();
+   private Set < Authentication > authentications = new HashSet < 
Authentication >();
     
     @ManyToMany(mappedBy = "authorities")
-    private Set<Permission> permissions = new HashSet<Permission>();
+   private Set < Permission > permissions = new HashSet < Permission >();
 
     public Long getId() {
         return id;
     }
+
     public void setId(Long id) {
         this.id = id;
     }
@@ -54,32 +54,37 @@
     public String getName() {
         return name;
     }
+
     public void setName(String name) {
         this.name = name;
     }
     
-    public Set<Authentication> getAuthentications() {
+   public Set < Authentication > getAuthentications() {
         return authentications;
     }
+
     public void addAuthentication(Authentication authentication) {
         if (authentication == null) throw new IllegalArgumentException("Null 
authentication!");
         authentications.add(authentication);
         authentication.getAuthorities().add(this);
     }
+
     public void removeAuthentication(Authentication authentication) {
         if (authentication == null) throw new IllegalArgumentException("Null 
authentication!");
         authentications.remove(authentication);
         authentication.getAuthorities().remove(this);
     }
     
-    public Set<Permission> getPermissions() {
+   public Set < Permission > getPermissions() {
         return permissions;
     }
+
     public void addPermission(Permission permission) {
         if (permission == null) throw new IllegalArgumentException("Null 
permission!");
         permissions.add(permission);
         permission.getAuthorities().add(this);
     }
+
     public void removPermission(Permission permission) {
         if (permission == null) throw new IllegalArgumentException("Null 
permission!");
         permissions.remove(permission);
@@ -93,22 +98,17 @@
                result = prime * result + ((name == null) ? 0 : 
name.hashCode());
                return result;
        }
+
        @Override
        public boolean equals(Object obj) {
-               if (this == obj)
-                       return true;
-               if (obj == null)
-                       return false;
-               if (getClass() != obj.getClass())
-                       return false;
+      if (this == obj) return true;
+      if (obj == null) return false;
+      if (getClass() != obj.getClass()) return false;
                final Authority other = (Authority) obj;
                if (name == null) {
-                       if (other.name != null)
-                               return false;
-               } else if (!name.equals(other.name))
-                       return false;
+         if (other.name != null) return false;
+      } else if (!name.equals(other.name)) return false;
                return true;
        }
     
-    
 }


Index: AuthorityHibernateService.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/security/AuthorityHibernateService.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- AuthorityHibernateService.java      7 Aug 2008 03:13:19 -0000       1.12
+++ AuthorityHibernateService.java      23 Sep 2008 07:12:57 -0000      1.13
@@ -1,15 +1,13 @@
 /*
-
-This software is OSI Certified Open Source Software.
-OSI Certified is a certification mark of the Open Source Initiative.
-
-The license (Mozilla version 1.0) can be read at the MMBase site.
-See http://www.MMBase.org/license
-
-*/
+ * 
+ * This software is OSI Certified Open Source Software. OSI Certified is a 
certification mark of the Open Source
+ * Initiative.
+ * 
+ * The license (Mozilla version 1.0) can be read at the MMBase site. See 
http://www.MMBase.org/license
+ * 
+ */
 package com.finalist.cmsc.services.community.security;
 
-
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -27,7 +25,6 @@
 import com.finalist.cmsc.paging.PagingStatusHolder;
 import com.finalist.cmsc.services.HibernateService;
 
-
 /**
  * @author Remco Bos
  */
@@ -46,7 +43,7 @@
     @Transactional
        public void deleteAuthority(String name) {
                Authority authority = findAuthorityByName(name);
-               Set<Authentication> set=new HashSet<Authentication>();
+      Set < Authentication > set = new HashSet < Authentication >();
                set.addAll(authority.getAuthentications());
                for (Authentication authentication : 
authority.getAuthentications()) {
                        authentication.getAuthorities().remove(authority);
@@ -66,53 +63,50 @@
     /** [EMAIL PROTECTED] */
     @Transactional(readOnly = true, propagation = Propagation.REQUIRED)
     public Authority findAuthorityByName(String name) {
-        Criteria criteria = getSession()
-                .createCriteria(Authority.class)
-                .add(Restrictions.eq("name", name));
+      Criteria criteria = 
getSession().createCriteria(Authority.class).add(Restrictions.eq("name", name));
         return findAuthorityByCriteria(criteria);
     }
 
        @SuppressWarnings("unchecked")
-       private List<Authority> addConditionToCriteria(PagingStatusHolder 
holder,Criteria criteria){
+   private List < Authority > addConditionToCriteria(PagingStatusHolder 
holder, Criteria criteria) {
        criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
-       
if("group".equalsIgnoreCase(holder.getSort())&&"asc".equalsIgnoreCase(holder.getDir())){
+      if ("group".equalsIgnoreCase(holder.getSort()) && 
"asc".equalsIgnoreCase(holder.getDir())) {
           criteria.addOrder(Order.asc("name"));
-        }else 
if("group".equalsIgnoreCase(holder.getSort())&&"desc".equalsIgnoreCase(holder.getDir())){
+      } else if ("group".equalsIgnoreCase(holder.getSort()) && 
"desc".equalsIgnoreCase(holder.getDir())) {
           criteria.addOrder(Order.desc("name"));
         }
          List list =  criteria.list();
          List newlist = new ArrayList();
-         for(int i = holder.getOffset() ; i < 
holder.getOffset()+holder.getPageSize()&&i<list.size();i++){
+      for (int i = holder.getOffset(); i < holder.getOffset() + 
holder.getPageSize() && i < list.size(); i++) {
                newlist.add(list.get(i));
          }
          return newlist;
     }
+
     @Transactional(readOnly = true)
-    public List<Authority> findAssociatedAuthorityByName(String 
name,PagingStatusHolder holder){
-        Criteria criteria = getSession()
-         .createCriteria(Authority.class).add(Restrictions.like("name", 
"%"+name+"%"));
-       return addConditionToCriteria(holder,criteria); 
+   public List < Authority > findAssociatedAuthorityByName(String name, 
PagingStatusHolder holder) {
+      Criteria criteria = 
getSession().createCriteria(Authority.class).add(Restrictions.like("name", "%" 
+ name + "%"));
+      return addConditionToCriteria(holder, criteria);
     }
+
     /** [EMAIL PROTECTED] */
     @Transactional(readOnly = true)
-    public Set<String> getAuthorityNames() {
+   public Set < String > getAuthorityNames() {
         Criteria criteria = getSession().createCriteria(Authority.class);
         return findAuthorityNamesByCriteria(criteria);
     }
     
     @Transactional(readOnly = true)
-    public List<Authority> getAllAuthorities(PagingStatusHolder holder) {
+   public List < Authority > getAllAuthorities(PagingStatusHolder holder) {
         Criteria criteria = getSession().createCriteria(Authority.class);
-        return addConditionToCriteria(holder,criteria); 
+      return addConditionToCriteria(holder, criteria);
     }
 
     /** [EMAIL PROTECTED] */
     @Transactional(readOnly = true)
-    public Set<String> getAuthorityNamesForUser(String userId) {
-        Criteria criteria = getSession()
-                .createCriteria(Authority.class)
-                .createCriteria("authentications")
-                .add(Restrictions.eq("userId", userId));
+   public Set < String > getAuthorityNamesForUser(String userId) {
+      Criteria criteria = 
getSession().createCriteria(Authority.class).createCriteria("authentications").add(
+            Restrictions.eq("userId", userId));
         return findAuthorityNamesByCriteria(criteria);
     }
 
@@ -123,84 +117,85 @@
     }
 
     @SuppressWarnings("unchecked")
-    private Set<String> findAuthorityNamesByCriteria(Criteria criteria) {
+   private Set < String > findAuthorityNamesByCriteria(Criteria criteria) {
         List authorityList = criteria.list();
-        Set<String> result = new HashSet<String>();
+      Set < String > result = new HashSet < String >();
         for (Iterator iter = authorityList.iterator(); iter.hasNext();) {
             Authority authority = (Authority) iter.next();
             result.add(authority.getName());
         }
         return result;
     }
+
     @SuppressWarnings("unchecked")
-    private Set<Authority> findAuthoritesByCriteria(Criteria criteria) {
+   private Set < Authority > findAuthoritesByCriteria(Criteria criteria) {
         List authorityList = criteria.list();
-        Set<Authority> result = new HashSet<Authority>();
+      Set < Authority > result = new HashSet < Authority >();
         for (Iterator iter = authorityList.iterator(); iter.hasNext();) {
             Authority authority = (Authority) iter.next();
             result.add(authority);
         }
         return result;
     }
+
     @Transactional(readOnly = true)
        public int countAllAuthorities() {
        Criteria criteria = getSession().createCriteria(Authority.class);
                return findAuthoritesByCriteria(criteria).size();
        }
+
     @Transactional(readOnly = true)
        public int countAssociatedAuthorities(String name) {
-       Criteria criteria = getSession()
-        .createCriteria(Authority.class).add(Restrictions.like("name", 
"%"+name+"%"));
+      Criteria criteria = 
getSession().createCriteria(Authority.class).add(Restrictions.like("name", "%" 
+ name + "%"));
                return findAuthoritesByCriteria(criteria).size();
        }
     
     @Transactional(readOnly = true)
-    public List<Authority> getAssociatedAuthorities(Map conditions, 
PagingStatusHolder holder) {
-       List<Authority> authorities=new ArrayList<Authority>();
+   public List < Authority > getAssociatedAuthorities(Map conditions, 
PagingStatusHolder holder) {
+      List < Authority > authorities = new ArrayList < Authority >();
      StringBuffer strb = new StringBuffer();
      basicGetAssociatedAuthorities(conditions, strb);
      strb.append(holder.getSortToken());
      Query q = getSession().createSQLQuery(strb.toString());
      q.setMaxResults(holder.getPageSize()).setFirstResult(holder.getOffset());
-     List<String> l=q.list();
-     for(String s:l){
-        Authority authority=new Authority();
-        //String str=((Object[])s)[0].toString();
-        authority =findAuthorityByName(s);
+      List < String > l = q.list();
+      for (String s : l) {
+         Authority authority = new Authority();
+         // String str=((Object[])s)[0].toString();
+         authority = findAuthorityByName(s);
         authorities.add(authority);
      }
      return authorities;
     }
 
-    private void basicGetAssociatedAuthorities(Map conditions, StringBuffer 
strb){
-       strb.append("select distinct asn.name " +
-                       //",concat(p.firstName ,p.lastName) as fullNmae " +
-                       "from  authorities asn" +
-                       " left outer join authentication_authorities on" +
-                       " asn.id=authentication_authorities.authority_id" +
-                       " left outer join authentication on" +
-                       " 
authentication_authorities.authentication_id=authentication.id" +
-                       " left outer join people p on 
p.authenticationId=authentication.id");
-     if (null!=conditions&&conditions.containsKey("group")) {
+   private void basicGetAssociatedAuthorities(Map conditions, StringBuffer 
strb) {
+      strb.append("select distinct asn.name "
+            +
+            // ",concat(p.firstName ,p.lastName) as fullNmae " +
+            "from  authorities asn" + " left outer join 
authentication_authorities on"
+            + " asn.id=authentication_authorities.authority_id" + " left outer 
join authentication on"
+            + " authentication_authorities.authentication_id=authentication.id"
+            + " left outer join people p on 
p.authenticationId=authentication.id");
+      if (null != conditions && conditions.containsKey("group")) {
       String group =  (String) conditions.get("group");
       strb.append(" where upper(asn.name) like'%" + group.toUpperCase() + 
"%'");
      }
      
-     if (null!=conditions&&conditions.containsKey("username")) {
+      if (null != conditions && conditions.containsKey("username")) {
                        String[] members = (String[]) 
conditions.get("username");
-                       if(members.length < 1) return;
-                       int i=0;
-                       for(String m:members){
+         if (members.length < 1) return;
+         int i = 0;
+         for (String m : members) {
                                String[] names = m.split(" ");
-                               if(names.length>2) continue;
-                               
if(i==0&&null==conditions.get("group"))strb.append(" where (");
-                               
if(i==0&&null!=conditions.get("group"))strb.append(" or (");
-                               if(i>0)strb.append("or(");
-                               if (names.length == 2)
-                                       strb.append(" upper(concat(p.firstName 
,p.lastName)) like'%" + names[0].toUpperCase()
-                                                       + "%'or 
upper(concat(p.firstName ,p.lastName)) like'%" + names[1].toUpperCase() + "%'");
-                               else if (names.length == 1)
-                                       strb.append(" upper(concat(p.firstName 
,p.lastName)) like'%" + names[0].toUpperCase()+ "%'");
+            if (names.length > 2) continue;
+            if (i == 0 && null == conditions.get("group")) strb.append(" where 
(");
+            if (i == 0 && null != conditions.get("group")) strb.append(" or 
(");
+            if (i > 0) strb.append("or(");
+            if (names.length == 2) strb.append(" upper(concat(p.firstName 
,p.lastName)) like'%"
+                  + names[0].toUpperCase() + "%'or upper(concat(p.firstName 
,p.lastName)) like'%"
+                  + names[1].toUpperCase() + "%'");
+            else if (names.length == 1) strb.append(" upper(concat(p.firstName 
,p.lastName)) like'%"
+                  + names[0].toUpperCase() + "%'");
                                strb.append(")");
                                i++;
                        }


Index: AuthorityService.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/security/AuthorityService.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- AuthorityService.java       22 Sep 2008 07:27:15 -0000      1.5
+++ AuthorityService.java       23 Sep 2008 07:12:57 -0000      1.6
@@ -1,15 +1,13 @@
 /*
-
-This software is OSI Certified Open Source Software.
-OSI Certified is a certification mark of the Open Source Initiative.
-
-The license (Mozilla version 1.0) can be read at the MMBase site.
-See http://www.MMBase.org/license
-
-*/
+ * 
+ * This software is OSI Certified Open Source Software. OSI Certified is a 
certification mark of the Open Source
+ * Initiative.
+ * 
+ * The license (Mozilla version 1.0) can be read at the MMBase site. See 
http://www.MMBase.org/license
+ * 
+ */
 package com.finalist.cmsc.services.community.security;
 
-
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -24,14 +22,15 @@
     /**
      * @return set with authorities names
      */
-    Set<String> getAuthorityNames();
-    List<Authority> getAllAuthorities(PagingStatusHolder holder);
+   Set < String > getAuthorityNames();
+
+   List < Authority > getAllAuthorities(PagingStatusHolder holder);
 
     /**
      * @param userName
      * @return set authorities
      */
-    Set<String> getAuthorityNamesForUser(String userName);
+   Set < String > getAuthorityNamesForUser(String userName);
 
     /**
      * Create a new Authority
@@ -43,6 +42,7 @@
 
     /**
      * Delete an Authority
+    * 
      * @param authorityName
      */
     void deleteAuthority(String authorityName);
@@ -57,18 +57,19 @@
 
     /**
      * Finds the authoritdy 
+    * 
      * @param authorityName
      * @return Authority with the requested name (if it exists)
      */
     Authority findAuthorityByName(String authorityName);
 
-    List<Authority> findAssociatedAuthorityByName(String 
name,PagingStatusHolder holder);
+   List < Authority > findAssociatedAuthorityByName(String name, 
PagingStatusHolder holder);
     
        int countAllAuthorities();
        
        int countAssociatedAuthorities(String name);
 
-       List<Authority> getAssociatedAuthorities(Map map, PagingStatusHolder 
holder);
+   List < Authority > getAssociatedAuthorities(Map map, PagingStatusHolder 
holder);
 
        int getAssociatedAuthoritiesNum(Map map, PagingStatusHolder holder);
     


Index: Permission.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/security/Permission.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Permission.java     25 Jan 2008 13:03:38 -0000      1.1
+++ Permission.java     23 Sep 2008 07:12:57 -0000      1.2
@@ -1,12 +1,11 @@
 /*
-
-This software is OSI Certified Open Source Software.
-OSI Certified is a certification mark of the Open Source Initiative.
-
-The license (Mozilla version 1.0) can be read at the MMBase site.
-See http://www.MMBase.org/license
-
-*/
+ * 
+ * This software is OSI Certified Open Source Software. OSI Certified is a 
certification mark of the Open Source
+ * Initiative.
+ * 
+ * The license (Mozilla version 1.0) can be read at the MMBase site. See 
http://www.MMBase.org/license
+ * 
+ */
 package com.finalist.cmsc.services.community.security;
 
 import java.io.Serializable;
@@ -41,16 +40,13 @@
     private String name;
 
     @ManyToMany
-    @JoinTable(
-        name = "permission_authorities",
-        joinColumns = [EMAIL PROTECTED](name = "permission_id")},
-        inverseJoinColumns = [EMAIL PROTECTED](name = "authority_id")}
-    )
-    private Set<Authority> authorities = new HashSet<Authority>();
+   @JoinTable(name = "permission_authorities", joinColumns = { 
@JoinColumn(name = "permission_id") }, inverseJoinColumns = { @JoinColumn(name 
= "authority_id") })
+   private Set < Authority > authorities = new HashSet < Authority >();
 
     public Long getId() {
         return id;
     }
+
     public void setId(Long id) {
         this.id = id;
     }
@@ -58,18 +54,21 @@
     public String getName() {
         return name;
     }
+
     public void setName(String name) {
         this.name = name;
     }
 
-    public Set<Authority> getAuthorities() {
+   public Set < Authority > getAuthorities() {
         return authorities;
     }
+
     public void addAuthority(Authority authority) {
         if (authority == null) throw new IllegalArgumentException("Null 
authority!");
         authorities.add(authority);
         authority.getPermissions().add(this);
     }
+
     public void removeAuthority(Authority authority) {
         if (authority == null) throw new IllegalArgumentException("Null 
authority!");
         authorities.remove(authority);
@@ -80,25 +79,19 @@
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result
-                + ((name == null) ? 0 : name.hashCode());
+      result = prime * result + ((name == null) ? 0 : name.hashCode());
         return result;
     }
 
     @Override
     public boolean equals(Object obj) {
-        if (this == obj)
-            return true;
-        if (obj == null)
-            return false;
-        if (getClass() != obj.getClass())
-            return false;
+      if (this == obj) return true;
+      if (obj == null) return false;
+      if (getClass() != obj.getClass()) return false;
         final Permission other = (Permission) obj;
         if (name == null) {
-            if (other.name != null)
-                return false;
-        } else if (!name.equals(other.name))
-            return false;
+         if (other.name != null) return false;
+      } else if (!name.equals(other.name)) return false;
         return true;
     }
 }


Index: PermissionService.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/security/PermissionService.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- PermissionService.java      29 Jan 2008 09:59:40 -0000      1.2
+++ PermissionService.java      23 Sep 2008 07:12:57 -0000      1.3
@@ -1,12 +1,11 @@
 /*
-
-This software is OSI Certified Open Source Software.
-OSI Certified is a certification mark of the Open Source Initiative.
-
-The license (Mozilla version 1.0) can be read at the MMBase site.
-See http://www.MMBase.org/license
-
-*/
+ * 
+ * This software is OSI Certified Open Source Software. OSI Certified is a 
certification mark of the Open Source
+ * Initiative.
+ * 
+ * The license (Mozilla version 1.0) can be read at the MMBase site. See 
http://www.MMBase.org/license
+ * 
+ */
 package com.finalist.cmsc.services.community.security;
 
 /**
@@ -14,20 +13,20 @@
  */
 public interface PermissionService {
 
-//    String getAllPermission();
-//
-//    Set<AccessPermission> getPermissions(Object resource);
-//
-//    boolean hasPermission(Object resource, String permission);
-//
-//    void deletePermissions(Object resource);
-//
-//    void deletePermission(Object resource, String authority, String 
permission);
-//
-//    void clearPermission(Object resource, String authority);
-//
-//    void setPermission(Object resource, String authority, String permission, 
boolean allow);
-//
-//    Map<Object, Set<AccessPermission>> 
getAllSetPermissionsForAuthority(String authority);
+   // String getAllPermission();
+   //
+   // Set<AccessPermission> getPermissions(Object resource);
+   //
+   // boolean hasPermission(Object resource, String permission);
+   //
+   // void deletePermissions(Object resource);
+   //
+   // void deletePermission(Object resource, String authority, String 
permission);
+   //
+   // void clearPermission(Object resource, String authority);
+   //
+   // void setPermission(Object resource, String authority, String permission, 
boolean allow);
+   //
+   // Map<Object, Set<AccessPermission>> 
getAllSetPermissionsForAuthority(String authority);
 
 }


Index: UserDetailsHibernateService.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/security/UserDetailsHibernateService.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- UserDetailsHibernateService.java    12 Apr 2008 14:26:34 -0000      1.3
+++ UserDetailsHibernateService.java    23 Sep 2008 07:12:57 -0000      1.4
@@ -1,12 +1,11 @@
 /*
-
-This software is OSI Certified Open Source Software.
-OSI Certified is a certification mark of the Open Source Initiative.
-
-The license (Mozilla version 1.0) can be read at the MMBase site.
-See http://www.MMBase.org/license
-
-*/
+ * 
+ * This software is OSI Certified Open Source Software. OSI Certified is a 
certification mark of the Open Source
+ * Initiative.
+ * 
+ * The license (Mozilla version 1.0) can be read at the MMBase site. See 
http://www.MMBase.org/license
+ * 
+ */
 package com.finalist.cmsc.services.community.security;
 
 import org.acegisecurity.GrantedAuthority;
@@ -27,10 +26,10 @@
 
 import com.finalist.cmsc.services.HibernateService;
 
-
 /**
- * <p>Retrieves user details (username, password, enabled flag, and 
authorities) 
- * from the database.</p>
+ * <p>
+ * Retrieves user details (username, password, enabled flag, and authorities) 
from the database.
+ * </p>
  *
  * @author Remco Bos
  */
@@ -47,15 +46,17 @@
         }
 
         /* Get authorities */
-        Set<Authority> authorities = authentication.getAuthorities();
-        List<GrantedAuthority> grantedAuthorities = new 
ArrayList<GrantedAuthority>();
+      Set < Authority > authorities = authentication.getAuthorities();
+      List < GrantedAuthority > grantedAuthorities = new ArrayList < 
GrantedAuthority >();
         for (Authority authority : authorities) {
             grantedAuthorities.add(new 
GrantedAuthorityImpl(authority.getName()));
         }
-        GrantedAuthority[] grantedAuthorityArray = 
grantedAuthorities.toArray(new GrantedAuthority[grantedAuthorities.size()]);
+      GrantedAuthority[] grantedAuthorityArray = 
grantedAuthorities.toArray(new GrantedAuthority[grantedAuthorities
+            .size()]);
 
         /* Create user object */
-        User user = new User(authentication.getUserId(), 
authentication.getPassword(), authentication.isEnabled(), true, true, true, 
grantedAuthorityArray);
+      User user = new User(authentication.getUserId(), 
authentication.getPassword(), authentication.isEnabled(), true,
+            true, true, grantedAuthorityArray);
         return user;
     }
 


Index: UserNotFoundException.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Modules/community/src/java/com/finalist/cmsc/services/community/security/UserNotFoundException.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- UserNotFoundException.java  29 Jan 2008 09:59:40 -0000      1.2
+++ UserNotFoundException.java  23 Sep 2008 07:12:57 -0000      1.3
@@ -1,17 +1,15 @@
 /*
-
-This software is OSI Certified Open Source Software.
-OSI Certified is a certification mark of the Open Source Initiative.
-
-The license (Mozilla version 1.0) can be read at the MMBase site.
-See http://www.MMBase.org/license
-
-*/
+ * 
+ * This software is OSI Certified Open Source Software. OSI Certified is a 
certification mark of the Open Source
+ * Initiative.
+ * 
+ * The license (Mozilla version 1.0) can be read at the MMBase site. See 
http://www.MMBase.org/license
+ * 
+ */
 package com.finalist.cmsc.services.community.security;
 
 /**
- * @author Remco Bos
- * TODO This class has isn't used yet. Do we want to throw some exceptions?? 
+ * @author Remco Bos TODO This class has isn't used yet. Do we want to throw 
some exceptions??
  */
 public class UserNotFoundException extends Exception {
 
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to