Class CMISQLQueryMaker

  • All Implemented Interfaces:
    QueryMaker

    public class CMISQLQueryMaker
    extends Object
    implements QueryMaker
    Transformer of CMISQL queries into real SQL queries for the actual database.
    • Field Detail

      • NULL_IS_FALSE_COLUMNS

        public static final Set<String> NULL_IS_FALSE_COLUMNS
      • MIXINS_NOT_PER_INSTANCE

        protected static final Set<String> MIXINS_NOT_PER_INSTANCE
        These mixins never match an instance mixin when used in a clause nuxeo:secondaryObjectTypeIds = 'foo'
      • dialect

        protected Dialect dialect
      • model

        protected Model model
      • hierTable

        protected Table 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
      • lifecycleWhereClauseQualifiers

        protected Set<String> lifecycleWhereClauseQualifiers
      • mixinTypeWhereClauseQualifiers

        protected Set<String> mixinTypeWhereClauseQualifiers
      • qualifierToType

        protected Map<String,​String> qualifierToType
        Qualifier to type.
      • canonicalQualifier

        protected Map<String,​String> canonicalQualifier
        Qualifier to canonical qualifier (correlation name).
      • allQualifiers

        protected Set<String> allQualifiers
        All qualifiers used (includes virtual columns)
      • versionableQualifiers

        protected Set<String> versionableQualifiers
        The qualifiers which correspond to versionable types.
      • realColumnsParams

        protected List<String> realColumnsParams
        Parameters for above (for SCORE expressions on some databases)
      • virtualColumns

        protected Map<String,​org.apache.chemistry.opencmis.server.support.query.ColumnReference> virtualColumns
        The non-real-columns we'll return as well.
      • typeInfo

        protected Map<String,​org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition<?>> typeInfo
        Type info returned to caller.
      • searchLatestVersion

        protected boolean searchLatestVersion
        Search only latest version = !searchAllVersions.
      • virtualColumnNames

        protected List<String> virtualColumnNames
        used for diagnostic when using DISTINCT
    • Constructor Detail

      • CMISQLQueryMaker

        public CMISQLQueryMaker()
    • Method Detail

      • getName

        public String getName()
        Description copied from interface: QueryMaker
        Gets the name for this query maker.
        Specified by:
        getName in interface QueryMaker
      • accepts

        public boolean accepts​(String queryType)
        Description copied from interface: QueryMaker
        Checks if this query maker accepts a given query.

        Called first.

        Specified by:
        accepts in interface QueryMaker
        Parameters:
        queryType - the query
        Returns:
        true if 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 the NuxeoCmisService, optional params[1] is a type info map, optional params[2] is searchAllVersions (default Boolean.TRUE for this method).

        Specified by:
        buildQuery in interface QueryMaker
        Parameters:
        sqlInfo - the sql info
        model - the model
        pathResolver - the path resolver
        statement - the query
        queryFilter - the query filter
        params - 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

        protected boolean isFacetsColumn​(String name)
      • 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

        protected void recordColumnFragment​(String qual,
                                            Column column)
        Records a database column's fragment (to know what to join).
      • recordFragment

        protected void recordFragment​(String qual,
                                      Table table)
        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

        protected Column getColumn​(org.apache.chemistry.opencmis.server.support.query.ColumnReference col)
        Finds a database column from a CMIS reference.
      • getSystemColumn

        protected Column getSystemColumn​(String id)
      • 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.
      • getTypeForQualifier

        protected org.apache.chemistry.opencmis.commons.definitions.TypeDefinition getTypeForQualifier​(String qual)
      • cmisToFulltextQuery

        protected static String cmisToFulltextQuery​(String statement)