src/main/java/de/uapcore/lightpit/viewmodel/ProjectInfo.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 90
2c74e36752f9
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.IssueSummary;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
4 import de.uapcore.lightpit.entities.Project;
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 import de.uapcore.lightpit.entities.VersionStatus;
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 import java.util.Collections;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
9 import java.util.List;
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 public class ProjectInfo {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
12
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
13 private final Project project;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
14 private List<Version> versions = Collections.emptyList();
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
15 private IssueSummary issueSummary = new IssueSummary();
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
16
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
17 public ProjectInfo(Project project) {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
18 this.project = project;
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
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
21 public Project getProject() {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
22 return project;
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
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
25 public List<Version> getVersions() {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
26 return versions;
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
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
29 public void setVersions(List<Version> versions) {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
30 this.versions = versions;
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
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
33 public Version getLatestVersion() {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
34 for (var v : versions) {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
35 if (v.getStatus().ordinal() >= VersionStatus.Released.ordinal())
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
36 return v;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
37 }
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
38 return null;
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
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
41 public Version getNextVersion() {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
42 Version next = null;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
43 for (var v : versions) {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
44 if (v.getStatus().ordinal() >= VersionStatus.Released.ordinal())
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
45 break;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
46 next = v;
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 return next;
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 public IssueSummary getIssueSummary() {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
52 return issueSummary;
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
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
55 public void setIssueSummary(IssueSummary issueSummary) {
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
56 this.issueSummary = issueSummary;
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
57 }
0a658e53177c improves issue overview and adds progress information
Mike Becker <universe@uap-core.de>
parents:
diff changeset
58 }

mercurial