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