org.jasig.cas.adaptors.ldap.util
Class SpringLdapUtils

java.lang.Object
  extended by org.jasig.cas.adaptors.ldap.util.SpringLdapUtils

public final class SpringLdapUtils
extends java.lang.Object

A basic LDAP Utility class

Author:
Siegfried Puchbauer, SPP (http://www.spp.at)

Field Summary
static java.lang.String LDAP_BOOLEAN_FALSE
           
static java.lang.String LDAP_BOOLEAN_TRUE
           
static java.lang.String OBJECTCLASS_ATTRIBUTE
           
 
Constructor Summary
SpringLdapUtils()
           
 
Method Summary
static boolean containsObjectClass(org.springframework.ldap.core.DirContextAdapter ctx, java.lang.String objectclass)
          Checks if the objectclass Attribute of the DirContext contains the given objectclass
static java.lang.Boolean getBoolean(org.springframework.ldap.core.DirContextOperations ctx, java.lang.String attribute)
          Reads a Boolean value from the DirContextAdapter
static java.lang.Boolean getBoolean(org.springframework.ldap.core.DirContextOperations ctx, java.lang.String attribute, java.lang.Boolean nullValue)
          Reads a Boolean value from the DirContextAdapter
static void setBoolean(org.springframework.ldap.core.DirContextOperations ctx, java.lang.String attribute, java.lang.Boolean value)
          Sets the attribute attribute to the boolean value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OBJECTCLASS_ATTRIBUTE

public static final java.lang.String OBJECTCLASS_ATTRIBUTE
See Also:
Constant Field Values

LDAP_BOOLEAN_TRUE

public static final java.lang.String LDAP_BOOLEAN_TRUE
See Also:
Constant Field Values

LDAP_BOOLEAN_FALSE

public static final java.lang.String LDAP_BOOLEAN_FALSE
See Also:
Constant Field Values
Constructor Detail

SpringLdapUtils

public SpringLdapUtils()
Method Detail

getBoolean

public static java.lang.Boolean getBoolean(org.springframework.ldap.core.DirContextOperations ctx,
                                           java.lang.String attribute)
Reads a Boolean value from the DirContextAdapter

Parameters:
ctx - the DirContextAdapter
attribute - the attribute name
Returns:
true if the attribute's value matches (case-insensitive) "true", otherwise false

getBoolean

public static java.lang.Boolean getBoolean(org.springframework.ldap.core.DirContextOperations ctx,
                                           java.lang.String attribute,
                                           java.lang.Boolean nullValue)
Reads a Boolean value from the DirContextAdapter

Parameters:
ctx - the DirContextAdapter
attribute - the attribute name
nullValue - the value which sould be returing in case of a null value
Returns:
true if the attribute's value matches (case-insensitive) "true", otherwise false

setBoolean

public static void setBoolean(org.springframework.ldap.core.DirContextOperations ctx,
                              java.lang.String attribute,
                              java.lang.Boolean value)
Sets the attribute attribute to the boolean value

Parameters:
ctx - the DirContextAdapter
attribute - the attribute name
value - the boolean value

containsObjectClass

public static boolean containsObjectClass(org.springframework.ldap.core.DirContextAdapter ctx,
                                          java.lang.String objectclass)
Checks if the objectclass Attribute of the DirContext contains the given objectclass

Parameters:
ctx - the DirContextAdaper to check
objectclass - the objectclass value to look for (case does not matter)
Returns:
true, if the DirContext contains the objectclass, otherwise false


Copyright © 2004-2010 Java Architectures Special Interest Group. All Rights Reserved.