Package com.atlassian.bamboo.repository
Class RepositoryDefinitionManagerImpl
- java.lang.Object
-
- com.atlassian.bamboo.repository.RepositoryDefinitionManagerImpl
-
- All Implemented Interfaces:
RepositoryDefinitionAccessor,RepositoryDefinitionManager
public class RepositoryDefinitionManagerImpl extends Object implements RepositoryDefinitionManager
-
-
Constructor Summary
Constructors Constructor Description RepositoryDefinitionManagerImpl(RepositoryDefinitionDao repositoryDefinitionDao, PlanRepositoryLinkDao planRepositoryLinkDao, RawRepositoryConfigurationXmlConverter rawRepositoryConfigurationXmlConverter, RssRepositoryPermissionDao rssRepositoryPermissionDao)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull LongcountAllProjectsRepositories()Count all project repositories.PartialVcsRepositoryDataentityToUnmergedData(@NotNull RepositoryDataEntity entity)@Nullable VcsRepositoryDataentityToVcsData(@Nullable RepositoryDataEntity input)@NotNull List<Long>findAllProjectsIdsUsingProjectRepositories()Find all project which are using project repositories.@NotNull Set<Long>findAllTopLevelRepositoriesIds()Get ids of all repositories that doesn't have parent repository (are either linked or are created on plan level)@NotNull List<RepositoryDataEntity>findRepositoriesByPluginKey(@NotNull String pluginKey)Given a pluginKey this will get you all of the repositories in Bamboo that were created for that key.List<RepositoryData>getGlobalRepositoryDefinitions()Get all Shared repositories current user has permission to use in his plans.List<RepositoryData>getGlobalRepositoryDefinitionsForAdministration()Get all Shared repositories current user has permission to administrate.List<RepositoryData>getGlobalRepositoryDefinitionsUnrestricted()Get all Shared Repositories without permission checking.List<PlanIdentifier>getIdentifiersOfPlansUsingRepository(long repositoryId)Get identifiers of Plans referencing a repository.@NotNull List<PlanIdentifier>getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren(long repositoryId)Get identifiers ofChains referencing a repository, either directly or through inheritance (only direct parent-child relationship is checked) If the parameter refers to a linked repository, onlyTopLevelPlans are returned.@NotNull List<VcsRepositoryData>getLinkedRepositories()Get all linked repositories current user has permission to use in his plans.List<VcsRepositoryData>getLinkedRepositoriesForAdministration()Get all Shared repositories current user has permission to administrate.List<VcsRepositoryData>getLinkedRepositoriesUnrestricted()Get all linked repositories without permission checking.@Nullable VcsRepositoryDatagetLinkedRepositoryByName(String name)Find a linked repository by name.@NotNull List<PartialVcsRepositoryData>getPlanRepositoriesForExport(@NotNull PlanIdentifier plan)Get all repositories attached to a plan in form suitable for export.@NotNull List<PlanRepositoryDefinition>getPlanRepositoryDefinitions(@NotNull PlanIdentifier plan)Get all repositories attached to a plan ordered by position.PlanRepositoryLinkgetPlanRepositoryLink(@NotNull ImmutablePlan plan, long repositoryId)Get persistent representation of a relation between Plan and repositoryPlanRepositoryLinkgetPlanRepositoryLinkByName(@NotNull ImmutablePlan plan, @NotNull String repositoryName)Get persistent representation of a relation between Plan and repository@NotNull List<PlanRepositoryLinkDto>getPlanRepositoryLinkDtos(@NotNull PlanIdentifier plan)@NotNull List<PlanRepositoryLink>getPlanRepositoryLinks(@NotNull ImmutablePlan plan)Get persistent representation of relation between Plan and repositoriesList<PlanRepositoryLink>getPlansUsingRepository(long repositoryId)GetPlanRepositoryLinks associated with repository.@NotNull List<VcsRepositoryData>getProjectRepositories(long projectId)Find all repositories in a project with given id.List<VcsRepositoryData>getProjectRepositoriesRestricted(long projectId)Get all project repositories current user has permission to use in his plans connected with requested project ID.@Nullable VcsRepositoryDatagetProjectRepositoryByName(String name, Long projectId)Find a project repository by name in project associated with given projectId.@Nullable RepositoryDataEntitygetRepositoryDataEntity(long id)Get persistent representation of a repository@NotNull List<RepositoryDefinition>getRepositoryDefinitionsForPlan(@NotNull ImmutablePlan plan)Get all repositories attached to a plan ordered by position.@Nullable VcsRepositoryDatagetVcsRepositoryData(long repositoryId)Get plugin-agnostic representation of a repository configuration.VcsRepositoryDatagetVcsRepositoryDataByOid(BambooEntityOid oid)Find a repository by oid.@Nullable PartialVcsRepositoryDatagetVcsRepositoryDataForEditing(long repositoryId)booleanisRepositoryOrItsDirectChildrenUsedInPlans(long repositoryId)Checks if repository is used in plansvoidremoveRepositoriesForPlan(Plan plan)Remove all repositories fromPlanthat are not global repositories.voidremoveRepositoryFromPlan(@NotNull PlanRepositoryLink planRepository)Removes relation between repository and plan.voidremoveRepositoryIfUnused(RepositoryDataEntity repositoryDataEntity)Marks repository for deletion if it is referenced by aRepositoryChangeset, removes it otherwise.voidremoveUnusedRepositories()Removes all repositories that has been previously markedForDeletion and are no longer referenced by anyRepositoryChangesetvoidsavePlanRepositoryLink(@NotNull PlanRepositoryLink planRepository)voidsavePlanRepositoryLinks(@NotNull List<PlanRepositoryLink> planRepositories)Saves the collection of plan to repository relations.longsavePlanRepositoryWithDefinition(@NotNull PlanRepositoryLink planRepository)Saves plan to repository relation definition with cascade toRepositoryDataEntitylongsaveRepositoryDefinition(RepositoryDataEntity repositoryData)Save repository definition.voidsaveRepositoryDefinitions(@NotNull Collection<RepositoryDataEntity> repositoriesBeingCreated)Saves all repository definitions in the collection.
-
-
-
Constructor Detail
-
RepositoryDefinitionManagerImpl
public RepositoryDefinitionManagerImpl(RepositoryDefinitionDao repositoryDefinitionDao, PlanRepositoryLinkDao planRepositoryLinkDao, RawRepositoryConfigurationXmlConverter rawRepositoryConfigurationXmlConverter, RssRepositoryPermissionDao rssRepositoryPermissionDao)
-
-
Method Detail
-
getPlanRepositoryLink
public PlanRepositoryLink getPlanRepositoryLink(@NotNull @NotNull ImmutablePlan plan, long repositoryId)
Description copied from interface:RepositoryDefinitionManagerGet persistent representation of a relation between Plan and repository- Specified by:
getPlanRepositoryLinkin interfaceRepositoryDefinitionManager
-
getPlanRepositoryLinkByName
public PlanRepositoryLink getPlanRepositoryLinkByName(@NotNull @NotNull ImmutablePlan plan, @NotNull @NotNull String repositoryName)
Description copied from interface:RepositoryDefinitionManagerGet persistent representation of a relation between Plan and repository- Specified by:
getPlanRepositoryLinkByNamein interfaceRepositoryDefinitionManager
-
getPlanRepositoryLinks
@NotNull public @NotNull List<PlanRepositoryLink> getPlanRepositoryLinks(@NotNull @NotNull ImmutablePlan plan)
Description copied from interface:RepositoryDefinitionManagerGet persistent representation of relation between Plan and repositories- Specified by:
getPlanRepositoryLinksin interfaceRepositoryDefinitionManager
-
getRepositoryDataEntity
@Nullable public @Nullable RepositoryDataEntity getRepositoryDataEntity(long id)
Description copied from interface:RepositoryDefinitionManagerGet persistent representation of a repository- Specified by:
getRepositoryDataEntityin interfaceRepositoryDefinitionManager
-
getRepositoryDefinitionsForPlan
@NotNull public @NotNull List<RepositoryDefinition> getRepositoryDefinitionsForPlan(@NotNull @NotNull ImmutablePlan plan)
Description copied from interface:RepositoryDefinitionManagerGet all repositories attached to a plan ordered by position.- Specified by:
getRepositoryDefinitionsForPlanin interfaceRepositoryDefinitionManager
-
getPlanRepositoryDefinitions
@NotNull public @NotNull List<PlanRepositoryDefinition> getPlanRepositoryDefinitions(@NotNull @NotNull PlanIdentifier plan)
Description copied from interface:RepositoryDefinitionManagerGet all repositories attached to a plan ordered by position.- Specified by:
getPlanRepositoryDefinitionsin interfaceRepositoryDefinitionManager
-
getPlanRepositoryLinkDtos
@NotNull public @NotNull List<PlanRepositoryLinkDto> getPlanRepositoryLinkDtos(@NotNull @NotNull PlanIdentifier plan)
- Specified by:
getPlanRepositoryLinkDtosin interfaceRepositoryDefinitionManager
-
getPlanRepositoriesForExport
@NotNull public @NotNull List<PartialVcsRepositoryData> getPlanRepositoriesForExport(@NotNull @NotNull PlanIdentifier plan)
Description copied from interface:RepositoryDefinitionManagerGet all repositories attached to a plan in form suitable for export.- Specified by:
getPlanRepositoriesForExportin interfaceRepositoryDefinitionManager
-
getPlansUsingRepository
public List<PlanRepositoryLink> getPlansUsingRepository(long repositoryId)
Description copied from interface:RepositoryDefinitionManagerGetPlanRepositoryLinks associated with repository. This method should only be used when editing the list of repositories associated with a Plan. This method only direct associations. This means, that since Bamboo 5.14, it will return no results for linked repository. See alsoRepositoryDefinitionManager.getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren(long)- Specified by:
getPlansUsingRepositoryin interfaceRepositoryDefinitionManager
-
getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren
@NotNull public @NotNull List<PlanIdentifier> getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren(long repositoryId)
Description copied from interface:RepositoryDefinitionManagerGet identifiers ofChains referencing a repository, either directly or through inheritance (only direct parent-child relationship is checked) If the parameter refers to a linked repository, onlyTopLevelPlans are returned. If the parameter refers to a plan local repository, it will return the plan the repository is linked to and all itsChainBranches- Specified by:
getIdentifiersOfPlansUsingRepositoryOrItsDirectChildrenin interfaceRepositoryDefinitionManager
-
isRepositoryOrItsDirectChildrenUsedInPlans
public boolean isRepositoryOrItsDirectChildrenUsedInPlans(long repositoryId)
Description copied from interface:RepositoryDefinitionManagerChecks if repository is used in plans- Specified by:
isRepositoryOrItsDirectChildrenUsedInPlansin interfaceRepositoryDefinitionManager
-
getGlobalRepositoryDefinitions
public List<RepositoryData> getGlobalRepositoryDefinitions()
Description copied from interface:RepositoryDefinitionManagerGet all Shared repositories current user has permission to use in his plans.- Specified by:
getGlobalRepositoryDefinitionsin interfaceRepositoryDefinitionManager
-
getGlobalRepositoryDefinitionsForAdministration
public List<RepositoryData> getGlobalRepositoryDefinitionsForAdministration()
Description copied from interface:RepositoryDefinitionManagerGet all Shared repositories current user has permission to administrate.- Specified by:
getGlobalRepositoryDefinitionsForAdministrationin interfaceRepositoryDefinitionManager
-
getGlobalRepositoryDefinitionsUnrestricted
public List<RepositoryData> getGlobalRepositoryDefinitionsUnrestricted()
Description copied from interface:RepositoryDefinitionManagerGet all Shared Repositories without permission checking.- Specified by:
getGlobalRepositoryDefinitionsUnrestrictedin interfaceRepositoryDefinitionManager
-
getLinkedRepositories
@NotNull public @NotNull List<VcsRepositoryData> getLinkedRepositories()
Description copied from interface:RepositoryDefinitionManagerGet all linked repositories current user has permission to use in his plans.- Specified by:
getLinkedRepositoriesin interfaceRepositoryDefinitionAccessor- Specified by:
getLinkedRepositoriesin interfaceRepositoryDefinitionManager
-
getLinkedRepositoriesForAdministration
public List<VcsRepositoryData> getLinkedRepositoriesForAdministration()
Description copied from interface:RepositoryDefinitionManagerGet all Shared repositories current user has permission to administrate.- Specified by:
getLinkedRepositoriesForAdministrationin interfaceRepositoryDefinitionManager
-
entityToVcsData
@Nullable public @Nullable VcsRepositoryData entityToVcsData(@Nullable @Nullable RepositoryDataEntity input)
- Specified by:
entityToVcsDatain interfaceRepositoryDefinitionManager
-
getVcsRepositoryData
@Nullable public @Nullable VcsRepositoryData getVcsRepositoryData(long repositoryId)
Description copied from interface:RepositoryDefinitionManagerGet plugin-agnostic representation of a repository configuration.- Specified by:
getVcsRepositoryDatain interfaceRepositoryDefinitionManager
-
entityToUnmergedData
public PartialVcsRepositoryData entityToUnmergedData(@NotNull @NotNull RepositoryDataEntity entity)
- Specified by:
entityToUnmergedDatain interfaceRepositoryDefinitionManager- Parameters:
entity- should be in decoded state.
-
getVcsRepositoryDataForEditing
@Nullable public @Nullable PartialVcsRepositoryData getVcsRepositoryDataForEditing(long repositoryId)
- Specified by:
getVcsRepositoryDataForEditingin interfaceRepositoryDefinitionManager
-
getLinkedRepositoriesUnrestricted
public List<VcsRepositoryData> getLinkedRepositoriesUnrestricted()
Description copied from interface:RepositoryDefinitionManagerGet all linked repositories without permission checking.- Specified by:
getLinkedRepositoriesUnrestrictedin interfaceRepositoryDefinitionManager
-
saveRepositoryDefinition
public long saveRepositoryDefinition(RepositoryDataEntity repositoryData)
Description copied from interface:RepositoryDefinitionManagerSave repository definition.- Specified by:
saveRepositoryDefinitionin interfaceRepositoryDefinitionManager- Returns:
- id of saved definition
-
saveRepositoryDefinitions
public void saveRepositoryDefinitions(@NotNull @NotNull Collection<RepositoryDataEntity> repositoriesBeingCreated)Description copied from interface:RepositoryDefinitionManagerSaves all repository definitions in the collection.- Specified by:
saveRepositoryDefinitionsin interfaceRepositoryDefinitionManager
-
savePlanRepositoryWithDefinition
public long savePlanRepositoryWithDefinition(@NotNull @NotNull PlanRepositoryLink planRepository)Description copied from interface:RepositoryDefinitionManagerSaves plan to repository relation definition with cascade toRepositoryDataEntity- Specified by:
savePlanRepositoryWithDefinitionin interfaceRepositoryDefinitionManager- Returns:
- new repository entity id
-
savePlanRepositoryLink
public void savePlanRepositoryLink(@NotNull @NotNull PlanRepositoryLink planRepository)- Specified by:
savePlanRepositoryLinkin interfaceRepositoryDefinitionManager
-
savePlanRepositoryLinks
public void savePlanRepositoryLinks(@NotNull @NotNull List<PlanRepositoryLink> planRepositories)Description copied from interface:RepositoryDefinitionManagerSaves the collection of plan to repository relations.- Specified by:
savePlanRepositoryLinksin interfaceRepositoryDefinitionManager
-
removeRepositoryFromPlan
public void removeRepositoryFromPlan(@NotNull @NotNull PlanRepositoryLink planRepository)Description copied from interface:RepositoryDefinitionManagerRemoves relation between repository and plan. If the repository is not a global repository,RepositoryDefinitionManager.removeRepositoryIfUnused(RepositoryDataEntity)is called.- Specified by:
removeRepositoryFromPlanin interfaceRepositoryDefinitionManager
-
removeRepositoryIfUnused
public void removeRepositoryIfUnused(RepositoryDataEntity repositoryDataEntity)
Description copied from interface:RepositoryDefinitionManagerMarks repository for deletion if it is referenced by aRepositoryChangeset, removes it otherwise.- Specified by:
removeRepositoryIfUnusedin interfaceRepositoryDefinitionManager
-
removeUnusedRepositories
public void removeUnusedRepositories()
Description copied from interface:RepositoryDefinitionManagerRemoves all repositories that has been previously markedForDeletion and are no longer referenced by anyRepositoryChangeset- Specified by:
removeUnusedRepositoriesin interfaceRepositoryDefinitionManager
-
removeRepositoriesForPlan
public void removeRepositoriesForPlan(Plan plan)
Description copied from interface:RepositoryDefinitionManagerRemove all repositories fromPlanthat are not global repositories.- Specified by:
removeRepositoriesForPlanin interfaceRepositoryDefinitionManager
-
getIdentifiersOfPlansUsingRepository
public List<PlanIdentifier> getIdentifiersOfPlansUsingRepository(long repositoryId)
Description copied from interface:RepositoryDefinitionManagerGet identifiers of Plans referencing a repository. This is faster than getPlansUsingRepository() and should be preferred for 'view' actions. This method only returns plans that are directly linked to the repository. This means, that since Bamboo 5.14, it will return no results for linked repository. See alsoRepositoryDefinitionManager.getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren(long)- Specified by:
getIdentifiersOfPlansUsingRepositoryin interfaceRepositoryDefinitionManager
-
findRepositoriesByPluginKey
@NotNull public @NotNull List<RepositoryDataEntity> findRepositoriesByPluginKey(@NotNull @NotNull String pluginKey)
Description copied from interface:RepositoryDefinitionManagerGiven a pluginKey this will get you all of the repositories in Bamboo that were created for that key. Irrespective of whether:- The plugin module with that plugin key is currently disabled.
- The repository is marked for deletion.
- The repository is marked as global or not.
- Specified by:
findRepositoriesByPluginKeyin interfaceRepositoryDefinitionManager- Parameters:
pluginKey- The plugin key to search for.- Returns:
- All of the repositories that match that plugin key.
-
getVcsRepositoryDataByOid
public VcsRepositoryData getVcsRepositoryDataByOid(BambooEntityOid oid)
Description copied from interface:RepositoryDefinitionAccessorFind a repository by oid.- Specified by:
getVcsRepositoryDataByOidin interfaceRepositoryDefinitionAccessor- Returns:
-
getLinkedRepositoryByName
@Nullable public @Nullable VcsRepositoryData getLinkedRepositoryByName(String name)
Description copied from interface:RepositoryDefinitionManagerFind a linked repository by name.- Specified by:
getLinkedRepositoryByNamein interfaceRepositoryDefinitionManager- Parameters:
name- of linked repository- Returns:
- linked repository
-
findAllTopLevelRepositoriesIds
@NotNull public @NotNull Set<Long> findAllTopLevelRepositoriesIds()
Description copied from interface:RepositoryDefinitionManagerGet ids of all repositories that doesn't have parent repository (are either linked or are created on plan level)- Specified by:
findAllTopLevelRepositoriesIdsin interfaceRepositoryDefinitionManager
-
getProjectRepositoryByName
@Nullable public @Nullable VcsRepositoryData getProjectRepositoryByName(String name, Long projectId)
Description copied from interface:RepositoryDefinitionManagerFind a project repository by name in project associated with given projectId.- Specified by:
getProjectRepositoryByNamein interfaceRepositoryDefinitionManager- Returns:
- RepositoryDataEntity if repository exists otherwise null.
-
countAllProjectsRepositories
@NotNull public @NotNull Long countAllProjectsRepositories()
Description copied from interface:RepositoryDefinitionManagerCount all project repositories.- Specified by:
countAllProjectsRepositoriesin interfaceRepositoryDefinitionManager- Returns:
- a Long count of all project repositories
-
getProjectRepositories
@NotNull public @NotNull List<VcsRepositoryData> getProjectRepositories(long projectId)
Description copied from interface:RepositoryDefinitionManagerFind all repositories in a project with given id.- Specified by:
getProjectRepositoriesin interfaceRepositoryDefinitionManager- Returns:
- a list of all project repositories
-
getProjectRepositoriesRestricted
public List<VcsRepositoryData> getProjectRepositoriesRestricted(long projectId)
Description copied from interface:RepositoryDefinitionManagerGet all project repositories current user has permission to use in his plans connected with requested project ID.- Specified by:
getProjectRepositoriesRestrictedin interfaceRepositoryDefinitionManager- Returns:
- a list of all project repositories
-
findAllProjectsIdsUsingProjectRepositories
@NotNull public @NotNull List<Long> findAllProjectsIdsUsingProjectRepositories()
Description copied from interface:RepositoryDefinitionManagerFind all project which are using project repositories.- Specified by:
findAllProjectsIdsUsingProjectRepositoriesin interfaceRepositoryDefinitionManager- Returns:
- a list of all projects IDs which are using project repositories
-
-