@Test public void testFieldsConvert() { NeutralQuery neutralQuery = new NeutralQuery(); neutralQuery.addCriteria(new NeutralCriteria("populationServed", "=", "Regular Students")); Query query = mongoQueryConverter.convert("section", neutralQuery); assertNotNull("Should not be null", query); DBObject obj = query.getQueryObject(); assertNotNull("Should not be null", obj); assertEquals("Should match", "Regular Students", obj.get("body.populationServed")); neutralQuery = new NeutralQuery(); neutralQuery.addCriteria(new NeutralCriteria("populationServed", ">=", "Regular Students")); query = mongoQueryConverter.convert("section", neutralQuery); assertNotNull("Should not be null", query); obj = query.getQueryObject(); assertNotNull("Should not be null", obj); DBObject obj1 = (DBObject) obj.get("body.populationServed"); assertEquals("Should match", "Regular Students", obj1.get("$gte")); neutralQuery = new NeutralQuery(); neutralQuery.addCriteria(new NeutralCriteria("populationServed", "<=", "Regular Students")); query = mongoQueryConverter.convert("section", neutralQuery); assertNotNull("Should not be null", query); obj = query.getQueryObject(); assertNotNull("Should not be null", obj); obj1 = (DBObject) obj.get("body.populationServed"); assertEquals("Should match", "Regular Students", obj1.get("$lte")); List<String> list = new ArrayList<String>(); list.add("Regular Students"); list.add("Irregular Students"); neutralQuery = new NeutralQuery(); neutralQuery.addCriteria(new NeutralCriteria("populationServed", NeutralCriteria.CRITERIA_IN, list)); query = mongoQueryConverter.convert("section", neutralQuery); assertNotNull("Should not be null", query); obj = query.getQueryObject(); assertNotNull("Should not be null", obj); obj1 = (DBObject) obj.get("body.populationServed"); assertNotNull(obj1.get("$in")); neutralQuery = new NeutralQuery(); neutralQuery.addCriteria(new NeutralCriteria("populationServed", NeutralCriteria.CRITERIA_EXISTS, true)); query = mongoQueryConverter.convert("section", neutralQuery); assertNotNull("Should not be null", query); obj = query.getQueryObject(); assertNotNull("Should not be null", obj); obj1 = (DBObject) obj.get("body.populationServed"); assertNotNull(obj1.get("$exists")); }
public Query convert(String entityName, NeutralQuery neutralQuery) { LOG.debug(">>>MongoQueryConverter.convery(entityName, neutralQuery)"); return convert(entityName, neutralQuery, false); }
MongoQueryConverter { public Query convert(String entityName, NeutralQuery neutralQuery) { LOG.debug(">>>MongoQueryConverter.convery(entityName, neutralQuery)"); return convert(entityName, neutralQuery, false); } }
MongoQueryConverter { public Query convert(String entityName, NeutralQuery neutralQuery) { LOG.debug(">>>MongoQueryConverter.convery(entityName, neutralQuery)"); return convert(entityName, neutralQuery, false); } MongoQueryConverter(); }
MongoQueryConverter { public Query convert(String entityName, NeutralQuery neutralQuery) { LOG.debug(">>>MongoQueryConverter.convery(entityName, neutralQuery)"); return convert(entityName, neutralQuery, false); } MongoQueryConverter(); Query convert(String entityName, NeutralQuery neutralQuery); Query convert(String entityName, NeutralQuery neutralQuery, boolean allFields); List<Criteria> convertToCriteria(String entityName, NeutralQuery neutralQuery, NeutralSchema entitySchema); }
MongoQueryConverter { public Query convert(String entityName, NeutralQuery neutralQuery) { LOG.debug(">>>MongoQueryConverter.convery(entityName, neutralQuery)"); return convert(entityName, neutralQuery, false); } MongoQueryConverter(); Query convert(String entityName, NeutralQuery neutralQuery); Query convert(String entityName, NeutralQuery neutralQuery, boolean allFields); List<Criteria> convertToCriteria(String entityName, NeutralQuery neutralQuery, NeutralSchema entitySchema);  }