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