public class CMISQLQueryMaker extends Object implements QueryMaker
Modifier and Type | Class and Description |
---|---|
class |
CMISQLQueryMaker.AnalyzingWalker
Walker of the WHERE clause to gather fulltext info.
|
static class |
CMISQLQueryMaker.CMISQLMapMaker
Map maker that can deal with aliased column names and computed values.
|
class |
CMISQLQueryMaker.GeneratingWalker
Walker of the WHERE clause that generates final SQL.
|
static class |
CMISQLQueryMaker.SqlColumn
Column corresponding to a returned value computed from an actual SQL expression.
|
QueryMaker.Query, QueryMaker.QueryCannotMatchException
Modifier and Type | Field and Description |
---|---|
protected Set<String> |
allQualifiers
All qualifiers used (includes virtual columns)
|
protected Map<String,Map<String,Table>> |
allTables
Map of qualifier -> fragment -> table
|
protected Map<String,String> |
canonicalQualifier
Qualifier to canonical qualifier (correlation name).
|
static String |
CMIS_PREFIX |
protected Database |
database |
static String |
DC_CREATED_KEY |
static String |
DC_CREATOR_KEY |
static String |
DC_DESCRIPTION_KEY |
static String |
DC_FRAGMENT_NAME |
static String |
DC_LAST_CONTRIBUTOR_KEY |
static String |
DC_MODIFIED_KEY |
static String |
DC_TITLE_KEY |
protected Dialect |
dialect |
protected Dialect.FulltextMatchInfo |
fulltextMatchInfo |
protected Table |
hierTable |
protected static String |
JOIN |
protected Set<String> |
lifecycleWhereClauseQualifiers |
protected static Set<String> |
MIXINS_NOT_PER_INSTANCE
These mixins never match an instance mixin when used in a clause nuxeo:secondaryObjectTypeIds = 'foo'
|
protected Set<String> |
mixinTypeWhereClauseQualifiers |
protected Model |
model |
static Set<String> |
NULL_IS_FALSE_COLUMNS |
static String |
NX_PREFIX |
protected static String |
ORDER_BY |
protected Map<String,String> |
qualifierToType
Qualifier to type.
|
protected org.apache.chemistry.opencmis.server.support.query.QueryObject |
query |
protected List<CMISQLQueryMaker.SqlColumn> |
realColumns
The columns we'll actually request from the database.
|
protected List<String> |
realColumnsParams
Parameters for above (for SCORE expressions on some databases)
|
static String |
REL_FRAGMENT_NAME |
static String |
REL_SOURCE_KEY |
static String |
REL_TARGET_KEY |
protected boolean |
searchLatestVersion
Search only latest version = !searchAllVersions.
|
boolean |
skipDeleted |
static String |
TYPE |
protected Map<String,org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition<?>> |
typeInfo
Type info returned to caller.
|
protected Set<String> |
versionableQualifiers
The qualifiers which correspond to versionable types.
|
protected List<String> |
virtualColumnNames
used for diagnostic when using DISTINCT
|
protected Map<String,org.apache.chemistry.opencmis.server.support.query.ColumnReference> |
virtualColumns
The non-real-columns we'll return as well.
|
protected static String |
WHERE |
Constructor and Description |
---|
CMISQLQueryMaker() |
Modifier and Type | Method and Description |
---|---|
boolean |
accepts(String queryType)
Checks if this query maker accepts a given query.
|
protected void |
addSystemColumns(boolean addSystemColumns,
boolean distinct) |
protected String |
applySecurityPolicyQueryTransformers(NuxeoCmisService service,
Principal principal,
String statement)
Applies security policies query transformers to the statement, if possible.
|
QueryMaker.Query |
buildQuery(SQLInfo sqlInfo,
Model model,
Session.PathResolver pathResolver,
String statement,
QueryFilter queryFilter,
Object... params)
Builds the query.
|
protected static String |
cmisToFulltextQuery(String statement) |
protected void |
findVersionableQualifiers() |
protected Column |
getColumn(org.apache.chemistry.opencmis.server.support.query.ColumnReference col)
Finds a database column from a CMIS reference.
|
protected static String |
getColumnKey(org.apache.chemistry.opencmis.server.support.query.ColumnReference col)
Get key to use in data returned to high-level caller.
|
String |
getName()
Gets the name for this query maker.
|
protected static String |
getPropertyKey(String qual,
String id) |
protected Column |
getSystemColumn(String id) |
protected Column |
getSystemColumn(String qual,
String id) |
protected Table |
getTable(Table table,
String qual) |
protected String |
getTableAlias(Table table,
String qual) |
protected org.apache.chemistry.opencmis.commons.definitions.TypeDefinition |
getTypeForQualifier(String qual) |
protected boolean |
isFacetsColumn(String name) |
protected void |
recordColumnFragment(String qual,
Column column)
Records a database column's fragment (to know what to join).
|
protected void |
recordFragment(String qual,
Table table)
Records a database table and qualifier (to know what to join).
|
protected void |
recordSelector(org.apache.chemistry.opencmis.server.support.query.CmisSelector sel,
String clauseType)
Records a JOIN / WHERE / ORDER BY selector, and associates it to a database column.
|
protected void |
recordSelectSelector(org.apache.chemistry.opencmis.server.support.query.CmisSelector sel)
Records a SELECT selector, and associates it to a database column.
|
protected void |
resolveQualifiers()
Finds what qualifiers are allowed and to what correlation name they are mapped.
|
public static final String TYPE
public static final String CMIS_PREFIX
public static final String NX_PREFIX
public static final String DC_FRAGMENT_NAME
public static final String DC_TITLE_KEY
public static final String DC_DESCRIPTION_KEY
public static final String DC_CREATOR_KEY
public static final String DC_CREATED_KEY
public static final String DC_MODIFIED_KEY
public static final String DC_LAST_CONTRIBUTOR_KEY
public static final String REL_FRAGMENT_NAME
public static final String REL_SOURCE_KEY
public static final String REL_TARGET_KEY
public static final Set<String> NULL_IS_FALSE_COLUMNS
protected static final Set<String> MIXINS_NOT_PER_INSTANCE
public boolean skipDeleted
protected org.apache.chemistry.opencmis.server.support.query.QueryObject query
protected Dialect.FulltextMatchInfo fulltextMatchInfo
protected Set<String> lifecycleWhereClauseQualifiers
protected Set<String> mixinTypeWhereClauseQualifiers
protected Map<String,String> qualifierToType
protected Map<String,String> canonicalQualifier
protected Set<String> allQualifiers
protected Set<String> versionableQualifiers
protected List<CMISQLQueryMaker.SqlColumn> realColumns
protected List<String> realColumnsParams
protected Map<String,org.apache.chemistry.opencmis.server.support.query.ColumnReference> virtualColumns
protected Map<String,org.apache.chemistry.opencmis.commons.definitions.PropertyDefinition<?>> typeInfo
protected boolean searchLatestVersion
protected List<String> virtualColumnNames
protected static final String JOIN
protected static final String WHERE
protected static final String ORDER_BY
public CMISQLQueryMaker()
public String getName()
QueryMaker
getName
in interface QueryMaker
public boolean accepts(String queryType)
QueryMaker
Called first.
accepts
in interface QueryMaker
queryType
- the querytrue
if the query is acceptedpublic QueryMaker.Query buildQuery(SQLInfo sqlInfo, Model model, Session.PathResolver pathResolver, String statement, QueryFilter queryFilter, Object... params)
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).
buildQuery
in interface QueryMaker
sqlInfo
- the sql infomodel
- the modelpathResolver
- the path resolverstatement
- the queryqueryFilter
- the query filterparams
- additional parameters, maker-specificprotected String applySecurityPolicyQueryTransformers(NuxeoCmisService service, Principal principal, String statement)
org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException
- If a security policy prevents doing CMIS queries.protected void findVersionableQualifiers()
protected boolean isFacetsColumn(String name)
protected void addSystemColumns(boolean addSystemColumns, boolean distinct)
protected void recordSelectSelector(org.apache.chemistry.opencmis.server.support.query.CmisSelector sel)
protected void recordSelector(org.apache.chemistry.opencmis.server.support.query.CmisSelector sel, String clauseType)
protected void recordColumnFragment(String qual, Column column)
protected void recordFragment(String qual, Table table)
protected void resolveQualifiers()
protected Column getColumn(org.apache.chemistry.opencmis.server.support.query.ColumnReference col)
protected Column getSystemColumn(String qual, String id)
protected Column getSystemColumn(String id)
protected static String getColumnKey(org.apache.chemistry.opencmis.server.support.query.ColumnReference col)
protected static String getPropertyKey(String qual, String id)
protected org.apache.chemistry.opencmis.commons.definitions.TypeDefinition getTypeForQualifier(String qual)
protected String getTableAlias(Table table, String qual)
protected static String cmisToFulltextQuery(String statement)
Copyright © 2015 Nuxeo SA. All rights reserved.