src/main/java/de/uapcore/lightpit/entities/IssueSummary.java

Thu, 08 Oct 2020 20:38:43 +0200

author
Mike Becker <universe@uap-core.de>
date
Thu, 08 Oct 2020 20:38:43 +0200
changeset 110
9d0be0b1580f
parent 86
0a658e53177c
child 116
d24354f21df5
permissions
-rw-r--r--

adds indicators for version status

replaces table column "Status" with version tag
fixes New Version form button not overriding the session version ID

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

mercurial