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

Fri, 18 Dec 2020 16:09:20 +0100

author
Mike Becker <universe@uap-core.de>
date
Fri, 18 Dec 2020 16:09:20 +0100
changeset 164
003b08bb3f25
parent 159
86b5d8a1662f
permissions
-rw-r--r--

Update issue "updated" date when a comment is added or changed - fixes #111

     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  */
    27 package de.uapcore.lightpit.dao
    29 import de.uapcore.lightpit.entities.*
    30 import java.sql.SQLException
    32 abstract class AbstractIssueDao : AbstractChildEntityDao<Issue, Project>() {
    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>
    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>
    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>
    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>
    74     /**
    75      * Stores the specified comment in database.
    76      * This is an update-or-insert operation.
    77      * The "updated" date of the corresponding issue is also updated.
    78      *
    79      * @param issue the issue to save the comment for
    80      * @param comment the comment to save
    81      */
    82     abstract fun saveComment(issue: Issue, comment: IssueComment)
    84     /**
    85      * Saves an instances to the database.
    86      * Implementations of this DAO must guarantee that the generated ID is stored in the instance.
    87      *
    88      * @param instance the instance to insert
    89      * @param parent the parent project
    90      * @throws SQLException on any kind of SQL error
    91      */
    92     abstract override fun save(instance: Issue, parent: Project)
    94     /**
    95      * Retrieves the affected, scheduled and resolved versions for the specified issue.
    96      *
    97      * @param issue the issue to join the information for
    98      */
    99     abstract fun joinVersionInformation(issue: Issue)
   100 }

mercurial