2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
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
13 * http://www.apache.org/licenses/LICENSE-2.0
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.
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
26 * https://creativecommons.org/licenses/by/4.0/
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.
34 * ============LICENSE_END============================================
38 package org.onap.portalapp.portal.transport;
40 import java.io.Serializable;
41 import java.util.Date;
42 import java.util.SortedSet;
43 import java.util.TreeSet;
45 public class CentralRole implements Serializable {
47 private static final long serialVersionUID = -9210905386086213882L;
50 private Date modified;
51 private Long createdId;
52 private Long modifiedId;
56 private boolean active;
57 private Integer priority;
59 private SortedSet<CentralRoleFunction> roleFunctions = new TreeSet<>();
61 private SortedSet<CentralRole> childRoles = new TreeSet<>();
63 private SortedSet<CentralRole> parentRoles = new TreeSet<>();
69 public CentralRole(Long id, String name, boolean active, Integer priority,
70 SortedSet<CentralRoleFunction> roleFunctions) {
75 this.priority = priority;
76 this.roleFunctions = roleFunctions;
79 public static class CentralRoleBuilder {
82 private boolean active;
83 private Integer priority;
84 private SortedSet<CentralRoleFunction> roleFunctions;
86 private Date modified;
87 private Long createdId;
88 private Long modifiedId;
90 private SortedSet<CentralRole> childRoles;
91 private SortedSet<CentralRole> parentRoles;
93 public CentralRoleBuilder setId(Long id) {
98 public CentralRoleBuilder setName(String name) {
103 public CentralRoleBuilder setActive(boolean active) {
104 this.active = active;
108 public CentralRoleBuilder setPriority(Integer priority) {
109 this.priority = priority;
113 public CentralRoleBuilder setRoleFunctions(SortedSet<CentralRoleFunction> roleFunctions) {
114 this.roleFunctions = roleFunctions;
118 public CentralRoleBuilder setCreated(Date created) {
119 this.created = created;
123 public CentralRoleBuilder setModified(Date modified) {
124 this.modified = modified;
128 public CentralRoleBuilder setCreatedId(Long createdId) {
129 this.createdId = createdId;
133 public CentralRoleBuilder setModifiedId(Long modifiedId) {
134 this.modifiedId = modifiedId;
138 public CentralRoleBuilder setRowNum(Long rowNum) {
139 this.rowNum = rowNum;
143 public CentralRoleBuilder setChildRoles(SortedSet<CentralRole> childRoles) {
144 this.childRoles = childRoles;
148 public CentralRoleBuilder setParentRoles(SortedSet<CentralRole> parentRoles) {
149 this.parentRoles = parentRoles;
153 public CentralRole createCentralRole() {
154 return new CentralRole(this);
158 public CentralRole(CentralRoleBuilder centralRoleBuilder) {
160 this.id = centralRoleBuilder.id;
161 this.created = centralRoleBuilder.created;
162 this.modified = centralRoleBuilder.modified;
163 this.createdId = centralRoleBuilder.createdId;
164 this.modifiedId = centralRoleBuilder.modifiedId;
165 this.rowNum = centralRoleBuilder.rowNum;
166 this.name = centralRoleBuilder.name;
167 this.active = centralRoleBuilder.active;
168 this.priority = centralRoleBuilder.priority;
169 this.roleFunctions = centralRoleBuilder.roleFunctions;
170 this.childRoles = centralRoleBuilder.childRoles;
171 this.parentRoles = centralRoleBuilder.parentRoles;
177 public Long getId() {
185 public void setId(Long id) {
190 * @return the created
192 public Date getCreated() {
200 public void setCreated(Date created) {
201 this.created = created;
205 * @return the modified
207 public Date getModified() {
213 * the modified to set
215 public void setModified(Date modified) {
216 this.modified = modified;
220 * @return the createdId
222 public Long getCreatedId() {
228 * the createdId to set
230 public void setCreatedId(Long createdId) {
231 this.createdId = createdId;
235 * @return the modifiedId
237 public Long getModifiedId() {
243 * the modifiedId to set
245 public void setModifiedId(Long modifiedId) {
246 this.modifiedId = modifiedId;
252 public Long getRowNum() {
260 public void setRowNum(Long rowNum) {
261 this.rowNum = rowNum;
267 public String getName() {
275 public void setName(String name) {
282 public boolean isActive() {
290 public void setActive(boolean active) {
291 this.active = active;
295 * @return the priority
297 public Integer getPriority() {
303 * the priority to set
305 public void setPriority(Integer priority) {
306 this.priority = priority;
310 * @return the roleFunctions
312 public SortedSet<CentralRoleFunction> getRoleFunctions() {
313 return roleFunctions;
317 * @param roleFunctions
318 * the roleFunctions to set
320 public void setRoleFunctions(SortedSet<CentralRoleFunction> roleFunctions) {
321 this.roleFunctions = roleFunctions;
325 * @return the childRoles
327 public SortedSet<CentralRole> getChildRoles() {
333 * the childRoles to set
335 public void setChildRoles(SortedSet<CentralRole> childRoles) {
336 this.childRoles = childRoles;
340 * @return the parentRoles
342 public SortedSet<CentralRole> getParentRoles() {
348 * the parentRoles to set
350 public void setParentRoles(SortedSet<CentralRole> parentRoles) {
351 this.parentRoles = parentRoles;