56b73221ff9450855ca8b2eafebd33831325ccd9
[policy/engine.git] / PolicyEngineAPI / src / main / java / org / onap / policy / api / DictionaryType.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * PolicyEngineAPI
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.policy.api;
22
23 import com.fasterxml.jackson.annotation.JsonCreator;
24
25 public enum DictionaryType {
26     /**
27      * Indicates Common Dictionaries.
28      */
29     Common("Common"),
30     /**
31      * Indicates Action Policy Dictionaries
32      */
33     Action("Action"),
34     /**
35      * Indicates ClosedLoop Policy Dictionaries.
36      */
37     ClosedLoop("ClosedLoop"),
38     /**
39      * Indicates Firewall Config Policy Dictionaries.
40      */
41     Firewall("Firewall"),
42     /**
43      * Indicates Decision Policy Dictionaries.
44      */
45     Decision("Decision"),
46     /**
47      * Indicates BRMS Policy Dictionaries.
48      */
49     BRMS("BRMS"),
50     /**
51      * Indicates DCAE Micro Service Policy Dictionaries.
52      */
53     MicroService("MicroService"),
54     /**
55      * Indicates Descriptive Scope Dictionaries
56      */
57     DescriptiveScope("DescriptiveScope"),
58     /**
59      * Indicates Policy Scope Dictionaries
60      */
61     PolicyScope("PolicyScope"),
62     /**
63      * Indicates Enforcer Dictionaries
64      */
65     Enforcer("Enforcer"),
66     /**
67      * Indicates SafePolicy Dictionaries
68      */
69     SafePolicy("SafePolicy"),
70     /**
71      * Enum support entry to extend dictionary
72      */
73     Extended("Extended");
74
75     private final String name;
76
77     private DictionaryType(final String typeName) {
78         this.name = typeName;
79     }
80
81     /**
82      * Returns the <code>String</code> format of Type for this
83      * <code>PolicyClass</code>
84      * 
85      * @return the <code>String</code> of the Type for this
86      *         <code>PolicyClass</code>
87      */
88     @Override
89     public String toString() {
90         return this.name;
91     }
92
93     @JsonCreator
94     public static DictionaryType create(final String value) {
95         for (final DictionaryType type : values()) {
96             if (type.toString().equalsIgnoreCase(value) || type.name().equalsIgnoreCase(value)) {
97                 return type;
98             }
99         }
100         throw new IllegalArgumentException("Invalid value: " + value);
101     }
102
103 }