private static boolean isTrue()

in lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/queryoptions/options/SearchHandler.java [107:160]


  private static boolean isTrue(final SearchBinary binary, final Entity entity) throws ODataApplicationException {
    SearchExpression left = binary.getLeftOperand();
    SearchExpression right = binary.getRightOperand();
    if (binary.getOperator() == SearchBinaryOperatorKind.AND) {
      if (left.isSearchBinary() && right.isSearchBinary()) {
        return isTrue(left, entity) && isTrue(right, entity);
      } else if (left.isSearchUnary() && right.isSearchBinary()) {
        return isTrue(left, entity) && isTrue(right, entity);
      } else if (left.isSearchBinary() && right.isSearchUnary()) {
        return isTrue(left, entity) && isTrue(right, entity);
      } else if (left.isSearchUnary() && right.isSearchUnary()) {
        return isTrue(left, entity) && isTrue(right, entity);
      }
      ListIterator<Property> properties = entity.getProperties().listIterator();
      boolean leftValid = false;
      boolean rightValid = false;
      while (properties.hasNext()) {
        Property property = properties.next();
        if (!leftValid) {
          leftValid = isTrue(left, property);
        }
        if (!rightValid) {
          rightValid = isTrue(right, property);
        }
      }
      return leftValid && rightValid;
    } else if (binary.getOperator() == SearchBinaryOperatorKind.OR) {
      if (left.isSearchBinary() && right.isSearchBinary()) {
        return isTrue(left, entity) || isTrue(right, entity);
      } else if (left.isSearchUnary() && right.isSearchBinary()) {
        return isTrue(left, entity) || isTrue(right, entity);
      } else if (left.isSearchBinary() && right.isSearchUnary()) {
        return isTrue(left, entity) || isTrue(right, entity);
      } else if (left.isSearchUnary() && right.isSearchUnary()) {
        return isTrue(left, entity) || isTrue(right, entity);
      }
      ListIterator<Property> properties = entity.getProperties().listIterator();
      boolean leftValid = false;
      boolean rightValid = false;
      while (properties.hasNext()) {
        Property property = properties.next();
        if (!leftValid) {
          leftValid = isTrue(left, property);
        }
        if (!rightValid) {
          rightValid = isTrue(right, property);
        }
      }
      return leftValid || rightValid;
    } else {
      throw new ODataApplicationException("Found unknown SearchBinaryOperatorKind: " + binary.getOperator(),
          HttpStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), Locale.ROOT);
    }
  }