From 06f0c5d6cc9ce850d8eb1dbda0d18ae6cfe05133 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max" Date: Mon, 27 Jul 2020 12:08:37 -0400 Subject: add lambda function to modify uris add lambda function to modify uris formatted files after modifications Issue-ID: SO-3101 Signed-off-by: Benjamin, Max (mb388a) Change-Id: Ia91adbf929e157a8ba3add8a4683e12ba3a64489 --- .../graphinventory/entities/GraphInventoryRelationships.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'graph-inventory/aai-client/src/main/java/org/onap') 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 getByType(GraphInventoryObjectName type, UnaryOperator func) { + + return this.getAll(Optional.of(type), func); + } + public List getAll() { return this.getAll(Optional.empty()); @@ -99,6 +105,10 @@ public abstract class GraphInventoryRelationships getAll(final Optional type) { + return getAll(type, UnaryOperator.identity()); + } + + protected List getAll(final Optional type, UnaryOperator func) { List relatedLinks; if (type.isPresent()) { relatedLinks = this.getRelatedUris(type.get()); @@ -107,7 +117,7 @@ public abstract class GraphInventoryRelationships result = new ArrayList<>(); for (Uri link : relatedLinks) { - result.add(this.get(link)); + result.add(this.get(func.apply(link))); } return result; } -- cgit 1.2.3-korg