use of org.alfresco.repo.search.impl.querymodel.Selector in project alfresco-repository by Alfresco.
the class DBQuery method buildPredicateCommands.
/*
* (non-Javadoc)
* @see org.alfresco.repo.search.impl.querymodel.impl.db.DBQueryBuilderComponent#buildPredicateCommands()
*/
@Override
public void buildPredicateCommands(List<DBQueryBuilderPredicatePartCommand> predicatePartCommands) {
boolean requiresAnd = false;
if (selectorGroup != null) {
for (String selector : selectorGroup) {
Selector current = getSource().getSelector(selector);
if (current instanceof DBQueryBuilderComponent) {
if (requiresAnd) {
DBQueryBuilderPredicatePartCommand and = new DBQueryBuilderPredicatePartCommand();
and.setType(DBQueryBuilderPredicatePartCommandType.AND);
predicatePartCommands.add(and);
}
((DBQueryBuilderComponent) current).buildPredicateCommands(predicatePartCommands);
requiresAnd = true;
} else {
throw new UnsupportedOperationException();
}
}
}
if (getConstraint() != null) {
if (getConstraint() instanceof DBQueryBuilderComponent) {
if (requiresAnd) {
DBQueryBuilderPredicatePartCommand and = new DBQueryBuilderPredicatePartCommand();
and.setType(DBQueryBuilderPredicatePartCommandType.AND);
predicatePartCommands.add(and);
}
((DBQueryBuilderComponent) getConstraint()).buildPredicateCommands(predicatePartCommands);
} else {
throw new UnsupportedOperationException();
}
}
if (getOrderings() != null) {
for (Ordering ordering : getOrderings()) {
if (ordering instanceof DBQueryBuilderComponent) {
((DBQueryBuilderComponent) ordering).buildPredicateCommands(predicatePartCommands);
} else {
throw new UnsupportedOperationException();
}
}
}
}