Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2003 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.content.document.ref
Class RefSQLGenerator

    java.lang.Object
      |
      +--com.bea.p13n.content.document.ref.RefSQLGenerator

public class RefSQLGenerator
extends Object

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

### instance

    public static final RefSQLGenerator instance

  Deprecated.
  A default static 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)`
  Those methods exist as instance methods to allow for subclasses to override behavior.

### NOT_EQUALS_TYPE

    public static final short NOT_EQUALS_TYPE

  Deprecated.
  The NotEquals expression type.

  See Also:
    `getExpressionType(com.bea.p13n.expression.Expression)`, Constant Field Values

### EQUALS_TYPE

    public static final short EQUALS_TYPE

  Deprecated.
  The Equals expression type.

  See Also:
    `getExpressionType(com.bea.p13n.expression.Expression)`, Constant Field Values

### GREATER_THAN_TYPE

    public static final short GREATER_THAN_TYPE

  Deprecated.
  The GreaterThan expression type.

  See Also:
    `getExpressionType(com.bea.p13n.expression.Expression)`, Constant Field Values

### LESS_THAN_TYPE

    public static final short LESS_THAN_TYPE

  Deprecated.
  The LessThan expression type.

  See Also:
    `getExpressionType(com.bea.p13n.expression.Expression)`, Constant Field Values

### GREATER_OR_EQUALS_TYPE

    public static final short GREATER_OR_EQUALS_TYPE

  Deprecated.
  The GreaterOrEquals expression type.

  See Also:
    `getExpressionType(com.bea.p13n.expression.Expression)`, Constant Field Values

### LESS_OR_EQUALS_TYPE

    public static final short LESS_OR_EQUALS_TYPE

  Deprecated.
  The LessOrEquals expression type.

  See Also:
    `getExpressionType(com.bea.p13n.expression.Expression)`, Constant Field Values

### LIKE_TYPE

    public static final short LIKE_TYPE

  Deprecated.
  The StringLike expression type.

  See Also:
    `getExpressionType(com.bea.p13n.expression.Expression)`, Constant Field Values

### COLLECTION_CONTAINS_TYPE

    public static final short COLLECTION_CONTAINS_TYPE

  Deprecated.
  The CollectionContains expression type.

  See Also:
    `getExpressionType(com.bea.p13n.expression.Expression)`, Constant Field Values

### COLLECTION_CONTAINS_ALL_TYPE

    public static final short COLLECTION_CONTAINS_ALL_TYPE

  Deprecated.
  The CollectionContainsAll expression type.

  See Also:
    `getExpressionType(com.bea.p13n.expression.Expression)`, Constant Field Values

### AND_TYPE

    public static final short AND_TYPE

  Deprecated.
  The LogicalAnd/LogicalMulitAnd expression type.

  See Also:
    `getExpressionType(com.bea.p13n.expression.Expression)`, Constant Field Values

### OR_TYPE

    public static final short OR_TYPE

  Deprecated.
  The LogicalOr/LogicalMulitOr expression type.

  See Also:
    `getExpressionType(com.bea.p13n.expression.Expression)`, Constant Field Values

### NOT_TYPE

    public static final short NOT_TYPE

  Deprecated.
  The LogicalNot expression type.

  See Also:
    `getExpressionType(com.bea.p13n.expression.Expression)`, Constant Field Values

### defPropertyColumnMap

    public static final Map defPropertyColumnMap

  Deprecated.
  The default map of property name to document table column name.

### defPropertyTypeMap

    public static final Map defPropertyTypeMap

  Deprecated.
  The default map of property names to valid value class.

### dateFormat

    public static final DateFormat dateFormat

  Deprecated.
  A date formatter for "MM/dd/yyyy HH:mm:ss z" (02/28/2000 15:58:35 MST).

### docTable

    public String docTable

  Deprecated.
  The document table name this should use.

  See Also:
    `RefDocumentProvider.DOC_TABLE`

### docMDTable

    public String docMDTable

  Deprecated.
  The document_metadata table name this should use.

  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).

  See Also:
    `RefDocumentProvider.DOC_MD_TABLE`

### propertyColumnMap

    public Map propertyColumnMap

  Deprecated.
  The map of Criteria property to table column name this should use.

  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.

### propertyTypeMap

    public Map propertyTypeMap

  Deprecated.
  The map of property to valid value class this should use.

  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").

### sortExplicitOnly

    public boolean sortExplicitOnly

  Deprecated.
  Control if sorting should happen on explicit properties only.

  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.

### failOnNonExplicit

    public boolean failOnNonExplicit

  Deprecated.
  Control what happens if `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).

Constructor Detail

### RefSQLGenerator

    public RefSQLGenerator()

  Deprecated.

Method Detail

### prepare

    public PreparedStatement prepare(Connection con,
                                     RefSQLGenerator.Info info)
                              throws SQLException

  Deprecated.
  Prepare a JDBC statement from the specified information on the given database connection.

    `SQLException`

### sort

    public void sort(List list,
                     RefSQLGenerator.Info info)
              throws DocumentException

  Deprecated.
  Sort a list of DocumentMetadataDefs based upon the info's sort criteria.

    `DocumentException`

### getSearchInfo

    public RefSQLGenerator.Info getSearchInfo(String baseSql,
                                              Search params,
                                              boolean supportsLikeEscapeClause)
                                       throws DocumentException

  Deprecated.
  Utility method to get an Info object from the Search params.

  Parameters:
    `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`

### createInfo

    protected String createInfo(Expression expr,
                                List params,
                                boolean supportsLikeEscapeClause)
                         throws DocumentException

  Deprecated.
  Utility method to convert an Expression into a SQL expression.

  Parameters:
    `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.
  Returns:
    the SQL expression (no WHERE, no SELECT).
  Throws:
    `DocumentException` - thrown on invalid expression data.

### createInfo

    protected void createInfo(StringBuffer buf,
                              Expression expr,
                              List params,
                              boolean supportsLikeEscapeClause)
                       throws DocumentException

  Deprecated.
  Utility method to convert an Expression into a SQL expression.

  Parameters:
    `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.
  Returns:
    the SQL expression (no WHERE, no SELECT).
  Throws:
    `DocumentException` - thrown on invalid expression data.

### getSubExpression

    protected static Expression getSubExpression(Expression expr,
                                                 int count)
                                          throws DocumentException

  Deprecated.
  Get the specified subexpression.

  Throws:
    `DocumentException` - thrown on invalid expression.
  See Also:
    `ExpressionHelper.getSubExpression(com.bea.p13n.expression.Expression, int)`

### getLeftHandSide

    protected static PropertyRef getLeftHandSide(Expression expr)
                                          throws DocumentException

  Deprecated.
  Get the left-hand-side of an expression.

  Throws:
    `DocumentException` - thrown on invalid expression.
  See Also:
    `ExpressionHelper.getLeftHandSide(com.bea.p13n.expression.Expression)`

### getRightHandSide

    protected static Object getRightHandSide(Expression expr)
                                      throws DocumentException

  Deprecated.
  Get the right-hand-side of an expression.

  Throws:
    `DocumentException` - thrown on invalid expression.
  See Also:
    `ExpressionHelper.getRightHandSide(com.bea.p13n.expression.Expression)`

### createLeafInfo

    protected void createLeafInfo(StringBuffer buf,
                                  Expression expr,
                                  List params,
                                  boolean supportsLikeEscapeClause)
                           throws DocumentException

  Deprecated.
  Utility to convert a valid leaf Expression into a SQL expression.

  Parameters:
    `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.
  Returns:
    the SQL expression (no WHERE, no SELECT).
  Throws:
    `DocumentException` - thrown on invalid expression data.

### createBranchInfo

    protected void createBranchInfo(StringBuffer buf,
                                    Expression expr,
                                    List params,
                                    boolean supportsLikeEscapeClause)
                             throws DocumentException

  Deprecated.
  Utility to convert a branch expression into a SQL expression.

  Parameters:
    `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.
  Returns:
    the SQL expression (no WHERE, no SELECT).
  Throws:
    `DocumentException` - thrown on invalid expression data.

### getExpressionType

    public short getExpressionType(Expression expr)
                            throws DocumentException

  Deprecated.
  Get a type constant for the given expression.

    `DocumentException`
  See Also:
    `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`

### getExpressionString

    public String getExpressionString(short type)
                               throws DocumentException

  Deprecated.
  Get the expression string for the specified expression type.

    `DocumentException`
  See Also:
    `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`

### isLegalSingleValueExpressionType

    public boolean isLegalSingleValueExpressionType(short type)

  Deprecated.
  Determine if a comparator is legal, single-value attribute comparator.

### getSQLOperator

    public String getSQLOperator(short type)
                          throws DocumentException

  Deprecated.
  Return the corresponding SQL operator for the given expression type.

    `DocumentException`

### toSQLLike

    public String toSQLLike(String like,
                            boolean patternMatchIgnoreCase,
                            boolean supportsLikeEscapeClause)

  Deprecated.
  Convert a query LIKE value to a SQL LIKE value.

### toSQLLike

    public String toSQLLike(String like,
                            boolean supportsLikeEscapeClause)

  Deprecated.
  Convert a query LIKE value to a SQL LIKE value.

### toSQLLike

    public Object toSQLLike(Object obj,
                            boolean patternMatchIgnoreCase,
                            boolean supportsLikeEscapeClause)

  Deprecated.
  Convert an object, which might be a string, to a SQL like string.

### toSQLLike

    public Object toSQLLike(Object obj,
                            boolean supportsLikeEscapeClause)

  Deprecated.
  Convert an object, which might be a string, to a SQL like string.

Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2003 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003 BEA Systems, Inc. All Rights Reserved