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

Mon, 01 Jun 2020 14:46:58 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 01 Jun 2020 14:46:58 +0200
changeset 86
0a658e53177c
parent 81
1a2e7b5d48f7
child 88
1438e5a22c55
permissions
-rw-r--r--

improves issue overview and adds progress information

     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> scheduledVersions = Collections.emptyList();
    52     private List<Version> resolvedVersions = Collections.emptyList();
    54     private Timestamp created = Timestamp.from(Instant.now());
    55     private Timestamp updated = Timestamp.from(Instant.now());
    56     private Date eta;
    58     public Issue(int id) {
    59         this.id = id;
    60     }
    62     public int getId() {
    63         return id;
    64     }
    66     /**
    67      * Should only be used by a DAO to store the generated ID.
    68      * @param id the freshly generated ID returned from the database after insert
    69      */
    70     public void setId(int id) {
    71         this.id = id;
    72     }
    74     public void setProject(Project project) {
    75         this.project = project;
    76     }
    78     public Project getProject() {
    79         return project;
    80     }
    82     public IssueStatus getStatus() {
    83         return status;
    84     }
    86     public void setStatus(IssueStatus status) {
    87         this.status = status;
    88     }
    90     public int getPhase() {
    91         return this.status.getPhase();
    92     }
    94     public IssueCategory getCategory() {
    95         return category;
    96     }
    98     public void setCategory(IssueCategory category) {
    99         this.category = category;
   100     }
   102     public String getSubject() {
   103         return subject;
   104     }
   106     public void setSubject(String subject) {
   107         this.subject = subject;
   108     }
   110     public String getDescription() {
   111         return description;
   112     }
   114     public void setDescription(String description) {
   115         this.description = description;
   116     }
   118     public User getAssignee() {
   119         return assignee;
   120     }
   122     public void setAssignee(User assignee) {
   123         this.assignee = assignee;
   124     }
   126     public List<Version> getAffectedVersions() {
   127         return affectedVersions;
   128     }
   130     public void setAffectedVersions(List<Version> affectedVersions) {
   131         this.affectedVersions = affectedVersions;
   132     }
   134     public List<Version> getScheduledVersions() {
   135         return scheduledVersions;
   136     }
   138     public void setScheduledVersions(List<Version> scheduledVersions) {
   139         this.scheduledVersions = scheduledVersions;
   140     }
   142     public List<Version> getResolvedVersions() {
   143         return resolvedVersions;
   144     }
   146     public void setResolvedVersions(List<Version> resolvedVersions) {
   147         this.resolvedVersions = resolvedVersions;
   148     }
   150     public Timestamp getCreated() {
   151         return created;
   152     }
   154     public void setCreated(Timestamp created) {
   155         this.created = created;
   156     }
   158     public Timestamp getUpdated() {
   159         return updated;
   160     }
   162     public void setUpdated(Timestamp updated) {
   163         this.updated = updated;
   164     }
   166     public Date getEta() {
   167         return eta;
   168     }
   170     public void setEta(Date eta) {
   171         this.eta = eta;
   172     }
   174     @Override
   175     public boolean equals(Object o) {
   176         if (this == o) return true;
   177         if (o == null || getClass() != o.getClass()) return false;
   178         Issue issue = (Issue) o;
   179         return id == issue.id;
   180     }
   182     @Override
   183     public int hashCode() {
   184         return Objects.hash(id);
   185     }
   186 }

mercurial