e0887876b8b4fa9aadab32fc6872e0a4da1c7266
[sdc.git] / common / openecomp-sdc-artifact-generator-lib / openecomp-sdc-artifact-generator-api / src / main / java / org / openecomp / sdc / generator / logging / ArtifactGeneratorLogResponseCode.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.generator.logging;
22
23 import java.util.HashMap;
24 import java.util.Map;
25
26 public enum ArtifactGeneratorLogResponseCode {
27   INTERNAL_SERVER_ERROR(201),
28   MISSING_CONFIG_PROPERTIES_FILE(202),
29   MISSING_SYSTME_PROPERY_CONFIGURATION(203),
30   MANDATORY_ATTRIBUTE_MISSING(313),
31   SERVICE_TOSCA_MISSING(314),
32   INVALID_TOSCA_YAML(315),
33   INVALID_CLIENT_CONFIGURATION(316),
34   UNABLE_TO_GENERATE_ARTIFACT(317),
35   MISSING_WIDGET_CONFIGURATION(318),
36   INVALID_ID_VALUE(319),
37   MISSING_SERVICE_VERSION(320),
38   INVALID_SERVICE_VERSION(321),
39   MISSING_RESOURCE_VERSION(322),
40   INVALID_RESOURCE_VERSION(323),
41   MISSING_PRO_SERVICE(324),
42   MISSING_PRO_SERVICE_METADATA(325),
43   RESOURCE_TOSCA_MISSING(326);
44
45
46   private static Map<Integer, ArtifactGeneratorLogResponseCode> mapValueToEnum = new HashMap<>();
47
48   static {
49     for (ArtifactGeneratorLogResponseCode responseCode :
50         ArtifactGeneratorLogResponseCode.values()) {
51       mapValueToEnum.put(responseCode.value, responseCode);
52     }
53   }
54
55   private int value;
56
57   ArtifactGeneratorLogResponseCode(int value) {
58     this.value = value;
59   }
60
61   public static ArtifactGeneratorLogResponseCode parseValue(int value) {
62     return mapValueToEnum.get(value);
63   }
64
65   public int getValue() {
66     return value;
67   }
68 }