mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Refactor CMIS Dictionary part 2
- further simplification of CMISDictionaryService and fixup fallout - added logging - consolidate & fix property definition handling (only one definition per property) - include support for aspect properties - fix property.isInherited - open up the door for types outside of CMIS doc, folder, rel & policy Dictionary Service - add isOverride() to PropertyDefinition Invite Workflows - ensure they create their own namespace for new types/props - NOTE: the previous way uses a hole in the DictinaryService which has been there unnoticed for over 4 years, till now. At some point, the hole will be filled in. Tests pass for CMIS REST / Web Services and Query. Tests pass for Invitation Service. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13786 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -25,15 +25,12 @@
|
||||
package org.alfresco.cmis.search;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.cmis.CMISDataTypeEnum;
|
||||
import org.alfresco.cmis.dictionary.CMISDictionaryService;
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyDefinition;
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyId;
|
||||
import org.alfresco.cmis.dictionary.CMISTypeDefinition;
|
||||
import org.alfresco.cmis.dictionary.CMISTypeId;
|
||||
import org.alfresco.repo.search.impl.querymodel.Column;
|
||||
import org.alfresco.repo.search.impl.querymodel.PropertyArgument;
|
||||
import org.alfresco.repo.search.impl.querymodel.Query;
|
||||
@@ -48,33 +45,24 @@ public class CMISResultSetMetaDataImpl implements CMISResultSetMetaData
|
||||
{
|
||||
private CMISQueryOptions options;
|
||||
|
||||
private Query query;
|
||||
|
||||
private Map<String, CMISResultSetColumn> columnMetaData;
|
||||
|
||||
private Map<String, CMISResultSetSelector> selectorMetaData;
|
||||
|
||||
private CMISDictionaryService cmisDictionaryService;
|
||||
|
||||
public CMISResultSetMetaDataImpl(CMISQueryOptions options, Query query, CMISDictionaryService cmisDictionaryService)
|
||||
{
|
||||
this.options = options;
|
||||
this.query = query;
|
||||
|
||||
Map<String, Selector> selectors = query.getSource().getSelectors();
|
||||
selectorMetaData = new LinkedHashMap<String, CMISResultSetSelector>();
|
||||
for(Selector selector : selectors.values())
|
||||
{
|
||||
CMISTypeId typeId = cmisDictionaryService.getTypeId(selector.getType(), null);
|
||||
CMISTypeDefinition type = cmisDictionaryService.getType(typeId);
|
||||
CMISTypeDefinition type = cmisDictionaryService.findTypeForClass(selector.getType());
|
||||
CMISResultSetSelector smd = new CMISResultSetSelectorImpl(selector.getAlias(), type);
|
||||
selectorMetaData.put(smd.getName(), smd);
|
||||
}
|
||||
|
||||
List<Column> columns = query.getColumns();
|
||||
columnMetaData = new LinkedHashMap<String, CMISResultSetColumn>();
|
||||
|
||||
int i = 0;
|
||||
for (Column column : query.getColumns())
|
||||
{
|
||||
CMISPropertyDefinition propertyDefinition = null;
|
||||
@@ -83,13 +71,12 @@ public class CMISResultSetMetaDataImpl implements CMISResultSetMetaData
|
||||
{
|
||||
PropertyArgument arg = (PropertyArgument) column.getFunctionArguments().get(PropertyAccessor.ARG_PROPERTY);
|
||||
QName propertyQName = arg.getPropertyName();
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
propertyDefinition = cmisDictionaryService.getProperty(propertyId);
|
||||
propertyDefinition = cmisDictionaryService.findProperty(propertyQName, null);
|
||||
type = propertyDefinition.getDataType();
|
||||
}
|
||||
if (type == null)
|
||||
{
|
||||
type = cmisDictionaryService.getDataType(column.getFunction().getReturnType());
|
||||
type = cmisDictionaryService.findDataType(column.getFunction().getReturnType());
|
||||
}
|
||||
CMISResultSetColumn cmd = new CMISResultSetColumnImpl(column.getAlias(), propertyDefinition, type);
|
||||
columnMetaData.put(cmd.getName(), cmd);
|
||||
|
@@ -29,7 +29,7 @@ import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.cmis.dictionary.CMISDictionaryService;
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyId;
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyDefinition;
|
||||
import org.alfresco.cmis.property.CMISPropertyService;
|
||||
import org.alfresco.cmis.property.CMISPropertyServiceImpl;
|
||||
import org.alfresco.repo.search.impl.lucene.LuceneQueryParser;
|
||||
@@ -131,8 +131,8 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
*/
|
||||
public Serializable getProperty(NodeRef nodeRef, QName propertyQName)
|
||||
{
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
return cmisPropertyService.getProperty(nodeRef, propertyId.getName());
|
||||
CMISPropertyDefinition propertyDef = cmisDictionaryService.findProperty(propertyQName, null);
|
||||
return cmisPropertyService.getProperty(nodeRef, propertyDef.getPropertyId().getName());
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -166,9 +166,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyDefinition propertyDef = cmisDictionaryService.findProperty(propertyQName, null);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneEquality(lqp, propertyId.getName(), value, mode);
|
||||
return impl.buildLuceneEquality(lqp, propertyDef.getPropertyId().getName(), value, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -186,9 +186,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyDefinition propertyDef = cmisDictionaryService.findProperty(propertyQName, null);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneExists(lqp, propertyId.getName(), not);
|
||||
return impl.buildLuceneExists(lqp, propertyDef.getPropertyId().getName(), not);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -207,9 +207,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyDefinition propertyDef = cmisDictionaryService.findProperty(propertyQName, null);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneGreaterThan(lqp, propertyId.getName(), value, mode);
|
||||
return impl.buildLuceneGreaterThan(lqp, propertyDef.getPropertyId().getName(), value, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -228,9 +228,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyDefinition propertyDef = cmisDictionaryService.findProperty(propertyQName, null);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneGreaterThanOrEquals(lqp, propertyId.getName(), value, mode);
|
||||
return impl.buildLuceneGreaterThanOrEquals(lqp, propertyDef.getPropertyId().getName(), value, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -249,9 +249,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyDefinition propertyDef = cmisDictionaryService.findProperty(propertyQName, null);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneIn(lqp, propertyId.getName(), values, not, mode);
|
||||
return impl.buildLuceneIn(lqp, propertyDef.getPropertyId().getName(), values, not, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -270,9 +270,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyDefinition propertyDef = cmisDictionaryService.findProperty(propertyQName, null);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneInequality(lqp, propertyId.getName(), value, mode);
|
||||
return impl.buildLuceneInequality(lqp, propertyDef.getPropertyId().getName(), value, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -291,9 +291,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyDefinition propertyDef = cmisDictionaryService.findProperty(propertyQName, null);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneLessThan(lqp, propertyId.getName(), value, mode);
|
||||
return impl.buildLuceneLessThan(lqp, propertyDef.getPropertyId().getName(), value, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -312,9 +312,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyDefinition propertyDef = cmisDictionaryService.findProperty(propertyQName, null);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneLessThanOrEquals(lqp, propertyId.getName(), value, mode);
|
||||
return impl.buildLuceneLessThanOrEquals(lqp, propertyDef.getPropertyId().getName(), value, mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -332,9 +332,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyDefinition propertyDef = cmisDictionaryService.findProperty(propertyQName, null);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.buildLuceneLike(lqp, propertyId.getName(), value, not);
|
||||
return impl.buildLuceneLike(lqp, propertyDef.getPropertyId().getName(), value, not);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -349,9 +349,9 @@ public class CmisFunctionEvaluationContext implements FunctionEvaluationContext
|
||||
{
|
||||
if (cmisPropertyService instanceof CMISPropertyServiceImpl)
|
||||
{
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(propertyQName);
|
||||
CMISPropertyDefinition propertyDef = cmisDictionaryService.findProperty(propertyQName, null);
|
||||
CMISPropertyServiceImpl impl = (CMISPropertyServiceImpl) cmisPropertyService;
|
||||
return impl.getLuceneSortField(propertyId.getName());
|
||||
return impl.getLuceneSortField(propertyDef.getPropertyId().getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -1539,7 +1539,7 @@ public class QueryTest extends BaseCMISTest
|
||||
CMISResultSet rs = cmisQueryService.query(options);
|
||||
CMISResultSetMetaData md = rs.getMetaData();
|
||||
assertNotNull(md.getQueryOptions());
|
||||
CMISTypeDefinition typeDef = cmisDictionaryService.getType(CMISDictionaryModel.DOCUMENT_TYPE_ID);
|
||||
CMISTypeDefinition typeDef = cmisDictionaryService.findType(CMISDictionaryModel.DOCUMENT_TYPE_ID);
|
||||
assertEquals(typeDef.getPropertyDefinitions().size(), md.getColumnNames().length);
|
||||
assertNotNull(md.getColumn(CMISDictionaryModel.PROP_OBJECT_ID));
|
||||
assertEquals(1, md.getSelectors().length);
|
||||
|
@@ -39,9 +39,9 @@ import org.alfresco.cmis.dictionary.CMISPropertyDefinition;
|
||||
import org.alfresco.cmis.dictionary.CMISPropertyId;
|
||||
import org.alfresco.cmis.dictionary.CMISScope;
|
||||
import org.alfresco.cmis.dictionary.CMISTypeDefinition;
|
||||
import org.alfresco.cmis.dictionary.CMISTypeId;
|
||||
import org.alfresco.cmis.search.CMISQueryException;
|
||||
import org.alfresco.cmis.search.CMISQueryOptions;
|
||||
import org.alfresco.cmis.search.CMISQueryOptions.CMISQueryMode;
|
||||
import org.alfresco.repo.search.impl.parsers.CMISLexer;
|
||||
import org.alfresco.repo.search.impl.parsers.CMISParser;
|
||||
import org.alfresco.repo.search.impl.parsers.FTSLexer;
|
||||
@@ -101,12 +101,19 @@ public class CMISQueryParser
|
||||
private CMISDictionaryService cmisDictionaryService;
|
||||
|
||||
private CMISJoinEnum joinSupport;
|
||||
|
||||
private CMISScope[] validScopes;
|
||||
|
||||
private static CMISScope[] STRICT_SCOPES = new CMISScope[] {CMISScope.DOCUMENT, CMISScope.FOLDER};
|
||||
private static CMISScope[] ALFRESCO_SCOPES = new CMISScope[] {CMISScope.DOCUMENT, CMISScope.FOLDER, CMISScope.POLICY};
|
||||
|
||||
|
||||
public CMISQueryParser(CMISQueryOptions options, CMISDictionaryService cmisDictionaryService, CMISJoinEnum joinSupport)
|
||||
{
|
||||
this.options = options;
|
||||
this.cmisDictionaryService = cmisDictionaryService;
|
||||
this.joinSupport = joinSupport;
|
||||
this.validScopes = (options.getQueryMode() == CMISQueryMode.CMS_STRICT) ? STRICT_SCOPES : ALFRESCO_SCOPES;
|
||||
}
|
||||
|
||||
public Query parse(QueryModelFactory factory)
|
||||
@@ -597,19 +604,12 @@ public class CMISQueryParser
|
||||
throw new CMISQueryException("No selector for " + qualifier);
|
||||
}
|
||||
|
||||
CMISTypeId typeId = cmisDictionaryService.getTypeId(selector.getType(), null);
|
||||
if (typeId == null || (typeId.getScope() != CMISScope.DOCUMENT && typeId.getScope() != CMISScope.FOLDER))
|
||||
CMISTypeDefinition typeDef = cmisDictionaryService.findTypeForClass(selector.getType(), CMISScope.DOCUMENT, CMISScope.FOLDER);
|
||||
if (typeDef == null)
|
||||
{
|
||||
throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias());
|
||||
}
|
||||
|
||||
CMISTypeDefinition typeDef = cmisDictionaryService.getType(typeId);
|
||||
CMISPropertyDefinition propDef = null;
|
||||
CMISPropertyId propId = cmisDictionaryService.getPropertyId(columnName);
|
||||
if (propId != null)
|
||||
{
|
||||
propDef = typeDef.getPropertyDefinitions().get(propId);
|
||||
}
|
||||
CMISPropertyDefinition propDef = cmisDictionaryService.findProperty(columnName, typeDef);
|
||||
if (propDef == null)
|
||||
{
|
||||
throw new CMISQueryException("Invalid column for " + typeDef.getQueryName() + "." + columnName);
|
||||
@@ -636,19 +636,12 @@ public class CMISQueryParser
|
||||
throw new CMISQueryException("No selector for " + qualifier);
|
||||
}
|
||||
|
||||
CMISTypeId typeId = cmisDictionaryService.getTypeId(selector.getType(), null);
|
||||
if (typeId == null || (typeId.getScope() != CMISScope.DOCUMENT && typeId.getScope() != CMISScope.FOLDER))
|
||||
CMISTypeDefinition typeDef = cmisDictionaryService.findTypeForClass(selector.getType(), CMISScope.DOCUMENT, CMISScope.FOLDER);
|
||||
if (typeDef == null)
|
||||
{
|
||||
throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias());
|
||||
}
|
||||
|
||||
CMISTypeDefinition typeDef = cmisDictionaryService.getType(typeId);
|
||||
CMISPropertyDefinition propDef = null;
|
||||
CMISPropertyId propId = cmisDictionaryService.getPropertyId(columnName);
|
||||
if (propId != null)
|
||||
{
|
||||
propDef = typeDef.getPropertyDefinitions().get(propId);
|
||||
}
|
||||
CMISPropertyDefinition propDef = cmisDictionaryService.findProperty(columnName, typeDef);
|
||||
if (propDef == null)
|
||||
{
|
||||
throw new CMISQueryException("Invalid column for " + typeDef.getQueryName() + "." + columnName + " selector alias " + selector.getAlias());
|
||||
@@ -688,12 +681,11 @@ public class CMISQueryParser
|
||||
{
|
||||
for (Selector selector : selectors.values())
|
||||
{
|
||||
CMISTypeId typeId = cmisDictionaryService.getTypeId(selector.getType(), null);
|
||||
if (typeId == null || (typeId.getScope() == CMISScope.RELATIONSHIP))
|
||||
CMISTypeDefinition typeDef = cmisDictionaryService.findTypeForClass(selector.getType(), validScopes);
|
||||
if (typeDef == null)
|
||||
{
|
||||
throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias());
|
||||
}
|
||||
CMISTypeDefinition typeDef = cmisDictionaryService.getType(typeId);
|
||||
Map<CMISPropertyId, CMISPropertyDefinition> propDefs = typeDef.getPropertyDefinitions();
|
||||
for (CMISPropertyDefinition definition : propDefs.values())
|
||||
{
|
||||
@@ -726,12 +718,11 @@ public class CMISQueryParser
|
||||
throw new CMISQueryException("No selector for " + qualifier + " in " + qualifier + ".*");
|
||||
}
|
||||
|
||||
CMISTypeId typeId = cmisDictionaryService.getTypeId(selector.getType(), null);
|
||||
if (typeId == null || (typeId.getScope() == CMISScope.RELATIONSHIP))
|
||||
CMISTypeDefinition typeDef = cmisDictionaryService.findTypeForClass(selector.getType(), validScopes);
|
||||
if (typeDef == null)
|
||||
{
|
||||
throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias());
|
||||
}
|
||||
CMISTypeDefinition typeDef = cmisDictionaryService.getType(typeId);
|
||||
Map<CMISPropertyId, CMISPropertyDefinition> propDefs = typeDef.getPropertyDefinitions();
|
||||
for (CMISPropertyDefinition definition : propDefs.values())
|
||||
{
|
||||
@@ -766,18 +757,12 @@ public class CMISQueryParser
|
||||
throw new CMISQueryException("No selector for " + qualifier);
|
||||
}
|
||||
|
||||
CMISTypeId typeId = cmisDictionaryService.getTypeId(selector.getType(), null);
|
||||
if (typeId == null || (typeId.getScope() == CMISScope.RELATIONSHIP))
|
||||
CMISTypeDefinition typeDef = cmisDictionaryService.findTypeForClass(selector.getType(), validScopes);
|
||||
if (typeDef == null)
|
||||
{
|
||||
throw new CMISQueryException("Type unsupported in CMIS queries: " + selector.getAlias());
|
||||
}
|
||||
CMISTypeDefinition typeDef = cmisDictionaryService.getType(typeId);
|
||||
CMISPropertyDefinition propDef = null;
|
||||
CMISPropertyId propId = cmisDictionaryService.getPropertyId(columnName);
|
||||
if (propId != null)
|
||||
{
|
||||
propDef = typeDef.getPropertyDefinitions().get(propId);
|
||||
}
|
||||
CMISPropertyDefinition propDef = cmisDictionaryService.findProperty(columnName, typeDef);
|
||||
if (propDef == null)
|
||||
{
|
||||
throw new CMISQueryException("Invalid column for " + typeDef.getQueryName() + "." + columnName);
|
||||
@@ -908,13 +893,12 @@ public class CMISQueryParser
|
||||
}
|
||||
else
|
||||
{
|
||||
CMISPropertyId propertyId = cmisDictionaryService.getPropertyId(id);
|
||||
CMISPropertyDefinition propDef = cmisDictionaryService.getProperty(propertyId);
|
||||
PropertyArgument arg = factory.createPropertyArgument(definition.getName(), propDef.isQueryable(), propDef.isOrderable(), "", propDef.getPropertyId().getQName());
|
||||
if(!arg.isQueryable())
|
||||
CMISPropertyDefinition propDef = cmisDictionaryService.findProperty(id, null);
|
||||
if (propDef == null || !propDef.isQueryable())
|
||||
{
|
||||
throw new CMISQueryException("Column refers to unqueryable property " + arg.getPropertyName());
|
||||
throw new CMISQueryException("Column refers to unqueryable property " + definition.getName());
|
||||
}
|
||||
PropertyArgument arg = factory.createPropertyArgument(definition.getName(), propDef.isQueryable(), propDef.isOrderable(), "", propDef.getPropertyId().getQName());
|
||||
return arg;
|
||||
}
|
||||
}
|
||||
@@ -1062,20 +1046,19 @@ public class CMISQueryParser
|
||||
alias = singleTableNode.getChild(1).getText();
|
||||
}
|
||||
|
||||
CMISTypeId typeId = cmisDictionaryService.getTypeIdFromTable(tableName);
|
||||
if (typeId == null)
|
||||
CMISTypeDefinition typeDef = cmisDictionaryService.findTypeForTable(tableName);
|
||||
if (typeDef == null)
|
||||
{
|
||||
throw new CMISQueryException("Type is unsupported in query " + tableName);
|
||||
}
|
||||
if (typeId.getScope() != CMISScope.POLICY)
|
||||
if (typeDef.getTypeId().getScope() != CMISScope.POLICY)
|
||||
{
|
||||
CMISTypeDefinition cmisType = cmisDictionaryService.getType(typeId);
|
||||
if (!cmisType.isQueryable())
|
||||
if (!typeDef.isQueryable())
|
||||
{
|
||||
throw new CMISQueryException("Type is not queryable " + tableName + " -> " + cmisType);
|
||||
throw new CMISQueryException("Type is not queryable " + tableName + " -> " + typeDef.getTypeId());
|
||||
}
|
||||
}
|
||||
return factory.createSelector(typeId.getQName(), alias);
|
||||
return factory.createSelector(typeDef.getTypeId().getQName(), alias);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1094,20 +1077,19 @@ public class CMISQueryParser
|
||||
{
|
||||
alias = singleTableNode.getChild(1).getText();
|
||||
}
|
||||
CMISTypeId typeId = cmisDictionaryService.getTypeIdFromTable(tableName);
|
||||
if (typeId == null)
|
||||
CMISTypeDefinition typeDef = cmisDictionaryService.findTypeForTable(tableName);
|
||||
if (typeDef == null)
|
||||
{
|
||||
throw new CMISQueryException("Type is unsupported in query " + tableName);
|
||||
}
|
||||
if (typeId.getScope() != CMISScope.POLICY)
|
||||
if (typeDef.getTypeId().getScope() != CMISScope.POLICY)
|
||||
{
|
||||
CMISTypeDefinition cmisType = cmisDictionaryService.getType(typeId);
|
||||
if (!cmisType.isQueryable())
|
||||
if (!typeDef.isQueryable())
|
||||
{
|
||||
throw new CMISQueryException("Type is not queryable " + tableName + " -> " + cmisType);
|
||||
throw new CMISQueryException("Type is not queryable " + tableName + " -> " + typeDef.getTypeId());
|
||||
}
|
||||
}
|
||||
Source lhs = factory.createSelector(typeId.getQName(), alias);
|
||||
Source lhs = factory.createSelector(typeDef.getTypeId().getQName(), alias);
|
||||
|
||||
List<CommonTree> list = (List<CommonTree>) (source.getChildren());
|
||||
for (CommonTree joinNode : list)
|
||||
@@ -1169,8 +1151,7 @@ public class CMISQueryParser
|
||||
{
|
||||
qualifer = columnReferenceNode.getChild(1).getText();
|
||||
}
|
||||
CMISPropertyId propId = cmisDictionaryService.getPropertyId(cmisPropertyName);
|
||||
CMISPropertyDefinition propDef = cmisDictionaryService.getProperty(propId);
|
||||
CMISPropertyDefinition propDef = cmisDictionaryService.findProperty(cmisPropertyName, null);
|
||||
return factory.createPropertyArgument(argumentName, propDef.isQueryable(), propDef.isOrderable(), qualifer, propDef.getPropertyId().getQName());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user