2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (c) 2017-2019 AT&T Intellectual Property. All rights reserved.
6 * Copyright (c) 2017-2019 European Software Marketing Ltd.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.aai.babel.xml.generator.model;
24 import java.util.Arrays;
25 import java.util.LinkedHashMap;
26 import java.util.List;
30 * Widget Type Enumeration.
33 public class WidgetType {
36 * Dynamically created set of Widget Types.
38 private static Map<String, WidgetType> elements = new LinkedHashMap<>();
41 * Types that must be present for Model generation to function correctly.
43 private static final List<String> mandatoryElements = Arrays.asList( //
44 "SERVICE", "VF", "VFC", "VSERVER", "VOLUME", "FLAVOR", "TENANT", "VOLUME_GROUP", "LINT", "L3_NET",
45 "VFMODULE", "IMAGE", "OAM_NETWORK", "ALLOTTED_RESOURCE", "TUNNEL_XCONNECT", "CONFIGURATION", "CR",
48 private final String name;
50 public WidgetType(String name) {
52 elements.put(name, this);
55 public static void validateElements() {
56 mandatoryElements.forEach(WidgetType::valueOf);
59 public static WidgetType valueOf(String typeName) {
60 WidgetType type = elements.get(typeName);
62 throw new IllegalArgumentException("Unknown type " + typeName);
68 public String toString() {