Novell exteNd
Director 5.2 API

com.sssw.fw.util.jndi
Class EboLdapSearchHelper

java.lang.Object
 |
 +--com.sssw.fw.util.jndi.EboLdapSearchHelper

public class EboLdapSearchHelper
extends Object

No information available


Field Summary
static int LDAP_APPROX
          Ldap operator that corresponds to the '~=' search comparison condition.
static int LDAP_BETWEEN
          Ldap operator that corresponds to a SQL 'BETWEEN' operator.
static int LDAP_ENDS_WITH
          Ldap operator that corresponds to the '=' search comparison condition where the pattern specifies items that end with a certain sequence of characters.
static int LDAP_EQUAL
          Ldap operator that corresponds to the '=' search comparison condition.
static int LDAP_GEQ
          Ldap operator that corresponds to the '>=' search comparison condition.
static int LDAP_GREATER
          Ldap operator that corresponds to the '!<=' search comparison condition.
static int LDAP_IN
          Ldap operator that corresponds to a SQL 'IN' operator.
static int LDAP_LEQ
          Ldap operator that corresponds to the '<=' search comparison condition.
static int LDAP_LESS
          Ldap operator that corresponds to the '!>=' search comparison condition.
static int LDAP_MATCH
          Ldap operator that corresponds to the '=' search comparison condition where the pattern specifies items that contain wildcard characters.
static int LDAP_PRESENCE
          Ldap operator that corresponds to the '=*' search comparison condition.
static int LDAP_STARTS_WITH
          Ldap operator that corresponds to the '=' search comparison condition where the pattern specifies items that start with a certain sequence of characters.
 
Constructor Summary
EboLdapSearchHelper()
           
 
Method Summary
static Timestamp convertTimestamp(String tmStr)
          Convert an LDAP modifyTimestamp attribute with the format of yyyymmddhhmm(ss)Z to a java.sql.Timestamp with the format of yyyy-mm-dd hh:mm:ss.fffffffff
static String genBetween(String attrName, Object first, Object last, boolean not)
          Generate an LDAP search filter expression corresponding to SQL BETWEEN query
static String genBetweenWithArgs(String attrName, Object first, Object last, boolean not, boolean useAttrArgs)
          Generate an LDAP search filter expression corresponding to SQL BETWEEN query for use with filter arguments All values will be replaced by arguments.
static String genExpression(String attrName, Object value, int op, boolean not)
          Generate an LDAP search filter expression
static String genExpressionWithArgs(String attrName, int op, boolean not, boolean useAttrArg)
          Generate an LDAP search filter expression for use with filter arguments All values will be replaced by arguments.
static String genIn(String attrName, Object[] ins, boolean not)
          Generate an LDAP search filter expression corresponding to SQL IN query
static String genInWithArgs(String attrName, Object[] ins, boolean not, boolean useAttrArg)
          Generate an LDAP search filter expression corresponding to SQL IN query for use with filter arguments All values will be replaced by arguments.
static String getOpAsString(int op)
          Return the string value of an LDAP Search operator
static boolean isCompareOp(int op)
          Indicate whether the specified operator is comparison-based i.e., operator that uses comparison such as MyAttr >= foo
static boolean isRangeOp(int op)
          Indicate whether the specified operator is range-based i.e., operator that uses range test such as IN or BETWEEN
static boolean isSubstringOp(int op)
          Indicate whether the specified operator is substring-based i.e., operator that uses substring matching such as MyAttr=foo*
static boolean isUnaryOp(int op)
          Indicate whether the specified operator is unary i.e., operator that works on one operand such as MyAttr=*
static boolean isValidOp(int op)
          Indicate whether the specified operator is valid for use in LDAP search methods
static boolean isValidQueryExprObj(Object obj)
          Indicate whether the specified object is valid for LDAP search expressions
static String negate(String str)
          Return a negated string The string will be parenthesized and negated with the LDAP negation symbol
static String parenthesize(String str)
          Return a parenthesized string
static String wrapString(String wrappee, String wrapper)
          Return a wrapped string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LDAP_EQUAL

public static final int LDAP_EQUAL
Ldap operator that corresponds to the '=' search comparison condition.

LDAP_LESS

public static final int LDAP_LESS
Ldap operator that corresponds to the '!>=' search comparison condition.

LDAP_LEQ

public static final int LDAP_LEQ
Ldap operator that corresponds to the '<=' search comparison condition.

LDAP_GREATER

public static final int LDAP_GREATER
Ldap operator that corresponds to the '!<=' search comparison condition.

LDAP_GEQ

public static final int LDAP_GEQ
Ldap operator that corresponds to the '>=' search comparison condition.

LDAP_APPROX

public static final int LDAP_APPROX
Ldap operator that corresponds to the '~=' search comparison condition.

LDAP_MATCH

public static final int LDAP_MATCH
Ldap operator that corresponds to the '=' search comparison condition where the pattern specifies items that contain wildcard characters. (e.g., name=f*o).

LDAP_STARTS_WITH

public static final int LDAP_STARTS_WITH
Ldap operator that corresponds to the '=' search comparison condition where the pattern specifies items that start with a certain sequence of characters. (e.g., name=*foo).

LDAP_ENDS_WITH

public static final int LDAP_ENDS_WITH
Ldap operator that corresponds to the '=' search comparison condition where the pattern specifies items that end with a certain sequence of characters. (e.g., name=foo*).

LDAP_IN

public static final int LDAP_IN
Ldap operator that corresponds to a SQL 'IN' operator.

LDAP_BETWEEN

public static final int LDAP_BETWEEN
Ldap operator that corresponds to a SQL 'BETWEEN' operator.

LDAP_PRESENCE

public static final int LDAP_PRESENCE
Ldap operator that corresponds to the '=*' search comparison condition.
Constructor Detail

EboLdapSearchHelper

public EboLdapSearchHelper()
Method Detail

isValidOp

public static boolean isValidOp(int op)
Indicate whether the specified operator is valid for use in LDAP search methods
Parameters:
op - the operator identifier
Returns:
true if valid, false otherwise

isCompareOp

public static boolean isCompareOp(int op)
Indicate whether the specified operator is comparison-based i.e., operator that uses comparison such as MyAttr >= foo
Parameters:
op - the operator identifier
Returns:
true if comparison operator, false otherwise

isSubstringOp

public static boolean isSubstringOp(int op)
Indicate whether the specified operator is substring-based i.e., operator that uses substring matching such as MyAttr=foo*
Parameters:
op - the operator identifier
Returns:
true if substring, false otherwise

isUnaryOp

public static boolean isUnaryOp(int op)
Indicate whether the specified operator is unary i.e., operator that works on one operand such as MyAttr=*
Parameters:
op - the operator identifier
Returns:
true if unary operator, false otherwise

isRangeOp

public static boolean isRangeOp(int op)
Indicate whether the specified operator is range-based i.e., operator that uses range test such as IN or BETWEEN
Parameters:
op - the operator identifier
Returns:
true if range operator, false otherwise

isValidQueryExprObj

public static boolean isValidQueryExprObj(Object obj)
Indicate whether the specified object is valid for LDAP search expressions
Parameters:
obj - the expression value
Returns:
true if valid, false otherwise

genExpression

public static String genExpression(String attrName,
                                   Object value,
                                   int op,
                                   boolean not)
Generate an LDAP search filter expression
Parameters:
attrName - the attribute name
value - the attribute value
op - the search expression operator (must satisfy isValidOp(op))
not - specifies whether the entire expression should be negated
Returns:
the expression

genExpressionWithArgs

public static String genExpressionWithArgs(String attrName,
                                           int op,
                                           boolean not,
                                           boolean useAttrArg)
Generate an LDAP search filter expression for use with filter arguments All values will be replaced by arguments. Note: all arguments will be returned as {?} rather than {0}, {1}, etc.
Parameters:
attrName - the attribute name
op - the search expression operator (must satisfy isValidOp(op))
not - specifies whether the entire expression should be negated
useAttrArg - specifies whether the attribute name should also be replaced by an argument
Returns:
the expression

genIn

public static String genIn(String attrName,
                           Object[] ins,
                           boolean not)
Generate an LDAP search filter expression corresponding to SQL IN query
Parameters:
attrName - the attribute name
ins - the set of values to be matched
not - specifies whether the entire expression should be negated
Returns:
the expression

genInWithArgs

public static String genInWithArgs(String attrName,
                                   Object[] ins,
                                   boolean not,
                                   boolean useAttrArg)
Generate an LDAP search filter expression corresponding to SQL IN query for use with filter arguments All values will be replaced by arguments. Note: all arguments will be returned as {?} rather than {0}, {1}, etc.
Parameters:
attrName - the attribute name
ins - the set of values to be matched
not - specifies whether the entire expression should be negated
useAttrArgs - specifies whether the attribute name should also be replaced by an argument
Returns:
the expression

genBetween

public static String genBetween(String attrName,
                                Object first,
                                Object last,
                                boolean not)
Generate an LDAP search filter expression corresponding to SQL BETWEEN query
Parameters:
attrName - the attribute name
first - the lowest value to be included
last - the highest value to be included
not - specifies whether the entire expression should be negated
Returns:
the expression

genBetweenWithArgs

public static String genBetweenWithArgs(String attrName,
                                        Object first,
                                        Object last,
                                        boolean not,
                                        boolean useAttrArgs)
Generate an LDAP search filter expression corresponding to SQL BETWEEN query for use with filter arguments All values will be replaced by arguments. Note: all arguments will be returned as {?} rather than {0}, {1}, etc.
Parameters:
attrName - the attribute name
first - the lowest value to be included
last - the highest value to be included
not - specifies whether the entire expression should be negated
useAttrArgs - specifies whether the attribute name should also be replaced by an argument
Returns:
the expression

convertTimestamp

public static Timestamp convertTimestamp(String tmStr)
Convert an LDAP modifyTimestamp attribute with the format of yyyymmddhhmm(ss)Z to a java.sql.Timestamp with the format of yyyy-mm-dd hh:mm:ss.fffffffff
Parameters:
tmStr - a timestamp String in eDirectory format
Returns:
a converted Timestamp object.

getOpAsString

public static String getOpAsString(int op)
Return the string value of an LDAP Search operator
Parameters:
int - an operator value (e.g., EboLdapSearchHelper.LDAP_EQUAL)
Returns:
the operator as a string (e.g., "=")

wrapString

public static String wrapString(String wrappee,
                                String wrapper)
Return a wrapped string
Parameters:
wrappee - a string to be wrapped (e.g., "value")
wrapper - the wrapping value (e.g., "'");
Returns:
the wrapped value (e.g., "'value'")

parenthesize

public static String parenthesize(String str)
Return a parenthesized string
Parameters:
str - a string to be parenthesized (e.g., "attr=value")
Returns:
the parenthesized value (e.g., "(attr=value)")

negate

public static String negate(String str)
Return a negated string The string will be parenthesized and negated with the LDAP negation symbol
Parameters:
str - a string to be negated (e.g., "attr=value")
Returns:
the negated value (e.g., "!(attr=value)")

Novell exteNd
Director 5.2 API