Package com.atlassian.bamboo.repository
Class RepositoryDefinitionManagerImpl
java.lang.Object
com.atlassian.bamboo.repository.RepositoryDefinitionManagerImpl
- All Implemented Interfaces:
RepositoryDefinitionAccessor
,RepositoryDefinitionManager
-
Constructor Summary
ConstructorDescriptionRepositoryDefinitionManagerImpl
(RepositoryDefinitionDao repositoryDefinitionDao, PlanRepositoryLinkDao planRepositoryLinkDao, RawRepositoryConfigurationXmlConverter rawRepositoryConfigurationXmlConverter, RssRepositoryPermissionDao rssRepositoryPermissionDao) -
Method Summary
Modifier and TypeMethodDescription@NotNull Long
Count all project repositories.entityToUnmergedData
(@NotNull RepositoryDataEntity entity) @Nullable VcsRepositoryData
entityToVcsData
(@Nullable RepositoryDataEntity input) Find all project which are using project repositories.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 the repositories in Bamboo that were created for that key.Get all Shared repositories current user has permission to use in his plans.Get all Shared repositories current user has permission to administrate.Get all Shared Repositories without permission checking.getIdentifiersOfPlansUsingRepository
(long repositoryId) Get identifiers of Plans referencing a repository.@NotNull List<PlanIdentifier>
getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren
(long repositoryId) Get identifiers ofChain
s referencing a repository, either directly or through inheritance (only direct parent-child relationship is checked) If the parameter refers to a linked repository, onlyTopLevelPlan
s are returned.@NotNull List<VcsRepositoryData>
Get all linked repositories current user has permission to use in his plans.Get all Shared repositories current user has permission to administrate.Get all linked repositories in a form suitable for export.Get all linked repositories without permission checking.@Nullable VcsRepositoryData
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.getPlanRepositoryLink
(@NotNull ImmutablePlan plan, long repositoryId) Get persistent representation of a relation between Plan and repositorygetPlanRepositoryLinkByName
(@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 repositoriesgetPlansUsingRepository
(long repositoryId) GetPlanRepositoryLink
s associated with repository.@NotNull List<VcsRepositoryData>
getProjectRepositories
(long projectId) Find all repositories in a project with given id.getProjectRepositoriesRestricted
(long projectId) Get all project repositories current user has permission to use in his plans connected with requested project ID.@Nullable VcsRepositoryData
getProjectRepositoryByName
(String name, Long projectId) Find a project repository by name in project associated with given projectId.@Nullable RepositoryDataEntity
getRepositoryDataEntity
(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 VcsRepositoryData
getVcsRepositoryData
(long repositoryId) Get plugin-agnostic representation of a repository configuration.Find a repository by oid.@Nullable PartialVcsRepositoryData
getVcsRepositoryDataForEditing
(long repositoryId) boolean
isRepositoryOrItsDirectChildrenUsedInPlans
(long repositoryId) Checks if repository is used in plansvoid
Remove all repositories fromPlan
that are not global repositories.void
removeRepositoryFromPlan
(@NotNull PlanRepositoryLink planRepository) Removes relation between repository and plan.void
removeRepositoryIfUnused
(RepositoryDataEntity repositoryDataEntity) Marks repository for deletion if it is referenced by aRepositoryChangeset
, removes it otherwise.void
Removes all repositories that has been previously markedForDeletion and are no longer referenced by anyRepositoryChangeset
void
savePlanRepositoryLink
(@NotNull PlanRepositoryLink planRepository) void
savePlanRepositoryLinks
(@NotNull List<PlanRepositoryLink> planRepositories) Saves the collection of plan to repository relations.long
savePlanRepositoryWithDefinition
(@NotNull PlanRepositoryLink planRepository) Saves plan to repository relation definition with cascade toRepositoryDataEntity
long
saveRepositoryDefinition
(RepositoryDataEntity repositoryData) Save repository definition.void
saveRepositoryDefinitions
(@NotNull Collection<RepositoryDataEntity> repositoriesBeingCreated) Saves all repository definitions in the collection.
-
Constructor Details
-
RepositoryDefinitionManagerImpl
public RepositoryDefinitionManagerImpl(RepositoryDefinitionDao repositoryDefinitionDao, PlanRepositoryLinkDao planRepositoryLinkDao, RawRepositoryConfigurationXmlConverter rawRepositoryConfigurationXmlConverter, RssRepositoryPermissionDao rssRepositoryPermissionDao)
-
-
Method Details
-
getPlanRepositoryLink
public PlanRepositoryLink getPlanRepositoryLink(@NotNull @NotNull ImmutablePlan plan, long repositoryId) Description copied from interface:RepositoryDefinitionManager
Get persistent representation of a relation between Plan and repository- Specified by:
getPlanRepositoryLink
in interfaceRepositoryDefinitionManager
-
getPlanRepositoryLinkByName
public PlanRepositoryLink getPlanRepositoryLinkByName(@NotNull @NotNull ImmutablePlan plan, @NotNull @NotNull String repositoryName) Description copied from interface:RepositoryDefinitionManager
Get persistent representation of a relation between Plan and repository- Specified by:
getPlanRepositoryLinkByName
in interfaceRepositoryDefinitionManager
-
getPlanRepositoryLinks
@NotNull public @NotNull List<PlanRepositoryLink> getPlanRepositoryLinks(@NotNull @NotNull ImmutablePlan plan) Description copied from interface:RepositoryDefinitionManager
Get persistent representation of relation between Plan and repositories- Specified by:
getPlanRepositoryLinks
in interfaceRepositoryDefinitionManager
-
getRepositoryDataEntity
Description copied from interface:RepositoryDefinitionManager
Get persistent representation of a repository- Specified by:
getRepositoryDataEntity
in interfaceRepositoryDefinitionManager
-
getRepositoryDefinitionsForPlan
@NotNull public @NotNull List<RepositoryDefinition> getRepositoryDefinitionsForPlan(@NotNull @NotNull ImmutablePlan plan) Description copied from interface:RepositoryDefinitionManager
Get all repositories attached to a plan ordered by position.- Specified by:
getRepositoryDefinitionsForPlan
in interfaceRepositoryDefinitionManager
-
getPlanRepositoryDefinitions
@NotNull public @NotNull List<PlanRepositoryDefinition> getPlanRepositoryDefinitions(@NotNull @NotNull PlanIdentifier plan) Description copied from interface:RepositoryDefinitionManager
Get all repositories attached to a plan ordered by position.- Specified by:
getPlanRepositoryDefinitions
in interfaceRepositoryDefinitionManager
-
getPlanRepositoryLinkDtos
@NotNull public @NotNull List<PlanRepositoryLinkDto> getPlanRepositoryLinkDtos(@NotNull @NotNull PlanIdentifier plan) - Specified by:
getPlanRepositoryLinkDtos
in interfaceRepositoryDefinitionManager
-
getPlanRepositoriesForExport
@NotNull public @NotNull List<PartialVcsRepositoryData> getPlanRepositoriesForExport(@NotNull @NotNull PlanIdentifier plan) Description copied from interface:RepositoryDefinitionManager
Get all repositories attached to a plan in form suitable for export.- Specified by:
getPlanRepositoriesForExport
in interfaceRepositoryDefinitionManager
-
getPlansUsingRepository
Description copied from interface:RepositoryDefinitionManager
GetPlanRepositoryLink
s 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:
getPlansUsingRepository
in interfaceRepositoryDefinitionManager
-
getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren
@NotNull public @NotNull List<PlanIdentifier> getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren(long repositoryId) Description copied from interface:RepositoryDefinitionManager
Get identifiers ofChain
s referencing a repository, either directly or through inheritance (only direct parent-child relationship is checked) If the parameter refers to a linked repository, onlyTopLevelPlan
s are returned. If the parameter refers to a plan local repository, it will return the plan the repository is linked to and all itsChainBranch
es- Specified by:
getIdentifiersOfPlansUsingRepositoryOrItsDirectChildren
in interfaceRepositoryDefinitionManager
-
isRepositoryOrItsDirectChildrenUsedInPlans
public boolean isRepositoryOrItsDirectChildrenUsedInPlans(long repositoryId) Description copied from interface:RepositoryDefinitionManager
Checks if repository is used in plans- Specified by:
isRepositoryOrItsDirectChildrenUsedInPlans
in interfaceRepositoryDefinitionManager
-
getGlobalRepositoryDefinitions
Description copied from interface:RepositoryDefinitionManager
Get all Shared repositories current user has permission to use in his plans.- Specified by:
getGlobalRepositoryDefinitions
in interfaceRepositoryDefinitionManager
-
getGlobalRepositoryDefinitionsForAdministration
Description copied from interface:RepositoryDefinitionManager
Get all Shared repositories current user has permission to administrate.- Specified by:
getGlobalRepositoryDefinitionsForAdministration
in interfaceRepositoryDefinitionManager
-
getGlobalRepositoryDefinitionsUnrestricted
Description copied from interface:RepositoryDefinitionManager
Get all Shared Repositories without permission checking.- Specified by:
getGlobalRepositoryDefinitionsUnrestricted
in interfaceRepositoryDefinitionManager
-
getLinkedRepositories
Description copied from interface:RepositoryDefinitionManager
Get all linked repositories current user has permission to use in his plans.- Specified by:
getLinkedRepositories
in interfaceRepositoryDefinitionAccessor
- Specified by:
getLinkedRepositories
in interfaceRepositoryDefinitionManager
-
getLinkedRepositoriesForAdministration
Description copied from interface:RepositoryDefinitionManager
Get all Shared repositories current user has permission to administrate.- Specified by:
getLinkedRepositoriesForAdministration
in interfaceRepositoryDefinitionManager
-
getLinkedRepositoriesForExport
Description copied from interface:RepositoryDefinitionManager
Get all linked repositories in a form suitable for export.- Specified by:
getLinkedRepositoriesForExport
in interfaceRepositoryDefinitionManager
-
entityToVcsData
@Nullable public @Nullable VcsRepositoryData entityToVcsData(@Nullable @Nullable RepositoryDataEntity input) - Specified by:
entityToVcsData
in interfaceRepositoryDefinitionManager
-
getVcsRepositoryData
Description copied from interface:RepositoryDefinitionManager
Get plugin-agnostic representation of a repository configuration.- Specified by:
getVcsRepositoryData
in interfaceRepositoryDefinitionManager
-
entityToUnmergedData
- Specified by:
entityToUnmergedData
in interfaceRepositoryDefinitionManager
- Parameters:
entity
- should be in decoded state.
-
getVcsRepositoryDataForEditing
@Nullable public @Nullable PartialVcsRepositoryData getVcsRepositoryDataForEditing(long repositoryId) - Specified by:
getVcsRepositoryDataForEditing
in interfaceRepositoryDefinitionManager
-
getLinkedRepositoriesUnrestricted
Description copied from interface:RepositoryDefinitionManager
Get all linked repositories without permission checking.- Specified by:
getLinkedRepositoriesUnrestricted
in interfaceRepositoryDefinitionManager
-
saveRepositoryDefinition
Description copied from interface:RepositoryDefinitionManager
Save repository definition.- Specified by:
saveRepositoryDefinition
in interfaceRepositoryDefinitionManager
- Returns:
- id of saved definition
-
saveRepositoryDefinitions
public void saveRepositoryDefinitions(@NotNull @NotNull Collection<RepositoryDataEntity> repositoriesBeingCreated) Description copied from interface:RepositoryDefinitionManager
Saves all repository definitions in the collection.- Specified by:
saveRepositoryDefinitions
in interfaceRepositoryDefinitionManager
-
savePlanRepositoryWithDefinition
Description copied from interface:RepositoryDefinitionManager
Saves plan to repository relation definition with cascade toRepositoryDataEntity
- Specified by:
savePlanRepositoryWithDefinition
in interfaceRepositoryDefinitionManager
- Returns:
- new repository entity id
-
savePlanRepositoryLink
- Specified by:
savePlanRepositoryLink
in interfaceRepositoryDefinitionManager
-
savePlanRepositoryLinks
Description copied from interface:RepositoryDefinitionManager
Saves the collection of plan to repository relations.- Specified by:
savePlanRepositoryLinks
in interfaceRepositoryDefinitionManager
-
removeRepositoryFromPlan
Description copied from interface:RepositoryDefinitionManager
Removes relation between repository and plan. If the repository is not a global repository,RepositoryDefinitionManager.removeRepositoryIfUnused(RepositoryDataEntity)
is called.- Specified by:
removeRepositoryFromPlan
in interfaceRepositoryDefinitionManager
-
removeRepositoryIfUnused
Description copied from interface:RepositoryDefinitionManager
Marks repository for deletion if it is referenced by aRepositoryChangeset
, removes it otherwise.- Specified by:
removeRepositoryIfUnused
in interfaceRepositoryDefinitionManager
-
removeUnusedRepositories
public void removeUnusedRepositories()Description copied from interface:RepositoryDefinitionManager
Removes all repositories that has been previously markedForDeletion and are no longer referenced by anyRepositoryChangeset
- Specified by:
removeUnusedRepositories
in interfaceRepositoryDefinitionManager
-
removeRepositoriesForPlan
Description copied from interface:RepositoryDefinitionManager
Remove all repositories fromPlan
that are not global repositories.- Specified by:
removeRepositoriesForPlan
in interfaceRepositoryDefinitionManager
-
getIdentifiersOfPlansUsingRepository
Description copied from interface:RepositoryDefinitionManager
Get 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:
getIdentifiersOfPlansUsingRepository
in interfaceRepositoryDefinitionManager
-
findRepositoriesByPluginKey
@NotNull public @NotNull List<RepositoryDataEntity> findRepositoriesByPluginKey(@NotNull @NotNull String pluginKey) Description copied from interface:RepositoryDefinitionManager
Given a pluginKey this will get you all 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:
findRepositoriesByPluginKey
in interfaceRepositoryDefinitionManager
- Parameters:
pluginKey
- The plugin key to search for.- Returns:
- All the repositories that match that plugin key.
-
getVcsRepositoryDataByOid
Description copied from interface:RepositoryDefinitionAccessor
Find a repository by oid.- Specified by:
getVcsRepositoryDataByOid
in interfaceRepositoryDefinitionAccessor
- Returns:
-
getLinkedRepositoryByName
Description copied from interface:RepositoryDefinitionManager
Find a linked repository by name.- Specified by:
getLinkedRepositoryByName
in interfaceRepositoryDefinitionManager
- Parameters:
name
- of linked repository- Returns:
- linked repository
-
findAllTopLevelRepositoriesIds
Description copied from interface:RepositoryDefinitionManager
Get ids of all repositories that doesn't have parent repository (are either linked or are created on plan level)- Specified by:
findAllTopLevelRepositoriesIds
in interfaceRepositoryDefinitionManager
-
getProjectRepositoryByName
@Nullable public @Nullable VcsRepositoryData getProjectRepositoryByName(String name, Long projectId) Description copied from interface:RepositoryDefinitionManager
Find a project repository by name in project associated with given projectId.- Specified by:
getProjectRepositoryByName
in interfaceRepositoryDefinitionManager
- Returns:
- RepositoryDataEntity if repository exists otherwise null.
-
countAllProjectsRepositories
Description copied from interface:RepositoryDefinitionManager
Count all project repositories.- Specified by:
countAllProjectsRepositories
in interfaceRepositoryDefinitionManager
- Returns:
- a Long count of all project repositories
-
getProjectRepositories
Description copied from interface:RepositoryDefinitionManager
Find all repositories in a project with given id.- Specified by:
getProjectRepositories
in interfaceRepositoryDefinitionManager
- Returns:
- a list of all project repositories
-
getProjectRepositoriesRestricted
Description copied from interface:RepositoryDefinitionManager
Get all project repositories current user has permission to use in his plans connected with requested project ID.- Specified by:
getProjectRepositoriesRestricted
in interfaceRepositoryDefinitionManager
- Returns:
- a list of all project repositories
-
findAllProjectsIdsUsingProjectRepositories
Description copied from interface:RepositoryDefinitionManager
Find all project which are using project repositories.- Specified by:
findAllProjectsIdsUsingProjectRepositories
in interfaceRepositoryDefinitionManager
- Returns:
- a list of all projects IDs which are using project repositories
-