push addional code
[sdc.git] / openecomp-be / lib / openecomp-heat-lib / src / main / java / org / openecomp / sdc / heat / datatypes / model / ResourceTypeToMessageString.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.openecomp.sdc.heat.datatypes.model;
22
23 import java.util.HashMap;
24 import java.util.Map;
25
26 public enum ResourceTypeToMessageString {
27   SERVER_GROUP(HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE, "ServerGroup"),
28   SECURITY_GROUP(HeatResourcesTypes.NEUTRON_SECURITY_GROUP_RESOURCE_TYPE, "SecurityGroup"),
29   NETWORK_POLICY(HeatResourcesTypes.CONTRAIL_NETWORK_RULE_RESOURCE_TYPE, "NetworkPolicy");
30
31   private static Map<HeatResourcesTypes, String> resourcesTypesStringMap;
32
33   static {
34     resourcesTypesStringMap = new HashMap<>();
35
36     for (ResourceTypeToMessageString resourceTypeToMessageString : ResourceTypeToMessageString
37         .values()) {
38       resourcesTypesStringMap
39           .put(resourceTypeToMessageString.type, resourceTypeToMessageString.messageString);
40     }
41   }
42
43   private String messageString;
44   private HeatResourcesTypes type;
45
46
47   ResourceTypeToMessageString(HeatResourcesTypes type, String messgageString) {
48     this.type = type;
49     this.messageString = messgageString;
50   }
51
52   public static String getTypeForMessageFromResourceType(HeatResourcesTypes type) {
53     return resourcesTypesStringMap.get(type);
54   }
55 }