@Test public void exactMatchName() { properties.put(NAME, FIRST_VALUE); properties.put(SECOND_KEY, SECOND_VALUE); assertThat(getProperty(node)) .isEqualTo(FIRST_VALUE); }
public static String getProperty(GraphNode node) { Optional<String> backup = Optional.empty(); Optional<String> fuzzyMatch = Optional.empty(); for (Map.Entry<String, Object> entry : node.getPropertyContainer().getProperties().entrySet()) { Object valueObj = entry.getValue(); if (valueObj instanceof String) { String key = entry.getKey(); String value = (String) valueObj; for (String titleIndicator : TITLE_INDICATORS) { if (titleIndicator.equals(key) && filterLength(value)) { return value; } if (key.contains(titleIndicator) && !fuzzyMatch.isPresent()) { fuzzyMatch = Optional.of(value) .filter(DisplayUtil::filterLength); } } if (!backup.isPresent()) { backup = Optional.of(value) .filter(DisplayUtil::filterLength); } } } return fuzzyMatch.orElse(backup.orElse(node.getId())); }
DisplayUtil { public static String getProperty(GraphNode node) { Optional<String> backup = Optional.empty(); Optional<String> fuzzyMatch = Optional.empty(); for (Map.Entry<String, Object> entry : node.getPropertyContainer().getProperties().entrySet()) { Object valueObj = entry.getValue(); if (valueObj instanceof String) { String key = entry.getKey(); String value = (String) valueObj; for (String titleIndicator : TITLE_INDICATORS) { if (titleIndicator.equals(key) && filterLength(value)) { return value; } if (key.contains(titleIndicator) && !fuzzyMatch.isPresent()) { fuzzyMatch = Optional.of(value) .filter(DisplayUtil::filterLength); } } if (!backup.isPresent()) { backup = Optional.of(value) .filter(DisplayUtil::filterLength); } } } return fuzzyMatch.orElse(backup.orElse(node.getId())); } }
DisplayUtil { public static String getProperty(GraphNode node) { Optional<String> backup = Optional.empty(); Optional<String> fuzzyMatch = Optional.empty(); for (Map.Entry<String, Object> entry : node.getPropertyContainer().getProperties().entrySet()) { Object valueObj = entry.getValue(); if (valueObj instanceof String) { String key = entry.getKey(); String value = (String) valueObj; for (String titleIndicator : TITLE_INDICATORS) { if (titleIndicator.equals(key) && filterLength(value)) { return value; } if (key.contains(titleIndicator) && !fuzzyMatch.isPresent()) { fuzzyMatch = Optional.of(value) .filter(DisplayUtil::filterLength); } } if (!backup.isPresent()) { backup = Optional.of(value) .filter(DisplayUtil::filterLength); } } } return fuzzyMatch.orElse(backup.orElse(node.getId())); }  }
DisplayUtil { public static String getProperty(GraphNode node) { Optional<String> backup = Optional.empty(); Optional<String> fuzzyMatch = Optional.empty(); for (Map.Entry<String, Object> entry : node.getPropertyContainer().getProperties().entrySet()) { Object valueObj = entry.getValue(); if (valueObj instanceof String) { String key = entry.getKey(); String value = (String) valueObj; for (String titleIndicator : TITLE_INDICATORS) { if (titleIndicator.equals(key) && filterLength(value)) { return value; } if (key.contains(titleIndicator) && !fuzzyMatch.isPresent()) { fuzzyMatch = Optional.of(value) .filter(DisplayUtil::filterLength); } } if (!backup.isPresent()) { backup = Optional.of(value) .filter(DisplayUtil::filterLength); } } } return fuzzyMatch.orElse(backup.orElse(node.getId())); }  static String getProperty(GraphNode node); static String getType(GraphNode node); static String getTooltipTitle(GraphEntity entity); static String getTooltipText(GraphEntity entity); }
DisplayUtil { public static String getProperty(GraphNode node) { Optional<String> backup = Optional.empty(); Optional<String> fuzzyMatch = Optional.empty(); for (Map.Entry<String, Object> entry : node.getPropertyContainer().getProperties().entrySet()) { Object valueObj = entry.getValue(); if (valueObj instanceof String) { String key = entry.getKey(); String value = (String) valueObj; for (String titleIndicator : TITLE_INDICATORS) { if (titleIndicator.equals(key) && filterLength(value)) { return value; } if (key.contains(titleIndicator) && !fuzzyMatch.isPresent()) { fuzzyMatch = Optional.of(value) .filter(DisplayUtil::filterLength); } } if (!backup.isPresent()) { backup = Optional.of(value) .filter(DisplayUtil::filterLength); } } } return fuzzyMatch.orElse(backup.orElse(node.getId())); }  static String getProperty(GraphNode node); static String getType(GraphNode node); static String getTooltipTitle(GraphEntity entity); static String getTooltipText(GraphEntity entity);  }