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.portalapp.portal.domain.CentralV2RoleFunction;
47 @SuppressWarnings("rawtypes")
48 public class CentralV2Role implements Serializable, Comparable{
52 private static final long serialVersionUID = -4332644961113063714L;
55 private Date modified;
56 private Long createdId;
57 private Long modifiedId;
61 private boolean active;
62 private Integer priority;
64 private SortedSet<CentralV2RoleFunction> roleFunctions = new TreeSet<>();
66 private SortedSet<CentralV2Role> childRoles = new TreeSet<>();
68 private SortedSet<CentralV2Role> parentRoles = new TreeSet<>();
70 public CentralV2Role(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum,
71 String name, boolean active, Integer priority, SortedSet<CentralV2RoleFunction> roleFunctions,
72 SortedSet<CentralV2Role> childRoles, SortedSet<CentralV2Role> parentRoles) {
75 this.created = created;
76 this.modified = modified;
77 this.createdId = createdId;
78 this.modifiedId = modifiedId;
82 this.priority = priority;
83 this.roleFunctions = roleFunctions;
84 this.childRoles = childRoles;
85 this.parentRoles = parentRoles;
88 public CentralV2Role(){
92 public CentralV2Role(Long id, String name){
101 public void setId(Long id) {
105 public Date getCreated() {
109 public void setCreated(Date created) {
110 this.created = created;
113 public Date getModified() {
117 public void setModified(Date modified) {
118 this.modified = modified;
121 public Long getCreatedId() {
125 public void setCreatedId(Long createdId) {
126 this.createdId = createdId;
129 public Long getModifiedId() {
133 public void setModifiedId(Long modifiedId) {
134 this.modifiedId = modifiedId;
137 public Long getRowNum() {
141 public void setRowNum(Long rowNum) {
142 this.rowNum = rowNum;
145 public String getName() {
149 public void setName(String name) {
153 public boolean getActive() {
157 public void setActive(boolean active) {
158 this.active = active;
161 public Integer getPriority() {
165 public void setPriority(Integer priority) {
166 this.priority = priority;
169 public SortedSet<CentralV2RoleFunction> getRoleFunctions() {
170 return roleFunctions;
173 public void setRoleFunctions(SortedSet<CentralV2RoleFunction> roleFunctions) {
174 this.roleFunctions = roleFunctions;
177 public SortedSet<CentralV2Role> getChildRoles() {
181 public void setChildRoles(SortedSet<CentralV2Role> childRoles) {
182 this.childRoles = childRoles;
185 public SortedSet<CentralV2Role> getParentRoles() {
189 public void setParentRoles(SortedSet<CentralV2Role> parentRoles) {
190 this.parentRoles = parentRoles;
192 public void addRoleFunction(CentralV2RoleFunction roleFunction) {
193 this.roleFunctions.add(roleFunction);
196 public void addChildRole(CentralV2Role role) {
197 this.childRoles.add(role);
200 public void addParentRole(CentralV2Role role) {
201 this.parentRoles.add(role);
204 public int compareTo(Object obj){
205 CentralV2Role other = (CentralV2Role)obj;
207 String c1 = getName();
208 String c2 = other.getName();
210 return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
214 public int hashCode() {
215 final int prime = 31;
217 result = prime * result + ((id == null) ? 0 : id.hashCode());
218 result = prime * result + ((name == null) ? 0 : name.hashCode());
223 public boolean equals(Object obj) {
228 if (getClass() != obj.getClass())
230 CentralV2Role other = (CentralV2Role) obj;
232 if (other.id != null)
234 } else if (!id.equals(other.id))
237 if (other.name != null)
239 } else if (!name.equals(other.name))