2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.aaiclient.client.aai.entities.uri;
24 import org.onap.aaiclient.client.aai.AAIObjectPlurals;
25 import org.onap.aaiclient.client.aai.AAIObjectType;
28 public class AAIUriFactory {
31 * values are filled into the URI template specified in {@link AAIObjectType} in order <br>
32 * There are two special lookups performed on certain types when a single value is specified: <br>
33 * Service Instance and AllottedResources <br>
34 * These can be retrieved without all their required keys but an HTTP call is required to do so
40 public static AAIResourceUri createResourceUri(AAIObjectType type, Object... values) {
41 if (AAIObjectType.SERVICE_INSTANCE.equals(type)) {
42 return new ServiceInstanceUri(values);
43 } else if (AAIObjectType.ALLOTTED_RESOURCE.equals(type)) {
44 return new AllottedResourceLookupUri(values);
46 return new AAISimpleUri(type, values);
50 public static NodesSingleUri createNodesUri(AAIObjectType type, Object... values) {
51 return new NodesSingleUri(type, values);
55 public static NodesPluralUri createNodesUri(AAIObjectPlurals type) {
56 return new NodesPluralUri(type);
61 * This method should only be used to wrap a URI retrieved from A&AI contained within an object response
67 public static AAISimpleUri createResourceFromExistingURI(AAIObjectType type, URI uri) {
68 return new AAISimpleUri(type, uri);
73 * creates an AAIResourceUri from a parentUri
80 public static AAISimpleUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectType childType,
81 Object... childValues) {
83 return new AAISimpleUri(parentUri, childType, childValues);
86 public static AAISimplePluralUri createResourceFromParentURI(AAIResourceUri parentUri, AAIObjectPlurals childType) {
88 return new AAISimplePluralUri(parentUri, childType);
92 * Creates a uri for a plural type e.g. /cloud-infrastructure/pservers
97 public static AAISimplePluralUri createResourceUri(AAIObjectPlurals type) {
99 return new AAISimplePluralUri(type);
104 * Creates a uri for a plural type with values e.g. /cloud-infrastructure/pservers
109 public static AAISimplePluralUri createResourceUri(AAIObjectPlurals type, Object... values) {
111 return new AAISimplePluralUri(type, values);