Thu, 08 Oct 2020 20:38:43 +0200
adds indicators for version status
replaces table column "Status" with version tag
fixes New Version form button not overriding the session version ID
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> resolvedVersions = Collections.emptyList(); |
universe@62 | 52 | |
universe@75 | 53 | private Timestamp created = Timestamp.from(Instant.now()); |
universe@75 | 54 | private Timestamp updated = Timestamp.from(Instant.now()); |
universe@62 | 55 | private Date eta; |
universe@62 | 56 | |
universe@86 | 57 | public Issue(int id) { |
universe@62 | 58 | this.id = id; |
universe@62 | 59 | } |
universe@62 | 60 | |
universe@62 | 61 | public int getId() { |
universe@62 | 62 | return id; |
universe@62 | 63 | } |
universe@62 | 64 | |
universe@75 | 65 | /** |
universe@75 | 66 | * Should only be used by a DAO to store the generated ID. |
universe@75 | 67 | * @param id the freshly generated ID returned from the database after insert |
universe@75 | 68 | */ |
universe@75 | 69 | public void setId(int id) { |
universe@75 | 70 | this.id = id; |
universe@75 | 71 | } |
universe@75 | 72 | |
universe@86 | 73 | public void setProject(Project project) { |
universe@86 | 74 | this.project = project; |
universe@86 | 75 | } |
universe@86 | 76 | |
universe@62 | 77 | public Project getProject() { |
universe@62 | 78 | return project; |
universe@62 | 79 | } |
universe@62 | 80 | |
universe@62 | 81 | public IssueStatus getStatus() { |
universe@62 | 82 | return status; |
universe@62 | 83 | } |
universe@62 | 84 | |
universe@62 | 85 | public void setStatus(IssueStatus status) { |
universe@62 | 86 | this.status = status; |
universe@62 | 87 | } |
universe@62 | 88 | |
universe@81 | 89 | public int getPhase() { |
universe@81 | 90 | return this.status.getPhase(); |
universe@81 | 91 | } |
universe@81 | 92 | |
universe@62 | 93 | public IssueCategory getCategory() { |
universe@62 | 94 | return category; |
universe@62 | 95 | } |
universe@62 | 96 | |
universe@62 | 97 | public void setCategory(IssueCategory category) { |
universe@62 | 98 | this.category = category; |
universe@62 | 99 | } |
universe@62 | 100 | |
universe@62 | 101 | public String getSubject() { |
universe@62 | 102 | return subject; |
universe@62 | 103 | } |
universe@62 | 104 | |
universe@62 | 105 | public void setSubject(String subject) { |
universe@62 | 106 | this.subject = subject; |
universe@62 | 107 | } |
universe@62 | 108 | |
universe@62 | 109 | public String getDescription() { |
universe@62 | 110 | return description; |
universe@62 | 111 | } |
universe@62 | 112 | |
universe@62 | 113 | public void setDescription(String description) { |
universe@62 | 114 | this.description = description; |
universe@62 | 115 | } |
universe@62 | 116 | |
universe@75 | 117 | public User getAssignee() { |
universe@75 | 118 | return assignee; |
universe@75 | 119 | } |
universe@75 | 120 | |
universe@75 | 121 | public void setAssignee(User assignee) { |
universe@75 | 122 | this.assignee = assignee; |
universe@75 | 123 | } |
universe@75 | 124 | |
universe@62 | 125 | public List<Version> getAffectedVersions() { |
universe@62 | 126 | return affectedVersions; |
universe@62 | 127 | } |
universe@62 | 128 | |
universe@62 | 129 | public void setAffectedVersions(List<Version> affectedVersions) { |
universe@62 | 130 | this.affectedVersions = affectedVersions; |
universe@62 | 131 | } |
universe@62 | 132 | |
universe@75 | 133 | public List<Version> getResolvedVersions() { |
universe@75 | 134 | return resolvedVersions; |
universe@62 | 135 | } |
universe@62 | 136 | |
universe@75 | 137 | public void setResolvedVersions(List<Version> resolvedVersions) { |
universe@75 | 138 | this.resolvedVersions = resolvedVersions; |
universe@62 | 139 | } |
universe@62 | 140 | |
universe@62 | 141 | public Timestamp getCreated() { |
universe@62 | 142 | return created; |
universe@62 | 143 | } |
universe@62 | 144 | |
universe@62 | 145 | public void setCreated(Timestamp created) { |
universe@62 | 146 | this.created = created; |
universe@62 | 147 | } |
universe@62 | 148 | |
universe@62 | 149 | public Timestamp getUpdated() { |
universe@62 | 150 | return updated; |
universe@62 | 151 | } |
universe@62 | 152 | |
universe@62 | 153 | public void setUpdated(Timestamp updated) { |
universe@62 | 154 | this.updated = updated; |
universe@62 | 155 | } |
universe@62 | 156 | |
universe@62 | 157 | public Date getEta() { |
universe@62 | 158 | return eta; |
universe@62 | 159 | } |
universe@62 | 160 | |
universe@62 | 161 | public void setEta(Date eta) { |
universe@62 | 162 | this.eta = eta; |
universe@62 | 163 | } |
universe@62 | 164 | |
universe@62 | 165 | @Override |
universe@62 | 166 | public boolean equals(Object o) { |
universe@62 | 167 | if (this == o) return true; |
universe@62 | 168 | if (o == null || getClass() != o.getClass()) return false; |
universe@62 | 169 | Issue issue = (Issue) o; |
universe@62 | 170 | return id == issue.id; |
universe@62 | 171 | } |
universe@62 | 172 | |
universe@62 | 173 | @Override |
universe@62 | 174 | public int hashCode() { |
universe@62 | 175 | return Objects.hash(id); |
universe@62 | 176 | } |
universe@62 | 177 | } |