|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface QueryBuilder
This object is used to build Query objects that can be passed to the Repository. Repositories do not need to implement all the query operations below. If an operation is not supported it is best to throw a RepositoryException. The Query and QueryExpression interfaces are designed to be open and flexible to allow different internal representations of query operations. An implementation of this interface is provided in QueryBuilderImpl. This class uses specific classes (e.g. AndQuery, PropertyQueryExpression, etc) to represent the query data structure. A developer wishing to create their own QueryBuilder does not have to subclass these classes.
Query
,
QueryExpression
,
QueryBuilderImpl
,
RepositoryView.getQueryBuilder()
,
RepositoryView.executeQuery(atg.repository.Query)
Field Summary | |
---|---|
static java.lang.String |
CLASS_VERSION
|
static int |
CONTAINS
Pattern matching operation CONTAINS . |
static int |
ENDS_WITH
Pattern matching operation ENDS_WITH . |
static int |
EQUALS
Comparison Relation == |
static int |
GREATER_THAN
Comparison Relation > |
static int |
GREATER_THAN_OR_EQUALS
Comparison Relation >= |
static int |
LESS_THAN
Comparison Relation < |
static int |
LESS_THAN_OR_EQUALS
Comparison Relation <= |
static int |
NOT_CONTAINS
Pattern matching operation NOT_CONTAINS . |
static int |
NOT_ENDS_WITH
Pattern matching operation NOT_ENDS_WITH . |
static int |
NOT_EQUALS
Comparison Relation != |
static int |
NOT_STARTS_WITH
Pattern matching operation NOT_STARTS_WITH . |
static int |
STARTS_WITH
Pattern matching operation STARTS_WITH . |
Method Summary | |
---|---|
Query |
addContextMembershipFilters(Query pQuery,
atg.repository.ContextFilteringRules pRules)
Add context membership query filters to the given query based on the ContextFilteringRules supplied. |
Query |
createAndQuery(Query[] pQueryElements)
Creates a query representing the logical AND of several queries. |
Query |
createComparisonQuery(QueryExpression pExpression1,
QueryExpression pExpression2,
int pComparisonRelation)
Creates a query representing an equivalence relationship between two expressions. |
QueryExpression |
createConstantQueryExpression(java.lang.Object pValue)
Returns a QueryExpression for the supplied constant object |
QueryExpression |
createCountQueryExpression(QueryExpression pCollection)
Returns a QueryExpression which represents the total number of elements for a collection for the given item. |
QueryExpression |
createElementAtQueryExpression(QueryExpression pIndex,
QueryExpression pCollection)
Returns a QueryExpression which represents an element in a collection of a property at a specified index. |
Query |
createIdMatchingQuery(java.lang.String[] pIds)
Creates a query which when executed will return all items with the given ids. |
Query |
createIncludesAllQuery(QueryExpression pCollection1,
QueryExpression pCollection2)
Creates a query that is matched if the property, which must evaluate to a Collection-like object, includes all of the values in the second Collection-like object. |
Query |
createIncludesAnyQuery(QueryExpression pCollection1,
QueryExpression pCollection2)
Creates a query that is matched if the property, which must evaluate to a Collection-like object, includes any of the values in the second Collection-like object. |
Query |
createIncludesItemQuery(QueryExpression pCollection,
Query pQuery)
This query takes two parameters. |
Query |
createIncludesQuery(QueryExpression pCollection,
QueryExpression pItem)
Creates a query that is matched if the property, which must evaluate to a Collection-like object, includes the supplied value. |
QueryExpression |
createIndexOfQueryExpression(QueryExpression pItem,
QueryExpression pCollection)
Returns a QueryExpression which represents the numeric index location of the supplied object in the given collection |
Query |
createIsNullQuery(QueryExpression pProperty)
Creates a query that is matched if the property is null (not defined). |
Query |
createNotQuery(Query pQueryElement)
Creates a query representing the logical NOT of a query |
Query |
createOrQuery(Query[] pQueryElements)
Creates a query representing the logical OR of several queries. |
Query |
createPatternMatchQuery(QueryExpression pContainerString,
QueryExpression pContainedString,
int pMatchingOperation)
Creates a query representing a pattern matching operation. |
Query |
createPatternMatchQuery(QueryExpression pContainerString,
QueryExpression pContainedString,
int pMatchingOperation,
boolean pIgnoreCase)
Creates a query representing a pattern matching operation. |
QueryExpression |
createPropertyQueryExpression(QueryExpression pParentProperty,
java.lang.String pPropertyName)
If the repository supports sub-property queries, returns a property query expression for the named property of the supplied property query expression. |
QueryExpression |
createPropertyQueryExpression(java.lang.String pPropertyName)
Returns a property query expression for the supplied property name. |
Query |
createReferencedByQuery(RepositoryPropertyDescriptor pProperty,
Query pQuery)
This query takes two parameters. |
Query |
createTextSearchQuery(QueryExpression pSearchString,
QueryExpression pSearchStringFormat,
QueryExpression pMinScore)
Creates a query representing the full text search query operation. |
Query |
createTextSearchQuery(QueryExpression pProperty,
QueryExpression pSearchString,
QueryExpression pSearchStringFormat,
QueryExpression pMinScore)
Creates a query representing the full text search query operation. |
Query |
createUnconstrainedQuery()
Creates a query which when executed would return all the items available from this view. |
RepositoryView |
getRepositoryView()
Returns the repository view that this query builder was created from. |
Field Detail |
---|
static final java.lang.String CLASS_VERSION
static final int EQUALS
==
createComparisonQuery
,
Constant Field Valuesstatic final int NOT_EQUALS
!=
createComparisonQuery
,
Constant Field Valuesstatic final int LESS_THAN
<
createComparisonQuery
,
Constant Field Valuesstatic final int GREATER_THAN
>
createComparisonQuery
,
Constant Field Valuesstatic final int LESS_THAN_OR_EQUALS
<=
createComparisonQuery
,
Constant Field Valuesstatic final int GREATER_THAN_OR_EQUALS
>=
createComparisonQuery
,
Constant Field Valuesstatic final int CONTAINS
CONTAINS
.
e.g. "foobar" contains "foo"
createPatternMatchQuery
,
Constant Field Valuesstatic final int STARTS_WITH
STARTS_WITH
.
e.g. "foobar" starts with "foo"
createPatternMatchQuery
,
Constant Field Valuesstatic final int ENDS_WITH
ENDS_WITH
.
e.g. "foobar" ends with "bar"
createPatternMatchQuery
,
Constant Field Valuesstatic final int NOT_CONTAINS
NOT_CONTAINS
.
e.g. not "foobar" contains "foo"
createPatternMatchQuery
,
Constant Field Valuesstatic final int NOT_STARTS_WITH
NOT_STARTS_WITH
.
e.g. not "foobar" starts with "foo"
createPatternMatchQuery
,
Constant Field Valuesstatic final int NOT_ENDS_WITH
NOT_ENDS_WITH
.
e.g. not "foobar" ends with "bar"
createPatternMatchQuery
,
Constant Field ValuesMethod Detail |
---|
RepositoryView getRepositoryView()
Query createAndQuery(Query[] pQueryElements) throws RepositoryException
RepositoryException
- if there was an error building the query operationQuery createOrQuery(Query[] pQueryElements) throws RepositoryException
RepositoryException
- if there was an error building the query operationQuery createNotQuery(Query pQueryElement) throws RepositoryException
RepositoryException
- if there was an error building the query operationQuery createUnconstrainedQuery() throws RepositoryException
RepositoryException
- if there was an error building the query operationQuery createIdMatchingQuery(java.lang.String[] pIds) throws RepositoryException
RepositoryException
- if there was an error building the query operationQuery addContextMembershipFilters(Query pQuery, atg.repository.ContextFilteringRules pRules) throws RepositoryException
pQuery
- The query to which constraints are to be added.pRules
- The ContextFilteringRules to use for generating the filters
RepositoryException
Query createComparisonQuery(QueryExpression pExpression1, QueryExpression pExpression2, int pComparisonRelation) throws RepositoryException
pExpression1
- first item in the equivalence relationshippExpression2
- second item in the equivalence relationshippComparisonRelation
- the comparison relation to evaluate, EQUALS, NOT_EQUALS,
GREATER_THAN, LESS_THAN, GREATER_THAN_OR_EQUALS, or LESS_THAN_OR_EQUALS.
RepositoryException
- if there was an error building the query operationQuery createIncludesQuery(QueryExpression pCollection, QueryExpression pItem) throws RepositoryException
pCollection
- should evaluate into a collectionpItem
- should evaluate into a value which will be looked for in the
collection
RepositoryException
- if there was an error building the query operationQuery createIncludesAnyQuery(QueryExpression pCollection1, QueryExpression pCollection2) throws RepositoryException
pCollection1
- should evaluate into a collectionpCollection2
- should evaluate into a collection of values which will be
looked for in the first collection
RepositoryException
- if there was an error building the query operationQuery createIncludesAllQuery(QueryExpression pCollection1, QueryExpression pCollection2) throws RepositoryException
pCollection1
- should evaluate into a collectionpCollection2
- should evaluate into a collection of values which will be
looked for in the first collection
RepositoryException
- if there was an error building the query operationQuery createIncludesItemQuery(QueryExpression pCollection, Query pQuery) throws RepositoryException
Note that the sub-query should be defined using a query builder for the repository view of the item type referenced in the collection. This is often different from the query builder used to create this particular query operation.
For example, if you have a category item type, which has a collection of products. This query can be used to return categories which have at least one product which has type="shorts" and size="medium". In this case, the sub-query (type="shorts" and size="medium") should be created using the query builder for the products repository view.
pCollection
- should be a PropertyQueryExpression which refers to
a collection of itemspQuery
- a query which should match the referenced repository items
RepositoryException
- if there was an error building the query operationQuery createReferencedByQuery(RepositoryPropertyDescriptor pProperty, Query pQuery) throws RepositoryException
Note that the sub-query should be defined using a query builder for the repository view of the item type doing the referencing. This is often different from the query builder used to create this particular query operation.
For example, if you have a category item type, which has a collection of products. This query can be used to return all products which are referenced by categories that are marked for sale. In this example, the subquery ("categories marked for sale") should be created using the query builder for the categories repository view.
pProperty
- a property which should reference the queried item
descriptorpQuery
- a query which should match the referencing repository items
RepositoryException
- if there was an error building the query operationQuery createPatternMatchQuery(QueryExpression pContainerString, QueryExpression pContainedString, int pMatchingOperation) throws RepositoryException
pContainerString
- the string which could contain the substringpContainedString
- the substring to perform the checking againstpMatchingOperation
- the matching process to evaluate, CONTAINS,
STARTS_WITH, ENDS_WITH
RepositoryException
- if there was an error building the query operationQuery createPatternMatchQuery(QueryExpression pContainerString, QueryExpression pContainedString, int pMatchingOperation, boolean pIgnoreCase) throws RepositoryException
pContainerString
- the string which could contain the substringpContainedString
- the substring to perform the checking againstpMatchingOperation
- the matching process to evaluate, CONTAINS,pIgnoreCase
- true if the match performed is case insensitive
STARTS_WITH, ENDS_WITH
RepositoryException
- if there was an error building the query operationQuery createTextSearchQuery(QueryExpression pProperty, QueryExpression pSearchString, QueryExpression pSearchStringFormat, QueryExpression pMinScore) throws RepositoryException
pProperty
- should be a PropertyQueryExpression specifying the
property whose text value should be searched. This value can be null
to search the default set of properties for this item descriptor in
this repository.pSearchString
- the string containing the full text search querypSearchStringFormat
- the name of the format that the full text
search query. If you specify null here, a default format is used. To
see the list of formats supported by a particular repository, check the
SupportedQueries.getTextSearchFormats() property.pMinScore
- This specifies an integer value from 0 to 100. It can
be used as a hint to the search engine to control how close a match must
be for an item to be returned.
RepositoryException
- if there was an error building the query operationQuery createTextSearchQuery(QueryExpression pSearchString, QueryExpression pSearchStringFormat, QueryExpression pMinScore) throws RepositoryException
pSearchString
- the string containing the full text search querypSearchStringFormat
- the name of the format that the full text
search query. If you specify null here, a default format is used. To
see the list of formats supported by a particular repository, check the
SupportedQueries.getSearchStringFormatsSupported() property.pMinScore
- This specifies an integer value from 0 to 100. It can
be used as a hint to the search engine to control how close a match must
be for an item to be returned.
RepositoryException
- if there was an error building the query operationQuery createIsNullQuery(QueryExpression pProperty) throws RepositoryException
RepositoryException
- if there was an error building the query operationQueryExpression createPropertyQueryExpression(java.lang.String pPropertyName) throws RepositoryException
pPropertyName
- the name of the property to evaluate
RepositoryException
- if there was an error building the query operationQueryExpression createPropertyQueryExpression(QueryExpression pParentProperty, java.lang.String pPropertyName) throws RepositoryException
pParentProperty
- the property expression which contains the property
named by pPropertyNamepPropertyName
- the name of the property to evaluate
RepositoryException
- if there was an error building the query
operationQueryExpression createConstantQueryExpression(java.lang.Object pValue) throws RepositoryException
pValue
- a "constant object" whose value can be determined
immediately. (e.g. Integer, Boolean, String, Vector)
RepositoryException
- if there was an error building the query operationQueryExpression createElementAtQueryExpression(QueryExpression pIndex, QueryExpression pCollection) throws RepositoryException
pCollection
- should evaluate into a collectionpIndex
- should evaluate into a value which can be used to return the element
at specific location of the collection.
like operation (e.g. an int or long)
RepositoryException
- if there was an error building the query operationQueryExpression createIndexOfQueryExpression(QueryExpression pItem, QueryExpression pCollection) throws RepositoryException
pCollection
- should evaluate into a collectionpItem
- should evaluate into a value which will be looked for in the
collection
RepositoryException
- if there was an error building the query operationQueryExpression createCountQueryExpression(QueryExpression pCollection) throws RepositoryException
pCollection
- should evaluate into a collection of items which can be counted.
RepositoryException
- if there was an error building the query operation
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |