diff options
author | 2020-07-14 14:38:48 -0400 | |
---|---|---|
committer | 2020-07-14 14:38:49 -0400 | |
commit | dfd4b46dc557ade131d7d9fefa07b9b7a349e854 (patch) | |
tree | 44c38f11c769ea1b75c470a66aa4b2c70b55b5cb /graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java | |
parent | 32dc5fffcf9071eda394b7b501e632f49887c552 (diff) |
dsl query builder now supports filters
dsl query builder now supports filters
Issue-ID: SO-3068
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I5b959381c6c0cf8a66109fa510a805ec5e0c1e50
Diffstat (limited to 'graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java')
-rw-r--r-- | graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java index 762203258a..59e3895ce2 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java @@ -24,6 +24,7 @@ import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.function.Consumer; import java.util.stream.Collectors; import org.onap.aaiclient.client.aai.entities.QueryStep; import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName; @@ -49,6 +50,17 @@ public class DSLQueryBuilder<S, E> { } public DSLQueryBuilder<S, Node> output() { + callOnLambda(item -> item.output()); + return (DSLQueryBuilder<S, Node>) this; + } + + public DSLQueryBuilder<S, Node> output(String... fields) { + callOnLambda(item -> item.output(fields)); + return (DSLQueryBuilder<S, Node>) this; + } + + protected void callOnLambda(Consumer<DSLNodeBase> consumer) { + Object obj = steps.get(steps.size() - 1); if (obj instanceof DSLNodeBase) { ((DSLNodeBase) steps.get(steps.size() - 1)).output(); @@ -60,7 +72,7 @@ public class DSLQueryBuilder<S, E> { try { o = f.get(obj); if (o instanceof DSLQueryBuilder && ((DSLQueryBuilder) o).steps.get(0) instanceof DSLNodeBase) { - ((DSLNodeBase) ((DSLQueryBuilder) o).steps.get(0)).output(); + consumer.accept(((DSLNodeBase) ((DSLQueryBuilder) o).steps.get(0))); } } catch (IllegalArgumentException | IllegalAccessException e) { } @@ -68,7 +80,6 @@ public class DSLQueryBuilder<S, E> { break; } } - return (DSLQueryBuilder<S, Node>) this; } @SafeVarargs |