Skip to content

Commit 4fdd1fc

Browse files
author
a-brandt
committed
changes for ArangoDB 2.6
1 parent 605b1fa commit 4fdd1fc

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

src/main/java/com/arangodb/ArangoDriver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5211,7 +5211,7 @@ public <T> VertexCursor<T> graphGetVertexCursor(
52115211
public EdgeCursor<PlainEdgeEntity> graphGetEdgeCursor(String graphName) throws ArangoException {
52125212
validateCollectionName(graphName);
52135213

5214-
return graphGetEdgeCursor(graphName, PlainEdgeEntity.class, null, null, null);
5214+
return graphGetEdgeCursor(graphName, PlainEdgeEntity.class, null, new GraphEdgesOptions(), null);
52155215
}
52165216

52175217
/**
@@ -5253,7 +5253,7 @@ public <T> CursorEntity<T> graphGetEdges(String graphName, Class<T> clazz, Strin
52535253
public <T> EdgeCursor<T> graphGetEdgeCursorByExample(String graphName, Class<T> clazz, Object vertexExample)
52545254
throws ArangoException {
52555255

5256-
return graphGetEdgeCursor(graphName, clazz, vertexExample, null, null);
5256+
return graphGetEdgeCursor(graphName, clazz, vertexExample, new GraphEdgesOptions(), null);
52575257
}
52585258

52595259
/**

src/main/java/com/arangodb/util/GraphEdgesOptions.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class GraphEdgesOptions implements OptionsInterface {
1818
private Integer minDepth;
1919
private Integer maxDepth;
2020
private Integer maxIterations;
21+
private Boolean includeData = Boolean.TRUE;
2122

2223
/**
2324
* The direction of the edges as a string. Possible values are outbound,
@@ -217,6 +218,26 @@ public GraphEdgesOptions setMaxIterations(Integer maxIterations) {
217218
return this;
218219
}
219220

221+
/**
222+
* Get include data
223+
*
224+
* @return
225+
*/
226+
public Boolean getIncludeData() {
227+
return includeData;
228+
}
229+
230+
/**
231+
* set include data to be compatible with older versions of AnrangoDB
232+
*
233+
* @param includeData
234+
*
235+
* @since ArangoDB 2.6
236+
*/
237+
public void setIncludeData(Boolean includeData) {
238+
this.includeData = includeData;
239+
}
240+
220241
@Override
221242
public Map<String, Object> toMap() {
222243
MapBuilder mp = new MapBuilder();
@@ -247,6 +268,10 @@ public Map<String, Object> toMap() {
247268
if (maxIterations != null) {
248269
mp.put("maxIterations", maxIterations);
249270
}
271+
if (includeData != null) {
272+
mp.put("includeData", includeData);
273+
}
274+
250275
return mp.get();
251276
}
252277

src/test/java/com/arangodb/ArangoDriverGraphEdgesGetCursorTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ public void batchSizeAndLimitTest() throws ArangoException {
232232
Boolean count = true;
233233
Boolean fullCount = true;
234234

235-
String query = "for i in graph_edges(@graphName, null) LIMIT 3 return i";
235+
String query = "for i in graph_edges(@graphName, null, {includeData: true}) LIMIT 3 return i";
236236
Map<String, Object> bindVars = new MapBuilder().put("graphName", GRAPH_NAME).get();
237237

238238
EdgeCursor<TestComplexEntity02> cursor = driver.executeEdgeQuery(query, bindVars,
@@ -279,7 +279,7 @@ public void edgesAqlTest() throws ArangoException {
279279
String query = "for i in graph_edges(@graphName, @vertex, @options) return i";
280280

281281
// options bindVars
282-
Map<String, Object> options = new MapBuilder().put("direction", "outbound").get();
282+
Map<String, Object> options = new MapBuilder().put("direction", "outbound").put("includeData", true).get();
283283

284284
// bindVars
285285
Map<String, Object> bindVars = new MapBuilder().put("graphName", GRAPH_NAME)

0 commit comments

Comments
 (0)