@Test public void getValuesReturnsAnEmptyListIfTheVertexDoesNotContainTheProperty() { Vertex vertex = vertex().build(); AltNameFacetDescription instance = new AltNameFacetDescription("facetName", "propertyName"); List<String> values = instance.getValues(vertex); assertThat(values, is(empty())); }
@Override public List<String> getValues(Vertex vertex) { List<String> values = Lists.newArrayList(); VertexProperty<String> property = vertex.property(propertyName); if (property.isPresent()) { String value = property.value(); try { AltNames altNames = objectMapper.readValue(value, AltNames.class); altNames.list.forEach(altName -> values.add(altName.getDisplayName())); } catch (IOException e) { LOG.error("Could not convert '{}'", value); LOG.error("Exception throw.", e); } } return values; }
AltNameFacetDescription extends AbstractFacetDescription { @Override public List<String> getValues(Vertex vertex) { List<String> values = Lists.newArrayList(); VertexProperty<String> property = vertex.property(propertyName); if (property.isPresent()) { String value = property.value(); try { AltNames altNames = objectMapper.readValue(value, AltNames.class); altNames.list.forEach(altName -> values.add(altName.getDisplayName())); } catch (IOException e) { LOG.error("Could not convert '{}'", value); LOG.error("Exception throw.", e); } } return values; } }
AltNameFacetDescription extends AbstractFacetDescription { @Override public List<String> getValues(Vertex vertex) { List<String> values = Lists.newArrayList(); VertexProperty<String> property = vertex.property(propertyName); if (property.isPresent()) { String value = property.value(); try { AltNames altNames = objectMapper.readValue(value, AltNames.class); altNames.list.forEach(altName -> values.add(altName.getDisplayName())); } catch (IOException e) { LOG.error("Could not convert '{}'", value); LOG.error("Exception throw.", e); } } return values; } AltNameFacetDescription(String facetName, String propertyName); }
AltNameFacetDescription extends AbstractFacetDescription { @Override public List<String> getValues(Vertex vertex) { List<String> values = Lists.newArrayList(); VertexProperty<String> property = vertex.property(propertyName); if (property.isPresent()) { String value = property.value(); try { AltNames altNames = objectMapper.readValue(value, AltNames.class); altNames.list.forEach(altName -> values.add(altName.getDisplayName())); } catch (IOException e) { LOG.error("Could not convert '{}'", value); LOG.error("Exception throw.", e); } } return values; } AltNameFacetDescription(String facetName, String propertyName); @Override void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facetValues); @Override List<String> getValues(Vertex vertex); }
AltNameFacetDescription extends AbstractFacetDescription { @Override public List<String> getValues(Vertex vertex) { List<String> values = Lists.newArrayList(); VertexProperty<String> property = vertex.property(propertyName); if (property.isPresent()) { String value = property.value(); try { AltNames altNames = objectMapper.readValue(value, AltNames.class); altNames.list.forEach(altName -> values.add(altName.getDisplayName())); } catch (IOException e) { LOG.error("Could not convert '{}'", value); LOG.error("Exception throw.", e); } } return values; } AltNameFacetDescription(String facetName, String propertyName); @Override void filter(GraphTraversal<Vertex, Vertex> graphTraversal, List<FacetValue> facetValues); @Override List<String> getValues(Vertex vertex); static final Logger LOG; }