diff options
Diffstat (limited to 'graph-inventory/aai-client/src/main')
2 files changed, 12 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 59e3895ce2..c56ce0bfee 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 @@ -63,7 +63,7 @@ public class DSLQueryBuilder<S, E> { Object obj = steps.get(steps.size() - 1); if (obj instanceof DSLNodeBase) { - ((DSLNodeBase) steps.get(steps.size() - 1)).output(); + consumer.accept((DSLNodeBase) steps.get(steps.size() - 1)); } else if (obj.getClass().getName().contains("$$Lambda$")) { // process lambda expressions for (Field f : obj.getClass().getDeclaredFields()) { diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java index 48feba25df..881b7e9a8e 100644 --- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java @@ -27,6 +27,7 @@ import java.util.List; import java.util.Map; import java.util.Optional; import java.util.function.Predicate; +import java.util.function.UnaryOperator; import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider; import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName; import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType; @@ -56,6 +57,11 @@ public abstract class GraphInventoryRelationships<Wrapper extends GraphInventory return this.getAll(Optional.of(type)); } + public List<Wrapper> getByType(GraphInventoryObjectName type, UnaryOperator<Uri> func) { + + return this.getAll(Optional.of(type), func); + } + public List<Wrapper> getAll() { return this.getAll(Optional.empty()); @@ -99,6 +105,10 @@ public abstract class GraphInventoryRelationships<Wrapper extends GraphInventory protected List<Wrapper> getAll(final Optional<GraphInventoryObjectName> type) { + return getAll(type, UnaryOperator.identity()); + } + + protected List<Wrapper> getAll(final Optional<GraphInventoryObjectName> type, UnaryOperator<Uri> func) { List<Uri> relatedLinks; if (type.isPresent()) { relatedLinks = this.getRelatedUris(type.get()); @@ -107,7 +117,7 @@ public abstract class GraphInventoryRelationships<Wrapper extends GraphInventory } ArrayList<Wrapper> result = new ArrayList<>(); for (Uri link : relatedLinks) { - result.add(this.get(link)); + result.add(this.get(func.apply(link))); } return result; } |