当前位置: 首页>>代码示例>>Java>>正文


Java CMISQueryMode.CMS_STRICT属性代码示例

本文整理汇总了Java中org.alfresco.opencmis.search.CMISQueryOptions.CMISQueryMode.CMS_STRICT属性的典型用法代码示例。如果您正苦于以下问题:Java CMISQueryMode.CMS_STRICT属性的具体用法?Java CMISQueryMode.CMS_STRICT怎么用?Java CMISQueryMode.CMS_STRICT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.alfresco.opencmis.search.CMISQueryOptions.CMISQueryMode的用法示例。


在下文中一共展示了CMISQueryMode.CMS_STRICT属性的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCMISQuery

/**
 *
 * @param mode CMISQueryMode
 * @param req SolrQueryRequest
 * @param queryModelQuery Query
 * @param cmisVersion CmisVersion
 * @param alternativeDictionary String
 * @return Query
 * @throws ParseException
 */
 public Query getCMISQuery(CMISQueryMode mode, Pair<SearchParameters, Boolean> searchParametersAndFilter, SolrQueryRequest req, org.alfresco.repo.search.impl.querymodel.Query queryModelQuery, CmisVersion cmisVersion, String alternativeDictionary) throws ParseException
{
    SearchParameters searchParameters = searchParametersAndFilter.getFirst();
    Boolean isFilter = searchParametersAndFilter.getSecond();
    
    BaseTypeId[] validScopes = (mode == CMISQueryMode.CMS_STRICT) ? CmisFunctionEvaluationContext.STRICT_SCOPES : CmisFunctionEvaluationContext.ALFRESCO_SCOPES;
    CmisFunctionEvaluationContext functionContext = getCMISFunctionEvaluationContext(mode, cmisVersion, alternativeDictionary);

    Set<String> selectorGroup = queryModelQuery.getSource().getSelectorGroups(functionContext).get(0);

    LuceneQueryBuilderContext<Query, Sort, ParseException> luceneContext = getLuceneQueryBuilderContext(searchParameters, req, alternativeDictionary, FTSQueryParser.RerankPhase.SINGLE_PASS);
    @SuppressWarnings("unchecked")
    LuceneQueryBuilder<Query, Sort, ParseException> builder = (LuceneQueryBuilder<Query, Sort, ParseException>) queryModelQuery;
    org.apache.lucene.search.Query luceneQuery = builder.buildQuery(selectorGroup, luceneContext, functionContext);

    ContextAwareQuery contextAwareQuery = new ContextAwareQuery(luceneQuery, Boolean.TRUE.equals(isFilter) ? null : searchParameters);
    return contextAwareQuery;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:28,代码来源:AlfrescoSolrDataModel.java

示例2: getCMISQuery

public Query getCMISQuery(CMISQueryMode mode, Pair<SearchParameters, Boolean> searchParametersAndFilter, IndexReader indexReader, org.alfresco.repo.search.impl.querymodel.Query queryModelQuery, CmisVersion cmisVersion, String alternativeDictionary)
        throws ParseException
{
    SearchParameters searchParameters = searchParametersAndFilter.getFirst();
    Boolean isFilter = searchParametersAndFilter.getSecond();
    
    BaseTypeId[] validScopes = (mode == CMISQueryMode.CMS_STRICT) ? CmisFunctionEvaluationContext.STRICT_SCOPES : CmisFunctionEvaluationContext.ALFRESCO_SCOPES;
    CmisFunctionEvaluationContext functionContext = getCMISFunctionEvaluationContext(mode, cmisVersion, alternativeDictionary);

    Set<String> selectorGroup = queryModelQuery.getSource().getSelectorGroups(functionContext).get(0);

    LuceneQueryBuilderContext<Query, Sort, ParseException> luceneContext = getLuceneQueryBuilderContext(searchParameters, indexReader, alternativeDictionary);
    @SuppressWarnings("unchecked")
    LuceneQueryBuilder<Query, Sort, ParseException> builder = (LuceneQueryBuilder<Query, Sort, ParseException>) queryModelQuery;
    org.apache.lucene.search.Query luceneQuery = builder.buildQuery(selectorGroup, luceneContext, functionContext);

    ContextAwareQuery contextAwareQuery = new ContextAwareQuery(luceneQuery, Boolean.TRUE.equals(isFilter) ? null : searchParameters);
    return contextAwareQuery;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:19,代码来源:AlfrescoSolrDataModel.java

示例3: executeQueryUsingEngine

private Pair<Query, QueryEngineResults> executeQueryUsingEngine(QueryEngine queryEngine, CMISQueryOptions options)
{
    CapabilityJoin joinSupport = getJoinSupport();
    if (options.getQueryMode() == CMISQueryOptions.CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS)
    {
        joinSupport = CapabilityJoin.INNERANDOUTER;
    }

    // TODO: Refactor to avoid duplication of valid scopes here and in
    // CMISQueryParser

    BaseTypeId[] validScopes = (options.getQueryMode() == CMISQueryMode.CMS_STRICT) ? CmisFunctionEvaluationContext.STRICT_SCOPES
            : CmisFunctionEvaluationContext.ALFRESCO_SCOPES;
    CmisFunctionEvaluationContext functionContext = new CmisFunctionEvaluationContext();
    functionContext.setCmisDictionaryService(cmisDictionaryService);
    functionContext.setNodeService(nodeService);
    functionContext.setValidScopes(validScopes);

    CMISQueryParser parser = new CMISQueryParser(options, cmisDictionaryService, joinSupport);
    QueryConsistency queryConsistency = options.getQueryConsistency();
    if (queryConsistency == QueryConsistency.DEFAULT)
    {
    	options.setQueryConsistency(QueryConsistency.EVENTUAL);
    }
    
    Query query = parser.parse(queryEngine.getQueryModelFactory(), functionContext);
    QueryEngineResults queryEngineResults = queryEngine.executeQuery(query, options, functionContext);
    
    return new Pair<Query, QueryEngineResults>(query, queryEngineResults);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:30,代码来源:CMISQueryServiceImpl.java

示例4: CMISQueryParser

public CMISQueryParser(CMISQueryOptions options, CMISDictionaryService cmisDictionaryService,
        CapabilityJoin joinSupport)
{
    this.options = options;
    this.cmisDictionaryService = cmisDictionaryService;
    this.joinSupport = joinSupport;
    this.validScopes = (options.getQueryMode() == CMISQueryMode.CMS_STRICT) ? CmisFunctionEvaluationContext.STRICT_SCOPES
            : CmisFunctionEvaluationContext.ALFRESCO_SCOPES;
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:9,代码来源:CMISQueryParser.java

示例5: checkPredicateConditionsForLike

private void checkPredicateConditionsForLike(Map<String, Argument> functionArguments,
        FunctionEvaluationContext functionEvaluationContext, Map<String, Column> columnMap)
{
    if (options.getQueryMode() == CMISQueryMode.CMS_STRICT)
    {
        PropertyArgument propertyArgument = (PropertyArgument) functionArguments.get(Like.ARG_PROPERTY);

        boolean isMultiValued = functionEvaluationContext.isMultiValued(propertyArgument.getPropertyName());

        if (isMultiValued)
        {
            throw new QueryModelException("Like is not supported for multi-valued properties");
        }

        String cmisPropertyName = propertyArgument.getPropertyName();

        Column column = columnMap.get(cmisPropertyName);
        if (column != null)
        {
            // check for function type
            if (column.getFunction().getName().equals(PropertyAccessor.NAME))
            {
                PropertyArgument arg = (PropertyArgument) column.getFunctionArguments().get(
                        PropertyAccessor.ARG_PROPERTY);
                cmisPropertyName = arg.getPropertyName();
            } else
            {
                throw new CmisInvalidArgumentException("Complex column reference not supoprted in LIKE "
                        + cmisPropertyName);
            }
        }

        PropertyDefinitionWrapper propDef = cmisDictionaryService.findPropertyByQueryName(cmisPropertyName);
        if (propDef.getPropertyDefinition().getPropertyType() != PropertyType.STRING)
        {
            throw new CmisInvalidArgumentException("LIKE is only supported against String types" + cmisPropertyName);
        }
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:39,代码来源:CMISQueryParser.java

示例6: getCMISFunctionEvaluationContext

public CmisFunctionEvaluationContext getCMISFunctionEvaluationContext(CMISQueryMode mode, CmisVersion cmisVersion, String alternativeDictionary)
{
    BaseTypeId[] validScopes = (mode == CMISQueryMode.CMS_STRICT) ? CmisFunctionEvaluationContext.STRICT_SCOPES : CmisFunctionEvaluationContext.ALFRESCO_SCOPES;
    CmisFunctionEvaluationContext functionContext = new CmisFunctionEvaluationContext();
    functionContext.setCmisDictionaryService(getCMISDictionary(alternativeDictionary, cmisVersion));
    functionContext.setValidScopes(validScopes);
    return functionContext;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:8,代码来源:AlfrescoSolrDataModel.java

示例7: executeQueryUsingEngine

private Pair<Query, QueryEngineResults> executeQueryUsingEngine(QueryEngine queryEngine, CMISQueryOptions options)
{
    CapabilityJoin joinSupport = getJoinSupport();
    if (options.getQueryMode() == CMISQueryOptions.CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS)
    {
        joinSupport = CapabilityJoin.INNERONLY;
    }

    // TODO: Refactor to avoid duplication of valid scopes here and in
    // CMISQueryParser

    BaseTypeId[] validScopes = (options.getQueryMode() == CMISQueryMode.CMS_STRICT) ? CmisFunctionEvaluationContext.STRICT_SCOPES
            : CmisFunctionEvaluationContext.ALFRESCO_SCOPES;
    CmisFunctionEvaluationContext functionContext = new CmisFunctionEvaluationContext();
    functionContext.setCmisDictionaryService(cmisDictionaryService);
    functionContext.setNodeService(nodeService);
    functionContext.setValidScopes(validScopes);

    CMISQueryParser parser = new CMISQueryParser(options, cmisDictionaryService, joinSupport);
    QueryConsistency queryConsistency = options.getQueryConsistency();
    if (queryConsistency == QueryConsistency.DEFAULT)
    {
    	options.setQueryConsistency(QueryConsistency.EVENTUAL);
    }
    
    Query query = parser.parse(queryEngine.getQueryModelFactory(), functionContext);
    QueryEngineResults queryEngineResults = queryEngine.executeQuery(query, options, functionContext);
    
    return new Pair<Query, QueryEngineResults>(query, queryEngineResults);
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:30,代码来源:CMISQueryServiceImpl.java

示例8: checkPredicateConditionsForIn

private void checkPredicateConditionsForIn(Map<String, Argument> functionArguments,
        FunctionEvaluationContext functionEvaluationContext, Map<String, Column> columnMap)
{
    if (options.getQueryMode() == CMISQueryMode.CMS_STRICT)
    {
        PropertyArgument propertyArgument = (PropertyArgument) functionArguments.get(In.ARG_PROPERTY);
        LiteralArgument modeArgument = (LiteralArgument) functionArguments.get(In.ARG_MODE);
        String modeString = DefaultTypeConverter.INSTANCE.convert(String.class,
                modeArgument.getValue(functionEvaluationContext));
        PredicateMode mode = PredicateMode.valueOf(modeString);
        String propertyName = propertyArgument.getPropertyName();

        Column column = columnMap.get(propertyName);
        if (column != null)
        {
            // check for function type
            if (column.getFunction().getName().equals(PropertyAccessor.NAME))
            {
                PropertyArgument arg = (PropertyArgument) column.getFunctionArguments().get(
                        PropertyAccessor.ARG_PROPERTY);
                propertyName = arg.getPropertyName();
            } else
            {
                throw new CmisInvalidArgumentException("Complex column reference not supoprted in LIKE "
                        + propertyName);
            }
        }

        boolean isMultiValued = functionEvaluationContext.isMultiValued(propertyName);

        switch (mode)
        {
        case ANY:
            if (isMultiValued)
            {
                break;
            } else
            {
                throw new QueryModelException("Predicate mode " + PredicateMode.ANY
                        + " is not supported for IN and single valued properties");
            }
        case SINGLE_VALUED_PROPERTY:
            if (isMultiValued)
            {
                throw new QueryModelException("Predicate mode " + PredicateMode.SINGLE_VALUED_PROPERTY
                        + " is not supported for IN and multi-valued properties");
            } else
            {
                break;
            }
        default:
            throw new QueryModelException("Unsupported predicate mode " + mode);
        }

        PropertyDefinitionWrapper propDef = cmisDictionaryService.findPropertyByQueryName(propertyName);
        if (propDef.getPropertyDefinition().getPropertyType() == PropertyType.BOOLEAN)
        {
            throw new QueryModelException("In is not supported for properties of type Boolean");
        }
    }

}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:62,代码来源:CMISQueryParser.java

示例9: buildColumnReference

public PropertyArgument buildColumnReference(String argumentName, CommonTree columnReferenceNode,
        QueryModelFactory factory, Map<String, Selector> selectors, Map<String, Column> columnMap)
{
    String cmisPropertyName = columnReferenceNode.getChild(0).getText();
    String qualifier = "";
    if (columnReferenceNode.getChildCount() > 1)
    {
        qualifier = columnReferenceNode.getChild(1).getText();
    }

    if ((qualifier == "") && (columnMap != null))
    {
        Column column = columnMap.get(cmisPropertyName);
        if (column != null)
        {
            // check for function type
            if (column.getFunction().getName().equals(PropertyAccessor.NAME))
            {
                PropertyArgument arg = (PropertyArgument) column.getFunctionArguments().get(
                        PropertyAccessor.ARG_PROPERTY);
                cmisPropertyName = arg.getPropertyName();
                qualifier = arg.getSelector();
            } else
            {
                // TODO: should be able to return non property arguments
                // The implementation should throw out what it can not
                // support at build time.
                throw new CmisInvalidArgumentException(
                        "Complex column reference unsupported (only direct column references are currently supported) "
                                + cmisPropertyName);
            }
        }
    }

    PropertyDefinitionWrapper propDef = cmisDictionaryService.findPropertyByQueryName(cmisPropertyName);
    if (propDef == null)
    {
        throw new CmisInvalidArgumentException("Unknown column/property " + cmisPropertyName);
    }

    if (selectors != null)
    {
        Selector selector = selectors.get(qualifier);
        if (selector == null)
        {
            if ((qualifier.equals("")) && (selectors.size() == 1))
            {
                selector = selectors.get(selectors.keySet().iterator().next());
            } else
            {
                throw new CmisInvalidArgumentException("No selector for " + qualifier);
            }
        }

        TypeDefinitionWrapper typeDef = cmisDictionaryService.findTypeForClass(selector.getType(), validScopes);
        if (typeDef == null)
        {
            throw new CmisInvalidArgumentException("Type unsupported in CMIS queries: " + selector.getAlias());
        }

        // Check column/property applies to selector/type

        if (typeDef.getPropertyById(propDef.getPropertyId()) == null)
        {
            throw new CmisInvalidArgumentException("Invalid column for "
                    + typeDef.getTypeDefinition(false).getQueryName() + "." + cmisPropertyName);
        }
    }

    if (options.getQueryMode() == CMISQueryMode.CMS_STRICT)
    {
        if (!propDef.getPropertyDefinition().isQueryable())
        {
            throw new CmisInvalidArgumentException("Column is not queryable " + qualifier + "." + cmisPropertyName);
        }
    }
    return factory.createPropertyArgument(argumentName, propDef.getPropertyDefinition().isQueryable(), propDef
            .getPropertyDefinition().isOrderable(), qualifier, propDef.getPropertyId());
}
 
开发者ID:Alfresco,项目名称:alfresco-data-model,代码行数:79,代码来源:CMISQueryParser.java

示例10: parseCMISQueryToAlfrescoAbstractQuery

public org.alfresco.repo.search.impl.querymodel.Query parseCMISQueryToAlfrescoAbstractQuery(CMISQueryMode mode, SearchParameters searchParameters,
        SolrQueryRequest req, String alternativeDictionary, CmisVersion cmisVersion) 
{
    // convert search parameters to cmis query options
    // TODO: how to handle store ref
    CMISQueryOptions options = new CMISQueryOptions(searchParameters.getQuery(), StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
    options.setQueryMode(CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS);
    options.setDefaultFieldName(searchParameters.getDefaultFieldName());
    // TODO: options.setDefaultFTSConnective()
    // TODO: options.setDefaultFTSFieldConnective()
    options.setIncludeInTransactionData(!searchParameters.excludeDataInTheCurrentTransaction());
    options.setLocales(searchParameters.getLocales());
    options.setMlAnalaysisMode(searchParameters.getMlAnalaysisMode());
    options.setQueryParameterDefinitions(searchParameters.getQueryParameterDefinitions());

    // parse cmis syntax
    CapabilityJoin joinSupport = (mode == CMISQueryMode.CMS_STRICT) ? CapabilityJoin.NONE : CapabilityJoin.INNERONLY;
    CmisFunctionEvaluationContext functionContext = getCMISFunctionEvaluationContext(mode, cmisVersion, alternativeDictionary);
    
    CMISDictionaryService cmisDictionary = getCMISDictionary(alternativeDictionary, cmisVersion);
    
    CMISQueryParser parser = new CMISQueryParser(options, cmisDictionary, joinSupport);
    org.alfresco.repo.search.impl.querymodel.Query queryModelQuery = parser.parse(new LuceneQueryModelFactory(), functionContext);

    // build lucene query
    Set<String> selectorGroup = null;
    if (queryModelQuery.getSource() != null)
    {
        List<Set<String>> selectorGroups = queryModelQuery.getSource().getSelectorGroups(functionContext);
        if (selectorGroups.size() == 0)
        {
            throw new UnsupportedOperationException("No selectors");
        }
        if (selectorGroups.size() > 1)
        {
            throw new UnsupportedOperationException("Advanced join is not supported");
        }
        selectorGroup = selectorGroups.get(0);
    }
    return queryModelQuery;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:41,代码来源:AlfrescoSolrDataModel.java

示例11: parseCMISQueryToAlfrescoAbstractQuery

public org.alfresco.repo.search.impl.querymodel.Query parseCMISQueryToAlfrescoAbstractQuery(CMISQueryMode mode, SearchParameters searchParameters,
		IndexReader indexReader, String alternativeDictionary, CmisVersion cmisVersion) throws ParseException
{
    // convert search parameters to cmis query options
    // TODO: how to handle store ref
    CMISQueryOptions options = new CMISQueryOptions(searchParameters.getQuery(), StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
    options.setQueryMode(CMISQueryMode.CMS_WITH_ALFRESCO_EXTENSIONS);
    options.setDefaultFieldName(searchParameters.getDefaultFieldName());
    // TODO: options.setDefaultFTSConnective()
    // TODO: options.setDefaultFTSFieldConnective()
    options.setIncludeInTransactionData(!searchParameters.excludeDataInTheCurrentTransaction());
    options.setLocales(searchParameters.getLocales());
    options.setMlAnalaysisMode(searchParameters.getMlAnalaysisMode());
    options.setQueryParameterDefinitions(searchParameters.getQueryParameterDefinitions());

    // parse cmis syntax
    CapabilityJoin joinSupport = (mode == CMISQueryMode.CMS_STRICT) ? CapabilityJoin.NONE : CapabilityJoin.INNERONLY;
    CmisFunctionEvaluationContext functionContext = getCMISFunctionEvaluationContext(mode, cmisVersion, alternativeDictionary);
    
    CMISDictionaryService cmisDictionary = getCMISDictionary(alternativeDictionary, cmisVersion);
    
    CMISQueryParser parser = new CMISQueryParser(options, cmisDictionary, joinSupport);
    org.alfresco.repo.search.impl.querymodel.Query queryModelQuery = parser.parse(new LuceneQueryModelFactory(), functionContext);

    // build lucene query
    Set<String> selectorGroup = null;
    if (queryModelQuery.getSource() != null)
    {
        List<Set<String>> selectorGroups = queryModelQuery.getSource().getSelectorGroups(functionContext);
        if (selectorGroups.size() == 0)
        {
            throw new UnsupportedOperationException("No selectors");
        }
        if (selectorGroups.size() > 1)
        {
            throw new UnsupportedOperationException("Advanced join is not supported");
        }
        selectorGroup = selectorGroups.get(0);
    }
    return queryModelQuery;
}
 
开发者ID:Alfresco,项目名称:community-edition-old,代码行数:41,代码来源:AlfrescoSolrDataModel.java


注:本文中的org.alfresco.opencmis.search.CMISQueryOptions.CMISQueryMode.CMS_STRICT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。