diff options
Diffstat (limited to 'aai-core/src/main/java/org/onap/aai/query/builder/GremlinTraversal.java')
-rw-r--r-- | aai-core/src/main/java/org/onap/aai/query/builder/GremlinTraversal.java | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/aai-core/src/main/java/org/onap/aai/query/builder/GremlinTraversal.java b/aai-core/src/main/java/org/onap/aai/query/builder/GremlinTraversal.java index 801ac339..b3d3f755 100644 --- a/aai-core/src/main/java/org/onap/aai/query/builder/GremlinTraversal.java +++ b/aai-core/src/main/java/org/onap/aai/query/builder/GremlinTraversal.java @@ -35,6 +35,7 @@ import org.onap.aai.introspection.Introspector; import org.onap.aai.introspection.Loader; import org.onap.aai.parsers.query.QueryParser; import org.onap.aai.parsers.query.TraversalStrategy; +import org.onap.aai.serialization.db.EdgeRules; /** * The Class GremlinTraversal. @@ -46,6 +47,16 @@ public class GremlinTraversal<E> extends GremlinQueryBuilder<E> { * * @param loader the loader */ + public GremlinTraversal(Loader loader, GraphTraversalSource source, EdgeRules ers) { + super(loader, source, ers); + this.factory = new TraversalStrategy(this.loader, this); + } + + /** + * Instantiates a new gremlin traversal. + * + * @param loader the loader + */ public GremlinTraversal(Loader loader, GraphTraversalSource source) { super(loader, source); this.factory = new TraversalStrategy(this.loader, this); @@ -61,6 +72,17 @@ public class GremlinTraversal<E> extends GremlinQueryBuilder<E> { super(loader, source, start); this.factory = new TraversalStrategy(this.loader, this); } + + /** + * Instantiates a new gremlin traversal. + * + * @param loader the loader + * @param start the start + */ + public GremlinTraversal(Loader loader, GraphTraversalSource source, Vertex start, EdgeRules ers) { + super(loader, source, start, ers); + this.factory = new TraversalStrategy(this.loader, this); + } protected GremlinTraversal(List<String> traversal, Loader loader, GraphTraversalSource source, GremlinQueryBuilder<E> gtb) { super(loader, source); @@ -124,11 +146,15 @@ public class GremlinTraversal<E> extends GremlinQueryBuilder<E> { @Override protected QueryBuilder<E> cloneQueryAtStep(int index) { - if (index == 0) { - index = stepIndex; + + int idx = index; + + if (idx == 0) { + idx = stepIndex; } + List<String> newList = new ArrayList<>(); - for (int i = 0; i < index; i++) { + for (int i = 0; i < idx; i++) { newList.add(this.list.get(i)); } |