Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
currentVersion=2.13.x-SNAPSHOT

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class AqlQueryBuilder {
private AqlRootElement root = new AqlRootElement();
private AqlItem sort;
private AqlInclude include;
private boolean isTransitive = false;

public AqlQueryBuilder item(AqlItem item) {
root.putAll(item.value());
Expand Down Expand Up @@ -83,10 +84,20 @@ public AqlQueryBuilder desc(String... by) {
return this;
}

public AqlQueryBuilder transitive() {
this.isTransitive = true;
return this;
}

public String build() {
try {
ObjectMapper mapper = new ObjectMapper();
return "items.find(" + getRootAsString(mapper) + ")" + getIncludeAsString() + getSortAsString(mapper);
String aql = "items.find(" + getRootAsString(mapper) + ")" + getIncludeAsString()
+ getSortAsString(mapper);
if (this.isTransitive) {
aql += ".transitive()";
}
return aql;
} catch (JsonProcessingException e) {
throw new AqlBuilderException("Error serializing object to json: ", e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
version=2.13.x-SNAPSHOT
version=2.13.x-SNAPSHOT

Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,12 @@ public void emptyElements() {
assertThat(result, notNullValue());
assertThat(result, is("items.find()"));
}

@Test
public void transitive() {
String result = new AqlQueryBuilder().include("size", "name", "repo").transitive().build();

assertThat(result, notNullValue());
assertThat(result, is("items.find().include(\"size\",\"name\",\"repo\").transitive()"));
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line break missing at the end of line.

}