|
© 2005 BEA Systems, Inc. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.bea.p13n.content.document.ref.RefSQLGenerator
A class which generate and execute SQL based upon the reference document management implementation.
Nested Class Summary | |
static class |
RefSQLGenerator.Info
Deprecated. The generated SQL and information about the Search. |
Field Summary | |
static short |
AND_TYPE
Deprecated. The LogicalAnd/LogicalMulitAnd expression type. |
static short |
COLLECTION_CONTAINS_ALL_TYPE
Deprecated. The CollectionContainsAll expression type. |
static short |
COLLECTION_CONTAINS_TYPE
Deprecated. The CollectionContains expression type. |
static DateFormat |
dateFormat
Deprecated. A date formatter for "MM/dd/yyyy HH:mm:ss z" (02/28/2000 15:58:35 MST). |
static Map |
defPropertyColumnMap
Deprecated. The default map of property name to document table column name. |
static Map |
defPropertyTypeMap
Deprecated. The default map of property names to valid value class. |
String |
docMDTable
Deprecated. The document_metadata table name this should use. |
String |
docTable
Deprecated. The document table name this should use. |
static short |
EQUALS_TYPE
Deprecated. The Equals expression type. |
boolean |
failOnNonExplicit
Deprecated. Control what happens if docMDTable is null and a property is
found that isn't in propertyColumnMap .
|
static short |
GREATER_OR_EQUALS_TYPE
Deprecated. The GreaterOrEquals expression type. |
static short |
GREATER_THAN_TYPE
Deprecated. The GreaterThan expression type. |
static RefSQLGenerator |
instance
Deprecated. A default static instance. |
static short |
LESS_OR_EQUALS_TYPE
Deprecated. The LessOrEquals expression type. |
static short |
LESS_THAN_TYPE
Deprecated. The LessThan expression type. |
static short |
LIKE_TYPE
Deprecated. The StringLike expression type. |
static short |
NOT_EQUALS_TYPE
Deprecated. The NotEquals expression type. |
static short |
NOT_TYPE
Deprecated. The LogicalNot expression type. |
static short |
OR_TYPE
Deprecated. The LogicalOr/LogicalMulitOr expression type. |
Map |
propertyColumnMap
Deprecated. The map of Criteria property to table column name this should use. |
Map |
propertyTypeMap
Deprecated. The map of property to valid value class this should use. |
boolean |
sortExplicitOnly
Deprecated. Control if sorting should happen on explicit properties only. |
Constructor Summary | |
RefSQLGenerator()
Deprecated. |
Method Summary | |
protected void |
createBranchInfo(StringBuffer buf,
Expression expr,
List params,
boolean supportsLikeEscapeClause)
Deprecated. Utility to convert a branch expression into a SQL expression. |
protected String |
createInfo(Expression expr,
List params,
boolean supportsLikeEscapeClause)
Deprecated. Utility method to convert an Expression into a SQL expression. |
protected void |
createInfo(StringBuffer buf,
Expression expr,
List params,
boolean supportsLikeEscapeClause)
Deprecated. Utility method to convert an Expression into a SQL expression. |
protected void |
createLeafInfo(StringBuffer buf,
Expression expr,
List params,
boolean supportsLikeEscapeClause)
Deprecated. Utility to convert a valid leaf Expression into a SQL expression. |
String |
getExpressionString(short type)
Deprecated. Get the expression string for the specified expression type. |
short |
getExpressionType(Expression expr)
Deprecated. Get a type constant for the given expression. |
protected static PropertyRef |
getLeftHandSide(Expression expr)
Deprecated. Get the left-hand-side of an expression. |
protected static Object |
getRightHandSide(Expression expr)
Deprecated. Get the right-hand-side of an expression. |
RefSQLGenerator.Info |
getSearchInfo(String baseSql,
Search params,
boolean supportsLikeEscapeClause)
Deprecated. Utility method to get an Info object from the Search params. |
String |
getSQLOperator(short type)
Deprecated. Return the corresponding SQL operator for the given expression type. |
protected static Expression |
getSubExpression(Expression expr,
int count)
Deprecated. Get the specified subexpression. |
boolean |
isLegalSingleValueExpressionType(short type)
Deprecated. Determine if a comparator is legal, single-value attribute comparator. |
PreparedStatement |
prepare(Connection con,
RefSQLGenerator.Info info)
Deprecated. Prepare a JDBC statement from the specified information on the given database connection. |
void |
sort(List list,
RefSQLGenerator.Info info)
Deprecated. Sort a list of DocumentMetadataDefs based upon the info's sort criteria. |
Object |
toSQLLike(Object obj,
boolean supportsLikeEscapeClause)
Deprecated. Convert an object, which might be a string, to a SQL like string. |
Object |
toSQLLike(Object obj,
boolean patternMatchIgnoreCase,
boolean supportsLikeEscapeClause)
Deprecated. Convert an object, which might be a string, to a SQL like string. |
String |
toSQLLike(String like,
boolean supportsLikeEscapeClause)
Deprecated. Convert a query LIKE value to a SQL LIKE value. |
String |
toSQLLike(String like,
boolean patternMatchIgnoreCase,
boolean supportsLikeEscapeClause)
Deprecated. Convert a query LIKE value to a SQL LIKE value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final short AND_TYPE
getExpressionType(com.bea.p13n.expression.Expression)
,
Constant Field Valuespublic static final short COLLECTION_CONTAINS_ALL_TYPE
getExpressionType(com.bea.p13n.expression.Expression)
,
Constant Field Valuespublic static final short COLLECTION_CONTAINS_TYPE
getExpressionType(com.bea.p13n.expression.Expression)
,
Constant Field Valuespublic static final DateFormat dateFormat
public static final Map defPropertyColumnMap
public static final Map defPropertyTypeMap
public String docMDTable
Set this to null for this to only handle explicit properties. In
this case, if a property is found that is not in the
propertyColumnMap
, this will either produce SQL that will never
match (if failOnNonExplicit
is false) or throw an exception (if
failOnNonExplicit
is true).
RefDocumentProvider.DOC_MD_TABLE
public String docTable
RefDocumentProvider.DOC_TABLE
public static final short EQUALS_TYPE
getExpressionType(com.bea.p13n.expression.Expression)
,
Constant Field Valuespublic boolean failOnNonExplicit
docMDTable
is null and a property is
found that isn't in propertyColumnMap
.
If this is true, an exception will be thrown; otherwise, SQL that will never match any document will be generated (default).
public static final short GREATER_OR_EQUALS_TYPE
getExpressionType(com.bea.p13n.expression.Expression)
,
Constant Field Valuespublic static final short GREATER_THAN_TYPE
getExpressionType(com.bea.p13n.expression.Expression)
,
Constant Field Valuespublic static final RefSQLGenerator instance
This can be used to access any of the default utility method implementations:
getExpressionType(com.bea.p13n.expression.Expression)
getExpressionString(short)
isLegalSingleValueExpressionType(short)
getSQLOperator(short)
toSQLLike(java.lang.String, boolean, boolean)
public static final short LESS_OR_EQUALS_TYPE
getExpressionType(com.bea.p13n.expression.Expression)
,
Constant Field Valuespublic static final short LESS_THAN_TYPE
getExpressionType(com.bea.p13n.expression.Expression)
,
Constant Field Valuespublic static final short LIKE_TYPE
getExpressionType(com.bea.p13n.expression.Expression)
,
Constant Field Valuespublic static final short NOT_EQUALS_TYPE
getExpressionType(com.bea.p13n.expression.Expression)
,
Constant Field Valuespublic static final short NOT_TYPE
getExpressionType(com.bea.p13n.expression.Expression)
,
Constant Field Valuespublic static final short OR_TYPE
getExpressionType(com.bea.p13n.expression.Expression)
,
Constant Field Valuespublic Map propertyColumnMap
If the property name from the expression is in this map, then the
associated value will be the document
table column
name in the resulting SQL statement. If the property name is not in
this map, then it is assumed the property is from the
document_metadata
table (unless
docMDTable
is set null, in which case an exception is
raised). For example, if the property name is "identifier" and the
associated value in the map is "ID", then all expressions written
against "identifier" will get converted into SQL statements againsts
the "ID" column of the document
table.
public Map propertyTypeMap
If the property name from the expression is in propertyColumnMap, it
also needs to be in this map. The associated value is the Class object
minimum type that the literal in the expression being compared to the
property must have. For example, if the property name "size" is mapped
to the "DOCUMENT_SIZE" column in propertyColumnMap
and mapped
to Number.class
here, then, in the expression, all
comparisions to "size" must be against numbers (e.g. "size != 1024",
"size < 10000.0").
public boolean sortExplicitOnly
Explicit properties are those that are mapped to
document
table columns in propertyColumnMap
.
If the sortBy of a Search contains a non-explicit property reference
and docMDTable
is not null, this will control what happens. If
this is false (the default), then the SortCriteria will be assigned to
the Info instance and no database level sorting will occur;
something else should handle the sorting (the sort(java.util.List, com.bea.p13n.content.document.ref.RefSQLGenerator.Info)
method can
be used to sort a List of DocumentMetadataDefs). If this is
true, then the property will be skipped for the sort and all sorting
will occur in the database.
Constructor Detail |
public RefSQLGenerator()
Method Detail |
protected void createBranchInfo(StringBuffer buf, Expression expr, List params, boolean supportsLikeEscapeClause) throws DocumentException
buf
- the string buffer to write into.expr
- the branch expression.params
- the prepared statement input parameters list (will be
appended to).supportsLikeEscapeClause
- tells if the SQL statement can use the
LIKE ESCAPE clause.
DocumentException
- thrown on invalid expression data.protected String createInfo(Expression expr, List params, boolean supportsLikeEscapeClause) throws DocumentException
expr
- the expression object.params
- the prepared statement input parameters list (will be
appended to).supportsLikeEscapeClause
- tells if the SQL statement can use the
LIKE ESCAPE clause.
DocumentException
- thrown on invalid expression data.protected void createInfo(StringBuffer buf, Expression expr, List params, boolean supportsLikeEscapeClause) throws DocumentException
buf
- the string buffer to write into.expr
- the expression object.params
- the prepared statement input parameters list (will be
appended to).supportsLikeEscapeClause
- tells if the SQL statement can use the
LIKE ESCAPE clause.
DocumentException
- thrown on invalid expression data.protected void createLeafInfo(StringBuffer buf, Expression expr, List params, boolean supportsLikeEscapeClause) throws DocumentException
buf
- the string buffer to write into.expr
- the expression object.params
- the prepared statement input parameters list (will be
appended to).supportsLikeEscapeClause
- tells if the SQL statement can use the
LIKE ESCAPE clause.
DocumentException
- thrown on invalid expression data.public String getExpressionString(short type) throws DocumentException
DocumentException
NOT_EQUALS_TYPE
,
EQUALS_TYPE
,
GREATER_THAN_TYPE
,
LESS_THAN_TYPE
,
GREATER_OR_EQUALS_TYPE
,
LESS_OR_EQUALS_TYPE
,
LIKE_TYPE
,
COLLECTION_CONTAINS_TYPE
,
COLLECTION_CONTAINS_ALL_TYPE
,
AND_TYPE
,
OR_TYPE
,
NOT_TYPE
public short getExpressionType(Expression expr) throws DocumentException
DocumentException
NOT_EQUALS_TYPE
,
EQUALS_TYPE
,
GREATER_THAN_TYPE
,
LESS_THAN_TYPE
,
GREATER_OR_EQUALS_TYPE
,
LESS_OR_EQUALS_TYPE
,
LIKE_TYPE
,
COLLECTION_CONTAINS_TYPE
,
COLLECTION_CONTAINS_ALL_TYPE
,
AND_TYPE
,
OR_TYPE
,
NOT_TYPE
protected static PropertyRef getLeftHandSide(Expression expr) throws DocumentException
DocumentException
- thrown on invalid expression.ExpressionHelper.getLeftHandSide(com.bea.p13n.expression.Expression)
protected static Object getRightHandSide(Expression expr) throws DocumentException
DocumentException
- thrown on invalid expression.ExpressionHelper.getRightHandSide(com.bea.p13n.expression.Expression)
public RefSQLGenerator.Info getSearchInfo(String baseSql, Search params, boolean supportsLikeEscapeClause) throws DocumentException
baseSql
- the base select part of the sql (no from, no where).params
- the list to add the prepared statement parameters to.supportsLikeEscapeClause
- tells if the SQL statement can use the
LIKE ESCAPE clause.
DocumentException
public String getSQLOperator(short type) throws DocumentException
DocumentException
protected static Expression getSubExpression(Expression expr, int count) throws DocumentException
DocumentException
- thrown on invalid expression.ExpressionHelper.getSubExpression(com.bea.p13n.expression.Expression, int)
public boolean isLegalSingleValueExpressionType(short type)
public PreparedStatement prepare(Connection con, RefSQLGenerator.Info info) throws SQLException
SQLException
public void sort(List list, RefSQLGenerator.Info info) throws DocumentException
DocumentException
public Object toSQLLike(Object obj, boolean supportsLikeEscapeClause)
public Object toSQLLike(Object obj, boolean patternMatchIgnoreCase, boolean supportsLikeEscapeClause)
public String toSQLLike(String like, boolean supportsLikeEscapeClause)
public String toSQLLike(String like, boolean patternMatchIgnoreCase, boolean supportsLikeEscapeClause)
|
© 2005 BEA Systems, Inc. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |