migrate entities package

Fri, 23 Oct 2020 20:34:57 +0200

author
Mike Becker <universe@uap-core.de>
date
Fri, 23 Oct 2020 20:34:57 +0200
changeset 150
822b7e3d064d
parent 149
30b840ed8c0e
child 151
b3f14cd4f3ab

migrate entities package

src/main/java/de/uapcore/lightpit/dao/Functions.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/dao/IssueDao.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/dao/postgres/PGIssueDao.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/dao/postgres/PGUserDao.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/entities/Component.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/entities/Issue.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/entities/IssueCategory.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/entities/IssueComment.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/entities/IssueStatus.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/entities/IssueSummary.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/entities/Project.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/entities/User.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/entities/Version.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/entities/VersionStatistics.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/entities/VersionStatus.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/viewmodel/util/IssueSorter.java file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/entities/Component.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/entities/Issue.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/entities/IssueComment.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/entities/Project.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/entities/User.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/entities/Version.kt file | annotate | diff | comparison | revisions
src/main/kotlin/de/uapcore/lightpit/types/WebColor.kt file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jsp/issue-view.jsp file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/jspf/issue-list.jspf file | annotate | diff | comparison | revisions
     1.1 --- a/src/main/java/de/uapcore/lightpit/dao/Functions.java	Fri Oct 23 18:40:50 2020 +0200
     1.2 +++ b/src/main/java/de/uapcore/lightpit/dao/Functions.java	Fri Oct 23 20:34:57 2020 +0200
     1.3 @@ -39,6 +39,10 @@
     1.4   */
     1.5  public final class Functions {
     1.6  
     1.7 +    public static String getSafeString(ResultSet rs, String column) throws SQLException {
     1.8 +        return Optional.ofNullable(rs.getString(column)).orElse("");
     1.9 +    }
    1.10 +
    1.11      public static void setStringOrNull(PreparedStatement stmt, int index, String str) throws SQLException {
    1.12          if (str == null || str.isBlank()) {
    1.13              stmt.setNull(index, Types.VARCHAR);
     2.1 --- a/src/main/java/de/uapcore/lightpit/dao/IssueDao.java	Fri Oct 23 18:40:50 2020 +0200
     2.2 +++ b/src/main/java/de/uapcore/lightpit/dao/IssueDao.java	Fri Oct 23 20:34:57 2020 +0200
     2.3 @@ -83,10 +83,11 @@
     2.4       * Stores the specified comment in database.
     2.5       * This is an update-or-insert operation.
     2.6       *
     2.7 +     * @param issue the issue to save the comment for
     2.8       * @param comment the comment to save
     2.9       * @throws SQLException on any kind of SQL error
    2.10       */
    2.11 -    void saveComment(IssueComment comment) throws SQLException;
    2.12 +    void saveComment(Issue issue, IssueComment comment) throws SQLException;
    2.13  
    2.14      /**
    2.15       * Saves an instances to the database.
     3.1 --- a/src/main/java/de/uapcore/lightpit/dao/postgres/PGIssueDao.java	Fri Oct 23 18:40:50 2020 +0200
     3.2 +++ b/src/main/java/de/uapcore/lightpit/dao/postgres/PGIssueDao.java	Fri Oct 23 20:34:57 2020 +0200
     3.3 @@ -275,7 +275,7 @@
     3.4          List<IssueComment> comments = new ArrayList<>();
     3.5          try (var result = listComments.executeQuery()) {
     3.6              while (result.next()) {
     3.7 -                final var comment = new IssueComment(result.getInt("commentid"), issue);
     3.8 +                final var comment = new IssueComment(result.getInt("commentid"));
     3.9                  comment.setCreated(result.getTimestamp("created"));
    3.10                  comment.setUpdated(result.getTimestamp("updated"));
    3.11                  comment.setUpdateCount(result.getInt("updatecount"));
    3.12 @@ -288,15 +288,13 @@
    3.13      }
    3.14  
    3.15      @Override
    3.16 -    public void saveComment(IssueComment comment) throws SQLException {
    3.17 -        Objects.requireNonNull(comment.getComment());
    3.18 -        Objects.requireNonNull(comment.getIssue());
    3.19 +    public void saveComment(Issue issue, IssueComment comment) throws SQLException {
    3.20          if (comment.getId() >= 0) {
    3.21              updateComment.setString(1, comment.getComment());
    3.22              updateComment.setInt(2, comment.getId());
    3.23              updateComment.execute();
    3.24          } else {
    3.25 -            insertComment.setInt(1, comment.getIssue().getId());
    3.26 +            insertComment.setInt(1, issue.getId());
    3.27              insertComment.setString(2, comment.getComment());
    3.28              setForeignKeyOrNull(insertComment, 3, comment.getAuthor(), User::getId);
    3.29              insertComment.execute();
     4.1 --- a/src/main/java/de/uapcore/lightpit/dao/postgres/PGUserDao.java	Fri Oct 23 18:40:50 2020 +0200
     4.2 +++ b/src/main/java/de/uapcore/lightpit/dao/postgres/PGUserDao.java	Fri Oct 23 20:34:57 2020 +0200
     4.3 @@ -40,6 +40,7 @@
     4.4  import java.util.Objects;
     4.5  import java.util.Optional;
     4.6  
     4.7 +import static de.uapcore.lightpit.dao.Functions.getSafeString;
     4.8  import static de.uapcore.lightpit.dao.Functions.setStringOrNull;
     4.9  
    4.10  public final class PGUserDao implements UserDao {
    4.11 @@ -68,9 +69,9 @@
    4.12          if (id == 0) return null;
    4.13          final var user = new User(id);
    4.14          user.setUsername(result.getString("username"));
    4.15 -        user.setGivenname(result.getString("givenname"));
    4.16 -        user.setLastname(result.getString("lastname"));
    4.17 -        user.setMail(result.getString("mail"));
    4.18 +        user.setGivenname(getSafeString(result, "givenname"));
    4.19 +        user.setLastname(getSafeString(result, "lastname"));
    4.20 +        user.setMail(getSafeString(result, "mail"));
    4.21          return user;
    4.22      }
    4.23  
     5.1 --- a/src/main/java/de/uapcore/lightpit/entities/Component.java	Fri Oct 23 18:40:50 2020 +0200
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,123 +0,0 @@
     5.4 -/*
     5.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     5.6 - *
     5.7 - * Copyright 2020 Mike Becker. All rights reserved.
     5.8 - *
     5.9 - * Redistribution and use in source and binary forms, with or without
    5.10 - * modification, are permitted provided that the following conditions are met:
    5.11 - *
    5.12 - *   1. Redistributions of source code must retain the above copyright
    5.13 - *      notice, this list of conditions and the following disclaimer.
    5.14 - *
    5.15 - *   2. Redistributions in binary form must reproduce the above copyright
    5.16 - *      notice, this list of conditions and the following disclaimer in the
    5.17 - *      documentation and/or other materials provided with the distribution.
    5.18 - *
    5.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    5.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    5.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    5.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
    5.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    5.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    5.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    5.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    5.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    5.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    5.29 - * POSSIBILITY OF SUCH DAMAGE.
    5.30 - *
    5.31 - */
    5.32 -package de.uapcore.lightpit.entities;
    5.33 -
    5.34 -import de.uapcore.lightpit.types.WebColor;
    5.35 -
    5.36 -import java.util.Objects;
    5.37 -
    5.38 -public final class Component {
    5.39 -
    5.40 -    private final int id;
    5.41 -
    5.42 -    private String name;
    5.43 -
    5.44 -    private String node;
    5.45 -
    5.46 -    private WebColor color = new WebColor("000000");
    5.47 -
    5.48 -    private int ordinal = 0;
    5.49 -
    5.50 -    private String description = null;
    5.51 -
    5.52 -    private User lead = null;
    5.53 -
    5.54 -    /**
    5.55 -     * Sole constructor.
    5.56 -     * @param id the ID of the component
    5.57 -     */
    5.58 -    public Component(int id) {
    5.59 -        this.id = id;
    5.60 -    }
    5.61 -
    5.62 -    public int getId() {
    5.63 -        return id;
    5.64 -    }
    5.65 -
    5.66 -    public String getName() {
    5.67 -        return name;
    5.68 -    }
    5.69 -
    5.70 -    public void setName(String name) {
    5.71 -        this.name = name;
    5.72 -    }
    5.73 -
    5.74 -    public String getNode() {
    5.75 -        return node;
    5.76 -    }
    5.77 -
    5.78 -    public void setNode(String node) {
    5.79 -        this.node = node;
    5.80 -    }
    5.81 -
    5.82 -    public WebColor getColor() {
    5.83 -        return color;
    5.84 -    }
    5.85 -
    5.86 -    public void setColor(WebColor color) {
    5.87 -        this.color = color;
    5.88 -    }
    5.89 -
    5.90 -    public int getOrdinal() {
    5.91 -        return ordinal;
    5.92 -    }
    5.93 -
    5.94 -    public void setOrdinal(int ordinal) {
    5.95 -        this.ordinal = ordinal;
    5.96 -    }
    5.97 -
    5.98 -    public String getDescription() {
    5.99 -        return description;
   5.100 -    }
   5.101 -
   5.102 -    public void setDescription(String description) {
   5.103 -        this.description = description;
   5.104 -    }
   5.105 -
   5.106 -    public User getLead() {
   5.107 -        return lead;
   5.108 -    }
   5.109 -
   5.110 -    public void setLead(User lead) {
   5.111 -        this.lead = lead;
   5.112 -    }
   5.113 -
   5.114 -    @Override
   5.115 -    public boolean equals(Object o) {
   5.116 -        if (this == o) return true;
   5.117 -        if (o == null || getClass() != o.getClass()) return false;
   5.118 -        Component component = (Component) o;
   5.119 -        return id == component.id;
   5.120 -    }
   5.121 -
   5.122 -    @Override
   5.123 -    public int hashCode() {
   5.124 -        return Objects.hash(id);
   5.125 -    }
   5.126 -}
     6.1 --- a/src/main/java/de/uapcore/lightpit/entities/Issue.java	Fri Oct 23 18:40:50 2020 +0200
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,195 +0,0 @@
     6.4 -/*
     6.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     6.6 - *
     6.7 - * Copyright 2018 Mike Becker. All rights reserved.
     6.8 - *
     6.9 - * Redistribution and use in source and binary forms, with or without
    6.10 - * modification, are permitted provided that the following conditions are met:
    6.11 - *
    6.12 - *   1. Redistributions of source code must retain the above copyright
    6.13 - *      notice, this list of conditions and the following disclaimer.
    6.14 - *
    6.15 - *   2. Redistributions in binary form must reproduce the above copyright
    6.16 - *      notice, this list of conditions and the following disclaimer in the
    6.17 - *      documentation and/or other materials provided with the distribution.
    6.18 - *
    6.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    6.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    6.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    6.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
    6.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    6.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    6.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    6.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    6.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    6.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    6.29 - * POSSIBILITY OF SUCH DAMAGE.
    6.30 - *
    6.31 - */
    6.32 -package de.uapcore.lightpit.entities;
    6.33 -
    6.34 -import java.sql.Date;
    6.35 -import java.sql.Timestamp;
    6.36 -import java.time.Instant;
    6.37 -import java.util.Collections;
    6.38 -import java.util.List;
    6.39 -import java.util.Objects;
    6.40 -
    6.41 -public final class Issue {
    6.42 -
    6.43 -    private int id;
    6.44 -    private Project project;
    6.45 -    private Component component;
    6.46 -
    6.47 -    private IssueStatus status;
    6.48 -    private IssueCategory category;
    6.49 -
    6.50 -    private String subject;
    6.51 -    private String description;
    6.52 -    private User assignee;
    6.53 -
    6.54 -    private List<Version> affectedVersions = Collections.emptyList();
    6.55 -    private List<Version> resolvedVersions = Collections.emptyList();
    6.56 -
    6.57 -    private Timestamp created = Timestamp.from(Instant.now());
    6.58 -    private Timestamp updated = Timestamp.from(Instant.now());
    6.59 -    private Date eta;
    6.60 -
    6.61 -    public Issue(int id) {
    6.62 -        this.id = id;
    6.63 -    }
    6.64 -
    6.65 -    public int getId() {
    6.66 -        return id;
    6.67 -    }
    6.68 -
    6.69 -    /**
    6.70 -     * Should only be used by a DAO to store the generated ID.
    6.71 -     * @param id the freshly generated ID returned from the database after insert
    6.72 -     */
    6.73 -    public void setId(int id) {
    6.74 -        this.id = id;
    6.75 -    }
    6.76 -
    6.77 -    public void setProject(Project project) {
    6.78 -        this.project = project;
    6.79 -    }
    6.80 -
    6.81 -    public Project getProject() {
    6.82 -        return project;
    6.83 -    }
    6.84 -
    6.85 -    public Component getComponent() {
    6.86 -        return component;
    6.87 -    }
    6.88 -
    6.89 -    public void setComponent(Component component) {
    6.90 -        this.component = component;
    6.91 -    }
    6.92 -
    6.93 -    public IssueStatus getStatus() {
    6.94 -        return status;
    6.95 -    }
    6.96 -
    6.97 -    public void setStatus(IssueStatus status) {
    6.98 -        this.status = status;
    6.99 -    }
   6.100 -
   6.101 -    public int getPhase() {
   6.102 -        return this.status.getPhase();
   6.103 -    }
   6.104 -
   6.105 -    public IssueCategory getCategory() {
   6.106 -        return category;
   6.107 -    }
   6.108 -
   6.109 -    public void setCategory(IssueCategory category) {
   6.110 -        this.category = category;
   6.111 -    }
   6.112 -
   6.113 -    public String getSubject() {
   6.114 -        return subject;
   6.115 -    }
   6.116 -
   6.117 -    public void setSubject(String subject) {
   6.118 -        this.subject = subject;
   6.119 -    }
   6.120 -
   6.121 -    public String getDescription() {
   6.122 -        return description;
   6.123 -    }
   6.124 -
   6.125 -    public void setDescription(String description) {
   6.126 -        this.description = description;
   6.127 -    }
   6.128 -
   6.129 -    public User getAssignee() {
   6.130 -        return assignee;
   6.131 -    }
   6.132 -
   6.133 -    public void setAssignee(User assignee) {
   6.134 -        this.assignee = assignee;
   6.135 -    }
   6.136 -
   6.137 -    public List<Version> getAffectedVersions() {
   6.138 -        return affectedVersions;
   6.139 -    }
   6.140 -
   6.141 -    public void setAffectedVersions(List<Version> affectedVersions) {
   6.142 -        this.affectedVersions = affectedVersions;
   6.143 -    }
   6.144 -
   6.145 -    public List<Version> getResolvedVersions() {
   6.146 -        return resolvedVersions;
   6.147 -    }
   6.148 -
   6.149 -    public void setResolvedVersions(List<Version> resolvedVersions) {
   6.150 -        this.resolvedVersions = resolvedVersions;
   6.151 -    }
   6.152 -
   6.153 -    public Timestamp getCreated() {
   6.154 -        return created;
   6.155 -    }
   6.156 -
   6.157 -    public void setCreated(Timestamp created) {
   6.158 -        this.created = created;
   6.159 -    }
   6.160 -
   6.161 -    public Timestamp getUpdated() {
   6.162 -        return updated;
   6.163 -    }
   6.164 -
   6.165 -    public void setUpdated(Timestamp updated) {
   6.166 -        this.updated = updated;
   6.167 -    }
   6.168 -
   6.169 -    public Date getEta() {
   6.170 -        return eta;
   6.171 -    }
   6.172 -
   6.173 -    public void setEta(Date eta) {
   6.174 -        this.eta = eta;
   6.175 -    }
   6.176 -
   6.177 -    /**
   6.178 -     * An issue is overdue, if it is not done and the ETA is before the current time.
   6.179 -     * @return true if this issue is overdue, false otherwise
   6.180 -     */
   6.181 -    public boolean isOverdue() {
   6.182 -        return eta != null && status.getPhase() != IssueStatus.PHASE_DONE
   6.183 -                && eta.before(new Date(System.currentTimeMillis()));
   6.184 -    }
   6.185 -
   6.186 -    @Override
   6.187 -    public boolean equals(Object o) {
   6.188 -        if (this == o) return true;
   6.189 -        if (o == null || getClass() != o.getClass()) return false;
   6.190 -        Issue issue = (Issue) o;
   6.191 -        return id == issue.id;
   6.192 -    }
   6.193 -
   6.194 -    @Override
   6.195 -    public int hashCode() {
   6.196 -        return Objects.hash(id);
   6.197 -    }
   6.198 -}
     7.1 --- a/src/main/java/de/uapcore/lightpit/entities/IssueCategory.java	Fri Oct 23 18:40:50 2020 +0200
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,37 +0,0 @@
     7.4 -/*
     7.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     7.6 - *
     7.7 - * Copyright 2018 Mike Becker. All rights reserved.
     7.8 - *
     7.9 - * Redistribution and use in source and binary forms, with or without
    7.10 - * modification, are permitted provided that the following conditions are met:
    7.11 - *
    7.12 - *   1. Redistributions of source code must retain the above copyright
    7.13 - *      notice, this list of conditions and the following disclaimer.
    7.14 - *
    7.15 - *   2. Redistributions in binary form must reproduce the above copyright
    7.16 - *      notice, this list of conditions and the following disclaimer in the
    7.17 - *      documentation and/or other materials provided with the distribution.
    7.18 - *
    7.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    7.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    7.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    7.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
    7.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    7.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    7.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    7.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    7.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    7.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    7.29 - * POSSIBILITY OF SUCH DAMAGE.
    7.30 - *
    7.31 - */
    7.32 -package de.uapcore.lightpit.entities;
    7.33 -
    7.34 -public enum IssueCategory {
    7.35 -    Feature,
    7.36 -    Improvement,
    7.37 -    Bug,
    7.38 -    Task,
    7.39 -    Test
    7.40 -}
     8.1 --- a/src/main/java/de/uapcore/lightpit/entities/IssueComment.java	Fri Oct 23 18:40:50 2020 +0200
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,85 +0,0 @@
     8.4 -package de.uapcore.lightpit.entities;
     8.5 -
     8.6 -import java.sql.Timestamp;
     8.7 -import java.time.Instant;
     8.8 -import java.util.Objects;
     8.9 -
    8.10 -public class IssueComment {
    8.11 -
    8.12 -    private final Issue issue;
    8.13 -    private final int commentid;
    8.14 -
    8.15 -    private User author;
    8.16 -    private String comment;
    8.17 -
    8.18 -    private Timestamp created = Timestamp.from(Instant.now());
    8.19 -    private Timestamp updated = Timestamp.from(Instant.now());
    8.20 -    private int updatecount = 0;
    8.21 -
    8.22 -
    8.23 -    public IssueComment(int id, Issue issue) {
    8.24 -        this.commentid = id;
    8.25 -        this.issue = issue;
    8.26 -    }
    8.27 -
    8.28 -    public Issue getIssue() {
    8.29 -        return issue;
    8.30 -    }
    8.31 -
    8.32 -    public int getId() {
    8.33 -        return commentid;
    8.34 -    }
    8.35 -
    8.36 -    public User getAuthor() {
    8.37 -        return author;
    8.38 -    }
    8.39 -
    8.40 -    public void setAuthor(User author) {
    8.41 -        this.author = author;
    8.42 -    }
    8.43 -
    8.44 -    public String getComment() {
    8.45 -        return comment;
    8.46 -    }
    8.47 -
    8.48 -    public void setComment(String comment) {
    8.49 -        this.comment = comment;
    8.50 -    }
    8.51 -
    8.52 -    public Timestamp getCreated() {
    8.53 -        return created;
    8.54 -    }
    8.55 -
    8.56 -    public void setCreated(Timestamp created) {
    8.57 -        this.created = created;
    8.58 -    }
    8.59 -
    8.60 -    public Timestamp getUpdated() {
    8.61 -        return updated;
    8.62 -    }
    8.63 -
    8.64 -    public void setUpdated(Timestamp updated) {
    8.65 -        this.updated = updated;
    8.66 -    }
    8.67 -
    8.68 -    public int getUpdateCount() {
    8.69 -        return updatecount;
    8.70 -    }
    8.71 -
    8.72 -    public void setUpdateCount(int updatecount) {
    8.73 -        this.updatecount = updatecount;
    8.74 -    }
    8.75 -
    8.76 -    @Override
    8.77 -    public boolean equals(Object o) {
    8.78 -        if (this == o) return true;
    8.79 -        if (o == null || getClass() != o.getClass()) return false;
    8.80 -        IssueComment that = (IssueComment) o;
    8.81 -        return commentid == that.commentid;
    8.82 -    }
    8.83 -
    8.84 -    @Override
    8.85 -    public int hashCode() {
    8.86 -        return Objects.hash(commentid);
    8.87 -    }
    8.88 -}
     9.1 --- a/src/main/java/de/uapcore/lightpit/entities/IssueStatus.java	Fri Oct 23 18:40:50 2020 +0200
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,59 +0,0 @@
     9.4 -/*
     9.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     9.6 - *
     9.7 - * Copyright 2018 Mike Becker. All rights reserved.
     9.8 - *
     9.9 - * Redistribution and use in source and binary forms, with or without
    9.10 - * modification, are permitted provided that the following conditions are met:
    9.11 - *
    9.12 - *   1. Redistributions of source code must retain the above copyright
    9.13 - *      notice, this list of conditions and the following disclaimer.
    9.14 - *
    9.15 - *   2. Redistributions in binary form must reproduce the above copyright
    9.16 - *      notice, this list of conditions and the following disclaimer in the
    9.17 - *      documentation and/or other materials provided with the distribution.
    9.18 - *
    9.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    9.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    9.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    9.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
    9.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    9.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    9.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    9.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    9.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    9.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    9.29 - * POSSIBILITY OF SUCH DAMAGE.
    9.30 - *
    9.31 - */
    9.32 -package de.uapcore.lightpit.entities;
    9.33 -
    9.34 -public enum IssueStatus {
    9.35 -    InSpecification(0),
    9.36 -    ToDo(0),
    9.37 -    Scheduled(0),
    9.38 -    InProgress(1),
    9.39 -    InReview(1),
    9.40 -    Done(2),
    9.41 -    Rejected(2),
    9.42 -    Withdrawn(2),
    9.43 -    Duplicate(2);
    9.44 -
    9.45 -    public static final int PHASE_OPEN = 0;
    9.46 -    public static final int PHASE_WIP = 1;
    9.47 -    public static final int PHASE_DONE = 2;
    9.48 -
    9.49 -    private int phase;
    9.50 -
    9.51 -    IssueStatus(int phase) {
    9.52 -        this.phase = phase;
    9.53 -    }
    9.54 -
    9.55 -    public int getPhase() {
    9.56 -        return phase;
    9.57 -    }
    9.58 -
    9.59 -    public static int phaseCount() {
    9.60 -        return 3;
    9.61 -    }
    9.62 -}
    10.1 --- a/src/main/java/de/uapcore/lightpit/entities/IssueSummary.java	Fri Oct 23 18:40:50 2020 +0200
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,67 +0,0 @@
    10.4 -package de.uapcore.lightpit.entities;
    10.5 -
    10.6 -public class IssueSummary {
    10.7 -    private int open = 0;
    10.8 -    private int active = 0;
    10.9 -    private int done = 0;
   10.10 -
   10.11 -    public int getOpen() {
   10.12 -        return open;
   10.13 -    }
   10.14 -
   10.15 -    public void setOpen(int open) {
   10.16 -        this.open = open;
   10.17 -    }
   10.18 -
   10.19 -    public int getActive() {
   10.20 -        return active;
   10.21 -    }
   10.22 -
   10.23 -    public void setActive(int active) {
   10.24 -        this.active = active;
   10.25 -    }
   10.26 -
   10.27 -    public int getDone() {
   10.28 -        return done;
   10.29 -    }
   10.30 -
   10.31 -    public void setDone(int done) {
   10.32 -        this.done = done;
   10.33 -    }
   10.34 -
   10.35 -    public int getTotal() {
   10.36 -        return open+active+done;
   10.37 -    }
   10.38 -
   10.39 -    public int getOpenPercent() {
   10.40 -        return 100-getActivePercent()-getDonePercent();
   10.41 -    }
   10.42 -
   10.43 -    public int getActivePercent() {
   10.44 -        int total = getTotal();
   10.45 -        return total > 0 ? Math.round(100.f*active/total) : 0;
   10.46 -    }
   10.47 -
   10.48 -    public int getDonePercent() {
   10.49 -        int total = getTotal();
   10.50 -        return total > 0 ? Math.round(100.f*done/total) : 100;
   10.51 -    }
   10.52 -
   10.53 -    /**
   10.54 -     * Adds the specified issue to the summary by increming the respective counter.
   10.55 -     * @param issue the issue
   10.56 -     */
   10.57 -    public void add(Issue issue) {
   10.58 -        switch (issue.getStatus().getPhase()) {
   10.59 -            case 0:
   10.60 -                open++;
   10.61 -                break;
   10.62 -            case 1:
   10.63 -                active++;
   10.64 -                break;
   10.65 -            case 2:
   10.66 -                done++;
   10.67 -                break;
   10.68 -        }
   10.69 -    }
   10.70 -}
    11.1 --- a/src/main/java/de/uapcore/lightpit/entities/Project.java	Fri Oct 23 18:40:50 2020 +0200
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,102 +0,0 @@
    11.4 -/*
    11.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    11.6 - *
    11.7 - * Copyright 2018 Mike Becker. All rights reserved.
    11.8 - *
    11.9 - * Redistribution and use in source and binary forms, with or without
   11.10 - * modification, are permitted provided that the following conditions are met:
   11.11 - *
   11.12 - *   1. Redistributions of source code must retain the above copyright
   11.13 - *      notice, this list of conditions and the following disclaimer.
   11.14 - *
   11.15 - *   2. Redistributions in binary form must reproduce the above copyright
   11.16 - *      notice, this list of conditions and the following disclaimer in the
   11.17 - *      documentation and/or other materials provided with the distribution.
   11.18 - *
   11.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   11.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   11.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   11.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
   11.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   11.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   11.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   11.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   11.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   11.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   11.29 - * POSSIBILITY OF SUCH DAMAGE.
   11.30 - *
   11.31 - */
   11.32 -package de.uapcore.lightpit.entities;
   11.33 -
   11.34 -import java.util.Objects;
   11.35 -
   11.36 -public class Project {
   11.37 -
   11.38 -    private final int id;
   11.39 -    private String name;
   11.40 -    private String node;
   11.41 -    private String description;
   11.42 -    private String repoUrl;
   11.43 -    private User owner;
   11.44 -
   11.45 -    public Project(int id) {
   11.46 -        this.id = id;
   11.47 -    }
   11.48 -
   11.49 -    public int getId() {
   11.50 -        return id;
   11.51 -    }
   11.52 -
   11.53 -    public String getName() {
   11.54 -        return name;
   11.55 -    }
   11.56 -
   11.57 -    public void setName(String name) {
   11.58 -        this.name = name;
   11.59 -    }
   11.60 -
   11.61 -    public String getNode() {
   11.62 -        return node;
   11.63 -    }
   11.64 -
   11.65 -    public void setNode(String node) {
   11.66 -        this.node = node;
   11.67 -    }
   11.68 -
   11.69 -    public String getDescription() {
   11.70 -        return description;
   11.71 -    }
   11.72 -
   11.73 -    public void setDescription(String description) {
   11.74 -        this.description = description;
   11.75 -    }
   11.76 -
   11.77 -    public String getRepoUrl() {
   11.78 -        return repoUrl;
   11.79 -    }
   11.80 -
   11.81 -    public void setRepoUrl(String repoUrl) {
   11.82 -        this.repoUrl = repoUrl;
   11.83 -    }
   11.84 -
   11.85 -    public User getOwner() {
   11.86 -        return owner;
   11.87 -    }
   11.88 -
   11.89 -    public void setOwner(User owner) {
   11.90 -        this.owner = owner;
   11.91 -    }
   11.92 -
   11.93 -    @Override
   11.94 -    public boolean equals(Object o) {
   11.95 -        if (this == o) return true;
   11.96 -        if (o == null || getClass() != o.getClass()) return false;
   11.97 -        Project project = (Project) o;
   11.98 -        return id == project.id;
   11.99 -    }
  11.100 -
  11.101 -    @Override
  11.102 -    public int hashCode() {
  11.103 -        return Objects.hash(id);
  11.104 -    }
  11.105 -}
    12.1 --- a/src/main/java/de/uapcore/lightpit/entities/User.java	Fri Oct 23 18:40:50 2020 +0200
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,115 +0,0 @@
    12.4 -/*
    12.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    12.6 - *
    12.7 - * Copyright 2018 Mike Becker. All rights reserved.
    12.8 - *
    12.9 - * Redistribution and use in source and binary forms, with or without
   12.10 - * modification, are permitted provided that the following conditions are met:
   12.11 - *
   12.12 - *   1. Redistributions of source code must retain the above copyright
   12.13 - *      notice, this list of conditions and the following disclaimer.
   12.14 - *
   12.15 - *   2. Redistributions in binary form must reproduce the above copyright
   12.16 - *      notice, this list of conditions and the following disclaimer in the
   12.17 - *      documentation and/or other materials provided with the distribution.
   12.18 - *
   12.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   12.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   12.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   12.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
   12.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   12.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   12.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   12.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   12.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   12.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   12.29 - * POSSIBILITY OF SUCH DAMAGE.
   12.30 - *
   12.31 - */
   12.32 -package de.uapcore.lightpit.entities;
   12.33 -
   12.34 -import java.util.Objects;
   12.35 -
   12.36 -public final class User {
   12.37 -
   12.38 -    public static final int ANONYMOUS_USERID = -1;
   12.39 -
   12.40 -    private final int id;
   12.41 -    private String username;
   12.42 -    private String mail;
   12.43 -    private String givenname;
   12.44 -    private String lastname;
   12.45 -
   12.46 -    public User(int id) {
   12.47 -        this.id = id;
   12.48 -    }
   12.49 -
   12.50 -    public int getId() {
   12.51 -        return id;
   12.52 -    }
   12.53 -
   12.54 -    public String getUsername() {
   12.55 -        return username;
   12.56 -    }
   12.57 -
   12.58 -    public void setUsername(String username) {
   12.59 -        this.username = username;
   12.60 -    }
   12.61 -
   12.62 -    public String getMail() {
   12.63 -        return mail;
   12.64 -    }
   12.65 -
   12.66 -    public void setMail(String mail) {
   12.67 -        this.mail = mail;
   12.68 -    }
   12.69 -
   12.70 -    public String getGivenname() {
   12.71 -        return givenname;
   12.72 -    }
   12.73 -
   12.74 -    public void setGivenname(String givenname) {
   12.75 -        this.givenname = givenname;
   12.76 -    }
   12.77 -
   12.78 -    public String getLastname() {
   12.79 -        return lastname;
   12.80 -    }
   12.81 -
   12.82 -    public void setLastname(String lastname) {
   12.83 -        this.lastname = lastname;
   12.84 -    }
   12.85 -
   12.86 -    public String getShortDisplayname() {
   12.87 -        StringBuilder dn = new StringBuilder();
   12.88 -        if (givenname != null)
   12.89 -            dn.append(givenname);
   12.90 -        dn.append(' ');
   12.91 -        if (lastname != null)
   12.92 -            dn.append(lastname);
   12.93 -        final var str = dn.toString().trim();
   12.94 -        return str.isBlank() ? username : str;
   12.95 -    }
   12.96 -
   12.97 -    public String getDisplayname() {
   12.98 -        final String sdn = getShortDisplayname();
   12.99 -        if (mail != null && !mail.isBlank()) {
  12.100 -            return sdn + " <" + mail + ">";
  12.101 -        } else {
  12.102 -            return sdn;
  12.103 -        }
  12.104 -    }
  12.105 -
  12.106 -    @Override
  12.107 -    public boolean equals(Object o) {
  12.108 -        if (this == o) return true;
  12.109 -        if (o == null || getClass() != o.getClass()) return false;
  12.110 -        User user = (User) o;
  12.111 -        return id == user.id;
  12.112 -    }
  12.113 -
  12.114 -    @Override
  12.115 -    public int hashCode() {
  12.116 -        return Objects.hash(id);
  12.117 -    }
  12.118 -}
    13.1 --- a/src/main/java/de/uapcore/lightpit/entities/Version.java	Fri Oct 23 18:40:50 2020 +0200
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,106 +0,0 @@
    13.4 -/*
    13.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    13.6 - *
    13.7 - * Copyright 2018 Mike Becker. All rights reserved.
    13.8 - *
    13.9 - * Redistribution and use in source and binary forms, with or without
   13.10 - * modification, are permitted provided that the following conditions are met:
   13.11 - *
   13.12 - *   1. Redistributions of source code must retain the above copyright
   13.13 - *      notice, this list of conditions and the following disclaimer.
   13.14 - *
   13.15 - *   2. Redistributions in binary form must reproduce the above copyright
   13.16 - *      notice, this list of conditions and the following disclaimer in the
   13.17 - *      documentation and/or other materials provided with the distribution.
   13.18 - *
   13.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   13.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   13.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   13.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
   13.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   13.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   13.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   13.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   13.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   13.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   13.29 - * POSSIBILITY OF SUCH DAMAGE.
   13.30 - *
   13.31 - */
   13.32 -package de.uapcore.lightpit.entities;
   13.33 -
   13.34 -import java.util.Objects;
   13.35 -
   13.36 -public final class Version implements Comparable<Version> {
   13.37 -
   13.38 -    private final int id;
   13.39 -    private String name;
   13.40 -    private String node;
   13.41 -    /**
   13.42 -     * If we do not want versions to be ordered lexicographically we may specify an order.
   13.43 -     */
   13.44 -    private int ordinal = 0;
   13.45 -    private VersionStatus status = VersionStatus.Future;
   13.46 -
   13.47 -    public Version(int id) {
   13.48 -        this.id = id;
   13.49 -    }
   13.50 -
   13.51 -    public int getId() {
   13.52 -        return id;
   13.53 -    }
   13.54 -
   13.55 -    public String getName() {
   13.56 -        return name;
   13.57 -    }
   13.58 -
   13.59 -    public void setName(String name) {
   13.60 -        this.name = name;
   13.61 -    }
   13.62 -
   13.63 -    public String getNode() {
   13.64 -        return node;
   13.65 -    }
   13.66 -
   13.67 -    public void setNode(String node) {
   13.68 -        this.node = node;
   13.69 -    }
   13.70 -
   13.71 -    public int getOrdinal() {
   13.72 -        return ordinal;
   13.73 -    }
   13.74 -
   13.75 -    public void setOrdinal(int ordinal) {
   13.76 -        this.ordinal = ordinal;
   13.77 -    }
   13.78 -
   13.79 -    public VersionStatus getStatus() {
   13.80 -        return status;
   13.81 -    }
   13.82 -
   13.83 -    public void setStatus(VersionStatus status) {
   13.84 -        this.status = status;
   13.85 -    }
   13.86 -
   13.87 -    @Override
   13.88 -    public boolean equals(Object o) {
   13.89 -        if (this == o) return true;
   13.90 -        if (o == null || getClass() != o.getClass()) return false;
   13.91 -        Version version = (Version) o;
   13.92 -        return id == version.id;
   13.93 -    }
   13.94 -
   13.95 -    @Override
   13.96 -    public int hashCode() {
   13.97 -        return Objects.hash(id);
   13.98 -    }
   13.99 -
  13.100 -    @Override
  13.101 -    public int compareTo(Version version) {
  13.102 -        int ord = Integer.compare(this.ordinal, version.ordinal);
  13.103 -        if (ord == 0) {
  13.104 -            return this.name.compareToIgnoreCase(version.name);
  13.105 -        } else {
  13.106 -            return ord;
  13.107 -        }
  13.108 -    }
  13.109 -}
    14.1 --- a/src/main/java/de/uapcore/lightpit/entities/VersionStatistics.java	Fri Oct 23 18:40:50 2020 +0200
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,101 +0,0 @@
    14.4 -/*
    14.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    14.6 - *
    14.7 - * Copyright 2018 Mike Becker. All rights reserved.
    14.8 - *
    14.9 - * Redistribution and use in source and binary forms, with or without
   14.10 - * modification, are permitted provided that the following conditions are met:
   14.11 - *
   14.12 - *   1. Redistributions of source code must retain the above copyright
   14.13 - *      notice, this list of conditions and the following disclaimer.
   14.14 - *
   14.15 - *   2. Redistributions in binary form must reproduce the above copyright
   14.16 - *      notice, this list of conditions and the following disclaimer in the
   14.17 - *      documentation and/or other materials provided with the distribution.
   14.18 - *
   14.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   14.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   14.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   14.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
   14.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   14.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   14.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   14.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   14.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   14.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   14.29 - * POSSIBILITY OF SUCH DAMAGE.
   14.30 - *
   14.31 - */
   14.32 -package de.uapcore.lightpit.entities;
   14.33 -
   14.34 -public class VersionStatistics {
   14.35 -
   14.36 -    private final Version version;
   14.37 -    private int[][] issueCount;
   14.38 -
   14.39 -    private int[] rowTotals = null;
   14.40 -    private int[] columnTotals = null;
   14.41 -    private int total = -1;
   14.42 -
   14.43 -    public VersionStatistics(Version version) {
   14.44 -        this.version = version;
   14.45 -        issueCount = new int[IssueCategory.values().length][IssueStatus.values().length];
   14.46 -    }
   14.47 -
   14.48 -    public Version getVersion() {
   14.49 -        return version;
   14.50 -    }
   14.51 -
   14.52 -    public void setIssueCount(IssueCategory category, IssueStatus status, int count) {
   14.53 -        issueCount[category.ordinal()][status.ordinal()] = count;
   14.54 -        total = -1;
   14.55 -        rowTotals = columnTotals = null;
   14.56 -    }
   14.57 -
   14.58 -    public int[][] getIssueCount() {
   14.59 -        return issueCount;
   14.60 -    }
   14.61 -
   14.62 -    public int[] getRowTotals() {
   14.63 -        if (rowTotals != null) return rowTotals;
   14.64 -        final int cn = IssueCategory.values().length;
   14.65 -        final int sn = IssueStatus.values().length;
   14.66 -        final var totals = new int[cn];
   14.67 -        for (int i = 0 ; i < cn ; i++) {
   14.68 -            totals[i] = 0;
   14.69 -            for (int j = 0 ; j < sn ; j++) {
   14.70 -                totals[i] += issueCount[i][j];
   14.71 -            }
   14.72 -        }
   14.73 -        return rowTotals = totals;
   14.74 -    }
   14.75 -
   14.76 -    public int[] getColumnTotals() {
   14.77 -        if (columnTotals != null) return columnTotals;
   14.78 -        final int cn = IssueCategory.values().length;
   14.79 -        final int sn = IssueStatus.values().length;
   14.80 -        final var totals = new int[sn];
   14.81 -        for (int i = 0 ; i < sn ; i++) {
   14.82 -            totals[i] = 0;
   14.83 -            for (int j = 0 ; j < cn ; j++) {
   14.84 -                totals[i] += issueCount[j][i];
   14.85 -            }
   14.86 -        }
   14.87 -        return columnTotals = totals;
   14.88 -    }
   14.89 -
   14.90 -    public int getTotal() {
   14.91 -        if (this.total >= 0) {
   14.92 -            return this.total;
   14.93 -        }
   14.94 -        int total = 0;
   14.95 -        final int cn = IssueCategory.values().length;
   14.96 -        final int sn = IssueStatus.values().length;
   14.97 -        for (int i = 0 ; i < sn ; i++) {
   14.98 -            for (int j = 0 ; j < cn ; j++) {
   14.99 -                total += issueCount[j][i];
  14.100 -            }
  14.101 -        }
  14.102 -        return this.total = total;
  14.103 -    }
  14.104 -}
    15.1 --- a/src/main/java/de/uapcore/lightpit/entities/VersionStatus.java	Fri Oct 23 18:40:50 2020 +0200
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,41 +0,0 @@
    15.4 -/*
    15.5 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    15.6 - *
    15.7 - * Copyright 2018 Mike Becker. All rights reserved.
    15.8 - *
    15.9 - * Redistribution and use in source and binary forms, with or without
   15.10 - * modification, are permitted provided that the following conditions are met:
   15.11 - *
   15.12 - *   1. Redistributions of source code must retain the above copyright
   15.13 - *      notice, this list of conditions and the following disclaimer.
   15.14 - *
   15.15 - *   2. Redistributions in binary form must reproduce the above copyright
   15.16 - *      notice, this list of conditions and the following disclaimer in the
   15.17 - *      documentation and/or other materials provided with the distribution.
   15.18 - *
   15.19 - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   15.20 - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   15.21 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   15.22 - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
   15.23 - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   15.24 - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   15.25 - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   15.26 - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   15.27 - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   15.28 - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   15.29 - * POSSIBILITY OF SUCH DAMAGE.
   15.30 - *
   15.31 - */
   15.32 -package de.uapcore.lightpit.entities;
   15.33 -
   15.34 -public enum VersionStatus {
   15.35 -    Future,
   15.36 -    Unreleased,
   15.37 -    Released,
   15.38 -    LTS,
   15.39 -    Deprecated;
   15.40 -
   15.41 -    public boolean isReleased() {
   15.42 -        return ordinal() >= VersionStatus.Released.ordinal();
   15.43 -    }
   15.44 -}
    16.1 --- a/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Fri Oct 23 18:40:50 2020 +0200
    16.2 +++ b/src/main/java/de/uapcore/lightpit/modules/ProjectsModule.java	Fri Oct 23 20:34:57 2020 +0200
    16.3 @@ -570,7 +570,7 @@
    16.4              return ResponseType.NONE;
    16.5          }
    16.6          try {
    16.7 -            final var issueComment = new IssueComment(getParameter(req, Integer.class, "commentid").orElse(-1), issue);
    16.8 +            final var issueComment = new IssueComment(getParameter(req, Integer.class, "commentid").orElse(-1));
    16.9              issueComment.setComment(getParameter(req, String.class, "comment").orElse(""));
   16.10  
   16.11              if (issueComment.getComment().isBlank()) {
   16.12 @@ -582,7 +582,7 @@
   16.13                  dao.getUserDao().findByUsername(req.getRemoteUser()).ifPresent(issueComment::setAuthor);
   16.14              }
   16.15  
   16.16 -            dao.getIssueDao().saveComment(issueComment);
   16.17 +            dao.getIssueDao().saveComment(issue, issueComment);
   16.18  
   16.19              // TODO: fix redirect location
   16.20              setRedirectLocation(req, "./projects/" + issue.getProject().getNode()+"/issues/"+issue.getId()+"/view");
    17.1 --- a/src/main/java/de/uapcore/lightpit/viewmodel/util/IssueSorter.java	Fri Oct 23 18:40:50 2020 +0200
    17.2 +++ b/src/main/java/de/uapcore/lightpit/viewmodel/util/IssueSorter.java	Fri Oct 23 20:34:57 2020 +0200
    17.3 @@ -1,7 +1,7 @@
    17.4  package de.uapcore.lightpit.viewmodel.util;
    17.5  
    17.6  import de.uapcore.lightpit.entities.Issue;
    17.7 -import de.uapcore.lightpit.entities.IssueStatus;
    17.8 +import de.uapcore.lightpit.entities.IssueStatusPhase;
    17.9  
   17.10  import java.util.Arrays;
   17.11  import java.util.Comparator;
   17.12 @@ -41,8 +41,8 @@
   17.13          switch (criteria.field) {
   17.14              case DONE:
   17.15                  result = Boolean.compare(
   17.16 -                        left.getPhase() == IssueStatus.PHASE_DONE,
   17.17 -                        right.getPhase() == IssueStatus.PHASE_DONE);
   17.18 +                        left.getStatus().getPhase().equals(IssueStatusPhase.Companion.getDone()),
   17.19 +                        right.getStatus().getPhase().equals(IssueStatusPhase.Companion.getDone()));
   17.20                  break;
   17.21              case ETA:
   17.22                  if (left.getEta() != null && right.getEta() != null)
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/src/main/kotlin/de/uapcore/lightpit/entities/Component.kt	Fri Oct 23 20:34:57 2020 +0200
    18.3 @@ -0,0 +1,37 @@
    18.4 +/*
    18.5 + * Copyright 2020 Mike Becker. All rights reserved.
    18.6 + *
    18.7 + * Redistribution and use in source and binary forms, with or without
    18.8 + * modification, are permitted provided that the following conditions are met:
    18.9 + *
   18.10 + * 1. Redistributions of source code must retain the above copyright
   18.11 + * notice, this list of conditions and the following disclaimer.
   18.12 + *
   18.13 + * 2. Redistributions in binary form must reproduce the above copyright
   18.14 + * notice, this list of conditions and the following disclaimer in the
   18.15 + * documentation and/or other materials provided with the distribution.
   18.16 + *
   18.17 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   18.18 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   18.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   18.20 + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   18.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   18.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   18.23 + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   18.24 + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   18.25 + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   18.26 + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   18.27 + */
   18.28 +
   18.29 +package de.uapcore.lightpit.entities
   18.30 +
   18.31 +import de.uapcore.lightpit.types.WebColor
   18.32 +
   18.33 +data class Component(val id: Int) {
   18.34 +    var name: String? = null
   18.35 +    var node: String? = null
   18.36 +    var color = WebColor("000000")
   18.37 +    var ordinal = 0
   18.38 +    var description: String? = null
   18.39 +    var lead: User? = null
   18.40 +}
   18.41 \ No newline at end of file
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/src/main/kotlin/de/uapcore/lightpit/entities/Issue.kt	Fri Oct 23 20:34:57 2020 +0200
    19.3 @@ -0,0 +1,105 @@
    19.4 +/*
    19.5 + * Copyright 2020 Mike Becker. All rights reserved.
    19.6 + *
    19.7 + * Redistribution and use in source and binary forms, with or without
    19.8 + * modification, are permitted provided that the following conditions are met:
    19.9 + *
   19.10 + * 1. Redistributions of source code must retain the above copyright
   19.11 + * notice, this list of conditions and the following disclaimer.
   19.12 + *
   19.13 + * 2. Redistributions in binary form must reproduce the above copyright
   19.14 + * notice, this list of conditions and the following disclaimer in the
   19.15 + * documentation and/or other materials provided with the distribution.
   19.16 + *
   19.17 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   19.18 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   19.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   19.20 + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   19.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   19.23 + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   19.24 + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   19.25 + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   19.26 + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   19.27 + */
   19.28 +
   19.29 +package de.uapcore.lightpit.entities
   19.30 +
   19.31 +import java.sql.Date
   19.32 +import java.sql.Timestamp
   19.33 +import java.time.Instant
   19.34 +import kotlin.math.roundToInt
   19.35 +
   19.36 +data class IssueStatusPhase(val number: Int) {
   19.37 +    companion object {
   19.38 +        val Open = IssueStatusPhase(0)
   19.39 +        val WorkInProgress = IssueStatusPhase(1)
   19.40 +        val Done = IssueStatusPhase(2)
   19.41 +    }
   19.42 +}
   19.43 +
   19.44 +enum class IssueStatus(val phase: IssueStatusPhase) {
   19.45 +    InSpecification(IssueStatusPhase.Open),
   19.46 +    ToDo(IssueStatusPhase.Open),
   19.47 +    Scheduled(IssueStatusPhase.Open),
   19.48 +    InProgress(IssueStatusPhase.WorkInProgress),
   19.49 +    InReview(IssueStatusPhase.WorkInProgress),
   19.50 +    Done(IssueStatusPhase.Done),
   19.51 +    Rejected(IssueStatusPhase.Done),
   19.52 +    Withdrawn(IssueStatusPhase.Done),
   19.53 +    Duplicate(IssueStatusPhase.Done);
   19.54 +}
   19.55 +
   19.56 +enum class IssueCategory {
   19.57 +    Feature, Improvement, Bug, Task, Test
   19.58 +}
   19.59 +
   19.60 +data class Issue(var id: Int) {
   19.61 +
   19.62 +    var project: Project? = null
   19.63 +    var component: Component? = null
   19.64 +
   19.65 +    var status = IssueStatus.InSpecification
   19.66 +    var category = IssueCategory.Feature
   19.67 +
   19.68 +    var subject: String? = null
   19.69 +    var description: String? = null
   19.70 +    var assignee: User? = null
   19.71 +
   19.72 +    var affectedVersions = emptyList<Version>()
   19.73 +    var resolvedVersions = emptyList<Version>()
   19.74 +
   19.75 +    var created: Timestamp = Timestamp.from(Instant.now())
   19.76 +    var updated: Timestamp = Timestamp.from(Instant.now())
   19.77 +    var eta: Date? = null
   19.78 +
   19.79 +    /**
   19.80 +     * An issue is overdue, if it is not done and the ETA is before the current time.
   19.81 +     */
   19.82 +    val overdue get() = status.phase != IssueStatusPhase.Done && eta?.before(Date(System.currentTimeMillis())) ?: false
   19.83 +}
   19.84 +
   19.85 +class IssueSummary {
   19.86 +    var open = 0
   19.87 +    var active = 0
   19.88 +    var done = 0
   19.89 +
   19.90 +    val total get() = open + active + done
   19.91 +
   19.92 +    val openPercent get() = 100 - activePercent - donePercent
   19.93 +    val activePercent get() = if (total > 0) (100f * active / total).roundToInt() else 0
   19.94 +    val donePercent get() = if (total > 0) (100f * done / total).roundToInt() else 100
   19.95 +
   19.96 +    /**
   19.97 +     * Adds the specified issue to the summary by incrementing the respective counter.
   19.98 +     * @param issue the issue
   19.99 +     */
  19.100 +    fun add(issue: Issue) {
  19.101 +        when (issue.status.phase) {
  19.102 +            IssueStatusPhase.Open -> open++
  19.103 +            IssueStatusPhase.WorkInProgress -> active++
  19.104 +            IssueStatusPhase.Done -> done++
  19.105 +        }
  19.106 +    }
  19.107 +}
  19.108 +
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/src/main/kotlin/de/uapcore/lightpit/entities/IssueComment.kt	Fri Oct 23 20:34:57 2020 +0200
    20.3 @@ -0,0 +1,37 @@
    20.4 +/*
    20.5 + * Copyright 2020 Mike Becker. All rights reserved.
    20.6 + *
    20.7 + * Redistribution and use in source and binary forms, with or without
    20.8 + * modification, are permitted provided that the following conditions are met:
    20.9 + *
   20.10 + * 1. Redistributions of source code must retain the above copyright
   20.11 + * notice, this list of conditions and the following disclaimer.
   20.12 + *
   20.13 + * 2. Redistributions in binary form must reproduce the above copyright
   20.14 + * notice, this list of conditions and the following disclaimer in the
   20.15 + * documentation and/or other materials provided with the distribution.
   20.16 + *
   20.17 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   20.18 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   20.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   20.20 + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   20.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   20.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   20.23 + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   20.24 + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   20.25 + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   20.26 + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   20.27 + */
   20.28 +
   20.29 +package de.uapcore.lightpit.entities
   20.30 +
   20.31 +import java.sql.Timestamp
   20.32 +import java.time.Instant
   20.33 +
   20.34 +data class IssueComment(val id: Int) {
   20.35 +    var author: User? = null
   20.36 +    var comment: String? = null
   20.37 +    var created: Timestamp = Timestamp.from(Instant.now())
   20.38 +    var updated: Timestamp = Timestamp.from(Instant.now())
   20.39 +    var updateCount = 0
   20.40 +}
   20.41 \ No newline at end of file
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/src/main/kotlin/de/uapcore/lightpit/entities/Project.kt	Fri Oct 23 20:34:57 2020 +0200
    21.3 @@ -0,0 +1,34 @@
    21.4 +/*
    21.5 + * Copyright 2020 Mike Becker. All rights reserved.
    21.6 + *
    21.7 + * Redistribution and use in source and binary forms, with or without
    21.8 + * modification, are permitted provided that the following conditions are met:
    21.9 + *
   21.10 + * 1. Redistributions of source code must retain the above copyright
   21.11 + * notice, this list of conditions and the following disclaimer.
   21.12 + *
   21.13 + * 2. Redistributions in binary form must reproduce the above copyright
   21.14 + * notice, this list of conditions and the following disclaimer in the
   21.15 + * documentation and/or other materials provided with the distribution.
   21.16 + *
   21.17 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   21.18 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   21.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   21.20 + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   21.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   21.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   21.23 + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   21.24 + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   21.25 + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   21.26 + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   21.27 + */
   21.28 +
   21.29 +package de.uapcore.lightpit.entities
   21.30 +
   21.31 +data class Project(val id: Int) {
   21.32 +    var name: String? = null
   21.33 +    var node: String? = null
   21.34 +    var description: String? = null
   21.35 +    var repoUrl: String? = null
   21.36 +    var owner: User? = null
   21.37 +}
   21.38 \ No newline at end of file
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/src/main/kotlin/de/uapcore/lightpit/entities/User.kt	Fri Oct 23 20:34:57 2020 +0200
    22.3 @@ -0,0 +1,40 @@
    22.4 +/*
    22.5 + * Copyright 2020 Mike Becker. All rights reserved.
    22.6 + *
    22.7 + * Redistribution and use in source and binary forms, with or without
    22.8 + * modification, are permitted provided that the following conditions are met:
    22.9 + *
   22.10 + * 1. Redistributions of source code must retain the above copyright
   22.11 + * notice, this list of conditions and the following disclaimer.
   22.12 + *
   22.13 + * 2. Redistributions in binary form must reproduce the above copyright
   22.14 + * notice, this list of conditions and the following disclaimer in the
   22.15 + * documentation and/or other materials provided with the distribution.
   22.16 + *
   22.17 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   22.18 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   22.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   22.20 + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   22.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   22.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   22.23 + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   22.24 + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   22.25 + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   22.26 + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   22.27 + */
   22.28 +
   22.29 +package de.uapcore.lightpit.entities
   22.30 +
   22.31 +data class User(val id: Int) {
   22.32 +    var username = "anonymous"
   22.33 +    var mail = ""
   22.34 +    var givenname = ""
   22.35 +    var lastname = ""
   22.36 +
   22.37 +    val shortDisplayname: String get() {
   22.38 +        val str = "$givenname $lastname"
   22.39 +        return if (str.isBlank()) username else str.trim()
   22.40 +    }
   22.41 +
   22.42 +    val displayname: String get() = if (mail.isBlank()) shortDisplayname else "$shortDisplayname <$mail>"
   22.43 +}
   22.44 \ No newline at end of file
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/src/main/kotlin/de/uapcore/lightpit/entities/Version.kt	Fri Oct 23 20:34:57 2020 +0200
    23.3 @@ -0,0 +1,47 @@
    23.4 +/*
    23.5 + * Copyright 2020 Mike Becker. All rights reserved.
    23.6 + *
    23.7 + * Redistribution and use in source and binary forms, with or without
    23.8 + * modification, are permitted provided that the following conditions are met:
    23.9 + *
   23.10 + * 1. Redistributions of source code must retain the above copyright
   23.11 + * notice, this list of conditions and the following disclaimer.
   23.12 + *
   23.13 + * 2. Redistributions in binary form must reproduce the above copyright
   23.14 + * notice, this list of conditions and the following disclaimer in the
   23.15 + * documentation and/or other materials provided with the distribution.
   23.16 + *
   23.17 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   23.18 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   23.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   23.20 + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   23.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   23.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   23.23 + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   23.24 + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   23.25 + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   23.26 + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   23.27 + */
   23.28 +
   23.29 +package de.uapcore.lightpit.entities
   23.30 +
   23.31 +enum class VersionStatus {
   23.32 +    Future, Unreleased, Released, LTS, Deprecated;
   23.33 +    val isReleased get() = this.ordinal >= Released.ordinal
   23.34 +}
   23.35 +
   23.36 +data class Version(val id: Int) : Comparable<Version> {
   23.37 +    var name: String = "unspecified"
   23.38 +    var node = name
   23.39 +    var ordinal = 0
   23.40 +    var status = VersionStatus.Future
   23.41 +
   23.42 +    override fun compareTo(other: Version): Int {
   23.43 +        val ord = Integer.compare(ordinal, other.ordinal)
   23.44 +        return if (ord == 0) {
   23.45 +            name.compareTo(other.name, ignoreCase = true)
   23.46 +        } else {
   23.47 +            ord
   23.48 +        }
   23.49 +    }
   23.50 +}
    24.1 --- a/src/main/kotlin/de/uapcore/lightpit/types/WebColor.kt	Fri Oct 23 18:40:50 2020 +0200
    24.2 +++ b/src/main/kotlin/de/uapcore/lightpit/types/WebColor.kt	Fri Oct 23 20:34:57 2020 +0200
    24.3 @@ -1,3 +1,28 @@
    24.4 +/*
    24.5 + * Copyright 2020 Mike Becker. All rights reserved.
    24.6 + *
    24.7 + * Redistribution and use in source and binary forms, with or without
    24.8 + * modification, are permitted provided that the following conditions are met:
    24.9 + *
   24.10 + * 1. Redistributions of source code must retain the above copyright
   24.11 + * notice, this list of conditions and the following disclaimer.
   24.12 + *
   24.13 + * 2. Redistributions in binary form must reproduce the above copyright
   24.14 + * notice, this list of conditions and the following disclaimer in the
   24.15 + * documentation and/or other materials provided with the distribution.
   24.16 + *
   24.17 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   24.18 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   24.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   24.20 + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
   24.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   24.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   24.23 + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
   24.24 + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   24.25 + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   24.26 + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   24.27 + *
   24.28 + */
   24.29  package de.uapcore.lightpit.types
   24.30  
   24.31  
    25.1 --- a/src/main/webapp/WEB-INF/jsp/issue-view.jsp	Fri Oct 23 18:40:50 2020 +0200
    25.2 +++ b/src/main/webapp/WEB-INF/jsp/issue-view.jsp	Fri Oct 23 20:34:57 2020 +0200
    25.3 @@ -79,7 +79,7 @@
    25.4      <tr>
    25.5          <th><fmt:message key="issue.status"/></th>
    25.6          <td>
    25.7 -            <div class="issue-tag phase-${issue.status.phase}" style="width: auto">
    25.8 +            <div class="issue-tag phase-${issue.status.phase.number}" style="width: auto">
    25.9                  <fmt:message key="issue.status.${issue.status}" />
   25.10              </div>
   25.11          </td>
    26.1 --- a/src/main/webapp/WEB-INF/jspf/issue-list.jspf	Fri Oct 23 18:40:50 2020 +0200
    26.2 +++ b/src/main/webapp/WEB-INF/jspf/issue-list.jspf	Fri Oct 23 20:34:57 2020 +0200
    26.3 @@ -16,7 +16,7 @@
    26.4      <c:forEach var="issue" items="${issues}">
    26.5          <tr>
    26.6              <td>
    26.7 -                <span class="phase-${issue.status.phase}">
    26.8 +                <span class="phase-${issue.status.phase.number}">
    26.9                      <a href="./projects/${issue.project.node}/issues/${issue.id}/view">
   26.10                          #${issue.id}&nbsp;-&nbsp;<c:out value="${issue.subject}" />
   26.11                      </a>
   26.12 @@ -25,13 +25,13 @@
   26.13                  <div class="issue-tag ${issue.category}">
   26.14                      <fmt:message key="issue.category.${issue.category}" />
   26.15                  </div>
   26.16 -                <div class="issue-tag phase-${issue.status.phase}">
   26.17 +                <div class="issue-tag phase-${issue.status.phase.number}">
   26.18                      <fmt:message key="issue.status.${issue.status}" />
   26.19                  </div>
   26.20              </td>
   26.21              <td>
   26.22                  <span class="<c:if test="${issue.overdue}">eta-overdue</c:if> ">
   26.23 -                        <fmt:formatDate value="${issue.eta}" />
   26.24 +                    <fmt:formatDate value="${issue.eta}" />
   26.25                  </span>
   26.26              </td>
   26.27          </tr>

mercurial