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.openecomp.mso.client.aai;
23 import com.google.common.base.CaseFormat;
25 public enum AAIObjectPlurals implements AAIObjectName, AAIObjectUriTemplate, AAIObjectUriPartial {
27 GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs"),
28 PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers");
30 private final String uriTemplate;
31 private final String partialUri;
32 private AAIObjectPlurals(String parentUri, String partialUri) {
33 this.uriTemplate = parentUri + partialUri;
34 this.partialUri = partialUri;
38 public String toString() {
39 return this.uriTemplate();
43 public String uriTemplate() {
44 return this.uriTemplate;
48 public String partialUri() {
49 return this.partialUri;
53 public String typeName() {
54 return this.typeName(CaseFormat.LOWER_HYPHEN);
57 public String typeName(CaseFormat format) {
58 String enumName = this.name();
59 if (this.equals(AAIObjectType.DEFAULT_CLOUD_REGION) || this.equals(AAIObjectType.DEFAULT_TENANT)) {
60 enumName = enumName.replace("DEFAULT_", "");
63 return CaseFormat.UPPER_UNDERSCORE.to(format, enumName);