public class QueryStatementImpl extends Object implements QueryStatement, Cloneable
| Constructor and Description | 
|---|
QueryStatementImpl(Session session,
                  Collection<String> selectPropertyIds,
                  Map<String,String> fromTypes,
                  String whereClause,
                  List<String> orderByPropertyIds)
Creates a QueryStatement object for a query of one primary type joined by
 zero or more secondary types. 
 | 
QueryStatementImpl(Session session,
                  String statement)
Creates a QueryStatement object with a given statement. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
protected QueryStatementImpl | 
clone()  | 
ItemIterable<QueryResult> | 
query(boolean searchAllVersions)
Executes the query. 
 | 
ItemIterable<QueryResult> | 
query(boolean searchAllVersions,
     OperationContext context)
Executes the query. 
 | 
void | 
setBoolean(int parameterIndex,
          boolean... bool)
Sets the designated parameter to the given boolean. 
 | 
protected void | 
setDateTime(int parameterIndex,
           boolean prefix,
           Calendar... cal)  | 
protected void | 
setDateTime(int parameterIndex,
           boolean prefix,
           Date... date)  | 
protected void | 
setDateTime(int parameterIndex,
           boolean prefix,
           long... ms)  | 
void | 
setDateTime(int parameterIndex,
           Calendar... cal)
Sets the designated parameter to the given DateTime value. 
 | 
void | 
setDateTime(int parameterIndex,
           Date... date)
Sets the designated parameter to the given DateTime value. 
 | 
void | 
setDateTime(int parameterIndex,
           long... ms)
Sets the designated parameter to the given DateTime value. 
 | 
void | 
setDateTimeTimestamp(int parameterIndex,
                    Calendar... cal)
Sets the designated parameter to the given DateTime value with the prefix
 'TIMESTAMP '. 
 | 
void | 
setDateTimeTimestamp(int parameterIndex,
                    Date... date)
Sets the designated parameter to the given DateTime value with the prefix
 'TIMESTAMP '. 
 | 
void | 
setDateTimeTimestamp(int parameterIndex,
                    long... ms)
Sets the designated parameter to the given DateTime value with the prefix
 'TIMESTAMP '. 
 | 
void | 
setId(int parameterIndex,
     ObjectId... id)
Sets the designated parameter to the given object ID. 
 | 
void | 
setNumber(int parameterIndex,
         Number... num)
Sets the designated parameter to the given number. 
 | 
void | 
setProperty(int parameterIndex,
           PropertyDefinition<?> propertyDefinition)
Sets the designated parameter to the query name of the given property. 
 | 
void | 
setProperty(int parameterIndex,
           String typeId,
           String propertyId)
Sets the designated parameter to the query name of the given property. 
 | 
void | 
setString(int parameterIndex,
         String... str)
Sets the designated parameter to the given string. 
 | 
void | 
setStringContains(int parameterIndex,
                 String str)
Sets the designated parameter to the given string in a CMIS contains
 statement. 
 | 
void | 
setStringLike(int parameterIndex,
             String str)
Sets the designated parameter to the given string. 
 | 
void | 
setType(int parameterIndex,
       ObjectType type)
Sets the designated parameter to the query name of the given type. 
 | 
void | 
setType(int parameterIndex,
       String typeId)
Sets the designated parameter to the query name of the given type ID. 
 | 
void | 
setUri(int parameterIndex,
      URI... uri)
Sets the designated parameter to the given URI. 
 | 
void | 
setUrl(int parameterIndex,
      URL... url)
Sets the designated parameter to the given URL. 
 | 
String | 
toQueryString()
Returns the query statement. 
 | 
String | 
toString()  | 
public QueryStatementImpl(Session session, String statement)
session - the Session object, must not be nullstatement - the query statement with placeholders ('?'), see
            QueryStatement for detailspublic QueryStatementImpl(Session session, Collection<String> selectPropertyIds, Map<String,String> fromTypes, String whereClause, List<String> orderByPropertyIds)
session - the Session object, must not be nullselectPropertyIds - the property IDs in the SELECT statement, if null all
            properties are selectedfromTypes - a Map of type aliases (keys) and type IDs (values), the Map
            must contain exactly one primary type and zero or more
            secondary typeswhereClause - an optional WHERE clause with placeholders ('?'), see
            QueryStatement for detailsorderByPropertyIds - an optional list of properties IDs for the ORDER BY clausepublic void setType(int parameterIndex,
           String typeId)
QueryStatementsetType in interface QueryStatementparameterIndex - the parameter index (one-based)typeId - the type IDpublic void setType(int parameterIndex,
           ObjectType type)
QueryStatementsetType in interface QueryStatementparameterIndex - the parameter index (one-based)type - the object typepublic void setProperty(int parameterIndex,
               String typeId,
               String propertyId)
QueryStatementsetProperty in interface QueryStatementparameterIndex - the parameter index (one-based)propertyId - the property IDpublic void setProperty(int parameterIndex,
               PropertyDefinition<?> propertyDefinition)
QueryStatementsetProperty in interface QueryStatementparameterIndex - the parameter index (one-based)propertyDefinition - the property definitionpublic void setNumber(int parameterIndex,
             Number... num)
QueryStatementsetNumber in interface QueryStatementparameterIndex - the parameter index (one-based)num - the numberpublic void setString(int parameterIndex,
             String... str)
QueryStatementsetString in interface QueryStatementparameterIndex - the parameter index (one-based)str - the stringpublic void setStringContains(int parameterIndex,
                     String str)
QueryStatementNote that the CMIS specification requires two levels of escaping. The first level escapes ', ", \ characters to \', \" and \\. The characters *, ? and - are interpreted as text search operators and are not escaped on first level. If *, ?, - shall be used as literals, they must be passed escaped with \*, \? and \- to this method.
For all statements in a CONTAINS() clause it is required to isolate those from a query statement. Therefore a second level escaping is performed. On the second level grammar ", ', - and \ are escaped with a \. See the spec for further details.
Summary (input --> first level escaping --> second level escaping and output): * --> * --> * ? --> ? --> ? - --> - --> - \ --> \\ --> \\\\ (for any other character following other than * ? -) \* --> \* --> \\* \? --> \? --> \\? \- --> \- --> \\- ' --> \' --> \\\' " --> \" --> \\\"
setStringContains in interface QueryStatementparameterIndex - the parameter index (one-based)str - the CONTAINS stringpublic void setStringLike(int parameterIndex,
                 String str)
QueryStatementsetStringLike in interface QueryStatementparameterIndex - the parameter index (one-based)str - the LIKE stringpublic void setId(int parameterIndex,
         ObjectId... id)
QueryStatementsetId in interface QueryStatementparameterIndex - the parameter index (one-based)id - the object IDpublic void setUri(int parameterIndex,
          URI... uri)
QueryStatementsetUri in interface QueryStatementparameterIndex - the parameter index (one-based)uri - the URIpublic void setUrl(int parameterIndex,
          URL... url)
QueryStatementsetUrl in interface QueryStatementparameterIndex - the parameter index (one-based)url - the URLpublic void setBoolean(int parameterIndex,
              boolean... bool)
QueryStatementsetBoolean in interface QueryStatementparameterIndex - the parameter index (one-based)bool - the booleanpublic void setDateTime(int parameterIndex,
               Calendar... cal)
QueryStatementsetDateTime in interface QueryStatementparameterIndex - the parameter index (one-based)cal - the DateTime value as Calendar objectpublic void setDateTimeTimestamp(int parameterIndex,
                        Calendar... cal)
QueryStatementsetDateTimeTimestamp in interface QueryStatementparameterIndex - the parameter index (one-based)cal - the DateTime value as Calendar objectprotected void setDateTime(int parameterIndex,
               boolean prefix,
               Calendar... cal)
public void setDateTime(int parameterIndex,
               Date... date)
QueryStatementsetDateTime in interface QueryStatementparameterIndex - the parameter index (one-based)public void setDateTimeTimestamp(int parameterIndex,
                        Date... date)
QueryStatementsetDateTimeTimestamp in interface QueryStatementparameterIndex - the parameter index (one-based)protected void setDateTime(int parameterIndex,
               boolean prefix,
               Date... date)
public void setDateTime(int parameterIndex,
               long... ms)
QueryStatementsetDateTime in interface QueryStatementparameterIndex - the parameter index (one-based)public void setDateTimeTimestamp(int parameterIndex,
                        long... ms)
QueryStatementsetDateTimeTimestamp in interface QueryStatementparameterIndex - the parameter index (one-based)protected void setDateTime(int parameterIndex,
               boolean prefix,
               long... ms)
public String toQueryString()
QueryStatementtoQueryString in interface QueryStatementnullpublic ItemIterable<QueryResult> query(boolean searchAllVersions)
QueryStatementquery in interface QueryStatementsearchAllVersions - true if all document versions should be included in
            the search results, false if only the latest document
            versions should be included in the search resultsSession.query(String, boolean)public ItemIterable<QueryResult> query(boolean searchAllVersions, OperationContext context)
QueryStatementquery in interface QueryStatementsearchAllVersions - true if all document versions should be included in
            the search results, false if only the latest document
            versions should be included in the search resultscontext - the operation context to useSession.query(String, boolean, OperationContext)protected QueryStatementImpl clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionCopyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.