Examples of LdapPersonAttributeDaoImpl


Examples of org.jasig.portal.services.persondir.support.LdapPersonAttributeDaoImpl

     *
     * @param info The {@link PersonDirInfo} to use as a basis for the DAO
     * @return A fully configured {@link LdapPersonAttributeDaoImpl}
     */
    private static IPersonAttributeDao ldapDao(final PersonDirInfo info) {
        final LdapPersonAttributeDaoImpl ldapImpl = new LdapPersonAttributeDaoImpl();
          
        ILdapServer ldapServer = null;
       
        final String ldapRefName = info.getLdapRefName();
        if (ldapRefName != null) {
            ldapServer = LdapServices.getLdapServer(ldapRefName);
           
            if (ldapServer == null)
                throw new IllegalArgumentException("LdapServices does not have an LDAP server configured with name [" + ldapRefName + "]");
        } else {
            // instantiate an LDAP server ad-hoc.
      
            // set the "usercontext" attribute of the PersonDirInfo as the baseDN
            // of the LdapServerImpl we're instantiating because when
            ldapServer = new LdapServerImpl(info.getUrl(), info.getUrl(), info.getUsercontext(), null, info.getLogonid(), info.getLogonpassword(), null);
        }
      
        ldapImpl.setLdapServer(ldapServer);
        ldapImpl.setTimeLimit(info.getLdaptimelimit());
        ldapImpl.setQuery(info.getUidquery());
        ldapImpl.setQueryAttributes(QUERY_ATTRIBUTE_LIST);
      
      
    
        // Map from LDAP attribute names to Sets of Strings representing uPortal
        // attribute names.
        final Map ldapToPortalAttribs = new HashMap();
      
        final String[] ldapAttribNames = info.getAttributenames();
        final String[] portalAttribNames = info.getAttributealiases();
        for (int i = 0; i < ldapAttribNames.length; i++) {
            final String ldapAttribName = ldapAttribNames[i];
          
            Set attributeNames = (Set)ldapToPortalAttribs.get(ldapAttribName);
            if (attributeNames == null)
                attributeNames = new HashSet();
           
            attributeNames.add(portalAttribNames[i]);
            ldapToPortalAttribs.put(ldapAttribName, attributeNames);
        }
      
        ldapImpl.setLdapAttributesToPortalAttributes(ldapToPortalAttribs);
        ldapImpl.setDefaultAttributeName(QUERY_ATTRIBUTE);
      
        return ldapImpl;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.