Update license; improve coverage; add docs dir
[portal.git] / ecomp-portal-BE-common / src / main / java / org / openecomp / portalapp / portal / transport / CentralRole.java
1 /*-
2  * ============LICENSE_START==========================================
3  * ONAP Portal
4  * ===================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  *
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
12  *
13  *             http://www.apache.org/licenses/LICENSE-2.0
14  *
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.
20  *
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
25  *
26  *             https://creativecommons.org/licenses/by/4.0/
27  *
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.
33  *
34  * ============LICENSE_END============================================
35  *
36  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
37  */
38 package org.openecomp.portalapp.portal.transport;
39
40 import java.util.Date;
41 import java.util.SortedSet;
42
43 import org.openecomp.portalapp.portal.domain.CentralRoleFunction;
44 import org.openecomp.portalapp.portal.domain.EPRole;
45
46 public class CentralRole implements Comparable {
47         public Long id;
48         public Date created;
49         public Date modified;
50         public Long createdId;
51         public Long modifiedId;
52         public Long rowNum;
53
54         public String name;
55         public boolean active;
56         public Integer priority;
57
58         public SortedSet<CentralRoleFunction> roleFunctions = null;
59
60         public SortedSet<CentralRole> childRoles = null;
61
62         public SortedSet<CentralRole> parentRoles = null;
63
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) {
67                 super();
68                 this.id = id;
69                 this.created = created;
70                 this.modified = modified;
71                 this.createdId = createdId;
72                 this.modifiedId = modifiedId;
73                 this.rowNum = rowNum;
74                 this.name = name;
75                 this.active = active;
76                 this.priority = priority;
77                 this.roleFunctions = roleFunctions;
78                 this.childRoles = childRoles;
79                 this.parentRoles = parentRoles;
80         }
81
82         public CentralRole() {
83
84         }
85
86         public CentralRole(Long id, String name) {
87                 this.id = id;
88                 this.name = name;
89         }
90
91         public Long getId() {
92                 return id;
93         }
94
95         public void setId(Long id) {
96                 this.id = id;
97         }
98
99         public Date getCreated() {
100                 return created;
101         }
102
103         public void setCreated(Date created) {
104                 this.created = created;
105         }
106
107         public Date getModified() {
108                 return modified;
109         }
110
111         public void setModified(Date modified) {
112                 this.modified = modified;
113         }
114
115         public Long getCreatedId() {
116                 return createdId;
117         }
118
119         public void setCreatedId(Long createdId) {
120                 this.createdId = createdId;
121         }
122
123         public Long getModifiedId() {
124                 return modifiedId;
125         }
126
127         public void setModifiedId(Long modifiedId) {
128                 this.modifiedId = modifiedId;
129         }
130
131         public Long getRowNum() {
132                 return rowNum;
133         }
134
135         public void setRowNum(Long rowNum) {
136                 this.rowNum = rowNum;
137         }
138
139         public String getName() {
140                 return name;
141         }
142
143         public void setName(String name) {
144                 this.name = name;
145         }
146
147         public boolean isActive() {
148                 return active;
149         }
150
151         public void setActive(boolean active) {
152                 this.active = active;
153         }
154
155         public Integer getPriority() {
156                 return priority;
157         }
158
159         public void setPriority(Integer priority) {
160                 this.priority = priority;
161         }
162
163         public SortedSet<CentralRoleFunction> getRoleFunctions() {
164                 return roleFunctions;
165         }
166
167         public void setRoleFunctions(SortedSet<CentralRoleFunction> roleFunctions) {
168                 this.roleFunctions = roleFunctions;
169         }
170
171         public SortedSet<CentralRole> getChildRoles() {
172                 return childRoles;
173         }
174
175         public void setChildRoles(SortedSet<CentralRole> childRoles) {
176                 this.childRoles = childRoles;
177         }
178
179         public SortedSet<CentralRole> getParentRoles() {
180                 return parentRoles;
181         }
182
183         public void setParentRoles(SortedSet<CentralRole> parentRoles) {
184                 this.parentRoles = parentRoles;
185         }
186
187         public int compareTo(Object obj) {
188                 EPRole other = (EPRole) obj;
189
190                 String c1 = getName();
191                 String c2 = other.getName();
192
193                 return (c1 == null || c2 == null) ? 1 : c1.compareTo(c2);
194         }
195
196         @Override
197         public int hashCode() {
198                 final int prime = 31;
199                 int result = 1;
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());
212                 return result;
213         }
214
215         @Override
216         public boolean equals(Object obj) {
217                 if (this == obj)
218                         return true;
219                 if (obj == null)
220                         return false;
221                 if (getClass() != obj.getClass())
222                         return false;
223                 CentralRole other = (CentralRole) obj;
224                 if (active != other.active)
225                         return false;
226                 if (childRoles == null) {
227                         if (other.childRoles != null)
228                                 return false;
229                 } else if (!childRoles.equals(other.childRoles))
230                         return false;
231                 if (created == null) {
232                         if (other.created != null)
233                                 return false;
234                 } else if (!created.equals(other.created))
235                         return false;
236                 if (createdId == null) {
237                         if (other.createdId != null)
238                                 return false;
239                 } else if (!createdId.equals(other.createdId))
240                         return false;
241                 if (id == null) {
242                         if (other.id != null)
243                                 return false;
244                 } else if (!id.equals(other.id))
245                         return false;
246                 if (modified == null) {
247                         if (other.modified != null)
248                                 return false;
249                 } else if (!modified.equals(other.modified))
250                         return false;
251                 if (modifiedId == null) {
252                         if (other.modifiedId != null)
253                                 return false;
254                 } else if (!modifiedId.equals(other.modifiedId))
255                         return false;
256                 if (name == null) {
257                         if (other.name != null)
258                                 return false;
259                 } else if (!name.equals(other.name))
260                         return false;
261                 if (parentRoles == null) {
262                         if (other.parentRoles != null)
263                                 return false;
264                 } else if (!parentRoles.equals(other.parentRoles))
265                         return false;
266                 if (priority == null) {
267                         if (other.priority != null)
268                                 return false;
269                 } else if (!priority.equals(other.priority))
270                         return false;
271                 if (roleFunctions == null) {
272                         if (other.roleFunctions != null)
273                                 return false;
274                 } else if (!roleFunctions.equals(other.roleFunctions))
275                         return false;
276                 if (rowNum == null) {
277                         if (other.rowNum != null)
278                                 return false;
279                 } else if (!rowNum.equals(other.rowNum))
280                         return false;
281                 return true;
282         }
283
284 }