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 import org.onap.portalsdk.core.domain.RoleFunction;
47 public class CentralRole implements Serializable {
49 private static final long serialVersionUID = -9210905386086213882L;
52 private Date modified;
53 private Long createdId;
54 private Long modifiedId;
58 private boolean active;
59 private Integer priority;
61 private SortedSet<CentralRoleFunction> roleFunctions = new TreeSet<>();
63 private SortedSet<CentralRole> childRoles = new TreeSet<>();
65 private SortedSet<CentralRole> parentRoles = new TreeSet<>();
71 public CentralRole(Long id, String name, boolean active, Integer priority,
72 SortedSet<CentralRoleFunction> roleFunctions) {
77 this.priority = priority;
78 this.roleFunctions = roleFunctions;
81 public static class CentralRoleBuilder {
84 private boolean active;
85 private Integer priority;
86 private SortedSet<CentralRoleFunction> roleFunctions;
88 private Date modified;
89 private Long createdId;
90 private Long modifiedId;
92 private SortedSet<CentralRole> childRoles;
93 private SortedSet<CentralRole> parentRoles;
95 public CentralRoleBuilder setId(Long id) {
100 public CentralRoleBuilder setName(String name) {
105 public CentralRoleBuilder setActive(boolean active) {
106 this.active = active;
110 public CentralRoleBuilder setPriority(Integer priority) {
111 this.priority = priority;
115 public CentralRoleBuilder setRoleFunctions(SortedSet<CentralRoleFunction> roleFunctions) {
116 this.roleFunctions = roleFunctions;
120 public CentralRoleBuilder setCreated(Date created) {
121 this.created = created;
125 public CentralRoleBuilder setModified(Date modified) {
126 this.modified = modified;
130 public CentralRoleBuilder setCreatedId(Long createdId) {
131 this.createdId = createdId;
135 public CentralRoleBuilder setModifiedId(Long modifiedId) {
136 this.modifiedId = modifiedId;
140 public CentralRoleBuilder setRowNum(Long rowNum) {
141 this.rowNum = rowNum;
145 public CentralRoleBuilder setChildRoles(SortedSet<CentralRole> childRoles) {
146 this.childRoles = childRoles;
150 public CentralRoleBuilder setParentRoles(SortedSet<CentralRole> parentRoles) {
151 this.parentRoles = parentRoles;
155 public CentralRole createCentralRole() {
156 return new CentralRole(this);
160 public CentralRole(CentralRoleBuilder centralRoleBuilder) {
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;
179 public Long getId() {
187 public void setId(Long id) {
192 * @return the created
194 public Date getCreated() {
202 public void setCreated(Date created) {
203 this.created = created;
207 * @return the modified
209 public Date getModified() {
215 * the modified to set
217 public void setModified(Date modified) {
218 this.modified = modified;
222 * @return the createdId
224 public Long getCreatedId() {
230 * the createdId to set
232 public void setCreatedId(Long createdId) {
233 this.createdId = createdId;
237 * @return the modifiedId
239 public Long getModifiedId() {
245 * the modifiedId to set
247 public void setModifiedId(Long modifiedId) {
248 this.modifiedId = modifiedId;
254 public Long getRowNum() {
262 public void setRowNum(Long rowNum) {
263 this.rowNum = rowNum;
269 public String getName() {
277 public void setName(String name) {
284 public boolean isActive() {
292 public void setActive(boolean active) {
293 this.active = active;
297 * @return the priority
299 public Integer getPriority() {
305 * the priority to set
307 public void setPriority(Integer priority) {
308 this.priority = priority;
312 * @return the roleFunctions
314 public SortedSet<CentralRoleFunction> getRoleFunctions() {
315 return roleFunctions;
319 * @param roleFunctions
320 * the roleFunctions to set
322 public void setRoleFunctions(SortedSet<CentralRoleFunction> roleFunctions) {
323 this.roleFunctions = roleFunctions;
327 * @return the childRoles
329 public SortedSet<CentralRole> getChildRoles() {
335 * the childRoles to set
337 public void setChildRoles(SortedSet<CentralRole> childRoles) {
338 this.childRoles = childRoles;
342 * @return the parentRoles
344 public SortedSet<CentralRole> getParentRoles() {
350 * the parentRoles to set
352 public void setParentRoles(SortedSet<CentralRole> parentRoles) {
353 this.parentRoles = parentRoles;