package com.redislabs.cytoscape.redisgraph.internal.graph.commands; import com.redislabs.cytoscape.redisgraph.internal.graph.implementation.GraphImplementationException; import com.redislabs.cytoscape.redisgraph.internal.graph.implementation.PropertyKey; import java.util.Map; /** * This class implements the 'Add Edge' command that can be executed by a Neo4jClient. */ public class AddEdge extends GraphCommand { private String relationship = "relationsip"; private final Map properties; private final PropertyKey startId; private final PropertyKey endId; public static AddEdge create(PropertyKey startId, PropertyKey endId, Map properties, String relationship) { return new AddEdge(startId, endId, properties, relationship); } private AddEdge(PropertyKey startId, PropertyKey endId, Map properties, String relationship) { this.startId = startId; this.endId = endId; this.properties = properties; this.relationship = relationship; } @Override public void execute() throws CommandException { try { graphImplementation.addEdge(startId, endId, relationship, properties); } catch (GraphImplementationException e) { throw new CommandException(e); } } }