Fix sonar issue with constrctr in xacml comp
[policy/engine.git] / ONAP-XACML / src / main / java / org / onap / policy / xacml / std / pap / StdPDPPolicyParams.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP-XACML
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
21 package org.onap.policy.xacml.std.pap;
22
23 import java.net.URI;
24
25 /**
26  * Parameters class for StdPDPPolicy
27  */
28 public class StdPDPPolicyParams {
29     private String id;
30     private boolean isRoot;
31     private String name;
32     private URI location;
33     private boolean isValid;
34     private String policyId;
35     private String description;
36     private String version;
37
38     /**
39      * Private constructor
40      */
41     private StdPDPPolicyParams(){
42         super();
43     }
44
45     /**
46      * Get an instance of builder class
47      * @return StdPDPPolicyParamsBuilder
48      */
49     public static StdPDPPolicyParamsBuilder builder() {
50         return new StdPDPPolicyParamsBuilder();
51     }
52
53     /**
54      * Return id
55      * @return id
56      */
57     public String getId() {
58         return id;
59     }
60
61     /**
62      * Boolean to indicate root
63      * @return isRoot
64      */
65     public boolean isRoot() {
66         return isRoot;
67     }
68
69     /**
70      * Get name of policy
71      * @return name
72      */
73     public String getName() {
74         return name;
75     }
76
77     /**
78      * Retrieve the uri
79      * @return location
80      */
81     public URI getLocation() {
82         return location;
83     }
84
85     /**
86      * Check policy valid
87      * @return isValid
88      */
89     public boolean isValid() {
90         return isValid;
91     }
92
93     /**
94      * Retrieve policy id
95      * @return policy id
96      */
97     public String getPolicyId() {
98         return policyId;
99     }
100
101     /**
102      * Description of policy
103      * @return description
104      */
105     public String getDescription() {
106         return description;
107     }
108
109     /**
110      * Retrieve version of policy
111      * @return version
112      */
113     public String getVersion() {
114         return version;
115     }
116
117     /**
118      * Builder class for std pdp policy params class
119      */
120     public static class StdPDPPolicyParamsBuilder {
121         StdPDPPolicyParams m = new StdPDPPolicyParams();
122
123         /**
124          * Build the policy params
125          * @return stdPdpPolicyParams object
126          */
127         public StdPDPPolicyParams build() {
128             return m;
129         }
130
131         /**
132          * Set id
133          * @param id - provide id
134          * @return builder
135          */
136         public StdPDPPolicyParamsBuilder id(String id) {
137             m.id = id;
138             return this;
139         }
140
141         /**
142          * Set whether isRoot
143          * @param isRoot - true/false
144          * @return builder
145          */
146         public StdPDPPolicyParamsBuilder isRoot(boolean isRoot) {
147             m.isRoot = isRoot;
148             return this;
149         }
150
151         /**
152          * Set name
153          * @param name - name of policy
154          * @return builder
155          */
156         public StdPDPPolicyParamsBuilder name(String name) {
157             m.name = name;
158             return this;
159         }
160
161         /**
162          * Set location uri
163          * @param uri - for location
164          * @return builder
165          */
166         public StdPDPPolicyParamsBuilder location(URI uri) {
167             m.location = uri;
168             return this;
169         }
170
171         /**
172          * Set valid flag
173          * @param isValid - whether the policy is valid
174          * @return builder
175          */
176         public StdPDPPolicyParamsBuilder isValid(boolean isValid) {
177             m.isValid = isValid;
178             return this;
179         }
180
181         /**
182          * Set policy id
183          * @param policyId - policy id
184          * @return builder
185          */
186         public StdPDPPolicyParamsBuilder policyId(String policyId) {
187             m.policyId = policyId;
188             return this;
189         }
190
191         /**
192          * Set description of policy
193          * @param description - of policy
194          * @return builder
195          */
196         public StdPDPPolicyParamsBuilder description(String description) {
197             m.description = description;
198             return this;
199         }
200
201         /**
202          * Set version of policy
203          * @param version - of policy
204          * @return builder
205          */
206         public StdPDPPolicyParamsBuilder version(String version) {
207             m.version = version;
208             return this;
209         }
210     }
211 }