src/main/java/de/uapcore/lightpit/viewmodel/VersionInfo.java

Mon, 01 Jun 2020 14:46:58 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 01 Jun 2020 14:46:58 +0200
changeset 86
0a658e53177c
child 88
1438e5a22c55
permissions
-rw-r--r--

improves issue overview and adds progress information

86
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 package de.uapcore.lightpit.viewmodel;
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 import de.uapcore.lightpit.entities.Issue;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
4 import de.uapcore.lightpit.entities.IssueSummary;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
5 import de.uapcore.lightpit.entities.Version;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
6
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
7 import java.util.ArrayList;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
8 import java.util.List;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
10 public class VersionInfo {
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 private final Version version;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 private final IssueSummary reportedTotal = new IssueSummary();
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15 private final IssueSummary scheduledTotal = new IssueSummary();
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16 private final IssueSummary resolvedTotal = new IssueSummary();
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 private final List<Issue> reported = new ArrayList<>();
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
19 private final List<Issue> scheduled = new ArrayList<>();
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
20 private final List<Issue> resolved = new ArrayList<>();
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 public VersionInfo(Version version) {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
23 this.version = version;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
24 }
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 public Version getVersion() {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
27 return version;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
28 }
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
29
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
30 public void addReported(Issue issue) {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
31 reportedTotal.add(issue);
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
32 reported.add(issue);
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
33 }
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 public void addScheduled(Issue issue) {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
36 scheduledTotal.add(issue);
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
37 scheduled.add(issue);
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 void addResolved(Issue issue) {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
41 resolvedTotal.add(issue);
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
42 resolved.add(issue);
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 IssueSummary getReportedTotal() {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
46 return reportedTotal;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
47 }
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 public IssueSummary getScheduledTotal() {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
50 return scheduledTotal;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
51 }
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
52
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
53 public IssueSummary getResolvedTotal() {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
54 return resolvedTotal;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
55 }
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
56
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
57 public List<Issue> getReported() {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
58 return reported;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
59 }
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
60
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
61 public List<Issue> getScheduled() {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
62 return scheduled;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
63 }
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
64
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
65 public List<Issue> getResolved() {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
66 return resolved;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
67 }
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
68
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
69 public void collectIssues(List<Issue> issues) {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
70 for (Issue issue : issues) {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
71 if (issue.getAffectedVersions().contains(version)) {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
72 addReported(issue);
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
73 }
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
74 if (issue.getScheduledVersions().contains(version)) {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
75 addScheduled(issue);
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
76 }
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
77 if (issue.getResolvedVersions().contains(version)) {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
78 addResolved(issue);
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
79 }
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
80 }
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
81 }
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
82 }

mercurial