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

Fri, 22 May 2020 21:23:57 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 22 May 2020 21:23:57 +0200
changeset 75
33b6843fdf8a
parent 62
833e0385572a
child 81
1a2e7b5d48f7
permissions
-rw-r--r--

adds the ability to create and edit issues

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

mercurial