本文整理汇总了Java中org.alfresco.repo.search.impl.querymodel.PropertyArgument.getPropertyName方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyArgument.getPropertyName方法的具体用法?Java PropertyArgument.getPropertyName怎么用?Java PropertyArgument.getPropertyName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.repo.search.impl.querymodel.PropertyArgument
的用法示例。
在下文中一共展示了PropertyArgument.getPropertyName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addComponent
import org.alfresco.repo.search.impl.querymodel.PropertyArgument; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
throws E
{
LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor();
PropertyArgument propertyArgument = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
Argument inverseArgument = functionArgs.get(ARG_NOT);
Boolean not = DefaultTypeConverter.INSTANCE.convert(Boolean.class, inverseArgument.getValue(functionContext));
LiteralArgument modeArgument = (LiteralArgument) functionArgs.get(ARG_MODE);
String modeString = DefaultTypeConverter.INSTANCE.convert(String.class, modeArgument.getValue(functionContext));
PredicateMode mode = PredicateMode.valueOf(modeString);
ListArgument listArgument = (ListArgument) functionArgs.get(ARG_LIST);
Collection<Serializable> collection = (Collection<Serializable>) listArgument.getValue(functionContext);
Q query = functionContext.buildLuceneIn(lqpa, propertyArgument.getPropertyName(), collection, not, mode);
if (query == null)
{
throw new QueryModelException("No query time mapping for property " + propertyArgument.getPropertyName() + ", it should not be allowed in predicates");
}
return query;
}
示例2: addComponent
import org.alfresco.repo.search.impl.querymodel.PropertyArgument; //导入方法依赖的package包/类
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
throws E
{
LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor();
Argument argument = functionArgs.get(ARG_FROM_INC);
Boolean fromInc = (Boolean) argument.getValue(functionContext);
argument = functionArgs.get(ARG_FROM);
String from = (String) argument.getValue(functionContext);
argument = functionArgs.get(ARG_TO);
String to = (String) argument.getValue(functionContext);
argument = functionArgs.get(ARG_TO_INC);
Boolean toInc = (Boolean) argument.getValue(functionContext);
PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
Q query;
if (propArg != null)
{
String prop = propArg.getPropertyName();
query = lqpa.getRangeQuery(functionContext.getLuceneFieldName(prop), from, to, fromInc, toInc, AnalysisMode.DEFAULT, LuceneFunction.FIELD);
}
else
{
query = lqpa.getRangeQuery(lqpa.getField(), from, to, fromInc, toInc, AnalysisMode.DEFAULT, LuceneFunction.FIELD);
}
return query;
}
示例3: addComponent
import org.alfresco.repo.search.impl.querymodel.PropertyArgument; //导入方法依赖的package包/类
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
throws E
{
LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor();
Argument argument = functionArgs.get(ARG_TERM);
String term = (String) argument.getValue(functionContext);
argument = functionArgs.get(ARG_TOKENISATION_MODE);
AnalysisMode mode = (AnalysisMode) argument.getValue(functionContext);
PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
Q query;
if (propArg != null)
{
String prop = propArg.getPropertyName();
query = lqpa.getFieldQuery(functionContext.getLuceneFieldName(prop), term, mode, LuceneFunction.FIELD);
}
else
{
query = lqpa.getFieldQuery(lqpa.getField(), term, mode, LuceneFunction.FIELD);
}
return query;
}
示例4: addComponent
import org.alfresco.repo.search.impl.querymodel.PropertyArgument; //导入方法依赖的package包/类
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
throws E
{
LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor();
PropertyArgument propertyArgument = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
Argument inverseArgument = functionArgs.get(ARG_NOT);
Boolean not = DefaultTypeConverter.INSTANCE.convert(Boolean.class, inverseArgument.getValue(functionContext));
Argument expressionArgument = functionArgs.get(ARG_EXP);
Serializable expression = expressionArgument.getValue(functionContext);
Q query = functionContext.buildLuceneLike(lqpa, propertyArgument.getPropertyName(), expression, not);
if (query == null)
{
throw new QueryModelException("No query time mapping for property " + propertyArgument.getPropertyName() + ", it should not be allowed in predicates");
}
return query;
}
示例5: addComponent
import org.alfresco.repo.search.impl.querymodel.PropertyArgument; //导入方法依赖的package包/类
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
throws E
{
LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor();
PropertyArgument propertyArgument = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
Argument inverseArgument = functionArgs.get(ARG_NOT);
Boolean not = DefaultTypeConverter.INSTANCE.convert(Boolean.class, inverseArgument.getValue(functionContext));
Q query = functionContext.buildLuceneExists(lqpa, propertyArgument.getPropertyName(), not);
if (query == null)
{
throw new QueryModelException("No query time mapping for property " + propertyArgument.getPropertyName() + ", it should not be allowed in predicates");
}
return query;
}
示例6: addComponent
import org.alfresco.repo.search.impl.querymodel.PropertyArgument; //导入方法依赖的package包/类
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
throws E
{
LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor();
Argument argument = functionArgs.get(ARG_TERM);
String term = (String) argument.getValue(functionContext);
argument = functionArgs.get(ARG_TOKENISATION_MODE);
AnalysisMode mode = (AnalysisMode) argument.getValue(functionContext);
PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
Q query;
if (propArg != null)
{
String prop = propArg.getPropertyName();
query = lqpa.getWildcardQuery(functionContext.getLuceneFieldName(prop), term, mode);
}
else
{
query = lqpa.getWildcardQuery(lqpa.getField(), term, mode);
}
return query;
}
示例7: addComponent
import org.alfresco.repo.search.impl.querymodel.PropertyArgument; //导入方法依赖的package包/类
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
throws E
{
LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor();
Argument argument = functionArgs.get(ARG_TERM);
String term = (String) argument.getValue(functionContext);
argument = functionArgs.get(ARG_MIN_SIMILARITY);
Float minSimilarity = (Float) argument.getValue(functionContext);
PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
Q query;
if (propArg != null)
{
String prop = propArg.getPropertyName();
query = lqpa.getFuzzyQuery(functionContext.getLuceneFieldName(prop), term, minSimilarity);
}
else
{
query = lqpa.getFuzzyQuery(lqpa.getField(), term, minSimilarity);
}
return query;
}
示例8: addComponent
import org.alfresco.repo.search.impl.querymodel.PropertyArgument; //导入方法依赖的package包/类
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
throws E
{
LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor();
Argument argument = functionArgs.get(ARG_TERM);
String term = (String) argument.getValue(functionContext);
// strip trailing wildcard *
term = term.substring(0, term.length()-1);
argument = functionArgs.get(ARG_TOKENISATION_MODE);
AnalysisMode mode = (AnalysisMode) argument.getValue(functionContext);
PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
Q query;
if (propArg != null)
{
String prop = propArg.getPropertyName();
query = lqpa.getPrefixQuery(functionContext.getLuceneFieldName(prop), term, mode);
}
else
{
query = lqpa.getPrefixQuery(lqpa.getField(), term, mode);
}
return query;
}
示例9: buildSortDefinitions
import org.alfresco.repo.search.impl.querymodel.PropertyArgument; //导入方法依赖的package包/类
public List<SortDefinition> buildSortDefinitions(Set<String> selectors, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
{
if ((getOrderings() == null) || (getOrderings().size() == 0))
{
return Collections.<SortDefinition>emptyList();
}
ArrayList<SortDefinition> definitions = new ArrayList<SortDefinition>(getOrderings().size());
for (Ordering ordering : getOrderings())
{
if (ordering.getColumn().getFunction().getName().equals(PropertyAccessor.NAME))
{
PropertyArgument property = (PropertyArgument) ordering.getColumn().getFunctionArguments().get(PropertyAccessor.ARG_PROPERTY);
if (property == null)
{
throw new IllegalStateException();
}
String propertyName = property.getPropertyName();
String fieldName = functionContext.getLuceneFieldName(propertyName);
definitions.add(new SortDefinition(SortType.FIELD, fieldName, ordering.getOrder() == Order.ASCENDING));
}
else if (ordering.getColumn().getFunction().getName().equals(Score.NAME))
{
definitions.add(new SortDefinition(SortType.SCORE, null, ordering.getOrder() == Order.ASCENDING));
}
}
return definitions;
}
示例10: addComponent
import org.alfresco.repo.search.impl.querymodel.PropertyArgument; //导入方法依赖的package包/类
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
throws E
{
LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor();
Argument argument = functionArgs.get(ARG_FIRST);
String first = (String) argument.getValue(functionContext);
argument = functionArgs.get(ARG_LAST);
String last = (String) argument.getValue(functionContext);
int slop = 100;
argument = functionArgs.get(ARG_SLOP);
if(argument != null)
{
String val = (String) argument.getValue(functionContext);
try
{
slop = Integer.parseInt(val);
}
catch(NumberFormatException nfe)
{
// ignore rubbish
}
}
PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
Q query;
if (propArg != null)
{
String prop = propArg.getPropertyName();
query = lqpa.getSpanQuery(functionContext.getLuceneFieldName(prop), first, last, slop, true);
}
else
{
query = lqpa.getSpanQuery(lqpa.getField(), first, last, slop, true);
}
return query;
}
示例11: addComponent
import org.alfresco.repo.search.impl.querymodel.PropertyArgument; //导入方法依赖的package包/类
public Q addComponent(Set<String> selectors, Map<String, Argument> functionArgs, LuceneQueryBuilderContext<Q, S, E> luceneContext, FunctionEvaluationContext functionContext)
throws E
{
LuceneQueryParserAdaptor<Q, S, E> lqpa = luceneContext.getLuceneQueryParserAdaptor();
Argument argument = functionArgs.get(ARG_PHRASE);
String term = (String) argument.getValue(functionContext);
Integer slop = Integer.valueOf(lqpa.getPhraseSlop());
argument = functionArgs.get(ARG_SLOP);
if(argument != null)
{
slop = (Integer) argument.getValue(functionContext);
}
argument = functionArgs.get(ARG_TOKENISATION_MODE);
AnalysisMode mode = (AnalysisMode) argument.getValue(functionContext);
PropertyArgument propArg = (PropertyArgument) functionArgs.get(ARG_PROPERTY);
Q query;
if (propArg != null)
{
String prop = propArg.getPropertyName();
query = lqpa.getFieldQuery(functionContext.getLuceneFieldName(prop), term, mode, slop, LuceneFunction.FIELD);
}
else
{
query = lqpa.getFieldQuery(lqpa.getField(), term, mode, slop, LuceneFunction.FIELD);
}
return query;
}
示例12: checkPredicateConditionsForLike
import org.alfresco.repo.search.impl.querymodel.PropertyArgument; //导入方法依赖的package包/类
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);
}
}
}
示例13: buildFieldReference
import org.alfresco.repo.search.impl.querymodel.PropertyArgument; //导入方法依赖的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);
}
示例14: checkPredicateConditionsForIn
import org.alfresco.repo.search.impl.querymodel.PropertyArgument; //导入方法依赖的package包/类
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");
}
}
}
示例15: buildColumnReference
import org.alfresco.repo.search.impl.querymodel.PropertyArgument; //导入方法依赖的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());
}