@Test public void testSortConvert() { NeutralQuery neutralQuery = new NeutralQuery(); neutralQuery.setSortBy("populationServed"); neutralQuery.setSortOrder(NeutralQuery.SortOrder.ascending); Query query = mongoQueryConverter.convert("section", neutralQuery); assertNotNull("Should not be null", query); DBObject obj = query.getSortObject(); assertEquals("Should match", 1, obj.get("body.populationServed")); neutralQuery = new NeutralQuery(); neutralQuery.setSortBy("populationServed"); neutralQuery.setSortOrder(NeutralQuery.SortOrder.descending); query = mongoQueryConverter.convert("section", neutralQuery); assertNotNull("Should not be null", query); obj = query.getSortObject(); assertEquals("Should match", -1, obj.get("body.populationServed")); neutralQuery = new NeutralQuery(); neutralQuery.setSortBy(null); query = mongoQueryConverter.convert("section", neutralQuery); assertNotNull("Should not be null", query); assertNull("Should be null", query.getSortObject()); neutralQuery = new NeutralQuery(); neutralQuery.setSortBy("populationServed"); neutralQuery.setSortOrder(null); query = mongoQueryConverter.convert("section", neutralQuery); assertNotNull("Should not be null", query); obj = query.getSortObject(); assertEquals("Should match", 1, obj.get("body.populationServed")); }
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);  }