|
1 /* |
|
2 * Copyright 2020 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 * |
|
25 */ |
|
26 |
|
27 package de.uapcore.lightpit.dao |
|
28 |
|
29 import de.uapcore.lightpit.entities.* |
|
30 import java.sql.SQLException |
|
31 |
|
32 abstract class AbstractIssueDao : AbstractChildEntityDao<Issue, Project>() { |
|
33 |
|
34 /** |
|
35 * Lists all issues that are related to the specified component and version. |
|
36 * If component or version is null, search for issues that are not assigned to any |
|
37 * component or version, respectively. |
|
38 * |
|
39 * @param project the project |
|
40 * @param component the component |
|
41 * @param version the version |
|
42 * @return a list of issues |
|
43 */ |
|
44 abstract fun list(project: Project, component: Component?, version: Version?): List<Issue> |
|
45 |
|
46 /** |
|
47 * Lists all issues that are related to the specified version. |
|
48 * If the version is null, lists issues that are not assigned to any version. |
|
49 * |
|
50 * @param project the project |
|
51 * @param version the version or null |
|
52 * @return a list of issues |
|
53 */ |
|
54 abstract fun list(project: Project, version: Version?): List<Issue> |
|
55 |
|
56 /** |
|
57 * Lists all issues that are related to the specified component. |
|
58 * If the component is null, lists issues that are not assigned to a component. |
|
59 * |
|
60 * @param project the project |
|
61 * @param component the component or null |
|
62 * @return a list of issues |
|
63 */ |
|
64 abstract fun list(project: Project, component: Component?): List<Issue> |
|
65 |
|
66 /** |
|
67 * Lists all comments for a specific issue in chronological order. |
|
68 * |
|
69 * @param issue the issue |
|
70 * @return the list of comments |
|
71 */ |
|
72 abstract fun listComments(issue: Issue): List<IssueComment> |
|
73 |
|
74 /** |
|
75 * Stores the specified comment in database. |
|
76 * This is an update-or-insert operation. |
|
77 * |
|
78 * @param issue the issue to save the comment for |
|
79 * @param comment the comment to save |
|
80 */ |
|
81 abstract fun saveComment(issue: Issue, comment: IssueComment) |
|
82 |
|
83 /** |
|
84 * Saves an instances to the database. |
|
85 * Implementations of this DAO must guarantee that the generated ID is stored in the instance. |
|
86 * |
|
87 * @param instance the instance to insert |
|
88 * @param parent the parent project |
|
89 * @throws SQLException on any kind of SQL error |
|
90 */ |
|
91 abstract override fun save(instance: Issue, parent: Project) |
|
92 |
|
93 /** |
|
94 * Retrieves the affected, scheduled and resolved versions for the specified issue. |
|
95 * |
|
96 * @param issue the issue to join the information for |
|
97 */ |
|
98 abstract fun joinVersionInformation(issue: Issue) |
|
99 } |