universe@62: /* universe@62: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. universe@62: * universe@62: * Copyright 2018 Mike Becker. All rights reserved. universe@62: * universe@62: * Redistribution and use in source and binary forms, with or without universe@62: * modification, are permitted provided that the following conditions are met: universe@62: * universe@62: * 1. Redistributions of source code must retain the above copyright universe@62: * notice, this list of conditions and the following disclaimer. universe@62: * universe@62: * 2. Redistributions in binary form must reproduce the above copyright universe@62: * notice, this list of conditions and the following disclaimer in the universe@62: * documentation and/or other materials provided with the distribution. universe@62: * universe@62: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" universe@62: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE universe@62: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE universe@62: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE universe@62: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR universe@62: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF universe@62: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS universe@62: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN universe@62: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) universe@62: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE universe@62: * POSSIBILITY OF SUCH DAMAGE. universe@62: * universe@62: */ universe@62: package de.uapcore.lightpit.entities; universe@62: universe@62: import java.sql.Date; universe@62: import java.sql.Timestamp; universe@75: import java.time.Instant; universe@75: import java.util.Collections; universe@62: import java.util.List; universe@62: import java.util.Objects; universe@62: universe@62: public final class Issue { universe@62: universe@75: private int id; universe@86: private Project project; universe@62: universe@62: private IssueStatus status; universe@62: private IssueCategory category; universe@62: universe@62: private String subject; universe@62: private String description; universe@75: private User assignee; universe@62: universe@75: private List affectedVersions = Collections.emptyList(); universe@75: private List resolvedVersions = Collections.emptyList(); universe@62: universe@75: private Timestamp created = Timestamp.from(Instant.now()); universe@75: private Timestamp updated = Timestamp.from(Instant.now()); universe@62: private Date eta; universe@62: universe@86: public Issue(int id) { universe@62: this.id = id; universe@62: } universe@62: universe@62: public int getId() { universe@62: return id; universe@62: } universe@62: universe@75: /** universe@75: * Should only be used by a DAO to store the generated ID. universe@75: * @param id the freshly generated ID returned from the database after insert universe@75: */ universe@75: public void setId(int id) { universe@75: this.id = id; universe@75: } universe@75: universe@86: public void setProject(Project project) { universe@86: this.project = project; universe@86: } universe@86: universe@62: public Project getProject() { universe@62: return project; universe@62: } universe@62: universe@62: public IssueStatus getStatus() { universe@62: return status; universe@62: } universe@62: universe@62: public void setStatus(IssueStatus status) { universe@62: this.status = status; universe@62: } universe@62: universe@81: public int getPhase() { universe@81: return this.status.getPhase(); universe@81: } universe@81: universe@62: public IssueCategory getCategory() { universe@62: return category; universe@62: } universe@62: universe@62: public void setCategory(IssueCategory category) { universe@62: this.category = category; universe@62: } universe@62: universe@62: public String getSubject() { universe@62: return subject; universe@62: } universe@62: universe@62: public void setSubject(String subject) { universe@62: this.subject = subject; universe@62: } universe@62: universe@62: public String getDescription() { universe@62: return description; universe@62: } universe@62: universe@62: public void setDescription(String description) { universe@62: this.description = description; universe@62: } universe@62: universe@75: public User getAssignee() { universe@75: return assignee; universe@75: } universe@75: universe@75: public void setAssignee(User assignee) { universe@75: this.assignee = assignee; universe@75: } universe@75: universe@62: public List getAffectedVersions() { universe@62: return affectedVersions; universe@62: } universe@62: universe@62: public void setAffectedVersions(List affectedVersions) { universe@62: this.affectedVersions = affectedVersions; universe@62: } universe@62: universe@75: public List getResolvedVersions() { universe@75: return resolvedVersions; universe@62: } universe@62: universe@75: public void setResolvedVersions(List resolvedVersions) { universe@75: this.resolvedVersions = resolvedVersions; universe@62: } universe@62: universe@62: public Timestamp getCreated() { universe@62: return created; universe@62: } universe@62: universe@62: public void setCreated(Timestamp created) { universe@62: this.created = created; universe@62: } universe@62: universe@62: public Timestamp getUpdated() { universe@62: return updated; universe@62: } universe@62: universe@62: public void setUpdated(Timestamp updated) { universe@62: this.updated = updated; universe@62: } universe@62: universe@62: public Date getEta() { universe@62: return eta; universe@62: } universe@62: universe@62: public void setEta(Date eta) { universe@62: this.eta = eta; universe@62: } universe@62: universe@62: @Override universe@62: public boolean equals(Object o) { universe@62: if (this == o) return true; universe@62: if (o == null || getClass() != o.getClass()) return false; universe@62: Issue issue = (Issue) o; universe@62: return id == issue.id; universe@62: } universe@62: universe@62: @Override universe@62: public int hashCode() { universe@62: return Objects.hash(id); universe@62: } universe@62: }