@Test(expected = InvalidParseOperationException.class) public void testGetCommandsThrowInvalidParseOperationExceptionWithMLT() throws InvalidCreateOperationException, InvalidParseOperationException { QueryToMongodb.getCommand(mlt("value", "var1", "var2")); }
public static Bson getCommand(final Query query) throws InvalidParseOperationException { final QUERY req = query.getQUERY(); final JsonNode content = query.getNode(req.exactToken()); switch (req) { case AND: case NOT: case OR: return booleanCommand(query, req); case EXISTS: case MISSING: return exists(content.asText(), req == QUERY.EXISTS); case FLT: case MLT: case MATCH: case MATCH_ALL: case MATCH_PHRASE: case MATCH_PHRASE_PREFIX: case SEARCH: case SUBOBJECT: throw new InvalidParseOperationException( COMMAND_NOT_ALLOWED_WITH_MONGO_DB + req.exactToken()); case NIN: case IN: return inCommand(req, content); case RANGE: return rangeCommand(req, content); case REGEX: return regexCommand(req, content); case TERM: return termCommand(content); case WILDCARD: return wildcardCommand(req, content); case EQ: case GT: case GTE: case LT: case LTE: case NE: return comparatorCommand(req, content); case ISNULL: return isNullCommand(content); case SIZE: return sizeCommand(req, content); case GEOMETRY: case BOX: case POLYGON: case CENTER: case GEOINTERSECTS: case GEOWITHIN: case PATH: return pathCommand(content); case NOP: return new BasicDBObject(); default: } throw new InvalidParseOperationException("Invalid command: " + req.exactToken()); }
QueryToMongodb { public static Bson getCommand(final Query query) throws InvalidParseOperationException { final QUERY req = query.getQUERY(); final JsonNode content = query.getNode(req.exactToken()); switch (req) { case AND: case NOT: case OR: return booleanCommand(query, req); case EXISTS: case MISSING: return exists(content.asText(), req == QUERY.EXISTS); case FLT: case MLT: case MATCH: case MATCH_ALL: case MATCH_PHRASE: case MATCH_PHRASE_PREFIX: case SEARCH: case SUBOBJECT: throw new InvalidParseOperationException( COMMAND_NOT_ALLOWED_WITH_MONGO_DB + req.exactToken()); case NIN: case IN: return inCommand(req, content); case RANGE: return rangeCommand(req, content); case REGEX: return regexCommand(req, content); case TERM: return termCommand(content); case WILDCARD: return wildcardCommand(req, content); case EQ: case GT: case GTE: case LT: case LTE: case NE: return comparatorCommand(req, content); case ISNULL: return isNullCommand(content); case SIZE: return sizeCommand(req, content); case GEOMETRY: case BOX: case POLYGON: case CENTER: case GEOINTERSECTS: case GEOWITHIN: case PATH: return pathCommand(content); case NOP: return new BasicDBObject(); default: } throw new InvalidParseOperationException("Invalid command: " + req.exactToken()); } }
QueryToMongodb { public static Bson getCommand(final Query query) throws InvalidParseOperationException { final QUERY req = query.getQUERY(); final JsonNode content = query.getNode(req.exactToken()); switch (req) { case AND: case NOT: case OR: return booleanCommand(query, req); case EXISTS: case MISSING: return exists(content.asText(), req == QUERY.EXISTS); case FLT: case MLT: case MATCH: case MATCH_ALL: case MATCH_PHRASE: case MATCH_PHRASE_PREFIX: case SEARCH: case SUBOBJECT: throw new InvalidParseOperationException( COMMAND_NOT_ALLOWED_WITH_MONGO_DB + req.exactToken()); case NIN: case IN: return inCommand(req, content); case RANGE: return rangeCommand(req, content); case REGEX: return regexCommand(req, content); case TERM: return termCommand(content); case WILDCARD: return wildcardCommand(req, content); case EQ: case GT: case GTE: case LT: case LTE: case NE: return comparatorCommand(req, content); case ISNULL: return isNullCommand(content); case SIZE: return sizeCommand(req, content); case GEOMETRY: case BOX: case POLYGON: case CENTER: case GEOINTERSECTS: case GEOWITHIN: case PATH: return pathCommand(content); case NOP: return new BasicDBObject(); default: } throw new InvalidParseOperationException("Invalid command: " + req.exactToken()); } private  QueryToMongodb(); }
QueryToMongodb { public static Bson getCommand(final Query query) throws InvalidParseOperationException { final QUERY req = query.getQUERY(); final JsonNode content = query.getNode(req.exactToken()); switch (req) { case AND: case NOT: case OR: return booleanCommand(query, req); case EXISTS: case MISSING: return exists(content.asText(), req == QUERY.EXISTS); case FLT: case MLT: case MATCH: case MATCH_ALL: case MATCH_PHRASE: case MATCH_PHRASE_PREFIX: case SEARCH: case SUBOBJECT: throw new InvalidParseOperationException( COMMAND_NOT_ALLOWED_WITH_MONGO_DB + req.exactToken()); case NIN: case IN: return inCommand(req, content); case RANGE: return rangeCommand(req, content); case REGEX: return regexCommand(req, content); case TERM: return termCommand(content); case WILDCARD: return wildcardCommand(req, content); case EQ: case GT: case GTE: case LT: case LTE: case NE: return comparatorCommand(req, content); case ISNULL: return isNullCommand(content); case SIZE: return sizeCommand(req, content); case GEOMETRY: case BOX: case POLYGON: case CENTER: case GEOINTERSECTS: case GEOWITHIN: case PATH: return pathCommand(content); case NOP: return new BasicDBObject(); default: } throw new InvalidParseOperationException("Invalid command: " + req.exactToken()); } private  QueryToMongodb(); static Bson getRoots(final String field, final Collection<String> roots); static Bson getFullCommand(final Bson command, final Bson roots); static Bson getCommand(final Query query); }
QueryToMongodb { public static Bson getCommand(final Query query) throws InvalidParseOperationException { final QUERY req = query.getQUERY(); final JsonNode content = query.getNode(req.exactToken()); switch (req) { case AND: case NOT: case OR: return booleanCommand(query, req); case EXISTS: case MISSING: return exists(content.asText(), req == QUERY.EXISTS); case FLT: case MLT: case MATCH: case MATCH_ALL: case MATCH_PHRASE: case MATCH_PHRASE_PREFIX: case SEARCH: case SUBOBJECT: throw new InvalidParseOperationException( COMMAND_NOT_ALLOWED_WITH_MONGO_DB + req.exactToken()); case NIN: case IN: return inCommand(req, content); case RANGE: return rangeCommand(req, content); case REGEX: return regexCommand(req, content); case TERM: return termCommand(content); case WILDCARD: return wildcardCommand(req, content); case EQ: case GT: case GTE: case LT: case LTE: case NE: return comparatorCommand(req, content); case ISNULL: return isNullCommand(content); case SIZE: return sizeCommand(req, content); case GEOMETRY: case BOX: case POLYGON: case CENTER: case GEOINTERSECTS: case GEOWITHIN: case PATH: return pathCommand(content); case NOP: return new BasicDBObject(); default: } throw new InvalidParseOperationException("Invalid command: " + req.exactToken()); } private  QueryToMongodb(); static Bson getRoots(final String field, final Collection<String> roots); static Bson getFullCommand(final Bson command, final Bson roots); static Bson getCommand(final Query query);  }