Fri, 30 Dec 2022 19:04:34 +0100
#29 add possibility to relate issues
mike@159 | 1 | /* |
universe@180 | 2 | * Copyright 2021 Mike Becker. All rights reserved. |
mike@159 | 3 | * |
mike@159 | 4 | * Redistribution and use in source and binary forms, with or without |
mike@159 | 5 | * modification, are permitted provided that the following conditions are met: |
mike@159 | 6 | * |
mike@159 | 7 | * 1. Redistributions of source code must retain the above copyright |
mike@159 | 8 | * notice, this list of conditions and the following disclaimer. |
mike@159 | 9 | * |
mike@159 | 10 | * 2. Redistributions in binary form must reproduce the above copyright |
mike@159 | 11 | * notice, this list of conditions and the following disclaimer in the |
mike@159 | 12 | * documentation and/or other materials provided with the distribution. |
mike@159 | 13 | * |
mike@159 | 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mike@159 | 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mike@159 | 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mike@159 | 17 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mike@159 | 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mike@159 | 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mike@159 | 20 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mike@159 | 21 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mike@159 | 22 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mike@159 | 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mike@159 | 24 | */ |
mike@159 | 25 | |
mike@159 | 26 | package de.uapcore.lightpit.dao |
mike@159 | 27 | |
universe@167 | 28 | import de.uapcore.lightpit.entities.* |
universe@184 | 29 | import de.uapcore.lightpit.viewmodel.ComponentSummary |
universe@184 | 30 | import de.uapcore.lightpit.viewmodel.IssueSummary |
universe@184 | 31 | import de.uapcore.lightpit.viewmodel.VersionSummary |
universe@167 | 32 | |
universe@167 | 33 | interface DataAccessObject { |
universe@248 | 34 | |
universe@167 | 35 | fun listUsers(): List<User> |
universe@167 | 36 | fun findUser(id: Int): User? |
universe@167 | 37 | fun findUserByName(username: String): User? |
universe@167 | 38 | fun insertUser(user: User) |
universe@167 | 39 | fun updateUser(user: User) |
universe@167 | 40 | |
universe@184 | 41 | /** |
universe@184 | 42 | * Lists all versions of the specified [project]. |
universe@184 | 43 | * |
universe@184 | 44 | * The list is first ordered by the ordinal of the version and |
universe@184 | 45 | * then by name, both descending. |
universe@184 | 46 | */ |
universe@167 | 47 | fun listVersions(project: Project): List<Version> |
universe@184 | 48 | fun listVersionSummaries(project: Project): List<VersionSummary> |
universe@167 | 49 | fun findVersion(id: Int): Version? |
universe@167 | 50 | fun findVersionByNode(project: Project, node: String): Version? |
universe@167 | 51 | fun insertVersion(version: Version) |
universe@167 | 52 | fun updateVersion(version: Version) |
universe@167 | 53 | |
universe@167 | 54 | fun listComponents(project: Project): List<Component> |
universe@184 | 55 | fun listComponentSummaries(project: Project): List<ComponentSummary> |
universe@167 | 56 | fun findComponent(id: Int): Component? |
universe@167 | 57 | fun findComponentByNode(project: Project, node: String): Component? |
universe@167 | 58 | fun insertComponent(component: Component) |
universe@167 | 59 | fun updateComponent(component: Component) |
universe@167 | 60 | |
universe@184 | 61 | /** |
universe@184 | 62 | * Lists all projects ordered by name. |
universe@184 | 63 | */ |
universe@167 | 64 | fun listProjects(): List<Project> |
universe@167 | 65 | fun findProject(id: Int): Project? |
universe@167 | 66 | fun findProjectByNode(node: String): Project? |
universe@167 | 67 | fun insertProject(project: Project) |
universe@167 | 68 | fun updateProject(project: Project) |
universe@167 | 69 | |
universe@167 | 70 | fun collectIssueSummary(project: Project): IssueSummary |
universe@257 | 71 | fun collectIssueSummary(assignee: User): IssueSummary |
universe@167 | 72 | |
universe@263 | 73 | fun listIssues(project: Project): List<Issue> |
universe@248 | 74 | fun listIssues(project: Project, version: Version?, component: Component?): List<Issue> |
universe@167 | 75 | fun findIssue(id: Int): Issue? |
universe@184 | 76 | fun insertIssue(issue: Issue): Int |
universe@167 | 77 | fun updateIssue(issue: Issue) |
universe@167 | 78 | |
universe@167 | 79 | fun listComments(issue: Issue): List<IssueComment> |
universe@207 | 80 | fun findComment(id: Int): IssueComment? |
universe@232 | 81 | fun insertComment(issueComment: IssueComment): Int |
universe@207 | 82 | fun updateComment(issueComment: IssueComment) |
universe@232 | 83 | |
universe@263 | 84 | /** |
universe@263 | 85 | * Inserts an issue relation, if it does not already exist. |
universe@263 | 86 | */ |
universe@263 | 87 | fun insertIssueRelation(rel: IssueRelation) |
universe@263 | 88 | fun deleteIssueRelation(rel: IssueRelation) |
universe@263 | 89 | fun listIssueRelations(issue: Issue): List<IssueRelation> |
universe@263 | 90 | |
universe@232 | 91 | fun insertHistoryEvent(issue: Issue, newId: Int = 0) |
universe@242 | 92 | fun insertHistoryEvent(issue: Issue, issueComment: IssueComment, newId: Int = 0) |
universe@235 | 93 | |
universe@239 | 94 | /** |
universe@239 | 95 | * Lists the issue history of the project with [projectId] for the past [days]. |
universe@239 | 96 | */ |
universe@235 | 97 | fun listIssueHistory(projectId: Int, days: Int): List<IssueHistoryEntry> |
universe@241 | 98 | |
universe@241 | 99 | /** |
universe@241 | 100 | * Lists the issue comment history of the project with [projectId] for the past [days]. |
universe@241 | 101 | */ |
universe@241 | 102 | fun listIssueCommentHistory(projectId: Int, days: Int): List<IssueCommentHistoryEntry> |
universe@232 | 103 | } |