Class CMISQLQueryMaker
java.lang.Object
org.nuxeo.ecm.core.opencmis.impl.server.CMISQLQueryMaker
- All Implemented Interfaces:
QueryMaker
Transformer of CMISQL queries into real SQL queries for the actual database.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassWalker of the WHERE clause to gather fulltext info.static enumstatic classMap maker that can deal with aliased column names and computed values.classWalker of the WHERE clause that generates final SQL.static classColumn corresponding to a returned value computed from an actual SQL expression.Nested classes/interfaces inherited from interface org.nuxeo.ecm.core.storage.sql.jdbc.QueryMaker
QueryMaker.Query, QueryMaker.QueryCannotMatchException -
Field Summary
FieldsModifier and TypeFieldDescriptionAll qualifiers used (includes virtual columns)Map of qualifier -> fragment -> tableQualifier to canonical qualifier (correlation name).static final Stringprotected Databasestatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected Dialectprotected Dialect.FulltextMatchInfoprotected TableThese mixins never match an instance mixin when used in a clause nuxeo:secondaryObjectTypeIds = 'foo'protected Modelstatic final StringQualifier to type.protected org.apache.chemistry.opencmis.server.support.query.QueryObjectprotected org.apache.chemistry.opencmis.server.support.query.QueryUtilStrictprotected List<CMISQLQueryMaker.SqlColumn> The columns we'll actually request from the database.Parameters for above (for SCORE expressions on some databases)static final Stringstatic final Stringstatic final Stringprotected booleanSearch only latest version = !booleanstatic final StringType info returned to caller.The qualifiers which correspond to versionable types.used for diagnostic when using DISTINCTThe non-real-columns we'll return as well. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks if this query maker accepts a given query.protected voidaddSystemColumns(boolean addSystemColumns, boolean distinct) protected StringapplySecurityPolicyQueryTransformers(NuxeoCmisService service, NuxeoPrincipal principal, String statement) Applies security policies query transformers to the statement, if possible.buildQuery(SQLInfo sqlInfo, Model model, Session.PathResolver pathResolver, String statement, QueryFilter queryFilter, Object... params) Builds the query.protected static StringcmisToFulltextQuery(String statement) protected voidprotected ColumngetColumn(org.apache.chemistry.opencmis.server.support.query.ColumnReference col) Finds a database column from a CMIS reference.protected static StringgetColumnKey(org.apache.chemistry.opencmis.server.support.query.ColumnReference col) Get key to use in data returned to high-level caller.getName()Gets the name for this query maker.protected static StringgetPropertyKey(String qual, String id) protected Columnprotected ColumngetSystemColumn(String qual, String id) protected Tableprotected StringgetTableAlias(Table table, String qual) protected org.apache.chemistry.opencmis.commons.definitions.TypeDefinitiongetTypeForQualifier(String qual) protected booleanisFacetsColumn(String name) protected voidrecordColumnFragment(String qual, Column column) Records a database column's fragment (to know what to join).protected voidrecordFragment(String qual, Table table) Records a database table and qualifier (to know what to join).protected voidrecordSelector(org.apache.chemistry.opencmis.server.support.query.CmisSelector sel, CMISQLQueryMaker.ClauseType clauseType) Records a JOIN / WHERE / ORDER BY selector, and associates it to a database column.protected voidrecordSelectSelector(org.apache.chemistry.opencmis.server.support.query.CmisSelector sel) Records a SELECT selector, and associates it to a database column.protected voidFinds what qualifiers are allowed and to what correlation name they are mapped.
-
Field Details
-
TYPE
- See Also:
-
CMIS_PREFIX
- See Also:
-
NX_PREFIX
- See Also:
-
DC_FRAGMENT_NAME
- See Also:
-
DC_TITLE_KEY
- See Also:
-
DC_DESCRIPTION_KEY
- See Also:
-
DC_CREATOR_KEY
- See Also:
-
DC_CREATED_KEY
- See Also:
-
DC_MODIFIED_KEY
- See Also:
-
DC_LAST_CONTRIBUTOR_KEY
- See Also:
-
REL_FRAGMENT_NAME
- See Also:
-
REL_SOURCE_KEY
- See Also:
-
REL_TARGET_KEY
- See Also:
-
NULL_IS_FALSE_COLUMNS
-
MIXINS_NOT_PER_INSTANCE
These mixins never match an instance mixin when used in a clause nuxeo:secondaryObjectTypeIds = 'foo' -
database
-
dialect
-
model
-
hierTable
-
skipDeleted
public boolean skipDeleted -
queryUtil
protected org.apache.chemistry.opencmis.server.support.query.QueryUtilStrict queryUtil -
query
protected org.apache.chemistry.opencmis.server.support.query.QueryObject query -
fulltextMatchInfo
-
lifecycleWhereClauseQualifiers
-
mixinTypeWhereClauseQualifiers
-
qualifierToType
Qualifier to type. -
canonicalQualifier
Qualifier to canonical qualifier (correlation name). -
allTables
Map of qualifier -> fragment -> table -
allQualifiers
All qualifiers used (includes virtual columns) -
versionableQualifiers
The qualifiers which correspond to versionable types. -
realColumns
The columns we'll actually request from the database. -
realColumnsParams
Parameters for above (for SCORE expressions on some databases) -
virtualColumns
protected Map<String,org.apache.chemistry.opencmis.server.support.query.ColumnReference> virtualColumnsThe non-real-columns we'll return as well. -
typeInfo
protected Map<String,org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition<?>> typeInfoType info returned to caller. -
searchLatestVersion
protected boolean searchLatestVersionSearch only latest version = !searchAllVersions. -
virtualColumnNames
used for diagnostic when using DISTINCT
-
-
Constructor Details
-
CMISQLQueryMaker
public CMISQLQueryMaker()
-
-
Method Details
-
getName
Description copied from interface:QueryMakerGets the name for this query maker.- Specified by:
getNamein interfaceQueryMaker
-
accepts
Description copied from interface:QueryMakerChecks if this query maker accepts a given query.Called first.
- Specified by:
acceptsin interfaceQueryMaker- Parameters:
queryType- the query- Returns:
trueif the query is accepted
-
buildQuery
public QueryMaker.Query buildQuery(SQLInfo sqlInfo, Model model, Session.PathResolver pathResolver, String statement, QueryFilter queryFilter, Object... params) Builds the query.The optional parameters must be passed:
params[0]is theNuxeoCmisService, optionalparams[1]is a type info map, optionalparams[2]is searchAllVersions (defaultBoolean.TRUEfor this method).- Specified by:
buildQueryin interfaceQueryMaker- Parameters:
sqlInfo- the sql infomodel- the modelpathResolver- the path resolverstatement- the queryqueryFilter- the query filterparams- additional parameters, maker-specific
-
applySecurityPolicyQueryTransformers
protected String applySecurityPolicyQueryTransformers(NuxeoCmisService service, NuxeoPrincipal principal, String statement) Applies security policies query transformers to the statement, if possible. Otherwise raises an exception.- Throws:
org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException- If a security policy prevents doing CMIS queries.- Since:
- 5.7.2
-
findVersionableQualifiers
protected void findVersionableQualifiers() -
isFacetsColumn
-
addSystemColumns
protected void addSystemColumns(boolean addSystemColumns, boolean distinct) -
recordSelectSelector
protected void recordSelectSelector(org.apache.chemistry.opencmis.server.support.query.CmisSelector sel) Records a SELECT selector, and associates it to a database column. -
recordSelector
protected void recordSelector(org.apache.chemistry.opencmis.server.support.query.CmisSelector sel, CMISQLQueryMaker.ClauseType clauseType) Records a JOIN / WHERE / ORDER BY selector, and associates it to a database column. -
recordColumnFragment
Records a database column's fragment (to know what to join). -
recordFragment
Records a database table and qualifier (to know what to join). -
resolveQualifiers
protected void resolveQualifiers()Finds what qualifiers are allowed and to what correlation name they are mapped. -
getColumn
Finds a database column from a CMIS reference. -
getSystemColumn
-
getSystemColumn
-
getColumnKey
protected static String getColumnKey(org.apache.chemistry.opencmis.server.support.query.ColumnReference col) Get key to use in data returned to high-level caller. -
getPropertyKey
-
getTypeForQualifier
protected org.apache.chemistry.opencmis.commons.definitions.TypeDefinition getTypeForQualifier(String qual) -
getTable
-
getTableAlias
-
cmisToFulltextQuery
-