Resolve sonar issue in Policy parameters
[policy/engine.git] / PolicyEngineAPI / src / main / java / org / onap / policy / api / PolicyConfigParams.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * PolicyEngineAPI
4  * ================================================================================
5  * Copyright (C) 2018 Samsung Electronics Co., Ltd. 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 package org.onap.policy.api;
21
22 import java.util.Map;
23 import java.util.UUID;
24
25 /**
26  * Policy config parameters representing the request object
27  */
28 public class PolicyConfigParams {
29     //policyConfigType the {@link PolicyConfigType} Enum format of the Config Type
30     private PolicyConfigType policyConfigType;
31
32     //policyName the <code>String</code> format of the Policy Name
33     private String policyName;
34
35     //policyDescription the <code>String</code> format of the Policy Description
36     private String policyDescription;
37
38     //onapName the <code>String</code> format of the ONAP Name
39     private String onapName;
40
41     //configName the <code>String</code> format of the Config Name
42     private String configName;
43
44     //attributes the <code>Map</code> Attributes that must contain the AttributeType and Map of key,
45     // value pairs corresponding to it.
46     private Map<AttributeType, Map<String, String>> attributes;
47
48     //configBodyType the {@link PolicyType} Enum format of the config Body Type.
49     private PolicyType configBodyType;
50
51     //configBody the <code>String</code> format of the Policy Body
52     private String configBody;
53
54     //requestID unique request ID which will be passed throughout the ONAP components to correlate logging messages.
55     private UUID requestID;
56
57     private PolicyConfigParams() {
58         super();
59     }
60
61     PolicyConfigType getPolicyConfigType() {
62         return policyConfigType;
63     }
64
65     public String getPolicyName() {
66         return policyName;
67     }
68
69     public String getPolicyDescription() {
70         return policyDescription;
71     }
72
73     public String getOnapName() {
74         return onapName;
75     }
76
77     public String getConfigName() {
78         return configName;
79     }
80
81     public Map<AttributeType, Map<String, String>> getAttributes() {
82         return attributes;
83     }
84
85     PolicyType getConfigBodyType() {
86         return configBodyType;
87     }
88
89     public String getConfigBody() {
90         return configBody;
91     }
92
93     public UUID getRequestID() {
94         return requestID;
95     }
96
97     public static PolicyConfigParamsBuilder builder() {
98         return new PolicyConfigParamsBuilder();
99     }
100
101     /**
102      * Builder class for policy config parameters
103      */
104     public static class PolicyConfigParamsBuilder {
105         PolicyConfigParams m = new PolicyConfigParams();
106
107         private PolicyConfigParamsBuilder() {
108             super();
109         }
110
111         public PolicyConfigParams build() {
112             return m;
113         }
114
115         public PolicyConfigParamsBuilder policyConfigType(PolicyConfigType policyConfigType) {
116             m.policyConfigType = policyConfigType;
117             return this;
118         }
119
120         public PolicyConfigParamsBuilder policyName(String policyName) {
121             m.policyName = policyName;
122             return this;
123         }
124
125         public PolicyConfigParamsBuilder policyDescription(String policyDescription) {
126             m.policyDescription = policyDescription;
127             return this;
128         }
129
130         public PolicyConfigParamsBuilder onapName(String onapName) {
131             m.onapName = onapName;
132             return this;
133         }
134
135         public PolicyConfigParamsBuilder configName(String configName) {
136             m.configName = configName;
137             return this;
138         }
139
140         public PolicyConfigParamsBuilder attributes(Map<AttributeType, Map<String, String>> attributes) {
141             m.attributes = attributes;
142             return this;
143         }
144
145         public PolicyConfigParamsBuilder configBodyType(PolicyType configBodyType) {
146             m.configBodyType = configBodyType;
147             return this;
148         }
149
150         public PolicyConfigParamsBuilder configBody(String configBody) {
151             m.configBody = configBody;
152             return this;
153         }
154
155         public PolicyConfigParamsBuilder requestID(UUID requestID) {
156             m.requestID = requestID;
157             return this;
158         }
159     }
160 }