@Test public void convertToPredicateTransformsExplicitFieldReferencesToPredicate() throws Exception { Set<String> references = new HashSet<>(); references.add("reference1"); references.add("reference2"); references.add("reference3"); ExplicitField title = new ExplicitField("test:test", false, null, references); Predicate predicate = title.convertToPredicate(); assertThat(predicate.getName(), is("test:test")); assertThat(predicate.getReferenceTypes(), IsMapContaining.hasEntry("reference1", 0L)); assertThat(predicate.getReferenceTypes(), IsMapContaining.hasEntry("reference2", 0L)); assertThat(predicate.getReferenceTypes(), IsMapContaining.hasEntry("reference3", 0L)); }
public Predicate convertToPredicate() { Map<String, Long> valueTypes = new HashMap<>(); Map<String, Long> referenceTypes = new HashMap<>(); if (values != null) { for (String value : values) { valueTypes.put(value, 0L); } } if (references != null) { for (String reference : references) { referenceTypes.put(reference, 0L); } } Predicate convertedPredicate = new Predicate(uri, Direction.OUT); convertedPredicate.setIsExplicit(true); convertedPredicate.setIsList(isList); convertedPredicate.setValueTypes(valueTypes); convertedPredicate.setReferenceTypes(referenceTypes); return convertedPredicate; }
ExplicitField { public Predicate convertToPredicate() { Map<String, Long> valueTypes = new HashMap<>(); Map<String, Long> referenceTypes = new HashMap<>(); if (values != null) { for (String value : values) { valueTypes.put(value, 0L); } } if (references != null) { for (String reference : references) { referenceTypes.put(reference, 0L); } } Predicate convertedPredicate = new Predicate(uri, Direction.OUT); convertedPredicate.setIsExplicit(true); convertedPredicate.setIsList(isList); convertedPredicate.setValueTypes(valueTypes); convertedPredicate.setReferenceTypes(referenceTypes); return convertedPredicate; } }
ExplicitField { public Predicate convertToPredicate() { Map<String, Long> valueTypes = new HashMap<>(); Map<String, Long> referenceTypes = new HashMap<>(); if (values != null) { for (String value : values) { valueTypes.put(value, 0L); } } if (references != null) { for (String reference : references) { referenceTypes.put(reference, 0L); } } Predicate convertedPredicate = new Predicate(uri, Direction.OUT); convertedPredicate.setIsExplicit(true); convertedPredicate.setIsList(isList); convertedPredicate.setValueTypes(valueTypes); convertedPredicate.setReferenceTypes(referenceTypes); return convertedPredicate; } @JsonCreator  ExplicitField(@JsonProperty("uri") String uri,
                       @JsonProperty("isList") boolean isList,
                       @JsonProperty("values") Set<String> values,
                       @JsonProperty("references") Set<String> references); }
ExplicitField { public Predicate convertToPredicate() { Map<String, Long> valueTypes = new HashMap<>(); Map<String, Long> referenceTypes = new HashMap<>(); if (values != null) { for (String value : values) { valueTypes.put(value, 0L); } } if (references != null) { for (String reference : references) { referenceTypes.put(reference, 0L); } } Predicate convertedPredicate = new Predicate(uri, Direction.OUT); convertedPredicate.setIsExplicit(true); convertedPredicate.setIsList(isList); convertedPredicate.setValueTypes(valueTypes); convertedPredicate.setReferenceTypes(referenceTypes); return convertedPredicate; } @JsonCreator  ExplicitField(@JsonProperty("uri") String uri,
                       @JsonProperty("isList") boolean isList,
                       @JsonProperty("values") Set<String> values,
                       @JsonProperty("references") Set<String> references); Set<String> getValues(); void setValues(Set<String> values); Set<String> getReferences(); void setReferences(Set<String> references); String getUri(); Predicate convertToPredicate(); @JsonProperty("isList") boolean isList(); void setList(boolean list); ExplicitField mergeWith(ExplicitField explicitField); }
ExplicitField { public Predicate convertToPredicate() { Map<String, Long> valueTypes = new HashMap<>(); Map<String, Long> referenceTypes = new HashMap<>(); if (values != null) { for (String value : values) { valueTypes.put(value, 0L); } } if (references != null) { for (String reference : references) { referenceTypes.put(reference, 0L); } } Predicate convertedPredicate = new Predicate(uri, Direction.OUT); convertedPredicate.setIsExplicit(true); convertedPredicate.setIsList(isList); convertedPredicate.setValueTypes(valueTypes); convertedPredicate.setReferenceTypes(referenceTypes); return convertedPredicate; } @JsonCreator  ExplicitField(@JsonProperty("uri") String uri,
                       @JsonProperty("isList") boolean isList,
                       @JsonProperty("values") Set<String> values,
                       @JsonProperty("references") Set<String> references); Set<String> getValues(); void setValues(Set<String> values); Set<String> getReferences(); void setReferences(Set<String> references); String getUri(); Predicate convertToPredicate(); @JsonProperty("isList") boolean isList(); void setList(boolean list); ExplicitField mergeWith(ExplicitField explicitField);  }