1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.common.lib.info;
20
21 import java.util.HashMap;
22 import java.util.Map;
23 import org.apache.commons.lang3.builder.EqualsBuilder;
24 import org.apache.commons.lang3.builder.HashCodeBuilder;
25 import org.apache.syncope.common.lib.BaseBean;
26
27 public class NumbersInfo implements BaseBean {
28
29 private static final long serialVersionUID = 7691187370598649583L;
30
31 public enum ConfItem {
32
33 RESOURCE(20),
34 ACCOUNT_POLICY(10),
35 PASSWORD_POLICY(10),
36 NOTIFICATION(8),
37 PULL_TASK(10),
38 VIR_SCHEMA(10),
39 ANY_TYPE(5),
40 SECURITY_QUESTION(12),
41 ROLE(15);
42
43 private final int score;
44
45 ConfItem(final int score) {
46 this.score = score;
47 }
48
49 public static int getScore(final String name) {
50 int score = 0;
51 for (ConfItem value : values()) {
52 if (value.name().equals(name)) {
53 score = value.score;
54 }
55 }
56 return score;
57 }
58 }
59
60 public static class TaskExecutorInfo {
61
62 private int size;
63
64 private int active;
65
66 private int queued;
67
68 private int completed;
69
70 public int getSize() {
71 return size;
72 }
73
74 public void setSize(final int size) {
75 this.size = size;
76 }
77
78 public int getActive() {
79 return active;
80 }
81
82 public void setActive(final int active) {
83 this.active = active;
84 }
85
86 public int getQueued() {
87 return queued;
88 }
89
90 public void setQueued(final int queued) {
91 this.queued = queued;
92 }
93
94 public int getCompleted() {
95 return completed;
96 }
97
98 public void setCompleted(final int completed) {
99 this.completed = completed;
100 }
101
102 @Override
103 public int hashCode() {
104 return new HashCodeBuilder().
105 append(size).
106 append(active).
107 append(queued).
108 append(completed).
109 build();
110 }
111
112 @Override
113 public boolean equals(final Object obj) {
114 if (this == obj) {
115 return true;
116 }
117 if (obj == null) {
118 return false;
119 }
120 if (getClass() != obj.getClass()) {
121 return false;
122 }
123 final TaskExecutorInfo other = (TaskExecutorInfo) obj;
124 return new EqualsBuilder().
125 append(size, other.size).
126 append(active, other.active).
127 append(queued, other.queued).
128 append(completed, other.completed).
129 build();
130 }
131 }
132
133 private int totalUsers;
134
135 private final Map<String, Integer> usersByRealm = new HashMap<>();
136
137 private final Map<String, Integer> usersByStatus = new HashMap<>();
138
139 private int totalGroups;
140
141 private final Map<String, Integer> groupsByRealm = new HashMap<>();
142
143 private String anyType1;
144
145 private Integer totalAny1;
146
147 private final Map<String, Integer> any1ByRealm = new HashMap<>();
148
149 private String anyType2;
150
151 private Integer totalAny2;
152
153 private final Map<String, Integer> any2ByRealm = new HashMap<>();
154
155 private int totalResources;
156
157 private int totalRoles;
158
159 private final Map<String, Boolean> confCompleteness = new HashMap<>();
160
161 private final Map<String, TaskExecutorInfo> taskExecutorInfos = new HashMap<>();
162
163 public int getTotalUsers() {
164 return totalUsers;
165 }
166
167 public void setTotalUsers(final int totalUsers) {
168 this.totalUsers = totalUsers;
169 }
170
171 public int getTotalGroups() {
172 return totalGroups;
173 }
174
175 public void setTotalGroups(final int totalGroups) {
176 this.totalGroups = totalGroups;
177 }
178
179 public String getAnyType1() {
180 return anyType1;
181 }
182
183 public void setAnyType1(final String anyType1) {
184 this.anyType1 = anyType1;
185 }
186
187 public Integer getTotalAny1() {
188 return totalAny1;
189 }
190
191 public void setTotalAny1(final Integer totalAny1) {
192 this.totalAny1 = totalAny1;
193 }
194
195 public String getAnyType2() {
196 return anyType2;
197 }
198
199 public void setAnyType2(final String anyType2) {
200 this.anyType2 = anyType2;
201 }
202
203 public Integer getTotalAny2() {
204 return totalAny2;
205 }
206
207 public void setTotalAny2(final Integer totalAny2) {
208 this.totalAny2 = totalAny2;
209 }
210
211 public int getTotalResources() {
212 return totalResources;
213 }
214
215 public void setTotalResources(final int totalResources) {
216 this.totalResources = totalResources;
217 }
218
219 public int getTotalRoles() {
220 return totalRoles;
221 }
222
223 public void setTotalRoles(final int totalRoles) {
224 this.totalRoles = totalRoles;
225 }
226
227 public Map<String, Integer> getUsersByRealm() {
228 return usersByRealm;
229 }
230
231 public Map<String, Integer> getUsersByStatus() {
232 return usersByStatus;
233 }
234
235 public Map<String, Integer> getGroupsByRealm() {
236 return groupsByRealm;
237 }
238
239 public Map<String, Integer> getAny1ByRealm() {
240 return any1ByRealm;
241 }
242
243 public Map<String, Integer> getAny2ByRealm() {
244 return any2ByRealm;
245 }
246
247 public Map<String, Boolean> getConfCompleteness() {
248 return confCompleteness;
249 }
250
251 public Map<String, TaskExecutorInfo> getTaskExecutorInfos() {
252 return taskExecutorInfos;
253 }
254
255 @Override
256 public int hashCode() {
257 return new HashCodeBuilder().
258 append(totalUsers).
259 append(usersByRealm).
260 append(usersByStatus).
261 append(totalGroups).
262 append(groupsByRealm).
263 append(anyType1).
264 append(totalAny1).
265 append(any1ByRealm).
266 append(anyType2).
267 append(totalAny2).
268 append(any2ByRealm).
269 append(totalResources).
270 append(totalRoles).
271 append(confCompleteness).
272 append(taskExecutorInfos).
273 build();
274 }
275
276 @Override
277 public boolean equals(final Object obj) {
278 if (this == obj) {
279 return true;
280 }
281 if (obj == null) {
282 return false;
283 }
284 if (getClass() != obj.getClass()) {
285 return false;
286 }
287 final NumbersInfo other = (NumbersInfo) obj;
288 return new EqualsBuilder().
289 append(totalUsers, other.totalUsers).
290 append(totalGroups, other.totalGroups).
291 append(totalResources, other.totalResources).
292 append(totalRoles, other.totalRoles).
293 append(anyType1, other.anyType1).
294 append(anyType2, other.anyType2).
295 append(usersByRealm, other.usersByRealm).
296 append(usersByStatus, other.usersByStatus).
297 append(groupsByRealm, other.groupsByRealm).
298 append(totalAny1, other.totalAny1).
299 append(any1ByRealm, other.any1ByRealm).
300 append(totalAny2, other.totalAny2).
301 append(any2ByRealm, other.any2ByRealm).
302 append(confCompleteness, other.confCompleteness).
303 append(taskExecutorInfos, other.taskExecutorInfos).
304 build();
305 }
306 }