private boolean processStatsODataQueryClauses(Operation op, ServiceStats rsp, List<Query> clauses) { for (Query q : clauses) { if (!Occurance.MUST_OCCUR.equals(q.occurance)) { op.fail(new IllegalArgumentException("only AND expressions are supported")); return true;
break; default: throw new RuntimeException("Unknown occurance: " + o.toString());
for (QueryTask.Query q : queryTask.querySpec.query.booleanClauses) { if (ServiceDocument.FIELD_NAME_SELF_LINK.equals(q.term.propertyName) && QueryTask.Query.Occurance.MUST_OCCUR.equals(q.occurance) && QueryTask.QueryTerm.MatchType.WILDCARD.equals(q.term.matchType) && q.term.matchValue != null) {
public static StringEncodedConstraint encodeCondition(Condition condition) { if (condition == null || !Type.TAG.equals(condition.type) || condition.expression == null || condition.expression.propertyName == null) { return null; } StringBuilder tagStringBuilder = new StringBuilder(); if (Occurance.MUST_NOT_OCCUR.equals(condition.occurrence)) { tagStringBuilder.append("!"); } tagStringBuilder.append(condition.expression.propertyName); if (!Enforcement.HARD.equals(condition.enforcement)) { tagStringBuilder.append(":"); tagStringBuilder.append(condition.enforcement.toString().toLowerCase()); } StringEncodedConstraint stringConstraint = new StringEncodedConstraint(); stringConstraint.tag = tagStringBuilder.toString(); return stringConstraint; }
private void test(String tagConstraint, String expectedPropertyName, boolean isAnti, boolean isHard, String expectedGeneratedTagConstraint) { StringEncodedConstraint stringConstraint = new StringEncodedConstraint(); stringConstraint.tag = tagConstraint; Condition condition = ConstraintConverter.decodeCondition(stringConstraint); assertEquals(expectedPropertyName, condition.expression.propertyName); assertEquals(isAnti, Occurance.MUST_NOT_OCCUR.equals(condition.occurrence)); assertEquals(isHard, Enforcement.HARD.equals(condition.enforcement)); StringEncodedConstraint generatedTagConstraint = ConstraintConverter .encodeCondition(condition); assertEquals(expectedGeneratedTagConstraint, generatedTagConstraint.tag); }