src/main/kotlin/de/uapcore/lightpit/dao/AbstractIssueDao.kt

Thu, 19 Nov 2020 13:58:54 +0100

author
mike@uapl01.localdomain
date
Thu, 19 Nov 2020 13:58:54 +0100
changeset 159
86b5d8a1662f
child 164
003b08bb3f25
permissions
-rw-r--r--

migrates DAO classes

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

mercurial