use of edu.mit.simile.backstage.model.data.ExpressionResult in project backstage by zepheira.
the class ListFacet method update.
@Override
public void update(TupleQueryBuilder queryBuilder, Var itemVar, BackChannel backChannel) throws ExpressionException {
_builder = queryBuilder;
_itemVar = itemVar;
ExpressionResult result = _expression.computeOutputOnItem(_context.getDatabase(), _builder, _itemVar);
if (!(result.valueExpr instanceof Var)) {
throw new ExpressionException("Facet expression does not evaluate to a Var");
}
_valueVar = (Var) result.valueExpr;
_valueType = result.valueType;
_countVar = _builder.makeVar("count");
backChannel.addComponentChangingState(this);
}
use of edu.mit.simile.backstage.model.data.ExpressionResult in project backstage by zepheira.
the class ListFacet method restrict.
@Override
public void restrict(TupleQueryBuilder builder, Var itemVar) throws ExpressionException {
if (!hasRestrictions()) {
return;
}
ExpressionResult result = _expression.computeOutputOnItem(_context.getDatabase(), builder, itemVar);
if (!(result.valueExpr instanceof Var)) {
throw new ExpressionException("Facet expression does not evaluate to a Var");
}
ValueExpr input = result.valueExpr;
ValueExpr condition = null;
if (_selectMissing) {
// what do we do???
}
for (String v : _selection) {
condition = createRestrictionClause(builder, v, result.valueType, input, condition);
}
builder.addCondition(condition);
}
Aggregations