|
1 package de.uapcore.lightpit.entities; |
|
2 |
|
3 public class IssueSummary { |
|
4 private int open = 0; |
|
5 private int active = 0; |
|
6 private int done = 0; |
|
7 |
|
8 public int getOpen() { |
|
9 return open; |
|
10 } |
|
11 |
|
12 public void setOpen(int open) { |
|
13 this.open = open; |
|
14 } |
|
15 |
|
16 public int getActive() { |
|
17 return active; |
|
18 } |
|
19 |
|
20 public void setActive(int active) { |
|
21 this.active = active; |
|
22 } |
|
23 |
|
24 public int getDone() { |
|
25 return done; |
|
26 } |
|
27 |
|
28 public void setDone(int done) { |
|
29 this.done = done; |
|
30 } |
|
31 |
|
32 public int getTotal() { |
|
33 return open+active+done; |
|
34 } |
|
35 |
|
36 public int getOpenPercent() { |
|
37 return 100-getActivePercent()-getDonePercent(); |
|
38 } |
|
39 |
|
40 public int getActivePercent() { |
|
41 int total = getTotal(); |
|
42 return total > 0 ? 100*active/total : 0; |
|
43 } |
|
44 |
|
45 public int getDonePercent() { |
|
46 int total = getTotal(); |
|
47 return total > 0 ? 100*done/total : 0; |
|
48 } |
|
49 |
|
50 /** |
|
51 * Adds the specified issue to the summary by increming the respective counter. |
|
52 * @param issue the issue |
|
53 */ |
|
54 public void add(Issue issue) { |
|
55 switch (issue.getStatus().getPhase()) { |
|
56 case 0: |
|
57 open++; |
|
58 break; |
|
59 case 1: |
|
60 active++; |
|
61 break; |
|
62 case 2: |
|
63 done++; |
|
64 break; |
|
65 } |
|
66 } |
|
67 } |