Merge automation from ECOMP's repository
[vid.git] / vid-automation / src / main / java / org / onap / sdc / ci / tests / devObjects / ResourceTypeEnum.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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.onap.sdc.ci.tests.devObjects;
22
23 /**
24  * Resource Type Enum
25  * @author mshitrit
26  *
27  */
28 public enum ResourceTypeEnum {
29
30         VFC("VFC (Virtual Function Component)"), VF("VF"/* (Virtual Function)" */), CP("CP (Connection Point)"), 
31                 VL( "VL (Virtual Link)"), VFCMT("VFCMT (VFC Monitoring Template)"), ABSTRACT("Abstract (Generic VFC/VF/Service Type)");
32
33         private String value;
34
35         private ResourceTypeEnum(String value) {
36                 this.value = value;
37         }
38
39         public String getValue() {
40                 return value;
41         }
42         
43         public static ResourceTypeEnum getType(String type) {
44                 for (ResourceTypeEnum e : ResourceTypeEnum.values()) {
45                         if (e.name().equals(type)) {
46                                 return e;
47                         }
48                 }
49                 return null;
50         }
51         
52         public static ResourceTypeEnum getTypeByName(String type) {
53                 for (ResourceTypeEnum e : ResourceTypeEnum.values()) {
54                         if (e.name().equalsIgnoreCase(type)) {
55                                 return e;
56                         }
57                 }
58                 return null;
59         }
60 /**
61  * Returns ResourceTypeEnum matching to received String ignore case
62  * @param type
63  * @return
64  */
65         public static ResourceTypeEnum getTypeIgnoreCase(String type) {
66                 for (ResourceTypeEnum e : ResourceTypeEnum.values()) {
67                         if (e.name().toLowerCase().equals(type.toLowerCase())) {
68                                 return e;
69                         }
70                 }
71                 return null;
72         }
73         /**
74          * Checks if enum exist with given type
75          * @param type
76          * @return
77          */
78         public static boolean containsName(String type) {
79
80                 for (ResourceTypeEnum e : ResourceTypeEnum.values()) {
81                         if (e.name().equals(type)) {
82                                 return true;
83                         }
84                 }
85                 return false;
86         }
87         /**
88          * Checks if enum exist with given type ignare case
89          * @param type
90          * @return
91          */
92         public static boolean containsIgnoreCase(String type) {
93
94                 for (ResourceTypeEnum e : ResourceTypeEnum.values()) {
95                         if (e.name().toLowerCase().equals(type.toLowerCase())) {
96                                 return true;
97                         }
98                 }
99                 return false;
100         }
101 }