diff options
Diffstat (limited to 'common/src/main')
-rw-r--r-- | common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java | 23 | ||||
-rw-r--r-- | common/src/main/java/org/onap/so/utils/TargetEntity.java | 3 |
2 files changed, 22 insertions, 4 deletions
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java index f086a6abcf..37d21b375e 100644 --- a/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java +++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java @@ -21,6 +21,8 @@ package org.onap.so.client.aai.entities.uri; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; import java.net.URI; import java.util.Map; import java.util.Optional; @@ -42,7 +44,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri { - private Optional<String> cachedValue = Optional.empty(); + private transient Optional<String> cachedValue = Optional.empty(); private final AAIObjectType aaiType; protected HttpLookupUri(AAIObjectType type, Object... values) { @@ -78,8 +80,7 @@ public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri throw new GraphInventoryPayloadException("could not map payload: " + resultJson, e); } } - Optional<String> cachedValueOpt = this.getCachedValue(); - return cachedValueOpt.isPresent() ? cachedValueOpt.get() : ""; + return cachedValue.get(); } protected Optional<String> extractRelatedLink(String jsonString) throws IOException { @@ -139,6 +140,22 @@ public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri return new AAIResourcesClient(); } + private void writeObject(ObjectOutputStream oos) throws IOException { + + oos.writeUTF(this.cachedValue.orElse("")); + } + + private void readObject(ObjectInputStream ois) throws IOException { + + String value = ois.readUTF(); + if ("".equals(value)) { + this.cachedValue = Optional.empty(); + } else { + this.cachedValue = Optional.ofNullable(value); + } + + } + @Override public abstract URI buildNoNetwork(); } diff --git a/common/src/main/java/org/onap/so/utils/TargetEntity.java b/common/src/main/java/org/onap/so/utils/TargetEntity.java index 0c59887de7..0f1fe51114 100644 --- a/common/src/main/java/org/onap/so/utils/TargetEntity.java +++ b/common/src/main/java/org/onap/so/utils/TargetEntity.java @@ -36,7 +36,8 @@ public enum TargetEntity { SNIRO, SDC, EXTERNAL, - MULTICLOUD; + MULTICLOUD, + OOF; private static final String PREFIX = "SO"; |