Class LDAPUtility


  • public class LDAPUtility
    extends Object
    This class contains some useful static functions to access to LDAP elements
    Author:
    tleroi
    • Method Detail

      • getConnection

        public static com.novell.ldap.LDAPConnection getConnection​(String connectionId)
      • getFirstAttributeValue

        public static String getFirstAttributeValue​(com.novell.ldap.LDAPEntry theEntry,
                                                    String attributeName)
        Returns the first value of a specific attribute from an entry. If this attribute have multiple values, only the first is returned
        Parameters:
        theEntry - the LDAP entry
        attributeName - the name of the attribute to retreive
        Returns:
        the first value as a string
      • getFirstEntryFromSearch

        public static com.novell.ldap.LDAPEntry getFirstEntryFromSearch​(String lds,
                                                                        String baseDN,
                                                                        int scope,
                                                                        String filter,
                                                                        String[] attrs)
                                                                 throws AdminException
        Search and returns the first Entry that match the parameters baseDN, scope and filter
        Parameters:
        lds - the LDAP connection name
        baseDN - the base DN for the search
        scope - the scope (LDAPConnection.SCOPE_BASE, LDAPConnection.SCOPE_ONE or LDAPConnection.SCOPE_SUB)
        filter - the filter for the search (if null, use '(objectClass=*)' )
        attrs - hidden attributes
        Returns:
        the first entry found
        Throws:
        AdminException - if a problem occur
      • getEntriesFromSearch

        public static List<com.novell.ldap.LDAPEntry> getEntriesFromSearch​(String lds,
                                                                           String baseDN,
                                                                           int scope,
                                                                           String filter,
                                                                           String[] attrs)
                                                                    throws AdminException
        Search and returns entries that match the parameters baseDN, scope and filter
        Parameters:
        lds - the LDAP connection name
        baseDN - the base DN for the search
        scope - the scope (LDAPConnection.SCOPE_BASE, LDAPConnection.SCOPE_ONE or LDAPConnection.SCOPE_SUB)
        filter - the filter for the search (if null, use '(objectClass=*)' )
        attrs - hidden attributes
        Returns:
        list of entry matching the criteria
        Throws:
        AdminException - if a problem occur
      • dblBackSlashesForDNInFilters

        public static String dblBackSlashesForDNInFilters​(String theDN)
      • normalizeFilterValue

        public static String normalizeFilterValue​(String theFilter)