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.BambooHibernateObjectDao<PlanRepositoryLink>
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
ConstructorsConstructorDescriptionPlanRepositoryLinkHibernateDao(@NotNull BambooClusterSettings bambooClusterSettings, @NotNull PlanDao planDao) -
Method Summary
Modifier and TypeMethodDescriptionvoiddetachAllRepositoriesFromPlan(@NotNull ImmutablePlan plan) Remove allPlanRepositoryLinkdefined 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(long planId) @NotNull List<PlanRepositoryLinkDto> @NotNull List<PlanRepositoryLink> getPlanRepositoryLinks(@NotNull PlanIdentifier plan) @NotNull List<PlanRepositoryLink> getPlanRepositoryLinks(@NotNull ImmutablePlan plan) getPlansUsingRepository(long repositoryId) protected @NotNull Optional<VersioningSupplement<Plan>> booleanisRepositoryOrItsDirectChildrenUsedInPlans(long repositoryId) Check if repository is used in plansvoidremoveLinksByParentRepositoryId(long parentId) Removes all link objects where repository is direct child of a repository with given id.voidremoveRepositoryFromPlan(@NotNull PlanRepositoryLink planRepository) Remove singlePlanRepositoryLink.Methods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateVersionAwareObjectDao
delete, deleteAll, getMainVersioningSupplement, incrementMainVersion, incrementMainVersion, incrementRootVersion, incrementRootVersion, incrementRootVersion, save, saveAllMethods inherited from class com.atlassian.bamboo.persistence3.BambooHibernateObjectDao
convertSearchTermToLikeExpression, countAll, countWithRestriction, executeCountQuery, findAll, findAll, findById, mergeMethods 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
-
PlanRepositoryLinkHibernateDao
public PlanRepositoryLinkHibernateDao(@NotNull @NotNull BambooClusterSettings bambooClusterSettings, @NotNull @NotNull PlanDao planDao)
-
-
Method Details
-
getPlanRepositoryLinks
@NotNull public @NotNull List<PlanRepositoryLink> getPlanRepositoryLinks(@NotNull @NotNull ImmutablePlan plan) - Specified by:
getPlanRepositoryLinksin interfacePlanRepositoryLinkDao- Parameters:
plan-- Returns:
- list of Source Repository relationships defined for the
Plansorted byPlanRepositoryLink.getPosition()
-
getRootVersioningSupplement
- Overrides:
getRootVersioningSupplementin classBambooHibernateVersionAwareObjectDao<PlanRepositoryLink,Plan>
-
getPlanRepositoryLinks
@NotNull public @NotNull List<PlanRepositoryLink> getPlanRepositoryLinks(@NotNull @NotNull PlanIdentifier plan) - Specified by:
getPlanRepositoryLinksin interfacePlanRepositoryLinkDao- Parameters:
plan-- Returns:
- list of Source Repository relationships defined for the
Plansorted byPlanRepositoryLink.getPosition()
-
getPlanRepositoryLinkDtos
- Specified by:
getPlanRepositoryLinkDtosin interfacePlanRepositoryLinkDao- Parameters:
planId-- Returns:
- list of Source Repository relationships defined for the
Plansorted byPlanRepositoryLink.getPosition()
-
getPlanRepositoryLinkDtos
- Specified by:
getPlanRepositoryLinkDtosin interfacePlanRepositoryLinkDao- Parameters:
plan-- Returns:
- list of Source Repository relationships defined for the
Plansorted byPlanRepositoryLink.getPosition()
-
getPlansUsingRepository
- Specified by:
getPlansUsingRepositoryin interfacePlanRepositoryLinkDao- Parameters:
repositoryId-- Returns:
- list of
Planthat reference a Source Repository
-
getIdentifiersOfPlansUsingRepository
Description copied from interface:PlanRepositoryLinkDaoGet identifiers of Plans referencing a repository. This is faster than getPlansUsingRepository() and should be preferred for 'view' actions.- Specified by:
getIdentifiersOfPlansUsingRepositoryin interfacePlanRepositoryLinkDao- Parameters:
repositoryId-- Returns:
-
getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren
public List<PlanIdentifier> getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren(long repositoryId) Description copied from interface:PlanRepositoryLinkDaoGet identifiers of Plans referencing a repository, either directly or through inheritance (only direct parent-child relationship is checked)- Specified by:
getIdentifiersOfPlansUsingRepositoryOrItsDirectChildrenin interfacePlanRepositoryLinkDao- Parameters:
repositoryId-- Returns:
-
isRepositoryOrItsDirectChildrenUsedInPlans
public boolean isRepositoryOrItsDirectChildrenUsedInPlans(long repositoryId) Description copied from interface:PlanRepositoryLinkDaoCheck if repository is used in plans- Specified by:
isRepositoryOrItsDirectChildrenUsedInPlansin interfacePlanRepositoryLinkDao- Parameters:
repositoryId-- Returns:
- true if the given repository is used in any plan
-
getPlanRepositoryLink
public PlanRepositoryLink getPlanRepositoryLink(@NotNull @NotNull PlanIdentifier plan, long repositoryId) - Specified by:
getPlanRepositoryLinkin interfacePlanRepositoryLinkDao- Parameters:
plan-repositoryId-- 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:
getPlanRepositoryLinkByNamein interfacePlanRepositoryLinkDao- Parameters:
plan-repositoryName-- Returns:
- relationship between plan and repository if it exists, null otherwise
-
detachAllRepositoriesFromPlan
Description copied from interface:PlanRepositoryLinkDaoRemove allPlanRepositoryLinkdefined for the . Does not deleteRepositoryDataEntityobjects.- Specified by:
detachAllRepositoriesFromPlanin interfacePlanRepositoryLinkDao- Parameters:
plan-
-
removeLinksByParentRepositoryId
public void removeLinksByParentRepositoryId(long parentId) Description copied from interface:PlanRepositoryLinkDaoRemoves all link objects where repository is direct child of a repository with given id.- Specified by:
removeLinksByParentRepositoryIdin interfacePlanRepositoryLinkDao- Parameters:
parentId-
-
removeRepositoryFromPlan
Description copied from interface:PlanRepositoryLinkDaoRemove singlePlanRepositoryLink. Does not deleteRepositoryDataEntity- Specified by:
removeRepositoryFromPlanin interfacePlanRepositoryLinkDao- Parameters:
planRepository-
-
findAllDtos
Description copied from interface:PlanRepositoryLinkDaoFind all in DTO form- Specified by:
findAllDtosin interfacePlanRepositoryLinkDao
-