return new DescendantNode(selector, descendantNode.getAncestorPath());
}
if (constraint instanceof PropertyExistence) {
PropertyExistence existence = (PropertyExistence)constraint;
if (!mapping.getOriginalName().equals(existence.selectorName())) return existence;
Column sourceColumn = mapping.getMappedColumn(existence.getPropertyName());
if (sourceColumn == null) return existence;
node.addSelector(sourceColumn.selectorName());
return new PropertyExistence(sourceColumn.selectorName(), sourceColumn.getPropertyName());
}
if (constraint instanceof FullTextSearch) {
FullTextSearch search = (FullTextSearch)constraint;
if (!mapping.getOriginalName().equals(search.selectorName())) return search;
Column sourceColumn = mapping.getMappedColumn(search.getPropertyName());
if (sourceColumn == null) {
if (search.getPropertyName() == null && mapping.getMappedSelectorNames().size() == 1) {
SelectorName newSelectorName = mapping.getSingleMappedSelectorName();
if (newSelectorName != null) {
node.addSelector(newSelectorName);
return new FullTextSearch(newSelectorName, search.getPropertyName(), search.fullTextSearchExpression(),
search.getFullTextSearchExpression());
}
}
return search;
}
node.addSelector(sourceColumn.selectorName());
return new FullTextSearch(sourceColumn.selectorName(), sourceColumn.getPropertyName(),
search.fullTextSearchExpression(), search.getFullTextSearchExpression());
}
if (constraint instanceof SetCriteria) {
SetCriteria set = (SetCriteria)constraint;
DynamicOperand oldLeft = set.leftOperand();