Mon, 01 Jun 2020 14:46:58 +0200
improves issue overview and adds progress information
universe@62 | 1 | /* |
universe@62 | 2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
universe@62 | 3 | * |
universe@62 | 4 | * Copyright 2018 Mike Becker. All rights reserved. |
universe@62 | 5 | * |
universe@62 | 6 | * Redistribution and use in source and binary forms, with or without |
universe@62 | 7 | * modification, are permitted provided that the following conditions are met: |
universe@62 | 8 | * |
universe@62 | 9 | * 1. Redistributions of source code must retain the above copyright |
universe@62 | 10 | * notice, this list of conditions and the following disclaimer. |
universe@62 | 11 | * |
universe@62 | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
universe@62 | 13 | * notice, this list of conditions and the following disclaimer in the |
universe@62 | 14 | * documentation and/or other materials provided with the distribution. |
universe@62 | 15 | * |
universe@62 | 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
universe@62 | 17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
universe@62 | 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
universe@62 | 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
universe@62 | 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
universe@62 | 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
universe@62 | 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
universe@62 | 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
universe@62 | 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
universe@62 | 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
universe@62 | 26 | * POSSIBILITY OF SUCH DAMAGE. |
universe@62 | 27 | * |
universe@62 | 28 | */ |
universe@62 | 29 | package de.uapcore.lightpit.entities; |
universe@62 | 30 | |
universe@62 | 31 | import java.sql.Date; |
universe@62 | 32 | import java.sql.Timestamp; |
universe@75 | 33 | import java.time.Instant; |
universe@75 | 34 | import java.util.Collections; |
universe@62 | 35 | import java.util.List; |
universe@62 | 36 | import java.util.Objects; |
universe@62 | 37 | |
universe@62 | 38 | public final class Issue { |
universe@62 | 39 | |
universe@75 | 40 | private int id; |
universe@86 | 41 | private Project project; |
universe@62 | 42 | |
universe@62 | 43 | private IssueStatus status; |
universe@62 | 44 | private IssueCategory category; |
universe@62 | 45 | |
universe@62 | 46 | private String subject; |
universe@62 | 47 | private String description; |
universe@75 | 48 | private User assignee; |
universe@62 | 49 | |
universe@75 | 50 | private List<Version> affectedVersions = Collections.emptyList(); |
universe@75 | 51 | private List<Version> scheduledVersions = Collections.emptyList(); |
universe@75 | 52 | private List<Version> resolvedVersions = Collections.emptyList(); |
universe@62 | 53 | |
universe@75 | 54 | private Timestamp created = Timestamp.from(Instant.now()); |
universe@75 | 55 | private Timestamp updated = Timestamp.from(Instant.now()); |
universe@62 | 56 | private Date eta; |
universe@62 | 57 | |
universe@86 | 58 | public Issue(int id) { |
universe@62 | 59 | this.id = id; |
universe@62 | 60 | } |
universe@62 | 61 | |
universe@62 | 62 | public int getId() { |
universe@62 | 63 | return id; |
universe@62 | 64 | } |
universe@62 | 65 | |
universe@75 | 66 | /** |
universe@75 | 67 | * Should only be used by a DAO to store the generated ID. |
universe@75 | 68 | * @param id the freshly generated ID returned from the database after insert |
universe@75 | 69 | */ |
universe@75 | 70 | public void setId(int id) { |
universe@75 | 71 | this.id = id; |
universe@75 | 72 | } |
universe@75 | 73 | |
universe@86 | 74 | public void setProject(Project project) { |
universe@86 | 75 | this.project = project; |
universe@86 | 76 | } |
universe@86 | 77 | |
universe@62 | 78 | public Project getProject() { |
universe@62 | 79 | return project; |
universe@62 | 80 | } |
universe@62 | 81 | |
universe@62 | 82 | public IssueStatus getStatus() { |
universe@62 | 83 | return status; |
universe@62 | 84 | } |
universe@62 | 85 | |
universe@62 | 86 | public void setStatus(IssueStatus status) { |
universe@62 | 87 | this.status = status; |
universe@62 | 88 | } |
universe@62 | 89 | |
universe@81 | 90 | public int getPhase() { |
universe@81 | 91 | return this.status.getPhase(); |
universe@81 | 92 | } |
universe@81 | 93 | |
universe@62 | 94 | public IssueCategory getCategory() { |
universe@62 | 95 | return category; |
universe@62 | 96 | } |
universe@62 | 97 | |
universe@62 | 98 | public void setCategory(IssueCategory category) { |
universe@62 | 99 | this.category = category; |
universe@62 | 100 | } |
universe@62 | 101 | |
universe@62 | 102 | public String getSubject() { |
universe@62 | 103 | return subject; |
universe@62 | 104 | } |
universe@62 | 105 | |
universe@62 | 106 | public void setSubject(String subject) { |
universe@62 | 107 | this.subject = subject; |
universe@62 | 108 | } |
universe@62 | 109 | |
universe@62 | 110 | public String getDescription() { |
universe@62 | 111 | return description; |
universe@62 | 112 | } |
universe@62 | 113 | |
universe@62 | 114 | public void setDescription(String description) { |
universe@62 | 115 | this.description = description; |
universe@62 | 116 | } |
universe@62 | 117 | |
universe@75 | 118 | public User getAssignee() { |
universe@75 | 119 | return assignee; |
universe@75 | 120 | } |
universe@75 | 121 | |
universe@75 | 122 | public void setAssignee(User assignee) { |
universe@75 | 123 | this.assignee = assignee; |
universe@75 | 124 | } |
universe@75 | 125 | |
universe@62 | 126 | public List<Version> getAffectedVersions() { |
universe@62 | 127 | return affectedVersions; |
universe@62 | 128 | } |
universe@62 | 129 | |
universe@62 | 130 | public void setAffectedVersions(List<Version> affectedVersions) { |
universe@62 | 131 | this.affectedVersions = affectedVersions; |
universe@62 | 132 | } |
universe@62 | 133 | |
universe@75 | 134 | public List<Version> getScheduledVersions() { |
universe@75 | 135 | return scheduledVersions; |
universe@62 | 136 | } |
universe@62 | 137 | |
universe@75 | 138 | public void setScheduledVersions(List<Version> scheduledVersions) { |
universe@75 | 139 | this.scheduledVersions = scheduledVersions; |
universe@62 | 140 | } |
universe@62 | 141 | |
universe@75 | 142 | public List<Version> getResolvedVersions() { |
universe@75 | 143 | return resolvedVersions; |
universe@62 | 144 | } |
universe@62 | 145 | |
universe@75 | 146 | public void setResolvedVersions(List<Version> resolvedVersions) { |
universe@75 | 147 | this.resolvedVersions = resolvedVersions; |
universe@62 | 148 | } |
universe@62 | 149 | |
universe@62 | 150 | public Timestamp getCreated() { |
universe@62 | 151 | return created; |
universe@62 | 152 | } |
universe@62 | 153 | |
universe@62 | 154 | public void setCreated(Timestamp created) { |
universe@62 | 155 | this.created = created; |
universe@62 | 156 | } |
universe@62 | 157 | |
universe@62 | 158 | public Timestamp getUpdated() { |
universe@62 | 159 | return updated; |
universe@62 | 160 | } |
universe@62 | 161 | |
universe@62 | 162 | public void setUpdated(Timestamp updated) { |
universe@62 | 163 | this.updated = updated; |
universe@62 | 164 | } |
universe@62 | 165 | |
universe@62 | 166 | public Date getEta() { |
universe@62 | 167 | return eta; |
universe@62 | 168 | } |
universe@62 | 169 | |
universe@62 | 170 | public void setEta(Date eta) { |
universe@62 | 171 | this.eta = eta; |
universe@62 | 172 | } |
universe@62 | 173 | |
universe@62 | 174 | @Override |
universe@62 | 175 | public boolean equals(Object o) { |
universe@62 | 176 | if (this == o) return true; |
universe@62 | 177 | if (o == null || getClass() != o.getClass()) return false; |
universe@62 | 178 | Issue issue = (Issue) o; |
universe@62 | 179 | return id == issue.id; |
universe@62 | 180 | } |
universe@62 | 181 | |
universe@62 | 182 | @Override |
universe@62 | 183 | public int hashCode() { |
universe@62 | 184 | return Objects.hash(id); |
universe@62 | 185 | } |
universe@62 | 186 | } |