All Downloads are FREE. Search and download functionalities are using the official Maven repository.

apoc.uuid.UuidConfig Maven / Gradle / Ivy

There is a newer version: 5.25.1
Show newest version
package apoc.uuid;

import java.util.Collections;
import java.util.Map;

import static apoc.util.Util.toBoolean;

public class UuidConfig {

    private boolean addToExistingNodes;
    private boolean addToSetLabels;
    private String uuidProperty;

    private static final String DEFAULT_UUID_PROPERTY = "uuid";
    private static final boolean DEFAULT_ADD_TO_EXISTING_NODES = true;
    private static final boolean DEFAULT_ADD_TO_SET_LABELS = false;


    public UuidConfig(Map config) {
        if (config == null) {
            config = Collections.emptyMap();
        }
        this.addToExistingNodes = toBoolean(config.getOrDefault("addToExistingNodes", DEFAULT_ADD_TO_EXISTING_NODES));
        this.addToSetLabels = toBoolean(config.getOrDefault("addToSetLabels", DEFAULT_ADD_TO_SET_LABELS));
        this.uuidProperty = config.getOrDefault("uuidProperty", DEFAULT_UUID_PROPERTY).toString();

    }

    public UuidConfig() {} // for Jackson deserialization

    public boolean isAddToExistingNodes() {
        return addToExistingNodes;
    }

    public void setAddToExistingNodes(boolean addToExistingNodes) {
        this.addToExistingNodes = addToExistingNodes;
    }

    public String getUuidProperty() {
        return uuidProperty;
    }

    public void setUuidProperty(String uuidProperty) {
        this.uuidProperty = uuidProperty;
    }

    public boolean isAddToSetLabels() {
        return addToSetLabels;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy