protected void importFromLDAPByUser( long ldapServerId, long companyId, LdapContext ldapContext, Properties userMappings, Properties userExpandoMappings, Properties contactMappings, Properties contactExpandoMappings, Properties groupMappings) throws Exception { byte[] cookie = new byte[0]; while (cookie != null) { List<SearchResult> searchResults = new ArrayList<SearchResult>(); String userMappingsScreenName = GetterUtil.getString(userMappings.getProperty("screenName")).toLowerCase(); cookie = PortalLDAPUtil.getUsers( ldapServerId, companyId, ldapContext, cookie, 0, new String[] {userMappingsScreenName}, searchResults); for (SearchResult searchResult : searchResults) { try { Attributes userAttributes = PortalLDAPUtil.getUserAttributes( ldapServerId, companyId, ldapContext, PortalLDAPUtil.getNameInNamespace(ldapServerId, companyId, searchResult)); User user = importUser( companyId, userAttributes, userMappings, userExpandoMappings, contactMappings, contactExpandoMappings, StringPool.BLANK); importGroups( ldapServerId, companyId, ldapContext, userAttributes, user, userMappings, groupMappings); } catch (Exception e) { _log.error("Unable to import user " + searchResult, e); } } } }