@Test public void testFilterFields() { SelectorQueryPlan plan = new SelectorQueryPlan(); List<EntityBody> results = createResults(); plan.getIncludeFields().add("field1"); List<EntityBody> out = defaultSelectorDocument.filterFields(results, plan); assertEquals("Should match", 1, out.size()); EntityBody body = out.get(0); assertTrue("Should be true", body.containsKey("field1")); assertFalse("Should be false", body.containsKey("field2")); assertFalse("Should be false", body.containsKey("field3")); plan.getIncludeFields().clear(); plan.getIncludeFields().add("field1"); plan.getIncludeFields().add("field2"); out = defaultSelectorDocument.filterFields(results, plan); assertEquals("Should match", 1, out.size()); body = out.get(0); assertTrue("Should be true", body.containsKey("field1")); assertTrue("Should be true", body.containsKey("field2")); assertFalse("Should be false", body.containsKey("field3")); plan.getIncludeFields().clear(); plan.getExcludeFields().add("field1"); out = defaultSelectorDocument.filterFields(results, plan); assertEquals("Should match", 1, out.size()); body = out.get(0); assertFalse("Should be false", body.containsKey("field1")); assertFalse("Should be false", body.containsKey("field2")); assertFalse("Should be false", body.containsKey("field3")); plan.getIncludeFields().clear(); plan.getExcludeFields().clear(); plan.getExcludeFields().add("field1"); plan.getIncludeFields().add("field1"); out = defaultSelectorDocument.filterFields(results, plan); assertEquals("Should match", 1, out.size()); body = out.get(0); assertFalse("Should be false", body.containsKey("field1")); assertFalse("Should be false", body.containsKey("field2")); assertFalse("Should be false", body.containsKey("field3")); plan.getIncludeFields().clear(); plan.getExcludeFields().clear(); out = defaultSelectorDocument.filterFields(results, plan); assertEquals("Should match", 1, out.size()); body = out.get(0); assertFalse("Should be false", body.containsKey("field1")); assertFalse("Should be false", body.containsKey("field2")); assertFalse("Should be false", body.containsKey("field3")); }
protected List<EntityBody> filterFields(List<EntityBody> results, SelectorQueryPlan plan) { List<EntityBody> filteredList = filterIncludeFields(results, plan); filteredList = filterExcludeFields(filteredList, plan); return filteredList; }
DefaultSelectorDocument implements SelectorDocument { protected List<EntityBody> filterFields(List<EntityBody> results, SelectorQueryPlan plan) { List<EntityBody> filteredList = filterIncludeFields(results, plan); filteredList = filterExcludeFields(filteredList, plan); return filteredList; } }
DefaultSelectorDocument implements SelectorDocument { protected List<EntityBody> filterFields(List<EntityBody> results, SelectorQueryPlan plan) { List<EntityBody> filteredList = filterIncludeFields(results, plan); filteredList = filterExcludeFields(filteredList, plan); return filteredList; }  }
DefaultSelectorDocument implements SelectorDocument { protected List<EntityBody> filterFields(List<EntityBody> results, SelectorQueryPlan plan) { List<EntityBody> filteredList = filterIncludeFields(results, plan); filteredList = filterExcludeFields(filteredList, plan); return filteredList; }  @Override List<EntityBody> aggregate(SelectorQuery selectorQuery, final NeutralQuery constraint); List<EntityBody> getEntitySubList(List<EntityBody> list, String field, String value); }
DefaultSelectorDocument implements SelectorDocument { protected List<EntityBody> filterFields(List<EntityBody> results, SelectorQueryPlan plan) { List<EntityBody> filteredList = filterIncludeFields(results, plan); filteredList = filterExcludeFields(filteredList, plan); return filteredList; }  @Override List<EntityBody> aggregate(SelectorQuery selectorQuery, final NeutralQuery constraint); List<EntityBody> getEntitySubList(List<EntityBody> list, String field, String value); static final int EMBEDDED_DOCUMENT_LIMIT; }