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.sdc.be.datatypes.enums;
23 public enum ComponentTypeEnum {
26 RESOURCE_INSTANCE("Resource Instance"),
28 SERVICE_INSTANCE("Service Instance");
32 private ComponentTypeEnum(String value) {
36 public String getValue() {
40 // Those values cannot be another field in enum, because they are needed
41 // as constants for Swagger allowedValues param
42 public static final String RESOURCE_PARAM_NAME = "resources";
43 public static final String SERVICE_PARAM_NAME = "services";
44 public static final String PRODUCT_PARAM_NAME = "products";
46 public NodeTypeEnum getNodeType() {
50 return NodeTypeEnum.Resource;
52 return NodeTypeEnum.Service;
54 return NodeTypeEnum.Product;
55 case RESOURCE_INSTANCE:
56 return NodeTypeEnum.ResourceInstance;
58 throw new UnsupportedOperationException("No nodeType is defined for: " + this.getValue());
62 public static ComponentTypeEnum findByValue(String value) {
63 ComponentTypeEnum ret = null;
64 for (ComponentTypeEnum curr : ComponentTypeEnum.values()) {
65 if (curr.getValue().equals(value)) {
73 public static ComponentTypeEnum findByParamName(String paramName) {
74 ComponentTypeEnum ret = null;
76 case RESOURCE_PARAM_NAME:
79 case SERVICE_PARAM_NAME:
82 case PRODUCT_PARAM_NAME:
91 public static String findParamByType(ComponentTypeEnum type) {
99 ret = RESOURCE_PARAM_NAME;
102 ret = SERVICE_PARAM_NAME;
105 ret = PRODUCT_PARAM_NAME;