|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.wewebu.ow.csqlc.OwCSQLCProcessor
public abstract class OwCSQLCProcessor
Content SQL Creator node processing facade.
An OwSearchNode + OwSort to content SQL abstract syntax tree conversion class.
The supported SQL syntaxes must conform generally to the SQL-92 syntax.
Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.
For licensing information read the license.txt file or
go to: http://wiki.alfresco.com
| Nested Class Summary | |
|---|---|
static class |
OwCSQLCProcessor.OwProcessContext
OwProcessContext. |
| Field Summary | |
|---|---|
protected OwSQLEntitiesResolver |
m_entitiesResolver
|
| Constructor Summary | |
|---|---|
OwCSQLCProcessor(OwSQLEntitiesResolver entitiesResolver_p)
|
|
OwCSQLCProcessor(OwSQLEntitiesResolver entitiesResolver_p,
Integer maxRows)
|
|
| Method Summary | |
|---|---|
protected String |
convertWildCards(OwSearchCriteria criteria_p,
String value_p)
(overridable) Convert the wildcards from client format into native representation and do also an escaping of characters matching the native wildcard definition. |
protected OwBetweenPredicate |
createBetweenPredicate(OwSearchCriteria criteria_p,
boolean negate_p,
OwCSQLCProcessor.OwProcessContext context_p)
|
protected String |
createCBRAllExpression(OwSearchCriteria criteria_p,
OwCSQLCProcessor.OwProcessContext context_p)
|
protected OwPredicate |
createCBRAllPredicate(OwSearchCriteria criteria_p,
OwCSQLCProcessor.OwProcessContext context_p)
|
protected String |
createCBRInExpression(OwSearchCriteria criteria_p,
OwCSQLCProcessor.OwProcessContext context_p)
|
protected OwPredicate |
createCBRInPredicate(OwSearchCriteria criteria_p,
OwCSQLCProcessor.OwProcessContext context_p)
|
protected abstract OwColumnQualifier |
createColumnQualifier(String propertyName_p,
String repositoryID_p)
|
protected OwColumnReference |
createColumnReference(OwColumnQualifier qualifier_p,
String columnName_p)
|
protected OwComparisonPredicate |
createComparisonPredicate(OwSearchCriteria criteria_p,
OwComparisonOperator comparisonOperator_p,
OwCSQLCProcessor.OwProcessContext context_p)
Create a compare predicate, is called if current predicate is a compare operator. |
protected OwSearchCondition |
createContentCondition(OwSearchNode conditionRootNode_p,
OwCSQLCProcessor.OwProcessContext context_p)
Scan the node for existence or definition of CBR (a.k.a. |
protected OwCharacterStringLiteral |
createContentSearchLiteral(List<String> textSearchExpressions_p,
OwSearchCriteria criteria_p)
(overridable) Create a literal for the content search criteria, will return a null value if the provided expression list does not contain valid values (non-empty and non-null). |
protected OwLiteral |
createDefaultLiteral(OwSearchCriteria criteria_p,
Object value_p)
|
protected OwPredicate |
createExtendedPredicate(OwSearchCriteria criteria_p,
OwCSQLCProcessor.OwProcessContext context_p,
int operator_p)
(overridable) This method is called if an unknown or by default unsupported operator is found in the provided OwSearchCriteria. |
protected abstract OwColumnQualifier |
createFromTableQualifier(String tableName_p,
String typeName_p)
|
protected OwInPredicate |
createInPredicate(OwSearchCriteria criteria_p,
boolean negate_p,
OwCSQLCProcessor.OwProcessContext context_p)
|
protected abstract String |
createJoinColumnName(OwColumnQualifier qualifier_p)
|
protected abstract OwPredicateFormat |
createLikeFormat()
|
protected OwLikePredicate |
createLikePredicate(OwSearchCriteria criteria_p,
boolean negate_p,
OwCSQLCProcessor.OwProcessContext context_p)
|
protected OwSQLDateTimeLiteral |
createLiteral(OwSearchCriteria criteria_p,
Date date_p)
|
protected OwSignedNumericLiteral |
createLiteral(OwSearchCriteria criteria_p,
Number number_p)
|
protected OwLiteral |
createLiteral(OwSearchCriteria criteria_p,
Object value_p)
|
protected OwCharacterStringLiteral |
createLiteral(OwSearchCriteria criteria_p,
String string_p)
|
protected OwLiteral |
createNullLiteral()
|
protected OwNullPredicate |
createNullPredicate(OwSearchCriteria criteria_p,
boolean negate_p,
OwCSQLCProcessor.OwProcessContext context_p)
|
protected OwQuantifiedInPredicate |
createQuantifiedInPredicate(OwSearchCriteria criteria_p,
boolean negate_p,
OwCSQLCProcessor.OwProcessContext context_p)
|
protected abstract OwColumnQualifier |
createQueryColumnQualifier(String tableName_p,
String typeName_p)
|
protected String |
createQueryFieldName(OwFieldDefinition fieldDefinition_p,
OwCSQLCProcessor.OwProcessContext context_p)
|
protected abstract OwColumnQualifier |
createQueryFieldQualifier(OwFieldDefinition fieldDefinition_p,
OwCSQLCProcessor.OwProcessContext context_p)
|
protected OwSimpleTable |
createSimpleTable(OwSelectList selectList,
OwFromClause fromClause,
OwWhereClause where)
(overridable) Factory method for OwSimpleTable object, which represents a SQL-statement object. |
OwExternal<List<OwQueryStatement>> |
createSQLStatements(OwSearchNode searchRootNode_p,
Collection<String> propertyQueryNames_p,
OwSort sortOrder_p)
Create the SQL statement(s) by parsing the provided root search node. |
OwExternal<List<OwQueryStatement>> |
createSQLStatements(OwSearchNode searchRootNode_p,
Collection<String> propertyQueryNames_p,
OwSort sortOrder_p,
int versionSelection_p)
Create the SQL statement(s) by parsing the provided root search node. |
protected OwSearchCondition |
createSubclassesConditions(List<OwClass> subclasses_p)
(overridable) |
protected abstract OwTextSearchPredicate |
createTextSearchPredicate(OwCharacterStringLiteral searchExpression_p,
OwColumnReference columnReference_p)
|
protected OwSearchCondition |
createVersionSelectionCondition(OwSearchNode searchRootNode_p,
int versionSelection_p)
|
protected abstract String |
escapeNativeWildCardRepresentation(String value_p,
Collection<OwWildCardDefinition> wildCardDefs)
If the value has characters representing native wild cards definitions, they should be escaped (if possible) before the convertWildCards(OwSearchCriteria, String)
replace all client wild cards with native representation. |
protected String |
escapeStringValue(String value_p)
String value escaping depending the definition of SQL part. |
protected Map<String,List<OwClass>> |
findMainObjectClasses(OwSearchNode searchRootNode_p)
|
protected Map<String,List<OwClass>> |
findSelectedObjectClasses(OwSearchNode searchRootNode_p,
String criteriaName_p)
|
protected abstract OwFolderPredicateFormat |
getFolderPredicateFormat()
|
protected abstract OwPredicateFormat |
getInFormat()
|
protected String |
getMainObjectCriteria()
|
Integer |
getMaxRows()
Get the max row definition. |
protected abstract OwPredicateFormat |
getQuantifiedComparisonFormat()
|
protected abstract OwPredicateFormat |
getQuantifiedInFormat()
|
protected Map<Integer,OwComparisonOperator> |
getSQLComparisonOperatorMap()
Map of operators which represent a simple compare function. |
protected void |
handleSingleContentCondition(OwSearchNode conditionRootNode_p,
OwCSQLCProcessor.OwProcessContext context_p,
List<String> textSearchExpressions_p)
(overridable) Method specific called for parsing statements where the isMultipleTextSearchSyntax() return false. |
protected abstract boolean |
isMultipleTextSearchSyntax()
|
protected boolean |
isValidPredicateValue(OwSearchCriteria criteria_p,
OwCSQLCProcessor.OwProcessContext context_p,
int operator_p)
(overridable) Simple method called during createPredicate(OwSearchCriteria, OwProcessContext) process
to quickly verify if the criteria value is good enough for a specific predicate/operator. |
protected abstract String |
joinType(OwCorrelatedTableName joinedTable_p)
|
protected boolean |
qualifySingleTable(OwSearchNode searchRootNode_p,
OwQueryStatement statement_p)
|
protected OwFieldDefinition |
retrieveDefinition(OwSearchCriteria criteria_p)
|
void |
setMaxRows(Integer rows)
Set max rows, if ResultSet size should be controlled through generated SQL statement. |
protected List<OwClass> |
subclass(OwClass mainType_p,
Map<String,List<OwClass>> typedSubclasses_p,
boolean singleMainType_p)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected OwSQLEntitiesResolver m_entitiesResolver
| Constructor Detail |
|---|
public OwCSQLCProcessor(OwSQLEntitiesResolver entitiesResolver_p)
public OwCSQLCProcessor(OwSQLEntitiesResolver entitiesResolver_p,
Integer maxRows)
| Method Detail |
|---|
protected String createQueryFieldName(OwFieldDefinition fieldDefinition_p,
OwCSQLCProcessor.OwProcessContext context_p)
throws OwException
OwException
protected abstract OwColumnQualifier createQueryFieldQualifier(OwFieldDefinition fieldDefinition_p,
OwCSQLCProcessor.OwProcessContext context_p)
throws OwException
OwException
protected abstract OwColumnQualifier createColumnQualifier(String propertyName_p,
String repositoryID_p)
throws OwException
OwException
public final OwExternal<List<OwQueryStatement>> createSQLStatements(OwSearchNode searchRootNode_p,
Collection<String> propertyQueryNames_p,
OwSort sortOrder_p)
throws OwException
searchRootNode_p - OwSearchNode root node to be used for parsingpropertyQueryNames_p - Collection List of query namessortOrder_p - OwSort defined sort for search
OwSearchNode , property collection and OwSort specification
OwException
public OwExternal<List<OwQueryStatement>> createSQLStatements(OwSearchNode searchRootNode_p,
Collection<String> propertyQueryNames_p,
OwSort sortOrder_p,
int versionSelection_p)
throws OwException
searchRootNode_p - OwSearchNode root node to be used for parsingpropertyQueryNames_p - Collection List of query namessortOrder_p - OwSort defined sort for searchversionSelection_p - int the version selection which should be handled
OwSearchNode , property collection and OwSort specification
OwException
protected boolean qualifySingleTable(OwSearchNode searchRootNode_p,
OwQueryStatement statement_p)
throws OwException
searchRootNode_p - statement_p -
OwExceptionprotected abstract String joinType(OwCorrelatedTableName joinedTable_p)
protected abstract String createJoinColumnName(OwColumnQualifier qualifier_p)
protected OwSearchCondition createSubclassesConditions(List<OwClass> subclasses_p)
throws OwException
subclasses_p -
OwExceptionprotected abstract boolean isMultipleTextSearchSyntax()
protected final List<OwClass> subclass(OwClass mainType_p,
Map<String,List<OwClass>> typedSubclasses_p,
boolean singleMainType_p)
protected abstract OwFolderPredicateFormat getFolderPredicateFormat()
protected OwSearchCondition createContentCondition(OwSearchNode conditionRootNode_p,
OwCSQLCProcessor.OwProcessContext context_p)
throws OwException
conditionRootNode_p - OwSearchNode the to be scannedcontext_p - OwProcessContext current context
OwException
protected void handleSingleContentCondition(OwSearchNode conditionRootNode_p,
OwCSQLCProcessor.OwProcessContext context_p,
List<String> textSearchExpressions_p)
throws OwException
isMultipleTextSearchSyntax() return false.
Will be called by the createContentCondition(OwSearchNode, OwProcessContext) method,
only if syntax does not allow multiple content search predicate/conditions.
conditionRootNode_p - OwSearchNode containing the content search criteriacontext_p - OwProcessContext current context for searchtextSearchExpressions_p - List of String where to attach additional expressions
OwException
protected OwCharacterStringLiteral createContentSearchLiteral(List<String> textSearchExpressions_p,
OwSearchCriteria criteria_p)
textSearchExpressions_p - List of expressions (String)criteria_p - OwSearchCriteria responsible for definition
protected OwSearchCondition createVersionSelectionCondition(OwSearchNode searchRootNode_p,
int versionSelection_p)
throws OwException
OwException
protected OwComparisonPredicate createComparisonPredicate(OwSearchCriteria criteria_p,
OwComparisonOperator comparisonOperator_p,
OwCSQLCProcessor.OwProcessContext context_p)
throws OwException
getSQLComparisonOperatorMap().
criteria_p - OwSearchCriteriacomparisonOperator_p - OwComparisonOperatorcontext_p - OwCSQLCProcessor.OwProcessContext
OwExceptionprotected abstract OwPredicateFormat getInFormat()
protected OwInPredicate createInPredicate(OwSearchCriteria criteria_p,
boolean negate_p,
OwCSQLCProcessor.OwProcessContext context_p)
throws OwException
OwException
protected OwLikePredicate createLikePredicate(OwSearchCriteria criteria_p,
boolean negate_p,
OwCSQLCProcessor.OwProcessContext context_p)
throws OwException
OwExceptionprotected abstract OwPredicateFormat createLikeFormat()
protected OwNullPredicate createNullPredicate(OwSearchCriteria criteria_p,
boolean negate_p,
OwCSQLCProcessor.OwProcessContext context_p)
throws OwException
OwExceptionprotected abstract OwPredicateFormat getQuantifiedInFormat()
protected OwQuantifiedInPredicate createQuantifiedInPredicate(OwSearchCriteria criteria_p,
boolean negate_p,
OwCSQLCProcessor.OwProcessContext context_p)
throws OwException
OwException
protected OwBetweenPredicate createBetweenPredicate(OwSearchCriteria criteria_p,
boolean negate_p,
OwCSQLCProcessor.OwProcessContext context_p)
throws OwException
OwException
protected OwPredicate createExtendedPredicate(OwSearchCriteria criteria_p,
OwCSQLCProcessor.OwProcessContext context_p,
int operator_p)
throws OwException
By default this method is throwing an invalid operation exception, and should be used to extend the operation capability of the OwCSQLCProcessor.
criteria_p - OwSearchCriteriacontext_p - OwProcessContextoperator_p - int value representing one of the OwSearchOperator.CRIT_OP_...
OwException
protected String createCBRAllExpression(OwSearchCriteria criteria_p,
OwCSQLCProcessor.OwProcessContext context_p)
throws OwException
OwException
protected OwPredicate createCBRAllPredicate(OwSearchCriteria criteria_p,
OwCSQLCProcessor.OwProcessContext context_p)
throws OwException
OwException
protected abstract OwTextSearchPredicate createTextSearchPredicate(OwCharacterStringLiteral searchExpression_p,
OwColumnReference columnReference_p)
throws OwException
OwException
protected String createCBRInExpression(OwSearchCriteria criteria_p,
OwCSQLCProcessor.OwProcessContext context_p)
throws OwException
OwException
protected OwPredicate createCBRInPredicate(OwSearchCriteria criteria_p,
OwCSQLCProcessor.OwProcessContext context_p)
throws OwException
OwExceptionprotected abstract OwPredicateFormat getQuantifiedComparisonFormat()
protected OwFieldDefinition retrieveDefinition(OwSearchCriteria criteria_p)
throws OwException
OwException
protected OwSQLDateTimeLiteral createLiteral(OwSearchCriteria criteria_p,
Date date_p)
throws OwCSQLCException
OwCSQLCException
protected OwSignedNumericLiteral createLiteral(OwSearchCriteria criteria_p,
Number number_p)
protected OwCharacterStringLiteral createLiteral(OwSearchCriteria criteria_p,
String string_p)
protected OwLiteral createDefaultLiteral(OwSearchCriteria criteria_p,
Object value_p)
protected OwLiteral createNullLiteral()
protected OwLiteral createLiteral(OwSearchCriteria criteria_p,
Object value_p)
throws OwException
OwException
protected String convertWildCards(OwSearchCriteria criteria_p,
String value_p)
criteria_p - OwSearchCriteriavalue_p - String
protected abstract String escapeNativeWildCardRepresentation(String value_p,
Collection<OwWildCardDefinition> wildCardDefs)
convertWildCards(OwSearchCriteria, String)
replace all client wild cards with native representation.
value_p - StringwildCardDefs - Collection current possible wildcards
protected Map<Integer,OwComparisonOperator> getSQLComparisonOperatorMap()
OwSearchOperator.CRIT_OP... to OwComparisonOperator
protected abstract OwColumnQualifier createQueryColumnQualifier(String tableName_p,
String typeName_p)
protected OwColumnReference createColumnReference(OwColumnQualifier qualifier_p,
String columnName_p)
protected final Map<String,List<OwClass>> findSelectedObjectClasses(OwSearchNode searchRootNode_p,
String criteriaName_p)
throws OwException
OwExceptionprotected String getMainObjectCriteria()
protected final Map<String,List<OwClass>> findMainObjectClasses(OwSearchNode searchRootNode_p)
throws OwException
OwException
protected abstract OwColumnQualifier createFromTableQualifier(String tableName_p,
String typeName_p)
protected String escapeStringValue(String value_p)
ATTENTION: This method is called by convertWildCards(OwSearchCriteria, String)
before checking if the wild cards are allowed for search criteria or not.
Wildcard escaping is done by the convertWildCards(OwSearchCriteria, String) method.
value_p - String to be escaped
protected boolean isValidPredicateValue(OwSearchCriteria criteria_p,
OwCSQLCProcessor.OwProcessContext context_p,
int operator_p)
createPredicate(OwSearchCriteria, OwProcessContext) process
to quickly verify if the criteria value is good enough for a specific predicate/operator.
Hint: This check should be kept lightweight (e.g. just verifying non-null values)!
For specific checks use the OwSearchCondition.isValid() method.
criteria_p - OwSearchCriteriacontext_p - OwCSQLCProcessor.OwProcessContextoperator_p - int representing on of OwSearchOperator.CRIT_OP_...
protected OwSimpleTable createSimpleTable(OwSelectList selectList,
OwFromClause fromClause,
OwWhereClause where)
getMaxRows() definition.
selectList - OwSelectList select property definitionsfromClause - OwFromClause SQL-from definitionwhere - OwWhereClause SQL-where definition, can be null
setMaxRows(Integer),
getMaxRows()public void setMaxRows(Integer rows)
No verification done for value, negative values are also accepted
rows - Integer can be nullpublic Integer getMaxRows()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||