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

Sat, 30 May 2020 15:26:15 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 30 May 2020 15:26:15 +0200
changeset 81
1a2e7b5d48f7
parent 75
33b6843fdf8a
child 86
0a658e53177c
permissions
-rw-r--r--

adds issue summaries

     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 final 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, Project project) {
    59         this.id = id;
    60         this.project = project;
    61     }
    63     public int getId() {
    64         return id;
    65     }
    67     /**
    68      * Should only be used by a DAO to store the generated ID.
    69      * @param id the freshly generated ID returned from the database after insert
    70      */
    71     public void setId(int id) {
    72         this.id = id;
    73     }
    75     public Project getProject() {
    76         return project;
    77     }
    79     public IssueStatus getStatus() {
    80         return status;
    81     }
    83     public void setStatus(IssueStatus status) {
    84         this.status = status;
    85     }
    87     public int getPhase() {
    88         return this.status.getPhase();
    89     }
    91     public IssueCategory getCategory() {
    92         return category;
    93     }
    95     public void setCategory(IssueCategory category) {
    96         this.category = category;
    97     }
    99     public String getSubject() {
   100         return subject;
   101     }
   103     public void setSubject(String subject) {
   104         this.subject = subject;
   105     }
   107     public String getDescription() {
   108         return description;
   109     }
   111     public void setDescription(String description) {
   112         this.description = description;
   113     }
   115     public User getAssignee() {
   116         return assignee;
   117     }
   119     public void setAssignee(User assignee) {
   120         this.assignee = assignee;
   121     }
   123     public List<Version> getAffectedVersions() {
   124         return affectedVersions;
   125     }
   127     public void setAffectedVersions(List<Version> affectedVersions) {
   128         this.affectedVersions = affectedVersions;
   129     }
   131     public List<Version> getScheduledVersions() {
   132         return scheduledVersions;
   133     }
   135     public void setScheduledVersions(List<Version> scheduledVersions) {
   136         this.scheduledVersions = scheduledVersions;
   137     }
   139     public List<Version> getResolvedVersions() {
   140         return resolvedVersions;
   141     }
   143     public void setResolvedVersions(List<Version> resolvedVersions) {
   144         this.resolvedVersions = resolvedVersions;
   145     }
   147     public Timestamp getCreated() {
   148         return created;
   149     }
   151     public void setCreated(Timestamp created) {
   152         this.created = created;
   153     }
   155     public Timestamp getUpdated() {
   156         return updated;
   157     }
   159     public void setUpdated(Timestamp updated) {
   160         this.updated = updated;
   161     }
   163     public Date getEta() {
   164         return eta;
   165     }
   167     public void setEta(Date eta) {
   168         this.eta = eta;
   169     }
   171     @Override
   172     public boolean equals(Object o) {
   173         if (this == o) return true;
   174         if (o == null || getClass() != o.getClass()) return false;
   175         Issue issue = (Issue) o;
   176         return id == issue.id;
   177     }
   179     @Override
   180     public int hashCode() {
   181         return Objects.hash(id);
   182     }
   183 }

mercurial