Class VcsPullRequestHibernateDao
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate5.support.HibernateDaoSupport
com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
com.atlassian.bamboo.persistence3.BambooHibernateObjectDao<MutableVcsPullRequest>
com.atlassian.bamboo.plan.pullrequest.VcsPullRequestHibernateDao
- All Implemented Interfaces:
BambooObjectDao<MutableVcsPullRequest>
,VcsPullRequestDao
,org.springframework.beans.factory.InitializingBean
public class VcsPullRequestHibernateDao
extends BambooHibernateObjectDao<MutableVcsPullRequest>
implements VcsPullRequestDao
-
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NotNull PartialList<MutableVcsPullRequest>
closePullRequestsClosedInRepository
(long targetRepositoryId, @NotNull Set<String> openPrKeys) Synchronize status of PRs in DB and in remote repository.Collection<? extends MutableVcsPullRequest>
findAll()
@Nullable MutableVcsPullRequest
findById
(long id) @NotNull List<MutableVcsPullRequest>
findByRepository
(long repositoryId, boolean isOpen) Search pull requests by target repository and status.@Nullable MutableVcsPullRequest
findByRepositoryAndKey
(long repositoryId, @NotNull String pullRequestKey) Search pull request by pull request key (unique on repository level) and target repository id@NotNull List<MutableVcsPullRequest>
findByStatus
(boolean isOpen, long startId, int maxLimit) Search pull requests by status.int
Remove pull requests which are neither linked to any repository nor to any plan branch.Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateObjectDao
convertSearchTermToLikeExpression, countAll, countWithRestriction, delete, deleteAll, executeCountQuery, findAll, findById, merge, save, saveAll
Methods inherited from class com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
getCacheAwareHibernateTemplate
Methods inherited from class org.springframework.orm.hibernate5.support.HibernateDaoSupport
checkDaoConfig, createHibernateTemplate, currentSession, getHibernateTemplate, getSessionFactory, setHibernateTemplate, setSessionFactory
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.atlassian.bamboo.persistence3.BambooObjectDao
countAll, countWithRestriction, delete, deleteAll, findAll, findById, merge, save, saveAll
-
Constructor Details
-
VcsPullRequestHibernateDao
public VcsPullRequestHibernateDao()
-
-
Method Details
-
findAll
- Specified by:
findAll
in interfaceVcsPullRequestDao
-
findByRepositoryAndKey
@Nullable public @Nullable MutableVcsPullRequest findByRepositoryAndKey(long repositoryId, @NotNull @NotNull String pullRequestKey) Description copied from interface:VcsPullRequestDao
Search pull request by pull request key (unique on repository level) and target repository id- Specified by:
findByRepositoryAndKey
in interfaceVcsPullRequestDao
- Parameters:
repositoryId
- target repository idpullRequestKey
- repository-specific pull request key- Returns:
- pull request or null if not found
-
findByRepository
@NotNull public @NotNull List<MutableVcsPullRequest> findByRepository(long repositoryId, boolean isOpen) Description copied from interface:VcsPullRequestDao
Search pull requests by target repository and status.- Specified by:
findByRepository
in interfaceVcsPullRequestDao
- Parameters:
repositoryId
- target repository idisOpen
- status- Returns:
- list of pull requests
-
closePullRequestsClosedInRepository
@NotNull public @NotNull PartialList<MutableVcsPullRequest> closePullRequestsClosedInRepository(long targetRepositoryId, @NotNull @NotNull Set<String> openPrKeys) Description copied from interface:VcsPullRequestDao
Synchronize status of PRs in DB and in remote repository. Returns aPartialList
of updated pull requests.If the returned list is incomplete, this method should be called again.
- Specified by:
closePullRequestsClosedInRepository
in interfaceVcsPullRequestDao
- Parameters:
targetRepositoryId
- id of a remote repositoryopenPrKeys
- keys of pull requests which have open state in remote repository- Returns:
- list of modified pull request entities
-
findById
- Specified by:
findById
in interfaceVcsPullRequestDao
-
findByStatus
@NotNull public @NotNull List<MutableVcsPullRequest> findByStatus(boolean isOpen, long startId, int maxLimit) Description copied from interface:VcsPullRequestDao
Search pull requests by status.- Specified by:
findByStatus
in interfaceVcsPullRequestDao
- Parameters:
isOpen
- statusstartId
- entity id to start query frommaxLimit
- maximum amount of values to be returned- Returns:
- list of pull requests sorted by id
-
removeOrphanedPullRequests
public int removeOrphanedPullRequests()Description copied from interface:VcsPullRequestDao
Remove pull requests which are neither linked to any repository nor to any plan branch.- Specified by:
removeOrphanedPullRequests
in interfaceVcsPullRequestDao
- Returns:
- number of removed records
-