diff options
author | Max Benjamin <max.benjamin@att.com> | 2019-06-06 17:37:59 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-06-06 17:37:59 +0000 |
commit | c4b90365d5c117bc6fd64af421a1468539a8aec3 (patch) | |
tree | 7b81c7516ecb099c880c3d878c1f828f3785fe23 /common/src/main/java/org | |
parent | fd0b48f7130300c70395742341a0cec2487bd6fa (diff) | |
parent | 560e84158798cb884de65e3cf33ab657f0e6e6df (diff) |
Merge "Merge remote-tracking branch 'origin/dublin' into 'origin/master'"
Diffstat (limited to 'common/src/main/java/org')
-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"; |