
apoc.schema.SchemaConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of apoc Show documentation
Show all versions of apoc Show documentation
A collection of useful Neo4j Procedures
package apoc.schema;
import java.util.*;
/**
* @author ab-larus
* @since 17.12.18
*/
public class SchemaConfig {
private Set labels;
private Set excludeLabels;
private Set relationships;
private Set excludeRelationships;
public Set getLabels() {
return labels;
}
public Set getExcludeLabels() {
return excludeLabels;
}
public Set getRelationships() {
return relationships;
}
public Set getExcludeRelationships() {
return excludeRelationships;
}
public SchemaConfig(Map config) {
config = config != null ? config : Collections.emptyMap();
this.labels = new HashSet<>((Collection)config.getOrDefault("labels", Collections.EMPTY_SET));
this.excludeLabels = new HashSet<>((Collection) config.getOrDefault("excludeLabels", Collections.EMPTY_SET));
validateParameters(this.labels, this.excludeLabels, "labels");
this.relationships = new HashSet<>((Collection)config.getOrDefault("relationships", Collections.EMPTY_SET));
this.excludeRelationships = new HashSet<>((Collection)config.getOrDefault("excludeRelationships", Collections.EMPTY_SET));
validateParameters(this.labels, this.excludeLabels, "relationships");
}
private void validateParameters(Set include, Set exclude, String parametrType){
if(!include.isEmpty() && !exclude.isEmpty())
throw new IllegalArgumentException(String.format("Parameters %s and exclude%s are both valuated. Please check parameters and valuate only one.", parametrType, parametrType));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy