1 package org.openecomp.portalapp.portal.transport;
4 import java.util.SortedSet;
6 import org.openecomp.portalapp.portal.domain.CentralRoleFunction;
7 import org.openecomp.portalapp.portal.domain.EPRole;
9 public class CentralRole implements Comparable{
13 public Long createdId;
14 public Long modifiedId;
18 public boolean active;
19 public Integer priority;
21 public SortedSet<CentralRoleFunction> roleFunctions = null;
23 public SortedSet<CentralRole> childRoles = null;
25 public SortedSet<CentralRole> parentRoles = null;
27 public CentralRole(Long id, Date created, Date modified, Long createdId, Long modifiedId, Long rowNum,
28 String name, boolean active, Integer priority, SortedSet<CentralRoleFunction> roleFunctions,
29 SortedSet<CentralRole> childRoles, SortedSet<CentralRole> parentRoles) {
32 this.created = created;
33 this.modified = modified;
34 this.createdId = createdId;
35 this.modifiedId = modifiedId;
39 this.priority = priority;
40 this.roleFunctions = roleFunctions;
41 this.childRoles = childRoles;
42 this.parentRoles = parentRoles;
49 public CentralRole(Long id, String name){
58 public void setId(Long id) {
62 public Date getCreated() {
66 public void setCreated(Date created) {
67 this.created = created;
70 public Date getModified() {
74 public void setModified(Date modified) {
75 this.modified = modified;
78 public Long getCreatedId() {
82 public void setCreatedId(Long createdId) {
83 this.createdId = createdId;
86 public Long getModifiedId() {
90 public void setModifiedId(Long modifiedId) {
91 this.modifiedId = modifiedId;
94 public Long getRowNum() {
98 public void setRowNum(Long rowNum) {
102 public String getName() {
106 public void setName(String name) {
110 public boolean isActive() {
114 public void setActive(boolean active) {
115 this.active = active;
118 public Integer getPriority() {
122 public void setPriority(Integer priority) {
123 this.priority = priority;
126 public SortedSet<CentralRoleFunction> getRoleFunctions() {
127 return roleFunctions;
130 public void setRoleFunctions(SortedSet<CentralRoleFunction> roleFunctions) {
131 this.roleFunctions = roleFunctions;
134 public SortedSet<CentralRole> getChildRoles() {
138 public void setChildRoles(SortedSet<CentralRole> childRoles) {
139 this.childRoles = childRoles;
142 public SortedSet<CentralRole> getParentRoles() {
146 public void setParentRoles(SortedSet<CentralRole> parentRoles) {
147 this.parentRoles = parentRoles;
150 public int compareTo(Object obj){
151 EPRole other = (EPRole)obj;
153 String c1 = getName();
154 String c2 = other.getName();
156 return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
160 public int hashCode() {
161 final int prime = 31;
163 result = prime * result + (active ? 1231 : 1237);
164 result = prime * result + ((childRoles == null) ? 0 : childRoles.hashCode());
165 result = prime * result + ((created == null) ? 0 : created.hashCode());
166 result = prime * result + ((createdId == null) ? 0 : createdId.hashCode());
167 result = prime * result + ((id == null) ? 0 : id.hashCode());
168 result = prime * result + ((modified == null) ? 0 : modified.hashCode());
169 result = prime * result + ((modifiedId == null) ? 0 : modifiedId.hashCode());
170 result = prime * result + ((name == null) ? 0 : name.hashCode());
171 result = prime * result + ((parentRoles == null) ? 0 : parentRoles.hashCode());
172 result = prime * result + ((priority == null) ? 0 : priority.hashCode());
173 result = prime * result + ((roleFunctions == null) ? 0 : roleFunctions.hashCode());
174 result = prime * result + ((rowNum == null) ? 0 : rowNum.hashCode());
179 public boolean equals(Object obj) {
184 if (getClass() != obj.getClass())
186 CentralRole other = (CentralRole) obj;
187 if (active != other.active)
189 if (childRoles == null) {
190 if (other.childRoles != null)
192 } else if (!childRoles.equals(other.childRoles))
194 if (created == null) {
195 if (other.created != null)
197 } else if (!created.equals(other.created))
199 if (createdId == null) {
200 if (other.createdId != null)
202 } else if (!createdId.equals(other.createdId))
205 if (other.id != null)
207 } else if (!id.equals(other.id))
209 if (modified == null) {
210 if (other.modified != null)
212 } else if (!modified.equals(other.modified))
214 if (modifiedId == null) {
215 if (other.modifiedId != null)
217 } else if (!modifiedId.equals(other.modifiedId))
220 if (other.name != null)
222 } else if (!name.equals(other.name))
224 if (parentRoles == null) {
225 if (other.parentRoles != null)
227 } else if (!parentRoles.equals(other.parentRoles))
229 if (priority == null) {
230 if (other.priority != null)
232 } else if (!priority.equals(other.priority))
234 if (roleFunctions == null) {
235 if (other.roleFunctions != null)
237 } else if (!roleFunctions.equals(other.roleFunctions))
239 if (rowNum == null) {
240 if (other.rowNum != null)
242 } else if (!rowNum.equals(other.rowNum))