Example usage for com.mongodb QueryBuilder all

List of usage examples for com.mongodb QueryBuilder all

Introduction

In this page you can find the example usage for com.mongodb QueryBuilder all.

Prototype

public QueryBuilder all(final Object object) 

Source Link

Document

Equivalent of the $all operand

Usage

From source file:org.wrml.contrib.runtime.service.mongo.MongoService.java

License:Apache License

private void addQueryCriterion(final SearchCriterion searchCriterion, final QueryBuilder queryBuilder) {

    final ComparisonOperator comparisonOperator = searchCriterion.getComparisonOperator();
    final Object comparisonValue = searchCriterion.getComparisonValue();
    switch (comparisonOperator) {

    case containsAll: {
        queryBuilder.all(comparisonValue);
        break;/*w  ww  .j  a va 2s.  com*/
    }

    case equalTo: {
        queryBuilder.equals(comparisonValue);
        break;
    }

    case equalToAny: {
        queryBuilder.in(comparisonValue);
        break;
    }

    case exists: {
        queryBuilder.exists(true);
        break;
    }

    case greaterThan: {
        queryBuilder.greaterThan(comparisonValue);
        break;
    }

    case greaterThanOrEqualTo: {
        queryBuilder.greaterThanEquals(comparisonValue);
        break;
    }

    case lessThan: {
        queryBuilder.lessThan(comparisonValue);
        break;
    }

    case lessThanOrEqualTo: {
        queryBuilder.lessThanEquals(comparisonValue);
        break;
    }

    case notEqualTo: {
        queryBuilder.notEquals(comparisonValue);
        break;
    }

    case notEqualToAny: {
        queryBuilder.notIn(comparisonValue);
        break;
    }

    case notExists: {
        queryBuilder.exists(false);
        break;
    }

    case regex: {
        final Pattern regexPattern = searchCriterion.getRegexPattern();
        if (regexPattern != null) {
            queryBuilder.regex(regexPattern);
        }

        break;
    }

    }
}