summaryrefslogtreecommitdiffstats
path: root/common/src
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-08-26 13:58:39 +0000
committerGerrit Code Review <gerrit@onap.org>2019-08-26 13:58:39 +0000
commit3eb71d0e4751d4ac52ca6a5e2c37f3809529dced (patch)
tree7de48530863e8f37c6c8b63de1727a42085b7bd2 /common/src
parent997fc06d9a2fce3038bd89dd050acc5e9b67be71 (diff)
parent53b46b3c23eeb332fb7b0ab0c69ca04b961f38cf (diff)
Merge "path prefix now stripped off per system"
Diffstat (limited to 'common/src')
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java6
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java7
2 files changed, 12 insertions, 1 deletions
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
index f2f99050db..1fe9da984f 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
@@ -21,6 +21,7 @@
package org.onap.so.client.aai.entities.uri;
import java.net.URI;
+import java.util.regex.Pattern;
import javax.ws.rs.core.UriBuilder;
import org.onap.so.client.aai.AAIObjectPlurals;
import org.onap.so.client.aai.AAIObjectType;
@@ -138,4 +139,9 @@ public class AAISimpleUri extends SimpleUri implements AAIResourceUri {
public AAISimpleUri format(Format format) {
return (AAISimpleUri) super.format(format);
}
+
+ @Override
+ protected Pattern getPrefixPattern() {
+ return Pattern.compile("/aai/v\\d+");
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
index 41ba07ad6c..ffe47c5c51 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
@@ -29,6 +29,7 @@ import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import java.util.regex.Pattern;
import javax.ws.rs.core.UriBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.onap.so.client.graphinventory.Format;
@@ -61,7 +62,7 @@ public class SimpleUri implements GraphInventoryResourceUri, Serializable {
protected SimpleUri(GraphInventoryObjectType type, URI uri) {
this.type = type;
this.pluralType = null;
- this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll("/aai/v\\d+", ""));
+ this.internalURI = UriBuilder.fromPath(uri.getRawPath().replaceAll(getPrefixPattern().toString(), ""));
this.values = new Object[0];
}
@@ -174,6 +175,10 @@ public class SimpleUri implements GraphInventoryResourceUri, Serializable {
return build(this.values);
}
+ protected Pattern getPrefixPattern() {
+ return Pattern.compile("/.*?/v\\d+");
+ }
+
protected URI build(Object... values) {
// This is a workaround because resteasy does not encode URIs correctly
final String[] encoded = new String[values.length];