本文整理汇总了Java中org.alfresco.repo.search.impl.querymodel.QueryModelFactory.createPropertyArgument方法的典型用法代码示例。如果您正苦于以下问题:Java QueryModelFactory.createPropertyArgument方法的具体用法?Java QueryModelFactory.createPropertyArgument怎么用?Java QueryModelFactory.createPropertyArgument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.repo.search.impl.querymodel.QueryModelFactory
的用法示例。
在下文中一共展示了QueryModelFactory.createPropertyArgument方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildFieldReference
import org.alfresco.repo.search.impl.querymodel.QueryModelFactory; //导入方法依赖的package包/类
static public PropertyArgument buildFieldReference(String argumentName, CommonTree fieldReferenceNode, QueryModelFactory factory,
FunctionEvaluationContext functionEvaluationContext, Selector selector, Map<String, Column> columnMap)
{
if (fieldReferenceNode.getType() != FTSParser.FIELD_REF)
{
throw new FTSQueryException("Not column ref ..." + fieldReferenceNode.getText());
}
String fieldName = getText(fieldReferenceNode.getChild(0));
if (columnMap != null)
{
for (Column column : columnMap.values())
{
if (column.getAlias().equals(fieldName))
{
// TODO: Check selector matches ...
PropertyArgument arg = (PropertyArgument) column.getFunctionArguments().get(PropertyAccessor.ARG_PROPERTY);
fieldName = arg.getPropertyName();
break;
}
}
}
// prepend prefixes and name spaces
if (fieldReferenceNode.getChildCount() > 1)
{
CommonTree child = (CommonTree) fieldReferenceNode.getChild(1);
if (child.getType() == FTSParser.PREFIX)
{
fieldName = getText(child.getChild(0)) + ":" + fieldName;
}
else if (child.getType() == FTSParser.NAME_SPACE)
{
fieldName = getText(child.getChild(0)) + fieldName;
}
}
String alias = "";
if (selector != null)
{
functionEvaluationContext.checkFieldApplies(selector, fieldName);
alias = selector.getAlias();
}
return factory.createPropertyArgument(argumentName, functionEvaluationContext.isQueryable(fieldName), functionEvaluationContext.isOrderable(fieldName), alias, fieldName);
}
示例2: buildColumnReference
import org.alfresco.repo.search.impl.querymodel.QueryModelFactory; //导入方法依赖的package包/类
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());
}