Reduce number of parameters in constructor
[portal.git] / ecomp-portal-BE-common / src / main / java / org / onap / portalapp / portal / transport / CentralRole.java
1 /*-
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
8  * Unless otherwise specified, all software contained herein is licensed
9  * under the Apache License, Version 2.0 (the "License");
10  * you may not use this software except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  *
21  * Unless otherwise specified, all documentation contained herein is licensed
22  * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23  * you may not use this documentation except in compliance with the License.
24  * You may obtain a copy of the License at
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
28  * Unless required by applicable law or agreed to in writing, documentation
29  * distributed under the License is distributed on an "AS IS" BASIS,
30  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31  * See the License for the specific language governing permissions and
32  * limitations under the License.
33  *
34  * ============LICENSE_END============================================
35  *
36  * 
37  */
38 package org.onap.portalapp.portal.transport;
39
40 import java.io.Serializable;
41 import java.util.Date;
42 import java.util.SortedSet;
43 import java.util.TreeSet;
44
45 import org.onap.portalsdk.core.domain.RoleFunction;
46
47 public class CentralRole implements Serializable {
48
49         private static final long serialVersionUID = -9210905386086213882L;
50         private Long id;
51         private Date created;
52         private Date modified;
53         private Long createdId;
54         private Long modifiedId;
55         private Long rowNum;
56
57         private String name;
58         private boolean active;
59         private Integer priority;
60
61         private SortedSet<CentralRoleFunction> roleFunctions = new TreeSet<>();
62
63         private SortedSet<CentralRole> childRoles = new TreeSet<>();
64
65         private SortedSet<CentralRole> parentRoles = new TreeSet<>();
66
67         public CentralRole(){
68                 
69         }
70         
71         public CentralRole(Long id, String name, boolean active, Integer priority,
72                         SortedSet<CentralRoleFunction> roleFunctions) {
73                 super();
74                 this.id = id;
75                 this.name = name;
76                 this.active = active;
77                 this.priority = priority;
78                 this.roleFunctions = roleFunctions;
79         }
80         
81         public static class CentralRoleBuilder {
82             private Long id;
83             private String name;
84             private boolean active;
85             private Integer priority;
86             private SortedSet<CentralRoleFunction> roleFunctions;
87             private Date created;
88             private Date modified;
89             private Long createdId;
90             private Long modifiedId;
91             private Long rowNum;
92             private SortedSet<CentralRole> childRoles;
93             private SortedSet<CentralRole> parentRoles;
94
95             public CentralRoleBuilder setId(Long id) {
96                 this.id = id;
97                 return this;
98             }
99
100             public CentralRoleBuilder setName(String name) {
101                 this.name = name;
102                 return this;
103             }
104
105             public CentralRoleBuilder setActive(boolean active) {
106                 this.active = active;
107                 return this;
108             }
109
110             public CentralRoleBuilder setPriority(Integer priority) {
111                 this.priority = priority;
112                 return this;
113             }
114
115             public CentralRoleBuilder setRoleFunctions(SortedSet<CentralRoleFunction> roleFunctions) {
116                 this.roleFunctions = roleFunctions;
117                 return this;
118             }
119
120             public CentralRoleBuilder setCreated(Date created) {
121                 this.created = created;
122                 return this;
123             }
124
125             public CentralRoleBuilder setModified(Date modified) {
126                 this.modified = modified;
127                 return this;
128             }
129
130             public CentralRoleBuilder setCreatedId(Long createdId) {
131                 this.createdId = createdId;
132                 return this;
133             }
134
135             public CentralRoleBuilder setModifiedId(Long modifiedId) {
136                 this.modifiedId = modifiedId;
137                 return this;
138             }
139
140             public CentralRoleBuilder setRowNum(Long rowNum) {
141                 this.rowNum = rowNum;
142                 return this;
143             }
144
145             public CentralRoleBuilder setChildRoles(SortedSet<CentralRole> childRoles) {
146                 this.childRoles = childRoles;
147                 return this;
148             }
149
150             public CentralRoleBuilder setParentRoles(SortedSet<CentralRole> parentRoles) {
151                 this.parentRoles = parentRoles;
152                 return this;
153             }
154
155             public CentralRole createCentralRole() {
156                 return new CentralRole(this);
157             }
158         }
159
160         public CentralRole(CentralRoleBuilder centralRoleBuilder) {
161                 super();
162                 this.id = centralRoleBuilder.id;
163                 this.created = centralRoleBuilder.created;
164                 this.modified = centralRoleBuilder.modified;
165                 this.createdId = centralRoleBuilder.createdId;
166                 this.modifiedId = centralRoleBuilder.modifiedId;
167                 this.rowNum = centralRoleBuilder.rowNum;
168                 this.name = centralRoleBuilder.name;
169                 this.active = centralRoleBuilder.active;
170                 this.priority = centralRoleBuilder.priority;
171                 this.roleFunctions = centralRoleBuilder.roleFunctions;
172                 this.childRoles = centralRoleBuilder.childRoles;
173                 this.parentRoles = centralRoleBuilder.parentRoles;
174         }
175
176         /**
177          * @return the id
178          */
179         public Long getId() {
180                 return id;
181         }
182
183         /**
184          * @param id
185          *            the id to set
186          */
187         public void setId(Long id) {
188                 this.id = id;
189         }
190
191         /**
192          * @return the created
193          */
194         public Date getCreated() {
195                 return created;
196         }
197
198         /**
199          * @param created
200          *            the created to set
201          */
202         public void setCreated(Date created) {
203                 this.created = created;
204         }
205
206         /**
207          * @return the modified
208          */
209         public Date getModified() {
210                 return modified;
211         }
212
213         /**
214          * @param modified
215          *            the modified to set
216          */
217         public void setModified(Date modified) {
218                 this.modified = modified;
219         }
220
221         /**
222          * @return the createdId
223          */
224         public Long getCreatedId() {
225                 return createdId;
226         }
227
228         /**
229          * @param createdId
230          *            the createdId to set
231          */
232         public void setCreatedId(Long createdId) {
233                 this.createdId = createdId;
234         }
235
236         /**
237          * @return the modifiedId
238          */
239         public Long getModifiedId() {
240                 return modifiedId;
241         }
242
243         /**
244          * @param modifiedId
245          *            the modifiedId to set
246          */
247         public void setModifiedId(Long modifiedId) {
248                 this.modifiedId = modifiedId;
249         }
250
251         /**
252          * @return the rowNum
253          */
254         public Long getRowNum() {
255                 return rowNum;
256         }
257
258         /**
259          * @param rowNum
260          *            the rowNum to set
261          */
262         public void setRowNum(Long rowNum) {
263                 this.rowNum = rowNum;
264         }
265
266         /**
267          * @return the name
268          */
269         public String getName() {
270                 return name;
271         }
272
273         /**
274          * @param name
275          *            the name to set
276          */
277         public void setName(String name) {
278                 this.name = name;
279         }
280
281         /**
282          * @return the active
283          */
284         public boolean isActive() {
285                 return active;
286         }
287
288         /**
289          * @param active
290          *            the active to set
291          */
292         public void setActive(boolean active) {
293                 this.active = active;
294         }
295
296         /**
297          * @return the priority
298          */
299         public Integer getPriority() {
300                 return priority;
301         }
302
303         /**
304          * @param priority
305          *            the priority to set
306          */
307         public void setPriority(Integer priority) {
308                 this.priority = priority;
309         }
310
311         /**
312          * @return the roleFunctions
313          */
314         public SortedSet<CentralRoleFunction> getRoleFunctions() {
315                 return roleFunctions;
316         }
317
318         /**
319          * @param roleFunctions
320          *            the roleFunctions to set
321          */
322         public void setRoleFunctions(SortedSet<CentralRoleFunction> roleFunctions) {
323                 this.roleFunctions = roleFunctions;
324         }
325
326         /**
327          * @return the childRoles
328          */
329         public SortedSet<CentralRole> getChildRoles() {
330                 return childRoles;
331         }
332
333         /**
334          * @param childRoles
335          *            the childRoles to set
336          */
337         public void setChildRoles(SortedSet<CentralRole> childRoles) {
338                 this.childRoles = childRoles;
339         }
340
341         /**
342          * @return the parentRoles
343          */
344         public SortedSet<CentralRole> getParentRoles() {
345                 return parentRoles;
346         }
347
348         /**
349          * @param parentRoles
350          *            the parentRoles to set
351          */
352         public void setParentRoles(SortedSet<CentralRole> parentRoles) {
353                 this.parentRoles = parentRoles;
354         }
355
356 }