Class VcsPullRequestHibernateDao
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate5.support.HibernateDaoSupport
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
Constructors -
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 MutableVcsPullRequestfindById(long id) @NotNull List<MutableVcsPullRequest> findByRepository(long repositoryId, boolean isOpen) Search pull requests by target repository and status.@Nullable MutableVcsPullRequestfindByRepositoryAndKey(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.intRemove 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, findAll, findById, merge, save, saveAllMethods inherited from class org.springframework.orm.hibernate5.support.HibernateDaoSupport
checkDaoConfig, createHibernateTemplate, currentSession, getHibernateTemplate, getSessionFactory, setHibernateTemplate, setSessionFactoryMethods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet, initDao
-
Constructor Details
-
VcsPullRequestHibernateDao
public VcsPullRequestHibernateDao()
-
-
Method Details
-
findAll
- Specified by:
findAllin interfaceVcsPullRequestDao
-
findByRepositoryAndKey
@Nullable public @Nullable MutableVcsPullRequest findByRepositoryAndKey(long repositoryId, @NotNull @NotNull String pullRequestKey) Description copied from interface:VcsPullRequestDaoSearch pull request by pull request key (unique on repository level) and target repository id- Specified by:
findByRepositoryAndKeyin 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:VcsPullRequestDaoSearch pull requests by target repository and status.- Specified by:
findByRepositoryin 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:VcsPullRequestDaoSynchronize status of PRs in DB and in remote repository. Returns aPartialListof updated pull requests.If the returned list is incomplete, this method should be called again.
- Specified by:
closePullRequestsClosedInRepositoryin 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:
findByIdin interfaceVcsPullRequestDao
-
findByStatus
@NotNull public @NotNull List<MutableVcsPullRequest> findByStatus(boolean isOpen, long startId, int maxLimit) Description copied from interface:VcsPullRequestDaoSearch pull requests by status.- Specified by:
findByStatusin 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:VcsPullRequestDaoRemove pull requests which are neither linked to any repository nor to any plan branch.- Specified by:
removeOrphanedPullRequestsin interfaceVcsPullRequestDao- Returns:
- number of removed records
-