adds data model for issues

Mon, 18 May 2020 21:05:57 +0200

author
Mike Becker <universe@uap-core.de>
date
Mon, 18 May 2020 21:05:57 +0200
changeset 62
833e0385572a
parent 61
3e287f361c7a
child 63
51aa5e267c7f

adds data model for issues

setup/postgres/psql_create_tables.sql file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/dao/DataAccessObjects.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/dao/Functions.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/dao/GenericDao.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/ProjectDao.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/dao/UserDao.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/dao/VersionDao.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/dao/postgres/PGDataAccessObjects.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/PGVersionDao.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/IssueStatus.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/entities/Version.java file | annotate | diff | comparison | revisions
     1.1 --- a/setup/postgres/psql_create_tables.sql	Sun May 17 16:38:04 2020 +0200
     1.2 +++ b/setup/postgres/psql_create_tables.sql	Mon May 18 21:05:57 2020 +0200
     1.3 @@ -32,3 +32,36 @@
     1.4      ordinal         integer         not null default 0,
     1.5      status          version_status  not null default 'Future'
     1.6  );
     1.7 +
     1.8 +create type issue_status as enum (
     1.9 +    'InSpecification',
    1.10 +    'ToDo',
    1.11 +    'Scheduled',
    1.12 +    'InProgress',
    1.13 +    'InReview',
    1.14 +    'Done',
    1.15 +    'Rejected',
    1.16 +    'Withdrawn'
    1.17 +);
    1.18 +
    1.19 +create type issue_category as enum (
    1.20 +    'Feature',
    1.21 +    'Improvement',
    1.22 +    'Bug',
    1.23 +    'Task',
    1.24 +    'Test'
    1.25 +);
    1.26 +
    1.27 +create table lpit_issue (
    1.28 +    id              serial          primary key,
    1.29 +    project         integer         not null references lpit_project(id),
    1.30 +    status          issue_status    not null default 'InSpecification',
    1.31 +    category        issue_category  not null default 'Feature',
    1.32 +    subject         varchar(20)     not null,
    1.33 +    description     text,
    1.34 +    version_plan    integer         references lpit_version(id),
    1.35 +    version_done    integer         references lpit_version(id),
    1.36 +    created         timestamp       with time zone not null default now(),
    1.37 +    updated         timestamp       with time zone not null default now(),
    1.38 +    eta             date
    1.39 +);
     2.1 --- a/src/main/java/de/uapcore/lightpit/dao/DataAccessObjects.java	Sun May 17 16:38:04 2020 +0200
     2.2 +++ b/src/main/java/de/uapcore/lightpit/dao/DataAccessObjects.java	Mon May 18 21:05:57 2020 +0200
     2.3 @@ -32,4 +32,5 @@
     2.4      UserDao getUserDao();
     2.5      ProjectDao getProjectDao();
     2.6      VersionDao getVersionDao();
     2.7 +    IssueDao getIssueDao();
     2.8  }
     3.1 --- a/src/main/java/de/uapcore/lightpit/dao/Functions.java	Sun May 17 16:38:04 2020 +0200
     3.2 +++ b/src/main/java/de/uapcore/lightpit/dao/Functions.java	Mon May 18 21:05:57 2020 +0200
     3.3 @@ -28,6 +28,7 @@
     3.4   */
     3.5  package de.uapcore.lightpit.dao;
     3.6  
     3.7 +import java.sql.Date;
     3.8  import java.sql.PreparedStatement;
     3.9  import java.sql.SQLException;
    3.10  import java.sql.Types;
    3.11 @@ -47,6 +48,14 @@
    3.12          }
    3.13      }
    3.14  
    3.15 +    public static void setDateOrNull(PreparedStatement stmt, int index, Date date) throws SQLException {
    3.16 +        if (date == null) {
    3.17 +            stmt.setNull(index, Types.DATE);
    3.18 +        } else {
    3.19 +            stmt.setDate(index, date);
    3.20 +        }
    3.21 +    }
    3.22 +
    3.23      public static <T> void setForeignKeyOrNull(PreparedStatement stmt, int index, T instance, Function<? super T, Integer> keyGetter) throws SQLException {
    3.24          Integer key = Optional.ofNullable(instance).map(keyGetter).orElse(null);
    3.25          if (key == null) {
     4.1 --- a/src/main/java/de/uapcore/lightpit/dao/GenericDao.java	Sun May 17 16:38:04 2020 +0200
     4.2 +++ b/src/main/java/de/uapcore/lightpit/dao/GenericDao.java	Mon May 18 21:05:57 2020 +0200
     4.3 @@ -29,16 +29,8 @@
     4.4  package de.uapcore.lightpit.dao;
     4.5  
     4.6  import java.sql.SQLException;
     4.7 -import java.util.List;
     4.8  
     4.9  public interface GenericDao<T> {
    4.10 -    /**
    4.11 -     * Returns a list of all entities.
    4.12 -     *
    4.13 -     * @return a list of all objects
    4.14 -     * @throws SQLException on any kind of SQL errors
    4.15 -     */
    4.16 -    List<T> list() throws SQLException;
    4.17  
    4.18      /**
    4.19       * Finds an entity by its integer ID.
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/src/main/java/de/uapcore/lightpit/dao/IssueDao.java	Mon May 18 21:05:57 2020 +0200
     5.3 @@ -0,0 +1,46 @@
     5.4 +/*
     5.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     5.6 + *
     5.7 + * Copyright 2018 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.dao;
    5.33 +
    5.34 +import de.uapcore.lightpit.entities.Issue;
    5.35 +import de.uapcore.lightpit.entities.Project;
    5.36 +
    5.37 +import java.sql.SQLException;
    5.38 +import java.util.List;
    5.39 +
    5.40 +public interface IssueDao extends GenericDao<Issue> {
    5.41 +
    5.42 +    /**
    5.43 +     * Lists all issues for the specified project.
    5.44 +     * @param project the project
    5.45 +     * @return a list of issues
    5.46 +     * @throws SQLException on any kind of SQL error
    5.47 +     */
    5.48 +    List<Issue> list(Project project) throws SQLException;
    5.49 +}
     6.1 --- a/src/main/java/de/uapcore/lightpit/dao/ProjectDao.java	Sun May 17 16:38:04 2020 +0200
     6.2 +++ b/src/main/java/de/uapcore/lightpit/dao/ProjectDao.java	Mon May 18 21:05:57 2020 +0200
     6.3 @@ -30,5 +30,9 @@
     6.4  
     6.5  import de.uapcore.lightpit.entities.Project;
     6.6  
     6.7 +import java.sql.SQLException;
     6.8 +import java.util.List;
     6.9 +
    6.10  public interface ProjectDao extends GenericDao<Project> {
    6.11 +    List<Project> list() throws SQLException;
    6.12  }
     7.1 --- a/src/main/java/de/uapcore/lightpit/dao/UserDao.java	Sun May 17 16:38:04 2020 +0200
     7.2 +++ b/src/main/java/de/uapcore/lightpit/dao/UserDao.java	Mon May 18 21:05:57 2020 +0200
     7.3 @@ -30,6 +30,10 @@
     7.4  
     7.5  import de.uapcore.lightpit.entities.User;
     7.6  
     7.7 +import java.sql.SQLException;
     7.8 +import java.util.List;
     7.9 +
    7.10  public interface UserDao extends GenericDao<User> {
    7.11  
    7.12 +    List<User> list() throws SQLException;
    7.13  }
     8.1 --- a/src/main/java/de/uapcore/lightpit/dao/VersionDao.java	Sun May 17 16:38:04 2020 +0200
     8.2 +++ b/src/main/java/de/uapcore/lightpit/dao/VersionDao.java	Mon May 18 21:05:57 2020 +0200
     8.3 @@ -34,14 +34,7 @@
     8.4  import java.sql.SQLException;
     8.5  import java.util.List;
     8.6  
     8.7 -public interface VersionDao {
     8.8 -
     8.9 -    Version find(int id) throws SQLException;
    8.10 -    void save(Version instance) throws SQLException;
    8.11 -    boolean update(Version instance) throws SQLException;
    8.12 -    default void saveOrUpdate(Version instance) throws SQLException {
    8.13 -        if (!update(instance)) save(instance);
    8.14 -    }
    8.15 +public interface VersionDao extends GenericDao<Version> {
    8.16  
    8.17      /**
    8.18       * Lists all versions for the specified project.
     9.1 --- a/src/main/java/de/uapcore/lightpit/dao/postgres/PGDataAccessObjects.java	Sun May 17 16:38:04 2020 +0200
     9.2 +++ b/src/main/java/de/uapcore/lightpit/dao/postgres/PGDataAccessObjects.java	Mon May 18 21:05:57 2020 +0200
     9.3 @@ -28,10 +28,7 @@
     9.4   */
     9.5  package de.uapcore.lightpit.dao.postgres;
     9.6  
     9.7 -import de.uapcore.lightpit.dao.DataAccessObjects;
     9.8 -import de.uapcore.lightpit.dao.ProjectDao;
     9.9 -import de.uapcore.lightpit.dao.UserDao;
    9.10 -import de.uapcore.lightpit.dao.VersionDao;
    9.11 +import de.uapcore.lightpit.dao.*;
    9.12  
    9.13  import java.sql.Connection;
    9.14  import java.sql.SQLException;
    9.15 @@ -41,11 +38,13 @@
    9.16      private final UserDao userDao;
    9.17      private final ProjectDao projectDao;
    9.18      private final VersionDao versionDao;
    9.19 +    private final IssueDao issueDao;
    9.20  
    9.21      public PGDataAccessObjects(Connection connection) throws SQLException {
    9.22          userDao = new PGUserDao(connection);
    9.23          projectDao = new PGProjectDao(connection);
    9.24          versionDao = new PGVersionDao(connection);
    9.25 +        issueDao = new PGIssueDao(connection);
    9.26      }
    9.27  
    9.28      @Override
    9.29 @@ -62,4 +61,9 @@
    9.30      public VersionDao getVersionDao() {
    9.31          return versionDao;
    9.32      }
    9.33 +
    9.34 +    @Override
    9.35 +    public IssueDao getIssueDao() {
    9.36 +        return issueDao;
    9.37 +    }
    9.38  }
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/src/main/java/de/uapcore/lightpit/dao/postgres/PGIssueDao.java	Mon May 18 21:05:57 2020 +0200
    10.3 @@ -0,0 +1,155 @@
    10.4 +/*
    10.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
    10.6 + *
    10.7 + * Copyright 2018 Mike Becker. All rights reserved.
    10.8 + *
    10.9 + * Redistribution and use in source and binary forms, with or without
   10.10 + * modification, are permitted provided that the following conditions are met:
   10.11 + *
   10.12 + *   1. Redistributions of source code must retain the above copyright
   10.13 + *      notice, this list of conditions and the following disclaimer.
   10.14 + *
   10.15 + *   2. Redistributions in binary form must reproduce the above copyright
   10.16 + *      notice, this list of conditions and the following disclaimer in the
   10.17 + *      documentation and/or other materials provided with the distribution.
   10.18 + *
   10.19 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
   10.20 + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   10.21 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   10.22 + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
   10.23 + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   10.24 + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   10.25 + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   10.26 + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   10.27 + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   10.28 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   10.29 + * POSSIBILITY OF SUCH DAMAGE.
   10.30 + *
   10.31 + */
   10.32 +package de.uapcore.lightpit.dao.postgres;
   10.33 +
   10.34 +import de.uapcore.lightpit.dao.IssueDao;
   10.35 +import de.uapcore.lightpit.entities.*;
   10.36 +
   10.37 +import java.sql.Connection;
   10.38 +import java.sql.PreparedStatement;
   10.39 +import java.sql.ResultSet;
   10.40 +import java.sql.SQLException;
   10.41 +import java.util.ArrayList;
   10.42 +import java.util.List;
   10.43 +import java.util.Objects;
   10.44 +
   10.45 +import static de.uapcore.lightpit.dao.Functions.*;
   10.46 +
   10.47 +public final class PGIssueDao implements IssueDao {
   10.48 +
   10.49 +    private final PreparedStatement insert, update, list, find;
   10.50 +
   10.51 +    public PGIssueDao(Connection connection) throws SQLException {
   10.52 +        list = connection.prepareStatement(
   10.53 +                "select id, project, status, category, subject, description, " +
   10.54 +                        "vplan.id, vplan.name, vdone.id, vdone.name, " +
   10.55 +                        "created, updated, eta " +
   10.56 +                        "from lpit_issue " +
   10.57 +                        "left join lpit_version vplan on vplan.id = version_plan " +
   10.58 +                        "left join lpit_version vdone on vdone.id = version_done " +
   10.59 +                        "where project = ? ");
   10.60 +
   10.61 +        find = connection.prepareStatement(
   10.62 +                "select id, project, status, category, subject, description, " +
   10.63 +                        "vplan.id, vplan.name, vdone.id, vdone.name, " +
   10.64 +                        "created, updated, eta " +
   10.65 +                        "from lpit_issue " +
   10.66 +                        "left join lpit_version vplan on vplan.id = version_plan " +
   10.67 +                        "left join lpit_version vdone on vdone.id = version_done " +
   10.68 +                        "where id = ? ");
   10.69 +
   10.70 +        insert = connection.prepareStatement(
   10.71 +                "insert into lpit_issue (project, status, category, subject, description, version_plan, version_done, eta) " +
   10.72 +                        "values (?, ?::issue_status, ?::issue_category, ?, ?, ?, ?, ?)"
   10.73 +        );
   10.74 +        update = connection.prepareStatement(
   10.75 +                "update lpit_issue set updated = now(), status = ?::issue_status, category = ?::issue_category, " +
   10.76 +                        "subject = ?, description = ?, version_plan = ?, version_done = ?, eta = ? where id = ?"
   10.77 +        );
   10.78 +    }
   10.79 +
   10.80 +    private Version obtainVersion(ResultSet result, Project project, String prefix) throws SQLException {
   10.81 +        final int vplan = result.getInt(prefix+"id");
   10.82 +        if (vplan > 0) {
   10.83 +            final var ver = new Version(vplan, project);
   10.84 +            ver.setName(result.getString(prefix+"name"));
   10.85 +            return ver;
   10.86 +        } else {
   10.87 +            return null;
   10.88 +        }
   10.89 +    }
   10.90 +
   10.91 +    public Issue mapColumns(ResultSet result) throws SQLException {
   10.92 +        final var project = new Project(result.getInt("project"));
   10.93 +        final var issue = new Issue(result.getInt("id"), project);
   10.94 +        issue.setStatus(IssueStatus.valueOf(result.getString("status")));
   10.95 +        issue.setCategory(IssueCategory.valueOf(result.getString("category")));
   10.96 +        issue.setSubject(result.getString("subject"));
   10.97 +        issue.setDescription(result.getString("description"));
   10.98 +        issue.setScheduledVersion(obtainVersion(result, project, "vplan."));
   10.99 +        issue.setResolvedVersion(obtainVersion(result, project, "vdone."));
  10.100 +        issue.setCreated(result.getTimestamp("created"));
  10.101 +        issue.setUpdated(result.getTimestamp("updated"));
  10.102 +        issue.setEta(result.getDate("eta"));
  10.103 +        return issue;
  10.104 +    }
  10.105 +
  10.106 +    @Override
  10.107 +    public void save(Issue instance) throws SQLException {
  10.108 +        Objects.requireNonNull(instance.getSubject());
  10.109 +        Objects.requireNonNull(instance.getProject());
  10.110 +        insert.setInt(1, instance.getProject().getId());
  10.111 +        insert.setString(2, instance.getStatus().name());
  10.112 +        insert.setString(3, instance.getCategory().name());
  10.113 +        insert.setString(4, instance.getSubject());
  10.114 +        setStringOrNull(insert, 5, instance.getDescription());
  10.115 +        setForeignKeyOrNull(insert, 6, instance.getScheduledVersion(), Version::getId);
  10.116 +        setForeignKeyOrNull(insert, 7, instance.getResolvedVersion(), Version::getId);
  10.117 +        setDateOrNull(insert, 8, instance.getEta());
  10.118 +        insert.executeUpdate();
  10.119 +    }
  10.120 +
  10.121 +    @Override
  10.122 +    public boolean update(Issue instance) throws SQLException {
  10.123 +        Objects.requireNonNull(instance.getSubject());
  10.124 +        update.setString(1, instance.getStatus().name());
  10.125 +        update.setString(2, instance.getCategory().name());
  10.126 +        update.setString(3, instance.getSubject());
  10.127 +        setStringOrNull(update, 4, instance.getDescription());
  10.128 +        setForeignKeyOrNull(update, 5, instance.getScheduledVersion(), Version::getId);
  10.129 +        setForeignKeyOrNull(update, 6, instance.getResolvedVersion(), Version::getId);
  10.130 +        setDateOrNull(update, 7, instance.getEta());
  10.131 +        update.setInt(8, instance.getId());
  10.132 +        return update.executeUpdate() > 0;
  10.133 +    }
  10.134 +
  10.135 +    @Override
  10.136 +    public List<Issue> list(Project project) throws SQLException {
  10.137 +        list.setInt(1, project.getId());
  10.138 +        List<Issue> versions = new ArrayList<>();
  10.139 +        try (var result = list.executeQuery()) {
  10.140 +            while (result.next()) {
  10.141 +                versions.add(mapColumns(result));
  10.142 +            }
  10.143 +        }
  10.144 +        return versions;
  10.145 +    }
  10.146 +
  10.147 +    @Override
  10.148 +    public Issue find(int id) throws SQLException {
  10.149 +        find.setInt(1, id);
  10.150 +        try (var result = find.executeQuery()) {
  10.151 +            if (result.next()) {
  10.152 +                return mapColumns(result);
  10.153 +            } else {
  10.154 +                return null;
  10.155 +            }
  10.156 +        }
  10.157 +    }
  10.158 +}
    11.1 --- a/src/main/java/de/uapcore/lightpit/dao/postgres/PGVersionDao.java	Sun May 17 16:38:04 2020 +0200
    11.2 +++ b/src/main/java/de/uapcore/lightpit/dao/postgres/PGVersionDao.java	Mon May 18 21:05:57 2020 +0200
    11.3 @@ -50,7 +50,7 @@
    11.4                  "select id, project, name, ordinal, status " +
    11.5                          "from lpit_version " +
    11.6                          "where project = ? " +
    11.7 -                        "order by ordinal, name");
    11.8 +                        "order by ordinal, lower(name)");
    11.9  
   11.10          find = connection.prepareStatement(
   11.11                  "select id, project, name, ordinal, status " +
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/src/main/java/de/uapcore/lightpit/entities/Issue.java	Mon May 18 21:05:57 2020 +0200
    12.3 @@ -0,0 +1,160 @@
    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.sql.Date;
   12.35 +import java.sql.Timestamp;
   12.36 +import java.util.List;
   12.37 +import java.util.Objects;
   12.38 +
   12.39 +public final class Issue {
   12.40 +
   12.41 +    private final int id;
   12.42 +    private final Project project;
   12.43 +
   12.44 +    private IssueStatus status;
   12.45 +    private IssueCategory category;
   12.46 +
   12.47 +    private String subject;
   12.48 +    private String description;
   12.49 +
   12.50 +    private List<Version> affectedVersions;
   12.51 +    private Version scheduledVersion;
   12.52 +    private Version resolvedVersion;
   12.53 +
   12.54 +    private Timestamp created;
   12.55 +    private Timestamp updated;
   12.56 +    private Date eta;
   12.57 +
   12.58 +    public Issue(int id, Project project) {
   12.59 +        this.id = id;
   12.60 +        this.project = project;
   12.61 +    }
   12.62 +
   12.63 +    public int getId() {
   12.64 +        return id;
   12.65 +    }
   12.66 +
   12.67 +    public Project getProject() {
   12.68 +        return project;
   12.69 +    }
   12.70 +
   12.71 +    public IssueStatus getStatus() {
   12.72 +        return status;
   12.73 +    }
   12.74 +
   12.75 +    public void setStatus(IssueStatus status) {
   12.76 +        this.status = status;
   12.77 +    }
   12.78 +
   12.79 +    public IssueCategory getCategory() {
   12.80 +        return category;
   12.81 +    }
   12.82 +
   12.83 +    public void setCategory(IssueCategory category) {
   12.84 +        this.category = category;
   12.85 +    }
   12.86 +
   12.87 +    public String getSubject() {
   12.88 +        return subject;
   12.89 +    }
   12.90 +
   12.91 +    public void setSubject(String subject) {
   12.92 +        this.subject = subject;
   12.93 +    }
   12.94 +
   12.95 +    public String getDescription() {
   12.96 +        return description;
   12.97 +    }
   12.98 +
   12.99 +    public void setDescription(String description) {
  12.100 +        this.description = description;
  12.101 +    }
  12.102 +
  12.103 +    public List<Version> getAffectedVersions() {
  12.104 +        return affectedVersions;
  12.105 +    }
  12.106 +
  12.107 +    public void setAffectedVersions(List<Version> affectedVersions) {
  12.108 +        this.affectedVersions = affectedVersions;
  12.109 +    }
  12.110 +
  12.111 +    public Version getScheduledVersion() {
  12.112 +        return scheduledVersion;
  12.113 +    }
  12.114 +
  12.115 +    public void setScheduledVersion(Version scheduledVersion) {
  12.116 +        this.scheduledVersion = scheduledVersion;
  12.117 +    }
  12.118 +
  12.119 +    public Version getResolvedVersion() {
  12.120 +        return resolvedVersion;
  12.121 +    }
  12.122 +
  12.123 +    public void setResolvedVersion(Version resolvedVersion) {
  12.124 +        this.resolvedVersion = resolvedVersion;
  12.125 +    }
  12.126 +
  12.127 +    public Timestamp getCreated() {
  12.128 +        return created;
  12.129 +    }
  12.130 +
  12.131 +    public void setCreated(Timestamp created) {
  12.132 +        this.created = created;
  12.133 +    }
  12.134 +
  12.135 +    public Timestamp getUpdated() {
  12.136 +        return updated;
  12.137 +    }
  12.138 +
  12.139 +    public void setUpdated(Timestamp updated) {
  12.140 +        this.updated = updated;
  12.141 +    }
  12.142 +
  12.143 +    public Date getEta() {
  12.144 +        return eta;
  12.145 +    }
  12.146 +
  12.147 +    public void setEta(Date eta) {
  12.148 +        this.eta = eta;
  12.149 +    }
  12.150 +
  12.151 +    @Override
  12.152 +    public boolean equals(Object o) {
  12.153 +        if (this == o) return true;
  12.154 +        if (o == null || getClass() != o.getClass()) return false;
  12.155 +        Issue issue = (Issue) o;
  12.156 +        return id == issue.id;
  12.157 +    }
  12.158 +
  12.159 +    @Override
  12.160 +    public int hashCode() {
  12.161 +        return Objects.hash(id);
  12.162 +    }
  12.163 +}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/src/main/java/de/uapcore/lightpit/entities/IssueCategory.java	Mon May 18 21:05:57 2020 +0200
    13.3 @@ -0,0 +1,37 @@
    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 +public enum IssueCategory {
   13.35 +    Feature,
   13.36 +    Improvement,
   13.37 +    Bug,
   13.38 +    Task,
   13.39 +    Test
   13.40 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/src/main/java/de/uapcore/lightpit/entities/IssueStatus.java	Mon May 18 21:05:57 2020 +0200
    14.3 @@ -0,0 +1,40 @@
    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 enum IssueStatus {
   14.35 +    InSpecification,
   14.36 +    ToDo,
   14.37 +    Scheduled,
   14.38 +    InProgress,
   14.39 +    InReview,
   14.40 +    Done,
   14.41 +    Rejected,
   14.42 +    Withdrawn
   14.43 +}
    15.1 --- a/src/main/java/de/uapcore/lightpit/entities/Version.java	Sun May 17 16:38:04 2020 +0200
    15.2 +++ b/src/main/java/de/uapcore/lightpit/entities/Version.java	Mon May 18 21:05:57 2020 +0200
    15.3 @@ -30,7 +30,7 @@
    15.4  
    15.5  import java.util.Objects;
    15.6  
    15.7 -public class Version implements Comparable<Version> {
    15.8 +public final class Version implements Comparable<Version> {
    15.9  
   15.10      private final int id;
   15.11      private final Project project;

mercurial