@Test public void getSelectedDocumentsWithFilterWithoutConstraints() throws Exception { when(this.request.getParameter("filter")).thenReturn("test"); Query query = mock(Query.class); when(this.queryManager.createQuery("", Query.HQL)).thenReturn(query); when(query.setWiki("test")).thenReturn(query); when(query.bindValues(Collections.emptyList())).thenReturn(query); DocumentReference circleReference = new DocumentReference("test", Arrays.asList("Shape", "2D"), "Circle"); when(query.execute()).thenReturn(Collections.singletonList(circleReference)); assertEquals(Collections.singleton(circleReference), this.documentSelectionResolver.getSelectedDocuments()); }
public Collection<DocumentReference> getSelectedDocuments() { Map<DocumentReference, Collection<DocumentReference>> selection = getSelectionFromRequest(); EntityTreeFilter filter = getFilterFromRequest(); if (filter != null) { extendSelection(selection, filter); } Set<DocumentReference> selectedDocuments = new LinkedHashSet<>(); selectedDocuments.addAll(selection.keySet().stream().filter(this::isExactMatch).collect(Collectors.toSet())); selection.keySet().removeAll(selectedDocuments); selectedDocuments.addAll(getSelectedDocuments(selection)); return selectedDocuments; }
DocumentSelectionResolver { public Collection<DocumentReference> getSelectedDocuments() { Map<DocumentReference, Collection<DocumentReference>> selection = getSelectionFromRequest(); EntityTreeFilter filter = getFilterFromRequest(); if (filter != null) { extendSelection(selection, filter); } Set<DocumentReference> selectedDocuments = new LinkedHashSet<>(); selectedDocuments.addAll(selection.keySet().stream().filter(this::isExactMatch).collect(Collectors.toSet())); selection.keySet().removeAll(selectedDocuments); selectedDocuments.addAll(getSelectedDocuments(selection)); return selectedDocuments; } }
DocumentSelectionResolver { public Collection<DocumentReference> getSelectedDocuments() { Map<DocumentReference, Collection<DocumentReference>> selection = getSelectionFromRequest(); EntityTreeFilter filter = getFilterFromRequest(); if (filter != null) { extendSelection(selection, filter); } Set<DocumentReference> selectedDocuments = new LinkedHashSet<>(); selectedDocuments.addAll(selection.keySet().stream().filter(this::isExactMatch).collect(Collectors.toSet())); selection.keySet().removeAll(selectedDocuments); selectedDocuments.addAll(getSelectedDocuments(selection)); return selectedDocuments; }  }
DocumentSelectionResolver { public Collection<DocumentReference> getSelectedDocuments() { Map<DocumentReference, Collection<DocumentReference>> selection = getSelectionFromRequest(); EntityTreeFilter filter = getFilterFromRequest(); if (filter != null) { extendSelection(selection, filter); } Set<DocumentReference> selectedDocuments = new LinkedHashSet<>(); selectedDocuments.addAll(selection.keySet().stream().filter(this::isExactMatch).collect(Collectors.toSet())); selection.keySet().removeAll(selectedDocuments); selectedDocuments.addAll(getSelectedDocuments(selection)); return selectedDocuments; }  boolean isSelectionSpecified(); Collection<DocumentReference> getSelectedDocuments(); }
DocumentSelectionResolver { public Collection<DocumentReference> getSelectedDocuments() { Map<DocumentReference, Collection<DocumentReference>> selection = getSelectionFromRequest(); EntityTreeFilter filter = getFilterFromRequest(); if (filter != null) { extendSelection(selection, filter); } Set<DocumentReference> selectedDocuments = new LinkedHashSet<>(); selectedDocuments.addAll(selection.keySet().stream().filter(this::isExactMatch).collect(Collectors.toSet())); selection.keySet().removeAll(selectedDocuments); selectedDocuments.addAll(getSelectedDocuments(selection)); return selectedDocuments; }  boolean isSelectionSpecified(); Collection<DocumentReference> getSelectedDocuments();  }