Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.query.nxql
Class NXQLQueryBuilder

java.lang.Object
  extended by org.nuxeo.ecm.platform.query.nxql.NXQLQueryBuilder

public class NXQLQueryBuilder
extends Object

Helper to generate NXQL queries from XMap descriptors

Since:
5.4
Author:
Anahide Tchertchian

Field Summary
static String DEFAULT_SPECIAL_CHARACTERS_REGEXP
          Prepares a statement for a fulltext field by converting FULLTEXT virtual operators to a syntax that the search syntax accepts.
static String IGNORED_CHARS_KEY
           
static SimpleDateFormat sf
           
 
Method Summary
static void appendStringList(StringBuilder queryBuilder, List<?> listParam, boolean quoteParameters, boolean escape)
           
static Boolean getBooleanValue(DocumentModel model, PredicateFieldDefinition fieldDescriptor)
           
static String getFieldType(DocumentModel model, PredicateFieldDefinition fieldDescriptor)
           
static Integer getIntValue(DocumentModel model, PredicateFieldDefinition fieldDescriptor)
           
static List<String> getListValue(DocumentModel model, PredicateFieldDefinition fieldDescriptor)
           
static String getPlainStringValue(DocumentModel model, PredicateFieldDefinition fieldDescriptor)
           
static String getQuery(DocumentModel model, WhereClauseDefinition whereClause, Object[] params, SortInfo... sortInfos)
           
static String getQuery(String pattern, Object[] params, boolean quoteParameters, boolean escape, SortInfo... sortInfos)
           
static String getQueryElement(DocumentModel model, PredicateDefinition predicateDescriptor, Escaper escaper)
           
static String getQueryElement(DocumentModel model, WhereClauseDefinition whereClause, Object[] params)
           
static Object getRawValue(DocumentModel model, PredicateFieldDefinition fieldDescriptor)
           
static String getSortClause(SortInfo... sortInfos)
           
static String getStringValue(DocumentModel model, PredicateFieldDefinition fieldDescriptor)
           
static String prepareStringLiteral(String s, boolean quoteParameter, boolean escape)
          Return the string literal in a form ready to embed in an NXQL statement.
static String serializeFullText(String value)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sf

public static final SimpleDateFormat sf

DEFAULT_SPECIAL_CHARACTERS_REGEXP

public static final String DEFAULT_SPECIAL_CHARACTERS_REGEXP
Prepares a statement for a fulltext field by converting FULLTEXT virtual operators to a syntax that the search syntax accepts.

See Also:
Constant Field Values

IGNORED_CHARS_KEY

public static final String IGNORED_CHARS_KEY
See Also:
Constant Field Values
Method Detail

getSortClause

public static String getSortClause(SortInfo... sortInfos)

getQuery

public static String getQuery(DocumentModel model,
                              WhereClauseDefinition whereClause,
                              Object[] params,
                              SortInfo... sortInfos)
                       throws ClientException
Throws:
ClientException

getQueryElement

public static String getQueryElement(DocumentModel model,
                                     WhereClauseDefinition whereClause,
                                     Object[] params)
                              throws ClientException
Throws:
ClientException

getQuery

public static String getQuery(String pattern,
                              Object[] params,
                              boolean quoteParameters,
                              boolean escape,
                              SortInfo... sortInfos)
                       throws ClientException
Throws:
ClientException

appendStringList

public static void appendStringList(StringBuilder queryBuilder,
                                    List<?> listParam,
                                    boolean quoteParameters,
                                    boolean escape)

prepareStringLiteral

public static String prepareStringLiteral(String s,
                                          boolean quoteParameter,
                                          boolean escape)
Return the string literal in a form ready to embed in an NXQL statement.


getQueryElement

public static String getQueryElement(DocumentModel model,
                                     PredicateDefinition predicateDescriptor,
                                     Escaper escaper)
                              throws ClientException
Throws:
ClientException

serializeFullText

public static String serializeFullText(String value)

getPlainStringValue

public static String getPlainStringValue(DocumentModel model,
                                         PredicateFieldDefinition fieldDescriptor)

getIntValue

public static Integer getIntValue(DocumentModel model,
                                  PredicateFieldDefinition fieldDescriptor)

getFieldType

public static String getFieldType(DocumentModel model,
                                  PredicateFieldDefinition fieldDescriptor)
                           throws ClientException
Throws:
ClientException

getRawValue

public static Object getRawValue(DocumentModel model,
                                 PredicateFieldDefinition fieldDescriptor)

getStringValue

public static String getStringValue(DocumentModel model,
                                    PredicateFieldDefinition fieldDescriptor)
                             throws ClientException
Throws:
ClientException

getListValue

public static List<String> getListValue(DocumentModel model,
                                        PredicateFieldDefinition fieldDescriptor)

getBooleanValue

public static Boolean getBooleanValue(DocumentModel model,
                                      PredicateFieldDefinition fieldDescriptor)

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.