Skip to content

Commit

Permalink
Enabled setting custom vertex ids in TP3 interface
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Patrikalakis <[email protected]>
  • Loading branch information
Alexander Patrikalakis authored and sjudeng committed Jun 12, 2017
1 parent 6dd9ff4 commit bb16592
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.janusgraph.core.JanusGraphVertex;
import org.janusgraph.core.VertexLabel;
import org.janusgraph.diskstorage.util.Hex;
import org.janusgraph.graphdb.database.StandardJanusGraph;
import org.janusgraph.graphdb.olap.computer.FulgoraGraphComputer;
import org.janusgraph.graphdb.relations.RelationIdentifier;
import org.janusgraph.graphdb.types.system.BaseVertexLabel;
Expand Down Expand Up @@ -99,7 +100,7 @@ public FulgoraGraphComputer compute() throws IllegalArgumentException {
@Override
public JanusGraphVertex addVertex(Object... keyValues) {
ElementHelper.legalPropertyKeyValueArray(keyValues);
if (ElementHelper.getIdValue(keyValues).isPresent()) throw Vertex.Exceptions.userSuppliedIdsNotSupported();
if (ElementHelper.getIdValue(keyValues).isPresent() && !((StandardJanusGraph) getGraph()).getConfiguration().allowVertexIdSetting()) throw Vertex.Exceptions.userSuppliedIdsNotSupported();
Object labelValue = null;
for (int i = 0; i < keyValues.length; i = i + 2) {
if (keyValues[i].equals(T.label)) {
Expand All @@ -114,7 +115,7 @@ public JanusGraphVertex addVertex(Object... keyValues) {
label = (labelValue instanceof VertexLabel)?(VertexLabel)labelValue:getOrCreateVertexLabel((String) labelValue);
}

final JanusGraphVertex vertex = addVertex(null,label);
final JanusGraphVertex vertex = addVertex(ElementHelper.getIdValue(keyValues).orElse(null), label);
// for (int i = 0; i < keyValues.length; i = i + 2) {
// if (!keyValues[i].equals(T.id) && !keyValues[i].equals(T.label))
// ((StandardJanusGraphTx)this).addPropertyInternal(vertex,getOrCreatePropertyKey((String) keyValues[i]),keyValues[i+1]);
Expand Down

0 comments on commit bb16592

Please sign in to comment.