Class NXQLQueryBuilder
java.lang.Object
org.nuxeo.ecm.platform.query.nxql.NXQLQueryBuilder
Helper to generate NXQL queries from XMap descriptors
- Since:
- 5.4
- Author:
- Anahide Tchertchian
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
appendClause
(String query, String clause) static void
appendStringList
(StringBuilder queryBuilder, List<?> listParam, boolean quoteParameters, boolean escape) protected static String
atomicQueryElement
(DocumentModel model, PredicateDefinition predicateDescriptor, Escaper escaper) static String
buildPattern
(String string, String key, String replacement) static Boolean
getBooleanValue
(DocumentModel model, PredicateFieldDefinition fieldDescriptor) protected static DateFormat
static String
getFieldType
(DocumentModel model, PredicateFieldDefinition fieldDescriptor) static Integer
getIntValue
(DocumentModel model, PredicateFieldDefinition fieldDescriptor) getListValue
(DocumentModel model, PredicateFieldDefinition fieldDescriptor) protected static String
getParameterWithHint
(String operator, String parameter, String hint) static String
getPlainStringValue
(DocumentModel model, PredicateFieldDefinition fieldDescriptor) static String
getQuery
(String pattern, Object[] params, boolean quoteParameters, boolean escape, DocumentModel searchDocumentModel, SortInfo... sortInfos) static String
getQuery
(DocumentModel model, WhereClauseDefinition whereClause, Object[] params, SortInfo... sortInfos) static String
getQuery
(DocumentModel model, WhereClauseDefinition whereClause, String quickFiltersClause, Object[] params, SortInfo... sortInfos) static String
getQueryElement
(DocumentModel model, PredicateDefinition predicateDescriptor, Escaper escaper) static String
getQueryElement
(DocumentModel model, WhereClauseDefinition whereClause, Object[] params) static String
getQueryElement
(DocumentModel model, WhereClauseDefinition whereClause, String quickFiltersClause, 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
replaceStringList
(String pattern, List<?> listParams, boolean quoteParameters, boolean escape, String key) static String
sanitizeFulltextInput
(String value) Remove any special character that could be mis-interpreted as a low level full-text query operator.static String
serializeFullText
(String value) protected static String
serializeUnary
(String parameter, String operator, String rvalue) protected static String
subClauseQueryElement
(DocumentModel model, PredicateDefinition predicateDescriptor)
-
Field Details
-
DEFAULT_SELECT_STATEMENT
- See Also:
-
SORTED_COLUMN
- See Also:
-
REGEXP_NAMED_PARAMETER
- See Also:
-
REGEXP_EXCLUDE_QUOTE
- See Also:
-
REGEXP_EXCLUDE_DOUBLE_QUOTE
- See Also:
-
DEFAULT_SPECIAL_CHARACTERS_REGEXP
- See Also:
-
IGNORED_CHARS_KEY
- See Also:
-
-
Method Details
-
getSortClause
- Returns:
- the built sort clause from input parameters, always non null
-
getQuery
public static String getQuery(DocumentModel model, WhereClauseDefinition whereClause, Object[] params, SortInfo... sortInfos) -
getQuery
public static String getQuery(DocumentModel model, WhereClauseDefinition whereClause, String quickFiltersClause, Object[] params, SortInfo... sortInfos) - Since:
- 8.4
-
getQueryElement
public static String getQueryElement(DocumentModel model, WhereClauseDefinition whereClause, Object[] params) -
getQueryElement
public static String getQueryElement(DocumentModel model, WhereClauseDefinition whereClause, String quickFiltersClause, Object[] params) - Since:
- 8.4
-
getQuery
public static String getQuery(String pattern, Object[] params, boolean quoteParameters, boolean escape, DocumentModel searchDocumentModel, SortInfo... sortInfos) -
appendStringList
public static void appendStringList(StringBuilder queryBuilder, List<?> listParam, boolean quoteParameters, boolean escape) -
replaceStringList
-
prepareStringLiteral
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) -
subClauseQueryElement
protected static String subClauseQueryElement(DocumentModel model, PredicateDefinition predicateDescriptor) -
atomicQueryElement
protected static String atomicQueryElement(DocumentModel model, PredicateDefinition predicateDescriptor, Escaper escaper) -
getParameterWithHint
-
sanitizeFulltextInput
Remove any special character that could be mis-interpreted as a low level full-text query operator. This method should be used by user facing callers of CoreQuery*PageProviders that use a fixed part or a pattern query. Fields in where clause already dealt with.- Returns:
- sanitized text value
- Since:
- 5.6
-
serializeFullText
-
serializeUnary
-
getPlainStringValue
public static String getPlainStringValue(DocumentModel model, PredicateFieldDefinition fieldDescriptor) -
getIntValue
-
getFieldType
-
getRawValue
-
getStringValue
-
getDateFormat
-
getListValue
public static List<String> getListValue(DocumentModel model, PredicateFieldDefinition fieldDescriptor) -
getBooleanValue
public static Boolean getBooleanValue(DocumentModel model, PredicateFieldDefinition fieldDescriptor) -
appendClause
- Since:
- 8.4
-
buildPattern
- Since:
- 8.4
-