summaryrefslogtreecommitdiffstats
path: root/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java
diff options
context:
space:
mode:
authorBenjamin, Max <max.benjamin@att.com>2020-09-21 11:38:23 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-09-23 16:32:42 -0400
commit2505a543b0e45c1c3c2fe2fb8b85664b08bf2fca (patch)
tree5f1593d45f8c9a2fb2d400b8fa58dbb3e29ef671 /graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java
parent8d68a316f303d0fc57eb7da4fef881a26d39d439 (diff)
removed references to AAIObjectType
removed references to AAIObjectType and AAIObjectPlurals additional corrections for removal of aai object type corrected additional java files updated groovy files to match aai fluent builder style Issue-ID: SO-3259 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Ifdf12fcacb34cc648548eb18b638afd06dad67a9
Diffstat (limited to 'graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java')
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java55
1 files changed, 36 insertions, 19 deletions
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java
index 6bb2cbd471..be49535f3e 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/entities/uri/AAIUriFactory.java
@@ -21,29 +21,43 @@
package org.onap.aaiclient.client.aai.entities.uri;
import java.net.URI;
+import org.onap.aaiclient.client.aai.AAIObjectName;
import org.onap.aaiclient.client.aai.AAIObjectPlurals;
import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
public class AAIUriFactory {
+
+ public static final AAIFluentTypeReverseLookup reverseLookup = new AAIFluentTypeReverseLookup();
+
/**
* values are filled into the URI template specified in {@link AAIObjectType} in order <br>
- * There are two special lookups performed on certain types when a single value is specified: <br>
- * Service Instance and AllottedResources <br>
- * These can be retrieved without all their required keys but an HTTP call is required to do so
- *
+ *
* @param type
* @param values
* @return
*/
public static AAIResourceUri createResourceUri(AAIObjectType type, Object... values) {
- if (AAIObjectType.SERVICE_INSTANCE.equals(type)) {
- return new ServiceInstanceUri(values);
- } else if (AAIObjectType.ALLOTTED_RESOURCE.equals(type)) {
- return new AllottedResourceLookupUri(values);
+ return new AAISimpleUri(type, values);
+ }
+
+ /**
+ * These can be retrieved without all their required keys but an HTTP call is required to do so
+ *
+ * @param type
+ * @param values
+ * @return
+ */
+ public static AAIResourceUri createResourceUri(AAISingleFragment fragment) {
+
+ if (Types.SERVICE_INSTANCE.typeName().equals(fragment.get().build().typeName())) {
+ return new ServiceInstanceUri(fragment);
+ } else if (Types.ALLOTTED_RESOURCE.typeName().equals(fragment.get().build().typeName())) {
+ return new AllottedResourceLookupUri(fragment);
} else {
- return new AAISimpleUri(type, values);
+ return null;
}
}
@@ -51,13 +65,16 @@ public class AAIUriFactory {
return new AAISimpleUri(uri.build(), uri.values());
}
- public static NodesSingleUri createNodesUri(AAIObjectType type, Object... values) {
+ protected static NodesSingleUri createNodesUri(AAIObjectType type, Object... values) {
return new NodesSingleUri(type, values);
+ }
+ public static NodesSingleUri createNodesUri(AAISingleFragment fragment) {
+ return new NodesSingleUri(fragment.get().build(), fragment.get().values());
}
- public static NodesPluralUri createNodesUri(AAIObjectPlurals type) {
- return new NodesPluralUri(type);
+ public static NodesPluralUri createNodesUri(AAIPluralFragment fragment) {
+ return new NodesPluralUri(fragment.get().build());
}
@@ -68,7 +85,8 @@ public class AAIUriFactory {
* @param uri
* @return
*/
- public static AAISimpleUri createResourceFromExistingURI(AAIObjectType type, URI uri) {
+ public static AAISimpleUri createResourceFromExistingURI(AAIObjectName name, URI uri) {
+ AAIObjectType type = reverseLookup.fromName(name.typeName(), uri.toString());
return new AAISimpleUri(type, uri);
}
@@ -81,20 +99,19 @@ public class AAIUriFactory {
* @param childValues
* @return
*/
- public static AAISimpleUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType,
- Object... childValues) {
+ public static AAISimpleUri createResourceFromParentURI(AAIResourceUri parentUri, AAISingleFragment fragment) {
- return new AAISimpleUri(parentUri, childType, childValues);
+ return new AAISimpleUri(parentUri, fragment.get().build(), fragment.get().values());
}
- public static AAISimplePluralUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectPlurals childType) {
+ public static AAISimplePluralUri createResourceFromParentURI(AAIResourceUri parentUri, AAIPluralFragment fragment) {
- return new AAISimplePluralUri(parentUri, childType);
+ return new AAISimplePluralUri(parentUri, fragment.get().build());
}
public static AAISimplePluralUri createResourceUri(AAIFluentPluralType uri) {
- return new AAISimplePluralUri(uri.build());
+ return new AAISimplePluralUri(uri.build(), uri.values());
}