public class ObjectSearcher extends Object implements TeiidSqlConstants.Reserved, StringConstants
ADD, ALL, ALLOCATE, ALTER, AND, ANY, ARE, ARRAY, ARRAY_AGG, AS, ASC, ASENSITIVE, ASYMETRIC, ATOMIC, AUTHORIZATION, BEGIN, BETWEEN, BIGDECIMAL, BIGINT, BIGINTEGER, BINARY, BLOB, BOTH, BREAK, BY, BYTE, CALL, CALLED, CASCADED, CASE, CAST, CHAR, CHARACTER, CHECK, CLOB, CLOSE, COLLATE, COLUMN, COMMIT, CONNECT, CONSTRAINT, CONTINUE, CONVERT, CORRESPONDING, CREATE, CRITERIA, CROSS, CURRENT_DATE, CURRENT_TIME, CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE, DATALINK, DATE, DAY, DEALLOCATE, DEC, DECIMAL, DECLARE, DEFAULT, DELETE, DEREF, DESC, DESCRIBE, DETERMINISTIC, DISCONNECT, DISTINCT, DLNEWCOPY, DLPREVIOUSCOPY, DLURLCOMPLETE, DLURLCOMPLETEONLY, DLURLCOMPLETEWRITE, DLURLPATH, DLURLPATHONLY, DLURLPATHWRITE, DLURLSCHEME, DLURLSERVER, DLVALUE, DOUBLE, DROP, DYNAMIC, EACH, ELEMENT, ELSE, END, ERROR, ESCAPE, EXCEPT, EXEC, EXECUTE, EXISTS, EXTERNAL, FALSE, FETCH, FILTER, FLOAT, FOR, FOREIGN, FREE, FROM, FULL, FUNCTION, GET, GLOBAL, GRANT, GROUP, GROUPING, HAS, HAVING, HOLD, HOUR, IDENTITY, IF, IMMEDIATE, IMPORT, IN, INDICATOR, INNER, INOUT, INPUT, INSENSITIVE, INSERT, INT, INTEGER, INTERSECT, INTERVAL, INTO, IS, ISOLATION, JOIN, LANGUAGE, LARGE, LATERAL, LEADING, LEAVE, LEFT, LIKE, LIKE_REGEX, LIMIT, LOCAL, LOCALTIME, LOCALTIMESTAMP, LONG, LOOP, MAKEDEP, MAKEIND, MAKENOTDEP, MATCH, MEMBER, MERGE, METHOD, MINUTE, MODIFIES, MODULE, MONTH, MULTISET, NATIONAL, NATURAL, NCHAR, NCLOB, NEW, NO, NOCACHE, NONE, NOT, NOUNNEST, NULL, NUMERIC, OBJECT, OF, OFFSET, OLD, ON, ONLY, OPEN, OPTION, OPTIONAL, OPTIONS, OR, ORDER, OUT, OUTER, OUTPUT, OVER, OVERLAPS, PARAMETER, PARTITION, PRECISION, PREPARE, PRIMARY, PROCEDURE, RANGE, READS, REAL, RECURSIVE, REFERENCES, REFERENCING, RELEASE, RETURN, RETURNS, REVOKE, RIGHT, ROLLBACK, ROLLUP, ROW, ROWS, SAVEPOINT, SCROLL, SEARCH, SECOND, SELECT, SENSITIVE, SESSION_USER, SET, SHORT, SIMILAR, SMALLINT, SOME, SPECIFIC, SPECIFICTYPE, SQL, SQLEXCEPTION, SQLSTATE, SQLWARNING, START, STATIC, STRING, SUBMULTILIST, SYMETRIC, SYSTEM, SYSTEM_USER, TABLE, TEMPORARY, TEXTTABLE, THEN, TIME, TIMESTAMP, TIMEZONE_HOUR, TIMEZONE_MINUTE, TO, TRAILING, TRANSLATE, TRANSLATION, TREAT, TRIGGER, TRUE, UNION, UNIQUE, UNKNOWN, UPDATE, USER, USING, VALUE, VALUES, VARCHAR, VARYING, VIRTUAL, WHEN, WHENEVER, WHERE, WHILE, WINDOW, WITH, WITHIN, WITHOUT, XML, XMLAGG, XMLATTRIBUTES, XMLBINARY, XMLCAST, XMLCOMMENT, XMLCONCAT, XMLDOCUMENT, XMLELEMENT, XMLEXISTS, XMLFOREST, XMLITERATE, XMLNAMESPACES, XMLPARSE, XMLPI, XMLQUERY, XMLSERIALIZE, XMLTABLE, XMLTEXT, XMLVALIDATE, YEAR
AMPERSAND, AT, BR, CLASS, CLOSE_ANGLE_BRACKET, CLOSE_BRACE, CLOSE_BRACKET, CLOSE_PRE_CMT, CLOSE_PRE_TAG, CLOSE_SQUARE_BRACKET, COLON, COMMA, CONNECTION_SUFFIX, CURRENT_FOLDER_SYMBOL, DDL, DEFAULT_LOCAL_WORKSPACE_NAME, DIVIDE, DOLLAR_SIGN, DOT, DOT_CHAR, DOT_DOT, DOT_KOMODO, DOUBLE_BACK_SLASH, DRIVE_SEPARATOR, EMPTY_ARRAY, EMPTY_STRING, ENUM, EQUALS, FILE_EXTENSION_SEPARATOR, FILE_NAME_WILDCARD, FINAL, FORWARD_SLASH, HASH, HYPHEN, INTERFACE, JAR, JAVA, JAVA_IO_TMPDIR, JBOSS_SERVER_TMP_DIR, KOMODO, LINE_SEPARATOR, LINE_SEPARATOR_PROPERTY_NAME, LOG, MINUS, MULTIPLY, NBSP, NEW_LINE, OPEN_ANGLE_BRACKET, OPEN_BRACE, OPEN_BRACKET, OPEN_PRE_CMT, OPEN_PRE_TAG, OPEN_SQUARE_BRACKET, PARENT_FOLDER_SYMBOL, PERCENT, PIPE, PLUS, PREFIX_PATTERN, PRIVATE, PUBLIC, QUESTION_MARK, QUOTE_MARK, SEMI_COLON, SERVICE_VDB_SUFFIX, SERVICE_VDB_VIEW_MODEL, SERVICE_VDB_VIEW_SUFFIX, SOURCES, SPACE, SPEECH_MARK, SRC, STAR, STATIC, TAB, TARGET, UNDERSCORE, UNDERSCORE_CHAR, VDB_DEPLOYMENT_SUFFIX, VDB_PREFIX, XML, XML_SUFFIX, ZIP, ZIP_SUFFIX
Constructor and Description |
---|
ObjectSearcher(Repository repository) |
Modifier and Type | Method and Description |
---|---|
void |
addWhereClause(Clause whereClause)
Adds the given where clause
|
ObjectSearcher |
addWhereCompareClause(LogicalOperator operator,
String alias,
String property,
ComparisonOperator compareOperator,
String value)
Add a comparison sub-clause to the WHERE clause, eg.
|
ObjectSearcher |
addWhereCompareClause(LogicalOperator operator,
String alias,
String property,
ComparisonOperator compareOperator,
String value,
boolean caseInsensitive)
Add a comparison sub-clause to the WHERE clause, eg.
|
ObjectSearcher |
addWhereContainsClause(LogicalOperator operator,
String alias,
String property,
Repository.KeywordCriteria keywordCriteria,
String... keywords)
Add a CONTAINS sub-clause to the WHERE clause, eg.
|
ObjectSearcher |
addWhereContainsClause(LogicalOperator operator,
String alias,
String property,
String keyword)
Add a CONTAINS sub-clause to the WHERE clause, eg.
|
ObjectSearcher |
addWhereParanthesisClause(LogicalOperator operator,
Clause... childClauses) |
ObjectSearcher |
addWhereParentClause(LogicalOperator operator,
String alias,
String parentPath,
boolean childrenOnly)
Add a parent clause to the Where clause, eg.
|
ObjectSearcher |
addWherePathClause(LogicalOperator operator,
String alias,
String path)
Add a PATH clause to the Where clause, eg.
|
ObjectSearcher |
addWhereSetClause(LogicalOperator operator,
String alias,
String property,
String... values)
Add an IN sub-clause to the WHERE clause, eg.
|
boolean |
equals(Object obj) |
String |
getCustomWhereClause() |
Collection<String> |
getParameters() |
Repository |
getRepository() |
List<Clause> |
getWhereClauses() |
int |
hashCode() |
void |
read(Repository.UnitOfWork uow,
String name) |
List<KomodoObject> |
searchObjects(Repository.UnitOfWork uow)
Performs the search using the parameters of this object seacher
|
List<KomodoObject> |
searchObjects(Repository.UnitOfWork transaction,
String statement)
Performs the search using the parameters of this object seacher
|
ObjectSearcher |
setCustomWhereClause(String whereClause)
Set a custom where clause for this searcher.
|
ObjectSearcher |
setFromType(String type)
Add a node type to the From clause
|
ObjectSearcher |
setFromType(String type,
String alias)
Add a node type to the From clause
|
void |
setParameterValue(String parameter,
String value)
Set the value of a parameter.
|
String |
toString() |
String |
toString(Repository.UnitOfWork uow) |
KomodoObject |
write(Repository.UnitOfWork uow,
String name)
Write the search object to the repository
|
public ObjectSearcher(Repository repository)
repository
- the repository to searchpublic Repository getRepository()
public ObjectSearcher setFromType(String type, String alias)
type
- the type to be addedalias
- the alias of the typepublic ObjectSearcher setFromType(String type)
type
- the type to be addedpublic void addWhereClause(Clause whereClause)
whereClause
- the where clausepublic ObjectSearcher addWhereSetClause(LogicalOperator operator, String alias, String property, String... values)
operator
- the AND/OR operator preceding the clause. Can be alias
- the alias of the typeproperty
- the name of the property belonging to the typevalues
- the value(s) that the property can bepublic ObjectSearcher addWhereCompareClause(LogicalOperator operator, String alias, String property, ComparisonOperator compareOperator, String value, boolean caseInsensitive)
operator
- the AND/OR operator preceding the clause. Can be alias
- the alias of the typeproperty
- the name of the property belonging to the typecompareOperator
- the comparison operatorvalue
- the value that the property can becaseInsensitive
- the case insensitive flagpublic ObjectSearcher addWhereCompareClause(LogicalOperator operator, String alias, String property, ComparisonOperator compareOperator, String value)
operator
- the AND/OR operator preceding the clause. Can be alias
- the alias of the typeproperty
- the name of the property belonging to the typecompareOperator
- the comparison operatorvalue
- the value that the property can bepublic ObjectSearcher addWhereContainsClause(LogicalOperator operator, String alias, String property, Repository.KeywordCriteria keywordCriteria, String... keywords)
operator
- the AND/OR operator preceding the clause. Can be alias
- the alias of the typeproperty
- the name of the property belonging to the typekeywordCriteria
- the criteria settings for the given valueskeywords
- the keywords to search for in the propertypublic ObjectSearcher addWhereContainsClause(LogicalOperator operator, String alias, String property, String keyword)
operator
- the AND/OR operator preceding the clause. Can be alias
- the alias of the typeproperty
- the name of the property belonging to the typekeyword
- the keyword to search for in the propertypublic ObjectSearcher addWherePathClause(LogicalOperator operator, String alias, String path)
operator
- the AND/OR operator preceding the clause. Can be alias
- the alias of the selectorpath
- the path to be addedpublic ObjectSearcher addWhereParentClause(LogicalOperator operator, String alias, String parentPath, boolean childrenOnly)
operator
- the AND/OR operator preceding the clause. Can be alias
- the alias of the selectorparentPath
- the path to be addedchildrenOnly
- set as true if to return only the direct children, false to return all descendantspublic ObjectSearcher addWhereParanthesisClause(LogicalOperator operator, Clause... childClauses)
operator
- the AND/OR operator preceding the clause. Can be childClauses
- the child clauses to be nested in the paranthesispublic String getCustomWhereClause()
public ObjectSearcher setCustomWhereClause(String whereClause)
toString()
or be completely custom.
Note:
* no parsing of this clause will be conducted prior to appending this clause.
* do not prefix this clause with the WHERE keywordwhereClause
- custom where clause stringpublic Collection<String> getParameters()
public void setParameterValue(String parameter, String value)
parameter
- the parametervalue
- the valuepublic String toString(Repository.UnitOfWork uow)
public List<KomodoObject> searchObjects(Repository.UnitOfWork transaction, String statement) throws KException
transaction
- the transaction (cannot be null
or have a state that is not Repository.UnitOfWork.State.NOT_STARTED
)statement
- an sql2-like query statementKomodoObject
s resulting from this search. Empty list if no results are foundKException
- if error occurspublic List<KomodoObject> searchObjects(Repository.UnitOfWork uow) throws KException
uow
- a transaction. Can be nullKomodoObject
s resulting from this searchKException
- if error occurspublic KomodoObject write(Repository.UnitOfWork uow, String name) throws KException
uow
- the transaction (cannot be null
or have a state that is not
Repository.UnitOfWork.State.NOT_STARTED
)name
- the name given to the search objectKException
- if an error occurspublic void read(Repository.UnitOfWork uow, String name) throws KException
uow
- the transaction (cannot be null
or have a state that is not
Repository.UnitOfWork.State.NOT_STARTED
)name
- the name of the search to readKException
- name is not a search in the repository or if another error occursCopyright © 2013–2019. All rights reserved.