src/main/java/de/uapcore/lightpit/entities/Issue.java

changeset 150
822b7e3d064d
parent 149
30b840ed8c0e
child 151
b3f14cd4f3ab
     1.1 --- a/src/main/java/de/uapcore/lightpit/entities/Issue.java	Fri Oct 23 18:40:50 2020 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,195 +0,0 @@
     1.4 -/*
     1.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     1.6 - *
     1.7 - * Copyright 2018 Mike Becker. All rights reserved.
     1.8 - *
     1.9 - * Redistribution and use in source and binary forms, with or without
    1.10 - * modification, are permitted provided that the following conditions are met:
    1.11 - *
    1.12 - *   1. Redistributions of source code must retain the above copyright
    1.13 - *      notice, this list of conditions and the following disclaimer.
    1.14 - *
    1.15 - *   2. Redistributions in binary form must reproduce the above copyright
    1.16 - *      notice, this list of conditions and the following disclaimer in the
    1.17 - *      documentation and/or other materials provided with the distribution.
    1.18 - *
    1.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    1.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
    1.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    1.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    1.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    1.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    1.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    1.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    1.29 - * POSSIBILITY OF SUCH DAMAGE.
    1.30 - *
    1.31 - */
    1.32 -package de.uapcore.lightpit.entities;
    1.33 -
    1.34 -import java.sql.Date;
    1.35 -import java.sql.Timestamp;
    1.36 -import java.time.Instant;
    1.37 -import java.util.Collections;
    1.38 -import java.util.List;
    1.39 -import java.util.Objects;
    1.40 -
    1.41 -public final class Issue {
    1.42 -
    1.43 -    private int id;
    1.44 -    private Project project;
    1.45 -    private Component component;
    1.46 -
    1.47 -    private IssueStatus status;
    1.48 -    private IssueCategory category;
    1.49 -
    1.50 -    private String subject;
    1.51 -    private String description;
    1.52 -    private User assignee;
    1.53 -
    1.54 -    private List<Version> affectedVersions = Collections.emptyList();
    1.55 -    private List<Version> resolvedVersions = Collections.emptyList();
    1.56 -
    1.57 -    private Timestamp created = Timestamp.from(Instant.now());
    1.58 -    private Timestamp updated = Timestamp.from(Instant.now());
    1.59 -    private Date eta;
    1.60 -
    1.61 -    public Issue(int id) {
    1.62 -        this.id = id;
    1.63 -    }
    1.64 -
    1.65 -    public int getId() {
    1.66 -        return id;
    1.67 -    }
    1.68 -
    1.69 -    /**
    1.70 -     * Should only be used by a DAO to store the generated ID.
    1.71 -     * @param id the freshly generated ID returned from the database after insert
    1.72 -     */
    1.73 -    public void setId(int id) {
    1.74 -        this.id = id;
    1.75 -    }
    1.76 -
    1.77 -    public void setProject(Project project) {
    1.78 -        this.project = project;
    1.79 -    }
    1.80 -
    1.81 -    public Project getProject() {
    1.82 -        return project;
    1.83 -    }
    1.84 -
    1.85 -    public Component getComponent() {
    1.86 -        return component;
    1.87 -    }
    1.88 -
    1.89 -    public void setComponent(Component component) {
    1.90 -        this.component = component;
    1.91 -    }
    1.92 -
    1.93 -    public IssueStatus getStatus() {
    1.94 -        return status;
    1.95 -    }
    1.96 -
    1.97 -    public void setStatus(IssueStatus status) {
    1.98 -        this.status = status;
    1.99 -    }
   1.100 -
   1.101 -    public int getPhase() {
   1.102 -        return this.status.getPhase();
   1.103 -    }
   1.104 -
   1.105 -    public IssueCategory getCategory() {
   1.106 -        return category;
   1.107 -    }
   1.108 -
   1.109 -    public void setCategory(IssueCategory category) {
   1.110 -        this.category = category;
   1.111 -    }
   1.112 -
   1.113 -    public String getSubject() {
   1.114 -        return subject;
   1.115 -    }
   1.116 -
   1.117 -    public void setSubject(String subject) {
   1.118 -        this.subject = subject;
   1.119 -    }
   1.120 -
   1.121 -    public String getDescription() {
   1.122 -        return description;
   1.123 -    }
   1.124 -
   1.125 -    public void setDescription(String description) {
   1.126 -        this.description = description;
   1.127 -    }
   1.128 -
   1.129 -    public User getAssignee() {
   1.130 -        return assignee;
   1.131 -    }
   1.132 -
   1.133 -    public void setAssignee(User assignee) {
   1.134 -        this.assignee = assignee;
   1.135 -    }
   1.136 -
   1.137 -    public List<Version> getAffectedVersions() {
   1.138 -        return affectedVersions;
   1.139 -    }
   1.140 -
   1.141 -    public void setAffectedVersions(List<Version> affectedVersions) {
   1.142 -        this.affectedVersions = affectedVersions;
   1.143 -    }
   1.144 -
   1.145 -    public List<Version> getResolvedVersions() {
   1.146 -        return resolvedVersions;
   1.147 -    }
   1.148 -
   1.149 -    public void setResolvedVersions(List<Version> resolvedVersions) {
   1.150 -        this.resolvedVersions = resolvedVersions;
   1.151 -    }
   1.152 -
   1.153 -    public Timestamp getCreated() {
   1.154 -        return created;
   1.155 -    }
   1.156 -
   1.157 -    public void setCreated(Timestamp created) {
   1.158 -        this.created = created;
   1.159 -    }
   1.160 -
   1.161 -    public Timestamp getUpdated() {
   1.162 -        return updated;
   1.163 -    }
   1.164 -
   1.165 -    public void setUpdated(Timestamp updated) {
   1.166 -        this.updated = updated;
   1.167 -    }
   1.168 -
   1.169 -    public Date getEta() {
   1.170 -        return eta;
   1.171 -    }
   1.172 -
   1.173 -    public void setEta(Date eta) {
   1.174 -        this.eta = eta;
   1.175 -    }
   1.176 -
   1.177 -    /**
   1.178 -     * An issue is overdue, if it is not done and the ETA is before the current time.
   1.179 -     * @return true if this issue is overdue, false otherwise
   1.180 -     */
   1.181 -    public boolean isOverdue() {
   1.182 -        return eta != null && status.getPhase() != IssueStatus.PHASE_DONE
   1.183 -                && eta.before(new Date(System.currentTimeMillis()));
   1.184 -    }
   1.185 -
   1.186 -    @Override
   1.187 -    public boolean equals(Object o) {
   1.188 -        if (this == o) return true;
   1.189 -        if (o == null || getClass() != o.getClass()) return false;
   1.190 -        Issue issue = (Issue) o;
   1.191 -        return id == issue.id;
   1.192 -    }
   1.193 -
   1.194 -    @Override
   1.195 -    public int hashCode() {
   1.196 -        return Objects.hash(id);
   1.197 -    }
   1.198 -}

mercurial