Format ONAP-XACML and add JUnit
[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  * Modifications Copyright (C) 2019 AT&T Intellectual Property.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.xacml.std.pap;
23
24 import java.net.URI;
25
26 /**
27  * Parameters class for StdPDPPolicy.
28  */
29 public class StdPDPPolicyParams {
30     private String id;
31     private boolean isRoot;
32     private String name;
33     private URI location;
34     private boolean isValid;
35     private String policyId;
36     private String description;
37     private String version;
38
39     /**
40      * Private constructor.
41      */
42     private StdPDPPolicyParams() {
43         super();
44     }
45
46     /**
47      * Get an instance of builder class.
48      *
49      * @return StdPDPPolicyParamsBuilder
50      */
51     public static StdPDPPolicyParamsBuilder builder() {
52         return new StdPDPPolicyParamsBuilder();
53     }
54
55     /**
56      * Return id.
57      *
58      * @return id String
59      */
60     public String getId() {
61         return id;
62     }
63
64     /**
65      * Boolean to indicate root.
66      *
67      * @return isRoot
68      */
69     public boolean isRoot() {
70         return isRoot;
71     }
72
73     /**
74      * Get name of policy.
75      *
76      * @return name
77      */
78     public String getName() {
79         return name;
80     }
81
82     /**
83      * Retrieve the uri.
84      *
85      * @return location
86      */
87     public URI getLocation() {
88         return location;
89     }
90
91     /**
92      * Check policy valid.
93      *
94      * @return isValid
95      */
96     public boolean isValid() {
97         return isValid;
98     }
99
100     /**
101      * Retrieve policy id.
102      *
103      * @return policy id
104      */
105     public String getPolicyId() {
106         return policyId;
107     }
108
109     /**
110      * Description of policy.
111      *
112      * @return description
113      */
114     public String getDescription() {
115         return description;
116     }
117
118     /**
119      * Retrieve version of policy.
120      *
121      * @return version
122      */
123     public String getVersion() {
124         return version;
125     }
126
127     /**
128      * Builder class for std pdp policy params class.
129      */
130     public static class StdPDPPolicyParamsBuilder {
131         StdPDPPolicyParams params = new StdPDPPolicyParams();
132
133         /**
134          * Build the policy params.
135          *
136          * @return stdPdpPolicyParams object
137          */
138         public StdPDPPolicyParams build() {
139             return params;
140         }
141
142         /**
143          * Set id.
144          *
145          * @param id - provide id
146          * @return builder
147          */
148         public StdPDPPolicyParamsBuilder id(String id) {
149             params.id = id;
150             return this;
151         }
152
153         /**
154          * Set whether isRoot.
155          *
156          * @param isRoot - true/false
157          * @return builder
158          */
159         public StdPDPPolicyParamsBuilder isRoot(boolean isRoot) {
160             params.isRoot = isRoot;
161             return this;
162         }
163
164         /**
165          * Set name.
166          *
167          * @param name - name of policy
168          * @return builder
169          */
170         public StdPDPPolicyParamsBuilder name(String name) {
171             params.name = name;
172             return this;
173         }
174
175         /**
176          * Set location uri.
177          *
178          * @param uri - for location
179          * @return builder
180          */
181         public StdPDPPolicyParamsBuilder location(URI uri) {
182             params.location = uri;
183             return this;
184         }
185
186         /**
187          * Set valid flag.
188          *
189          * @param isValid - whether the policy is valid
190          * @return builder
191          */
192         public StdPDPPolicyParamsBuilder isValid(boolean isValid) {
193             params.isValid = isValid;
194             return this;
195         }
196
197         /**
198          * Set policy id.
199          *
200          * @param policyId - policy id
201          * @return builder
202          */
203         public StdPDPPolicyParamsBuilder policyId(String policyId) {
204             params.policyId = policyId;
205             return this;
206         }
207
208         /**
209          * Set description of policy.
210          *
211          * @param description - of policy
212          * @return builder
213          */
214         public StdPDPPolicyParamsBuilder description(String description) {
215             params.description = description;
216             return this;
217         }
218
219         /**
220          * Set version of policy.
221          *
222          * @param version - of policy
223          * @return builder
224          */
225         public StdPDPPolicyParamsBuilder version(String version) {
226             params.version = version;
227             return this;
228         }
229     }
230 }