AT&T 1712 and 1802 release code
[so.git] / common / src / main / java / org / openecomp / mso / client / aai / AAIObjectPlurals.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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=========================================================
19  */
20
21 package org.openecomp.mso.client.aai;
22
23 import com.google.common.base.CaseFormat;
24
25 public enum AAIObjectPlurals implements AAIObjectName, AAIObjectUriTemplate, AAIObjectUriPartial {
26
27         GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs"),
28         PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers");
29         
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;
35         }
36         
37         @Override
38         public String toString() {
39                 return this.uriTemplate();
40         }
41
42         @Override
43         public String uriTemplate() {
44                 return this.uriTemplate;
45         }
46
47         @Override
48         public String partialUri() {
49                 return this.partialUri;
50         }
51
52         @Override
53         public String typeName() {
54                 return this.typeName(CaseFormat.LOWER_HYPHEN);
55         }
56         @Override
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_", "");
61                 }
62                 
63                 return CaseFormat.UPPER_UNDERSCORE.to(format, enumName);
64         }
65 }