Package com.atlassian.bamboo.repository
Class PlanRepositoryLinkHibernateDao
java.lang.Object
org.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate5.support.HibernateDaoSupport
com.atlassian.bamboo.persistence3.StatelessSessionHibernateDaoSupport
com.atlassian.bamboo.persistence3.BambooHibernateObjectDao<T>
com.atlassian.bamboo.persistence3.BambooHibernateVersionAwareObjectDao<PlanRepositoryLink,Plan>
com.atlassian.bamboo.repository.PlanRepositoryLinkHibernateDao
- All Implemented Interfaces:
BambooObjectDao<PlanRepositoryLink>
,PlanRepositoryLinkDao
,org.springframework.beans.factory.InitializingBean
public class PlanRepositoryLinkHibernateDao
extends BambooHibernateVersionAwareObjectDao<PlanRepositoryLink,Plan>
implements PlanRepositoryLinkDao
-
Field Summary
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
-
Constructor Summary
ConstructorDescriptionPlanRepositoryLinkHibernateDao
(@NotNull BambooClusterSettings bambooClusterSettings) -
Method Summary
Modifier and TypeMethodDescriptionvoid
detachAllRepositoriesFromPlan
(@NotNull ImmutablePlan plan) Remove allPlanRepositoryLink
defined for the .@NotNull List<PlanRepositoryLinkDto>
Find all in DTO formgetIdentifiersOfPlansUsingRepository
(long repositoryId) Get identifiers of Plans referencing a repository.getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren
(long repositoryId) Get identifiers of Plans referencing a repository, either directly or through inheritance (only direct parent-child relationship is checked)getPlanRepositoryLink
(@NotNull PlanIdentifier plan, long repositoryId) getPlanRepositoryLinkByName
(@NotNull PlanIdentifier plan, @NotNull String repositoryName) @NotNull List<PlanRepositoryLinkDto>
getPlanRepositoryLinkDtos
(@NotNull PlanIdentifier plan) @NotNull List<PlanRepositoryLink>
getPlanRepositoryLinks
(@NotNull ImmutablePlan plan) @NotNull List<PlanRepositoryLink>
getPlanRepositoryLinks
(@NotNull PlanIdentifier plan) getPlansUsingRepository
(long repositoryId) protected @NotNull Optional<VersioningSupplement<Plan>>
boolean
isRepositoryOrItsDirectChildrenUsedInPlans
(long repositoryId) Check if repository is used in plansvoid
removeLinksByParentRepositoryId
(long parentId) Removes all link objects where repository is direct child of a repository with given id.void
removeRepositoryFromPlan
(@NotNull PlanRepositoryLink planRepository) Remove singlePlanRepositoryLink
.Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateVersionAwareObjectDao
delete, deleteAll, getMainVersioningSupplement, incrementMainVersion, incrementMainVersion, incrementRootVersion, incrementRootVersion, save, saveAll
Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateObjectDao
convertSearchTermToLikeExpression, countAll, countWithRestriction, executeCountQuery, findAll, findById, merge
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
-
PlanRepositoryLinkHibernateDao
public PlanRepositoryLinkHibernateDao(@NotNull @NotNull BambooClusterSettings bambooClusterSettings)
-
-
Method Details
-
getPlanRepositoryLinks
@NotNull public @NotNull List<PlanRepositoryLink> getPlanRepositoryLinks(@NotNull @NotNull ImmutablePlan plan) - Specified by:
getPlanRepositoryLinks
in interfacePlanRepositoryLinkDao
- Returns:
- list of Source Repository relationships defined for the
Plan
sorted byPlanRepositoryLink.getPosition()
-
getRootVersioningSupplement
- Overrides:
getRootVersioningSupplement
in classBambooHibernateVersionAwareObjectDao<PlanRepositoryLink,
Plan>
-
getPlanRepositoryLinks
@NotNull public @NotNull List<PlanRepositoryLink> getPlanRepositoryLinks(@NotNull @NotNull PlanIdentifier plan) - Specified by:
getPlanRepositoryLinks
in interfacePlanRepositoryLinkDao
- Returns:
- list of Source Repository relationships defined for the
Plan
sorted byPlanRepositoryLink.getPosition()
-
getPlanRepositoryLinkDtos
@NotNull public @NotNull List<PlanRepositoryLinkDto> getPlanRepositoryLinkDtos(@NotNull @NotNull PlanIdentifier plan) - Specified by:
getPlanRepositoryLinkDtos
in interfacePlanRepositoryLinkDao
- Returns:
- list of Source Repository relationships defined for the
Plan
sorted byPlanRepositoryLink.getPosition()
-
getPlansUsingRepository
- Specified by:
getPlansUsingRepository
in interfacePlanRepositoryLinkDao
- Returns:
- list of
Plan
that reference a Source Repository
-
getIdentifiersOfPlansUsingRepository
Description copied from interface:PlanRepositoryLinkDao
Get identifiers of Plans referencing a repository. This is faster than getPlansUsingRepository() and should be preferred for 'view' actions.- Specified by:
getIdentifiersOfPlansUsingRepository
in interfacePlanRepositoryLinkDao
- Returns:
-
getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren
public List<PlanIdentifier> getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren(long repositoryId) Description copied from interface:PlanRepositoryLinkDao
Get identifiers of Plans referencing a repository, either directly or through inheritance (only direct parent-child relationship is checked)- Specified by:
getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren
in interfacePlanRepositoryLinkDao
- Returns:
-
isRepositoryOrItsDirectChildrenUsedInPlans
public boolean isRepositoryOrItsDirectChildrenUsedInPlans(long repositoryId) Description copied from interface:PlanRepositoryLinkDao
Check if repository is used in plans- Specified by:
isRepositoryOrItsDirectChildrenUsedInPlans
in interfacePlanRepositoryLinkDao
- Returns:
- true if the given repository is used in any plan
-
getPlanRepositoryLink
public PlanRepositoryLink getPlanRepositoryLink(@NotNull @NotNull PlanIdentifier plan, long repositoryId) - Specified by:
getPlanRepositoryLink
in interfacePlanRepositoryLinkDao
- Returns:
- relationship between plan and repository if it exists, null otherwise
-
getPlanRepositoryLinkByName
public PlanRepositoryLink getPlanRepositoryLinkByName(@NotNull @NotNull PlanIdentifier plan, @NotNull @NotNull String repositoryName) - Specified by:
getPlanRepositoryLinkByName
in interfacePlanRepositoryLinkDao
- Returns:
- relationship between plan and repository if it exists, null otherwise
-
detachAllRepositoriesFromPlan
Description copied from interface:PlanRepositoryLinkDao
Remove allPlanRepositoryLink
defined for the . Does not deleteRepositoryDataEntity
objects.- Specified by:
detachAllRepositoriesFromPlan
in interfacePlanRepositoryLinkDao
-
removeLinksByParentRepositoryId
public void removeLinksByParentRepositoryId(long parentId) Description copied from interface:PlanRepositoryLinkDao
Removes all link objects where repository is direct child of a repository with given id.- Specified by:
removeLinksByParentRepositoryId
in interfacePlanRepositoryLinkDao
-
removeRepositoryFromPlan
Description copied from interface:PlanRepositoryLinkDao
Remove singlePlanRepositoryLink
. Does not deleteRepositoryDataEntity
- Specified by:
removeRepositoryFromPlan
in interfacePlanRepositoryLinkDao
-
findAllDtos
Description copied from interface:PlanRepositoryLinkDao
Find all in DTO form- Specified by:
findAllDtos
in interfacePlanRepositoryLinkDao
-