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
-
-
Constructor Summary
Constructors Constructor Description PlanRepositoryLinkHibernateDao(@NotNull BambooClusterSettings bambooClusterSettings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
detachAllRepositoriesFromPlan(@NotNull ImmutablePlan plan)
Remove allPlanRepositoryLink
defined for the .@NotNull List<PlanRepositoryLinkDto>
findAllDtos()
Find all in DTO formList<PlanIdentifier>
getIdentifiersOfPlansUsingRepository(long repositoryId)
Get identifiers of Plans referencing a repository.List<PlanIdentifier>
getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren(long repositoryId)
Get identifiers of Plans referencing a repository, either directly or through inheritance (only direct parent-child relationship is checked)PlanRepositoryLink
getPlanRepositoryLink(@NotNull PlanIdentifier plan, long repositoryId)
PlanRepositoryLink
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)
List<PlanRepositoryLink>
getPlansUsingRepository(long repositoryId)
protected @NotNull Optional<VersioningSupplement<Plan>>
getRootVersioningSupplement()
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 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 Detail
-
PlanRepositoryLinkHibernateDao
public PlanRepositoryLinkHibernateDao(@NotNull @NotNull BambooClusterSettings bambooClusterSettings)
-
-
Method Detail
-
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
@NotNull protected @NotNull Optional<VersioningSupplement<Plan>> 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
public List<PlanRepositoryLink> getPlansUsingRepository(long repositoryId)
- Specified by:
getPlansUsingRepository
in interfacePlanRepositoryLinkDao
- Returns:
- list of
Plan
that reference a Source Repository
-
getIdentifiersOfPlansUsingRepository
public List<PlanIdentifier> getIdentifiersOfPlansUsingRepository(long repositoryId)
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
public void detachAllRepositoriesFromPlan(@NotNull @NotNull ImmutablePlan plan)
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
public void removeRepositoryFromPlan(@NotNull @NotNull PlanRepositoryLink planRepository)
Description copied from interface:PlanRepositoryLinkDao
Remove singlePlanRepositoryLink
. Does not deleteRepositoryDataEntity
- Specified by:
removeRepositoryFromPlan
in interfacePlanRepositoryLinkDao
-
findAllDtos
@NotNull public @NotNull List<PlanRepositoryLinkDto> findAllDtos()
Description copied from interface:PlanRepositoryLinkDao
Find all in DTO form- Specified by:
findAllDtos
in interfacePlanRepositoryLinkDao
-
-