summaryrefslogtreecommitdiffstats
path: root/common/src
diff options
context:
space:
mode:
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];