@SuppressWarnings("unchecked") @Test public void getSelectedDocumentsWithWildcardAndFilter() throws Exception { createDocumentReference("Shape.%", "test", "Shape", "%"); when(this.request.getParameterValues("pages")).thenReturn(new String[] {"Shape.%"}); when(this.request.getParameter("filter")).thenReturn("test"); DocumentReference squareReference = createDocumentReference("Shape.2D.Square", "test", "Shape", "2D", "Square"); when(this.filter.getDescendantExclusions(new SpaceReference("test", "Shape"))) .thenReturn(Collections.singleton(squareReference)); Query query = mock(Query.class); when(this.queryManager.createQuery("where (doc.fullName like ?1 and doc.fullName not in (?2))", Query.HQL)) .thenReturn(query); when(query.setWiki("test")).thenReturn(query); when(query.bindValues(any(List.class))).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();  }