Tree PREV CLASS NEXT CLASS SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD com.ibm.websphere.query.callbacks
Class LdapSelectQueryCallbackjava.lang.Objectcom.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
com.ibm.websphere.query.callbacks.LdapSelectQueryCallback
- All Implemented Interfaces:
- ISelectQueryCallback, java.io.Serializable
public class LdapSelectQueryCallback- extends com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- implements ISelectQueryCallback
The LdapSelectQueryCallback class is a query builder callback for LDAP. It provides attributes mapping and query syntax conversion for developers to build meaningful LDAP query strings.
It implements the ISelectQueryCallback interface so it can be used whenever an ISelectQueryCallback is needed.
This class has a hash table that contains SQL attributes mapping. When building an attribute string, the hash table is looked up to perform an attribute conversion.
- See Also:
- Serialized Form
Field Summary static java.lang.String LDAP_QUERY_AND
static java.lang.String LDAP_QUERY_CONDITIONHEAD
static java.lang.String LDAP_QUERY_CONDITIONTAIL
static java.lang.String LDAP_QUERY_EQ
static java.lang.String LDAP_QUERY_GEQ
static java.lang.String LDAP_QUERY_LEFTPAREN
static java.lang.String LDAP_QUERY_LEQ
static java.lang.String LDAP_QUERY_LIKE
static java.lang.String LDAP_QUERY_NOT
static java.lang.String LDAP_QUERY_OR
static java.lang.String LDAP_QUERY_ORDERBYASC
static java.lang.String LDAP_QUERY_ORDERBYDES
static java.lang.String LDAP_QUERY_PREDICATEHEAD
static java.lang.String LDAP_QUERY_PREDICATETAIL
static java.lang.String LDAP_QUERY_RIGHTPAREN
static java.lang.String LDAP_QUERY_WILDCARD
protected int nbSortStrings
protected java.lang.String[] sortStrings
protected java.util.Map typeMapping
Fields inherited from interface com.ibm.websphere.query.base.ISelectQueryCallback JOIN_CONDITIONS, JOIN_TABLES, JOINS, LAST_TABLE_ALIAS_INTEGER, MULTIVALUE_PROPERTY_NAMES, NAME_MAPPING, PREDICATE_IS_NULL, SELECT_ATTRIBUTES, TABLE_MAP, TABLE_NAME, TYPE_MAPPING
Constructor Summary LdapSelectQueryCallback()
Creates a new LdapSelectQueryCallback instance, default constructor.LdapSelectQueryCallback(java.util.Hashtable ht)
Creates a new LdapSelectQueryCallback instance with the given attribute mapping.LdapSelectQueryCallback(java.util.Map newNameMapping, java.util.Map newTypeMapping)
Creates a new LdapSelectQueryCallback instance with the given attribute and type mappings.
Method Summary java.lang.String buildArithmeticCondition(IArithmeticCondition arithmeticCondition)
Return the string representation for the given operator.java.lang.String buildAttribute(IAttribute attribute)
Return the LDAP attribute string for the given attribute.java.lang.String buildCondition(ICondition condition)
Return the LDAP condition string for the given condition.java.lang.String buildFunction(IFunction function)
Throws an exception because LDAP does not support functions.java.lang.String buildLimit(ILimit limit)
Return the string representation for the given limit clause.java.lang.String buildLimit(ISelectQuery selectQuery)
Return the string representation for the limit part of the given select query.java.lang.String buildOperator(IOperator operator)
Return the LDAP operator string for the given operator.java.lang.String buildOrderBy(IOrderBy orderBy)
This method iterates through the order by expressions in the order by object to generate the order by string in LDAP.java.lang.String buildOrderBy(ISelectQuery selectQuery)
This method uses the order by in the select query to generate the order by string in LDAP.java.lang.String buildOrderByExpression(IOrderByExpression orderByExpression)
This method uses the order by element and operator in the order by expression to generate the order by expression strings as an array of strings.java.lang.String buildPredicate(IPredicate predicate)
Return the LDAP predicate string for the given predicate.java.lang.String buildPredicate(IQuery query)
Return the LDAP predicate string for the given query.java.lang.String buildQuery(IQuery query)
Return the LDAP query string for the given query.java.lang.String buildSelectQuery(ISelectQuery selectQuery)
Return the LDAP select query string for the given select query.java.lang.String buildValue(IValue value)
Return the LDAP value string for the given value.protected java.lang.String buildValueString(java.lang.String valueString)
Return the LDAP query safe value string for the given string.long getLimit(ISelectQuery selectQuery)
java.util.Map getNameMapping()
Return the attribute mapping hash table of the builder callback.java.lang.String[] getSortStrings()
Return the sort strings of the builder callback.void setNameMapping(java.util.Hashtable newNameMapping)
Sets the attribute mapping hash table of the builder callback.
Methods inherited from class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter buildArithmeticCondition, buildAttribute, buildCondition, buildFrom, buildFrom, buildFunction, buildJoin, buildLimit, buildLimit, buildOperator, buildOrderBy, buildOrderBy, buildOrderByExpression, buildPredicate, buildPredicate, buildQuery, buildSelect, buildSelectQuery, buildTable, buildValue
Methods inherited from class java.lang.Object clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.ibm.websphere.query.base.ISelectQueryCallback buildArithmeticCondition, buildAttribute, buildCondition, buildFrom, buildFrom, buildFunction, buildJoin, buildLimit, buildLimit, buildOperator, buildOrderBy, buildOrderBy, buildOrderByExpression, buildPredicate, buildPredicate, buildSelect, buildSelectQuery, buildTable, buildValue
Field Detail LDAP_QUERY_LEFTPAREN
public static final java.lang.String LDAP_QUERY_LEFTPAREN
- See Also:
- Constant Field Values
LDAP_QUERY_NOT
public static final java.lang.String LDAP_QUERY_NOT
- See Also:
- Constant Field Values
LDAP_QUERY_RIGHTPAREN
public static final java.lang.String LDAP_QUERY_RIGHTPAREN
- See Also:
- Constant Field Values
LDAP_QUERY_PREDICATEHEAD
public static final java.lang.String LDAP_QUERY_PREDICATEHEAD
- See Also:
- Constant Field Values
LDAP_QUERY_PREDICATETAIL
public static final java.lang.String LDAP_QUERY_PREDICATETAIL
- See Also:
- Constant Field Values
LDAP_QUERY_CONDITIONHEAD
public static final java.lang.String LDAP_QUERY_CONDITIONHEAD
- See Also:
- Constant Field Values
LDAP_QUERY_CONDITIONTAIL
public static final java.lang.String LDAP_QUERY_CONDITIONTAIL
- See Also:
- Constant Field Values
LDAP_QUERY_AND
public static final java.lang.String LDAP_QUERY_AND
- See Also:
- Constant Field Values
LDAP_QUERY_OR
public static final java.lang.String LDAP_QUERY_OR
- See Also:
- Constant Field Values
LDAP_QUERY_EQ
public static final java.lang.String LDAP_QUERY_EQ
- See Also:
- Constant Field Values
LDAP_QUERY_LEQ
public static final java.lang.String LDAP_QUERY_LEQ
- See Also:
- Constant Field Values
LDAP_QUERY_GEQ
public static final java.lang.String LDAP_QUERY_GEQ
- See Also:
- Constant Field Values
typeMapping
protected java.util.Map typeMapping
LDAP_QUERY_LIKE
public static final java.lang.String LDAP_QUERY_LIKE
- See Also:
- Constant Field Values
LDAP_QUERY_ORDERBYASC
public static final java.lang.String LDAP_QUERY_ORDERBYASC
- See Also:
- Constant Field Values
LDAP_QUERY_ORDERBYDES
public static final java.lang.String LDAP_QUERY_ORDERBYDES
- See Also:
- Constant Field Values
LDAP_QUERY_WILDCARD
public static final java.lang.String LDAP_QUERY_WILDCARD
- See Also:
- Constant Field Values
nbSortStrings
protected int nbSortStrings
sortStrings
protected java.lang.String[] sortStrings
Constructor Detail LdapSelectQueryCallback
public LdapSelectQueryCallback()
- Creates a new LdapSelectQueryCallback instance, default constructor.
LdapSelectQueryCallback
public LdapSelectQueryCallback(java.util.Hashtable ht)
- Creates a new LdapSelectQueryCallback instance with the given attribute mapping.
LdapSelectQueryCallback
public LdapSelectQueryCallback(java.util.Map newNameMapping, java.util.Map newTypeMapping)
- Creates a new LdapSelectQueryCallback instance with the given attribute and type mappings.
Method Detail buildAttribute
public java.lang.String buildAttribute(IAttribute attribute) throws QueryException
Returns the LDAP attribute string for the given attribute.
- Specified by:
- buildAttribute in interface ISelectQueryCallback
- Specified by:
- buildAttribute in class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- Throws:
- QueryException
buildCondition
public java.lang.String buildCondition(ICondition condition) throws QueryException
Returns the LDAP condition string for the given condition.
This method defines string generation for conditions with all possible operators supported in LDAP.
- Specified by:
- buildCondition in interface ISelectQueryCallback
- Specified by:
- buildCondition in class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- Throws:
- QueryException
buildFunction
public java.lang.String buildFunction(IFunction function) throws QueryException
Throws an exception because LDAP does not support functions.
- Specified by:
- buildFunction in interface ISelectQueryCallback
- Specified by:
- buildFunction in class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- Throws:
- QueryException
buildOperator
public java.lang.String buildOperator(IOperator operator) throws QueryException
Returns the LDAP operator string for the given operator.
This method defines string generation for all possible operators supported in LDAP.
- Specified by:
- buildOperator in interface ISelectQueryCallback
- Specified by:
- buildOperator in class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- Throws:
- QueryException
buildOrderBy
public java.lang.String buildOrderBy(IOrderBy orderBy) throws QueryException
This method iterates through the order by expressions in the order by object to generate the order by string in LDAP.
- Specified by:
- buildOrderBy in interface ISelectQueryCallback
- Specified by:
- buildOrderBy in class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- Throws:
- QueryException
buildOrderBy
public java.lang.String buildOrderBy(ISelectQuery selectQuery) throws QueryException
This method uses the order by in the select query to generate the order by string in LDAP.
- Specified by:
- buildOrderBy in interface ISelectQueryCallback
- Specified by:
- buildOrderBy in class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- Throws:
- QueryException
buildOrderByExpression
public java.lang.String buildOrderByExpression(IOrderByExpression orderByExpression) throws QueryException
This method uses the order by element and operator in the order by expression to generate the order by expression strings as an array of strings. The results are stored as an instance variable so the builder callback users can use them to construct the final LDAP query string.
- Specified by:
- buildOrderByExpression in interface ISelectQueryCallback
- Specified by:
- buildOrderByExpression in class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- Throws:
- QueryException
buildPredicate
public java.lang.String buildPredicate(IPredicate predicate) throws QueryException
Returns the LDAP predicate string for the given predicate.
This method uses the predicate bases in the predicate to generate the predicate string in LDAP.
- Specified by:
- buildPredicate in interface ISelectQueryCallback
- Specified by:
- buildPredicate in class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- Throws:
- QueryException
buildPredicate
public java.lang.String buildPredicate(IQuery query) throws QueryException
Returns the LDAP predicate string for the given query.
This method uses the predicate in the query to generate the predicate string in LDAP.
- Specified by:
- buildPredicate in interface ISelectQueryCallback
- Specified by:
- buildPredicate in class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- Throws:
- QueryException
buildQuery
public java.lang.String buildQuery(IQuery query) throws QueryException
Returns the LDAP query string for the given query.
This method calls buildPredicate() to generate the query string in LDAP.
- Specified by:
- buildQuery in interface ISelectQueryCallback
- Specified by:
- buildQuery in class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- Throws:
- QueryException
buildSelectQuery
public java.lang.String buildSelectQuery(ISelectQuery selectQuery) throws QueryException
Returns the LDAP select query string for the given select query.
This method calls buildPredicate() to generate the select query string in LDAP. It also calls buildOrderBy() to generate the string array for order by as an instance variable.
- Specified by:
- buildSelectQuery in interface ISelectQueryCallback
- Specified by:
- buildSelectQuery in class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- Throws:
- QueryException
buildValue
public java.lang.String buildValue(IValue value) throws QueryException
Returns the LDAP value string for the given value.
This method generates the value string in LDAP based on the data type.
- Specified by:
- buildValue in interface ISelectQueryCallback
- Specified by:
- buildValue in class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- Throws:
- QueryException
getNameMapping
public java.util.Map getNameMapping()
- Returns the attribute mapping hash table of the builder callback.
setNameMapping
public void setNameMapping(java.util.Hashtable newNameMapping)
- Sets the attribute mapping hash table of the builder callback.
buildValueString
protected java.lang.String buildValueString(java.lang.String valueString) throws QueryException
Returns the LDAP query safe value string for the given string.
- Throws:
- QueryException
getSortStrings
public java.lang.String[] getSortStrings()
- Returns the sort strings of the builder callback.
buildArithmeticCondition
public java.lang.String buildArithmeticCondition(IArithmeticCondition arithmeticCondition) throws QueryException
- Description copied from interface: ISelectQueryCallback
- Returns the string representation for the given operator. Domain specific operator syntax can be applied here to generate meaningful strings.
- Specified by:
- buildArithmeticCondition in interface ISelectQueryCallback
- Specified by:
- buildArithmeticCondition in class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- Throws:
- QueryException
- See Also:
- ISelectQueryCallback#buildArithmeticCondition(IArithmeticCondition)
getLimit
public long getLimit(ISelectQuery selectQuery) throws QueryException
- Throws:
- QueryException
buildLimit
public java.lang.String buildLimit(ILimit limit) throws QueryException
- Description copied from interface: ISelectQueryCallback
- Returns the string representation for the given limit clause. Domain specific limit syntax can be applied here to generate meaningful strings.
- Specified by:
- buildLimit in interface ISelectQueryCallback
- Specified by:
- buildLimit in class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- Throws:
- QueryException
- See Also:
- ISelectQueryCallback#buildLimit(ILimit)
buildLimit
public java.lang.String buildLimit(ISelectQuery selectQuery) throws QueryException
- Description copied from interface: ISelectQueryCallback
- Returns the string representation for the limit part of the given select query. Domain specific limit syntax can be applied here to generate meaningful strings.
- Specified by:
- buildLimit in interface ISelectQueryCallback
- Specified by:
- buildLimit in class com.ibm.websphere.query.callbacks.SelectQueryCallbackAdapter
- Throws:
- QueryException
- See Also:
- ISelectQueryCallback#buildLimit(ISelectQuery)
Tree PREV CLASS NEXT CLASS SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD