public class OwSearchSQLOperator extends Object
Standard Operator to create SQL out of a OwSearchNode Tree.
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
Modifier and Type | Class and Description |
---|---|
protected static class |
OwSearchSQLOperator.SqlOperatorSingleton
Singleton for the SQL operators.
|
Modifier and Type | Field and Description |
---|---|
static int |
DATE_MODE_DB2
date mode for converting data types in where clause, DB2 conform
|
static int |
DATE_MODE_DEFAULT
date mode for converting data types in where clause, default mode
|
static int |
DATE_MODE_FNCM
date mode for FileNet P8
|
static int |
DATE_MODE_FNIM
date mode for FileNet Image Manager (days since 1.1.1970)
|
static int |
DATE_MODE_MS_ACCESS
date mode for converting data types in where clause, Microsoft Access conform
|
static int |
DATE_MODE_MSSQL
date mode for converting data types in where clause, MSSQL conform
|
static int |
DATE_MODE_ORACLE
date mode for converting data types in where clause, ORACLE conform
|
static int |
DATE_MODE_TREAT_IGNORE_TIME_AS_RANGE
date mode for date time optional
|
protected int |
m_iMode
mode to be used
|
protected static OwSearchSQLOperator.SqlOperatorSingleton |
m_SqlOperators
singleton for the SQL operators
|
Constructor and Description |
---|
OwSearchSQLOperator(int iMode_p)
create a new operator
|
Modifier and Type | Method and Description |
---|---|
protected String |
convertWildCards(OwSearchCriteria criteria_p,
String value_p)
convert the wildcards to client format
|
boolean |
createSQLSearchCriteria(OwSearchNode searchNode_p,
Writer w_p)
traverse the search criteria tree and generate a SQL Statement
|
protected String |
getCriteriaQueryName(OwSearchCriteria criteria_p)
(overridable) Method to get the property name, which is used for query statements.
This method can be overwritten if the field definition name and field definition query name are not corresponding. |
protected static int |
getDateMode(int iMode_p)
get the date mode part of the mode flag
|
protected String |
getOperatorSQL(OwSearchCriteria criteria_p,
Object value_p,
boolean fFieldFirst_p)
get a operator SQL Statement for the given criteria
|
protected String |
getSingleOperatorSQL(OwSearchCriteria criteria_p,
Object value_p,
int iOperator_p,
boolean fFieldFirst_p)
get a single operator SQL Statement for the given criteria_p
|
protected String |
getSQLOperatorAsString(int operator_p)
Get the String representation of the operator.
|
protected String |
getSQLValueString(OwSearchCriteria criteria_p,
Object value_p,
int iDateMode_p)
get the value of the criteria and convert it to a SQL conform string
|
protected String |
getStringValue(OwSearchCriteria criteria_p,
String value_p)
prevent the usage of " or ' in SQL query
|
protected boolean |
isOperatorFieldFirst(int iOP_p)
check if given operator has its field first
|
protected boolean |
isStringLiteral(OwSearchCriteria criteria_p)
(overridable) check if given criteria is a string literal and needs quotation marks
|
void |
setDateFormats(DateFormat dateAndTimeFormat_p,
DateFormat dateFormat_p)
overwrite date format with a own one
|
public static final int DATE_MODE_FNIM
public static final int DATE_MODE_MS_ACCESS
public static final int DATE_MODE_FNCM
public static final int DATE_MODE_ORACLE
public static final int DATE_MODE_MSSQL
public static final int DATE_MODE_DB2
public static final int DATE_MODE_DEFAULT
public static final int DATE_MODE_TREAT_IGNORE_TIME_AS_RANGE
protected int m_iMode
protected static final OwSearchSQLOperator.SqlOperatorSingleton m_SqlOperators
public OwSearchSQLOperator(int iMode_p)
iMode_p
- int defined as DATE_MODE_...protected static int getDateMode(int iMode_p)
iMode_p
- int defined as bitwise combination of DATE_MODE_... and DATE_ACCURACY_...public void setDateFormats(DateFormat dateAndTimeFormat_p, DateFormat dateFormat_p)
dateAndTimeFormat_p
- date format for SQL Date and Time conversiondateFormat_p
- date format for SQL for just Date conversion, ignores time partpublic boolean createSQLSearchCriteria(OwSearchNode searchNode_p, Writer w_p) throws Exception
searchNode_p
- current search criteria tree node to traverse, null is allowedw_p
- stream to write SQL Statement toException
protected boolean isOperatorFieldFirst(int iOP_p)
iOP_p
- protected String getOperatorSQL(OwSearchCriteria criteria_p, Object value_p, boolean fFieldFirst_p) throws Exception
criteria_p
- OwSearchCriteriavalue_p
- ObjectfFieldFirst_p
- boolean true = insert the field first, false = insert the value firstException
protected String getSingleOperatorSQL(OwSearchCriteria criteria_p, Object value_p, int iOperator_p, boolean fFieldFirst_p) throws Exception
criteria_p
- OwSearchCriteriavalue_p
- ObjectfFieldFirst_p
- boolean true = insert the field first, false = insert the value firstException
protected String getSQLValueString(OwSearchCriteria criteria_p, Object value_p, int iDateMode_p) throws Exception
criteria_p
- the criteria to convertiDateMode_p
- int Date mode used to convert date types as defined with DATE_MODE_...Exception
protected boolean isStringLiteral(OwSearchCriteria criteria_p) throws Exception
criteria_p
- Exception
protected String getStringValue(OwSearchCriteria criteria_p, String value_p)
criteria_p
- OwSearchCriteriavalue_p
- Stringprotected String convertWildCards(OwSearchCriteria criteria_p, String value_p)
criteria_p
- value_p
- protected String getSQLOperatorAsString(int operator_p)
operator_p
- int OwSearchOperator.CRIT_...protected String getCriteriaQueryName(OwSearchCriteria criteria_p) throws OwException
By default this method returns criteria_p.getFieldDefinition().getClassName()
.
criteria_p
- OwSearchCriteriaOwException
- if can not retrieve field definition informationCopyright © 2014 Alfresco Business Solutions. All Rights Reserved.