@Test public void filterDoesNotAddFilterToTheGraphTraversalWhenTheFacetOfTheDescriptionIsNotPresent() { GraphTraversal<Vertex, Vertex> traversal = newGraph() .withVertex(v -> v.withTimId("1")) .withVertex(v -> v.withTimId("2")) .build().traversal().V(); List<FacetValue> facetValues = Lists.newArrayList(); instance.filter(traversal, facetValues); assertThat(traversal.toList(), containsInAnyOrder(VertexMatcher.likeVertex().withTimId("1"), VertexMatcher.likeVertex().withTimId("2"))); }
@Override public void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facets) { Optional<FacetValue> facetValue = facets.stream().filter(facet -> Objects.equals(facet.getName(), facetName)).findFirst(); if (facetValue.isPresent()) { FacetValue value = facetValue.get(); if (value instanceof ListFacetValue) { List<String> values = ((ListFacetValue) value).getValues(); if (!values.isEmpty()) { graphTraversal.where(__.inE(values.toArray(new String[values.size()]))); } } } }
EdgeListFacetDescription extends AbstractFacetDescription { @Override public void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facets) { Optional<FacetValue> facetValue = facets.stream().filter(facet -> Objects.equals(facet.getName(), facetName)).findFirst(); if (facetValue.isPresent()) { FacetValue value = facetValue.get(); if (value instanceof ListFacetValue) { List<String> values = ((ListFacetValue) value).getValues(); if (!values.isEmpty()) { graphTraversal.where(__.inE(values.toArray(new String[values.size()]))); } } } } }
EdgeListFacetDescription extends AbstractFacetDescription { @Override public void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facets) { Optional<FacetValue> facetValue = facets.stream().filter(facet -> Objects.equals(facet.getName(), facetName)).findFirst(); if (facetValue.isPresent()) { FacetValue value = facetValue.get(); if (value instanceof ListFacetValue) { List<String> values = ((ListFacetValue) value).getValues(); if (!values.isEmpty()) { graphTraversal.where(__.inE(values.toArray(new String[values.size()]))); } } } } EdgeListFacetDescription(String facetName, String... relationNames); }
EdgeListFacetDescription extends AbstractFacetDescription { @Override public void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facets) { Optional<FacetValue> facetValue = facets.stream().filter(facet -> Objects.equals(facet.getName(), facetName)).findFirst(); if (facetValue.isPresent()) { FacetValue value = facetValue.get(); if (value instanceof ListFacetValue) { List<String> values = ((ListFacetValue) value).getValues(); if (!values.isEmpty()) { graphTraversal.where(__.inE(values.toArray(new String[values.size()]))); } } } } EdgeListFacetDescription(String facetName, String... relationNames); @Override void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facets); List<String> getValues(Vertex vertex); }
EdgeListFacetDescription extends AbstractFacetDescription { @Override public void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facets) { Optional<FacetValue> facetValue = facets.stream().filter(facet -> Objects.equals(facet.getName(), facetName)).findFirst(); if (facetValue.isPresent()) { FacetValue value = facetValue.get(); if (value instanceof ListFacetValue) { List<String> values = ((ListFacetValue) value).getValues(); if (!values.isEmpty()) { graphTraversal.where(__.inE(values.toArray(new String[values.size()]))); } } } } EdgeListFacetDescription(String facetName, String... relationNames); @Override void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facets); List<String> getValues(Vertex vertex);  }