2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright © 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============================================
36 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
38 package org.openecomp.portalapp.portal.transport;
40 import java.util.Date;
41 import java.util.SortedSet;
43 import org.openecomp.portalapp.portal.domain.CentralRoleFunction;
44 import org.openecomp.portalapp.portal.domain.EPRole;
46 public class CentralRole implements Comparable {
50 public Long createdId;
51 public Long modifiedId;
55 public boolean active;
56 public Integer priority;
58 public SortedSet<CentralRoleFunction> roleFunctions = null;
60 public SortedSet<CentralRole> childRoles = null;
62 public SortedSet<CentralRole> parentRoles = null;
64 public CentralRole(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum, String name,
65 boolean active, Integer priority, SortedSet<CentralRoleFunction> roleFunctions,
66 SortedSet<CentralRole> childRoles, SortedSet<CentralRole> parentRoles) {
69 this.created = created;
70 this.modified = modified;
71 this.createdId = createdId;
72 this.modifiedId = modifiedId;
76 this.priority = priority;
77 this.roleFunctions = roleFunctions;
78 this.childRoles = childRoles;
79 this.parentRoles = parentRoles;
82 public CentralRole() {
86 public CentralRole(Long id, String name) {
95 public void setId(Long id) {
99 public Date getCreated() {
103 public void setCreated(Date created) {
104 this.created = created;
107 public Date getModified() {
111 public void setModified(Date modified) {
112 this.modified = modified;
115 public Long getCreatedId() {
119 public void setCreatedId(Long createdId) {
120 this.createdId = createdId;
123 public Long getModifiedId() {
127 public void setModifiedId(Long modifiedId) {
128 this.modifiedId = modifiedId;
131 public Long getRowNum() {
135 public void setRowNum(Long rowNum) {
136 this.rowNum = rowNum;
139 public String getName() {
143 public void setName(String name) {
147 public boolean isActive() {
151 public void setActive(boolean active) {
152 this.active = active;
155 public Integer getPriority() {
159 public void setPriority(Integer priority) {
160 this.priority = priority;
163 public SortedSet<CentralRoleFunction> getRoleFunctions() {
164 return roleFunctions;
167 public void setRoleFunctions(SortedSet<CentralRoleFunction> roleFunctions) {
168 this.roleFunctions = roleFunctions;
171 public SortedSet<CentralRole> getChildRoles() {
175 public void setChildRoles(SortedSet<CentralRole> childRoles) {
176 this.childRoles = childRoles;
179 public SortedSet<CentralRole> getParentRoles() {
183 public void setParentRoles(SortedSet<CentralRole> parentRoles) {
184 this.parentRoles = parentRoles;
187 public int compareTo(Object obj) {
188 EPRole other = (EPRole) obj;
190 String c1 = getName();
191 String c2 = other.getName();
193 return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
197 public int hashCode() {
198 final int prime = 31;
200 result = prime * result + (active ? 1231 : 1237);
201 result = prime * result + ((childRoles == null) ? 0 : childRoles.hashCode());
202 result = prime * result + ((created == null) ? 0 : created.hashCode());
203 result = prime * result + ((createdId == null) ? 0 : createdId.hashCode());
204 result = prime * result + ((id == null) ? 0 : id.hashCode());
205 result = prime * result + ((modified == null) ? 0 : modified.hashCode());
206 result = prime * result + ((modifiedId == null) ? 0 : modifiedId.hashCode());
207 result = prime * result + ((name == null) ? 0 : name.hashCode());
208 result = prime * result + ((parentRoles == null) ? 0 : parentRoles.hashCode());
209 result = prime * result + ((priority == null) ? 0 : priority.hashCode());
210 result = prime * result + ((roleFunctions == null) ? 0 : roleFunctions.hashCode());
211 result = prime * result + ((rowNum == null) ? 0 : rowNum.hashCode());
216 public boolean equals(Object obj) {
221 if (getClass() != obj.getClass())
223 CentralRole other = (CentralRole) obj;
224 if (active != other.active)
226 if (childRoles == null) {
227 if (other.childRoles != null)
229 } else if (!childRoles.equals(other.childRoles))
231 if (created == null) {
232 if (other.created != null)
234 } else if (!created.equals(other.created))
236 if (createdId == null) {
237 if (other.createdId != null)
239 } else if (!createdId.equals(other.createdId))
242 if (other.id != null)
244 } else if (!id.equals(other.id))
246 if (modified == null) {
247 if (other.modified != null)
249 } else if (!modified.equals(other.modified))
251 if (modifiedId == null) {
252 if (other.modifiedId != null)
254 } else if (!modifiedId.equals(other.modifiedId))
257 if (other.name != null)
259 } else if (!name.equals(other.name))
261 if (parentRoles == null) {
262 if (other.parentRoles != null)
264 } else if (!parentRoles.equals(other.parentRoles))
266 if (priority == null) {
267 if (other.priority != null)
269 } else if (!priority.equals(other.priority))
271 if (roleFunctions == null) {
272 if (other.roleFunctions != null)
274 } else if (!roleFunctions.equals(other.roleFunctions))
276 if (rowNum == null) {
277 if (other.rowNum != null)
279 } else if (!rowNum.equals(other.rowNum))