Class CachedDeploymentProjectServiceImpl
java.lang.Object
com.atlassian.bamboo.deployments.cache.CachedDeploymentProjectServiceImpl
- All Implemented Interfaces:
CachedDeploymentProjectService
public class CachedDeploymentProjectServiceImpl
extends Object
implements CachedDeploymentProjectService
-
Constructor Summary
ConstructorsConstructorDescriptionCachedDeploymentProjectServiceImpl
(@NotNull DeploymentProjectDao deploymentProjectDao, @NotNull EnvironmentDao environmentDao, @NotNull CachedPlanManager cachedPlanManager, @NotNull CachedEnvironmentService cachedEnvironmentService, @NotNull InternalEnvironmentService internalEnvironmentService, @NotNull BambooPermissionManager bambooPermissionManager, @NotNull BambooCachingPermissionManagerFacadeFactory cachingPermissionManagerFacadeFactory, @NotNull PlanScheduler planScheduler, @NotNull PaginatedDataCollector paginatedDataCollector, @NotNull CapabilityRequirementsMatcher capabilityRequirementsMatcher) -
Method Summary
Modifier and TypeMethodDescription@NotNull Set<RequirementDeploymentMapping>
findEnvironmentsByRequirementKey
(@NotNull String requirementKey) Find environments which rely on requirementKey@NotNull List<DeploymentProject>
Retrieves a list of all deployment projects, filtered by permissions and decorated with operations, sorted by name (case-insensitive).@NotNull List<DeploymentProject>
getAllDeploymentProjects
(boolean sorted) Retrieves a list of all deployment projects, filtered by permissions and decorated with operations.@NotNull List<InternalDeploymentProject>
Retrieves a list of all deployment projects, unfiltered, undecorated, and unsorted.@NotNull BambooCacheStats
Retrieve cache statistics@Nullable DeploymentProject
getDeploymentProject
(long id) Retrieves a deployment project by its ID.long
@Nullable DeploymentProject
getDeploymentProjectForEnvironment
(long environmentId) Retrieve the deployment project that a specific environment belongs to.@NotNull List<DeploymentProject>
getDeploymentProjectsRelatedToPlan
(@NotNull PlanKey planKey) Retrieve the deployment projects that are linked to a specific plan@NotNull List<DeploymentProjectWithEnvironmentStatuses>
getDeploymentProjectsWithStatusesRelatedToPlanOrBranches
(@NotNull PlanKey masterOrBranchPlanKey) Retrieve the deployment projects that are linked to a specific plan or any of its branches.@NotNull List<DeploymentProjectStatusForResultSummary>
getDeploymentProjectsWithStatusesRelatedToPlanResult
(@NotNull ResultsSummary resultsSummary) Retrieve the deployment projects that are linked to a specific result.Create environment decorator function object.getEnvironmentsMatchingCapabilities
(int start, int limit, @Nullable String filter, @NotNull ReadOnlyCapabilitySet agentCapabilities, @NotNull Iterable<AgentAssignmentService.AgentAssignmentExecutor> executors) Provide a paginated list of minimal information about deployment environments matching agent capabilities.getInternalDeploymentProjectsReferencingArtifact
(@NotNull Artifact artifact) Retrieves a list of internal deployment projects referencing a specific artifact.@NotNull List<InternalDeploymentProject>
getInternalDeploymentProjectsRelatedToArtifact
(@NotNull ArtifactDefinition artifactDefinition) Retrieves a list of internal deployment projects related to a specific artifact definition.@NotNull List<InternalDeploymentProject>
getInternalDeploymentProjectsRelatedToPlan
(@NotNull PlanKey planKey) Retrieves a list of deployment projects related to a specific plan.@NotNull List<InternalDeploymentProject>
getInternalDeploymentProjectsRelatedToPlanConfiguration
(@NotNull PlanKey masterOrBranchPlanKey) Retrieve the deployment projects that are linked to a specific plan configuration, taking branch divergence into account.@NotNull List<InternalDeploymentProject>
getInternalDeploymentProjectsRelatedToPlansAndBranches
(@NotNull PlanKey masterOrBranchKey) Retrieve list of deployment projects associated with any of the branches in the plan.getPaginatedDeploymentsWithEnvironments
(int start, int limit, @Nullable String filter) Retrieve paginated view of DeploymentProject and Environment and information if there are more entries ordered byInternalDeploymentProject.getName()
andInternalEnvironment.getPosition()
.void
Initializes the cache.void
refresh
(long deploymentProjectId) Refreshes the cache for the given deployment project by its ID.void
remove
(long deploymentProjectId) Removes a deployment project from the cache by its ID.void
resetTriggers
(@NotNull PlanKey planKey) Delete and recreate the triggers for every deployment that's related to this planKey.
-
Constructor Details
-
CachedDeploymentProjectServiceImpl
@Inject public CachedDeploymentProjectServiceImpl(@NotNull @NotNull DeploymentProjectDao deploymentProjectDao, @NotNull @NotNull EnvironmentDao environmentDao, @NotNull @NotNull CachedPlanManager cachedPlanManager, @NotNull @NotNull CachedEnvironmentService cachedEnvironmentService, @NotNull @NotNull InternalEnvironmentService internalEnvironmentService, @NotNull @NotNull BambooPermissionManager bambooPermissionManager, @NotNull @NotNull BambooCachingPermissionManagerFacadeFactory cachingPermissionManagerFacadeFactory, @NotNull @NotNull PlanScheduler planScheduler, @NotNull @NotNull PaginatedDataCollector paginatedDataCollector, @NotNull @NotNull CapabilityRequirementsMatcher capabilityRequirementsMatcher)
-
-
Method Details
-
initialiseCache
public void initialiseCache()Description copied from interface:CachedDeploymentProjectService
Initializes the cache. Do NOT call this method multiple times; cache can be initialized only once.- Specified by:
initialiseCache
in interfaceCachedDeploymentProjectService
-
remove
public void remove(long deploymentProjectId) Description copied from interface:CachedDeploymentProjectService
Removes a deployment project from the cache by its ID.- Specified by:
remove
in interfaceCachedDeploymentProjectService
- Parameters:
deploymentProjectId
- the ID of the deployment project to remove
-
refresh
public void refresh(long deploymentProjectId) Description copied from interface:CachedDeploymentProjectService
Refreshes the cache for the given deployment project by its ID.- Specified by:
refresh
in interfaceCachedDeploymentProjectService
- Parameters:
deploymentProjectId
- the ID of the deployment project to remove
-
getDeploymentProject
@Nullable public @Nullable DeploymentProject getDeploymentProject(long id) throws org.acegisecurity.AccessDeniedException Description copied from interface:CachedDeploymentProjectService
Retrieves a deployment project by its ID.- Specified by:
getDeploymentProject
in interfaceCachedDeploymentProjectService
- Parameters:
id
- of the deployment project to retrieve- Returns:
- deployment project with the given id or null if none found.
- Throws:
org.acegisecurity.AccessDeniedException
- if access to the deployment project is denied
-
getAllDeploymentProjects
Description copied from interface:CachedDeploymentProjectService
Retrieves a list of all deployment projects, filtered by permissions and decorated with operations, sorted by name (case-insensitive).- Specified by:
getAllDeploymentProjects
in interfaceCachedDeploymentProjectService
- Returns:
- a list of all deployment projects
-
getAllDeploymentProjects
Description copied from interface:CachedDeploymentProjectService
Retrieves a list of all deployment projects, filtered by permissions and decorated with operations.- Specified by:
getAllDeploymentProjects
in interfaceCachedDeploymentProjectService
- Parameters:
sorted
- if true, the result will be sorted by name (case-insensitive)- Returns:
- a list of all deployment projects
-
getAllInternalDeploymentProjects
Description copied from interface:CachedDeploymentProjectService
Retrieves a list of all deployment projects, unfiltered, undecorated, and unsorted.- Specified by:
getAllInternalDeploymentProjects
in interfaceCachedDeploymentProjectService
- Returns:
- a list of all internal deployment projects
-
getDeploymentProjectsRelatedToPlan
@NotNull public @NotNull List<DeploymentProject> getDeploymentProjectsRelatedToPlan(@NotNull @NotNull PlanKey planKey) Description copied from interface:CachedDeploymentProjectService
Retrieve the deployment projects that are linked to a specific plan- Specified by:
getDeploymentProjectsRelatedToPlan
in interfaceCachedDeploymentProjectService
- Parameters:
planKey
- of the linked plan- Returns:
- a list of all deployment projects linked to a specified plan
-
getInternalDeploymentProjectsRelatedToPlan
@NotNull public @NotNull List<InternalDeploymentProject> getInternalDeploymentProjectsRelatedToPlan(@NotNull @NotNull PlanKey planKey) Description copied from interface:CachedDeploymentProjectService
Retrieves a list of deployment projects related to a specific plan.- Specified by:
getInternalDeploymentProjectsRelatedToPlan
in interfaceCachedDeploymentProjectService
- Parameters:
planKey
- the key of the plan- Returns:
- a list of related deployment projects
-
getInternalDeploymentProjectsRelatedToPlansAndBranches
@NotNull public @NotNull List<InternalDeploymentProject> getInternalDeploymentProjectsRelatedToPlansAndBranches(@NotNull @NotNull PlanKey masterOrBranchKey) Description copied from interface:CachedDeploymentProjectService
Retrieve list of deployment projects associated with any of the branches in the plan. The result includes divergent branches.- Specified by:
getInternalDeploymentProjectsRelatedToPlansAndBranches
in interfaceCachedDeploymentProjectService
- Parameters:
masterOrBranchKey
- identifies master plan or branch- Returns:
- list of deployment projects
-
getInternalDeploymentProjectsRelatedToPlanConfiguration
@NotNull public @NotNull List<InternalDeploymentProject> getInternalDeploymentProjectsRelatedToPlanConfiguration(@NotNull @NotNull PlanKey masterOrBranchPlanKey) Description copied from interface:CachedDeploymentProjectService
Retrieve the deployment projects that are linked to a specific plan configuration, taking branch divergence into account. If the argument is a master plan or a lightweight branch, deployments linked to the master plan and lightweight branches are returned. If the argument is a divergent branch, only deployments linked to that particular branch will be returned.- Specified by:
getInternalDeploymentProjectsRelatedToPlanConfiguration
in interfaceCachedDeploymentProjectService
- Parameters:
masterOrBranchPlanKey
- identifies master plan or branch- Returns:
- a list of all deployment projects linked to a specified plan or any of its branches
-
getInternalDeploymentProjectsRelatedToArtifact
@NotNull public @NotNull List<InternalDeploymentProject> getInternalDeploymentProjectsRelatedToArtifact(@NotNull @NotNull ArtifactDefinition artifactDefinition) Description copied from interface:CachedDeploymentProjectService
Retrieves a list of internal deployment projects related to a specific artifact definition.- Specified by:
getInternalDeploymentProjectsRelatedToArtifact
in interfaceCachedDeploymentProjectService
- Parameters:
artifactDefinition
- the artifact definition to search for related deployment projects- Returns:
- a list of internal deployment projects related to the specified artifact definition
-
getInternalDeploymentProjectsReferencingArtifact
public List<InternalDeploymentProject> getInternalDeploymentProjectsReferencingArtifact(@NotNull @NotNull Artifact artifact) Description copied from interface:CachedDeploymentProjectService
Retrieves a list of internal deployment projects referencing a specific artifact.- Specified by:
getInternalDeploymentProjectsReferencingArtifact
in interfaceCachedDeploymentProjectService
- Parameters:
artifact
- the artifact to search for related deployment projects- Returns:
- a list of internal deployment projects related to the specified artifact definition
-
resetTriggers
Description copied from interface:CachedDeploymentProjectService
Delete and recreate the triggers for every deployment that's related to this planKey.- Specified by:
resetTriggers
in interfaceCachedDeploymentProjectService
-
getPaginatedDeploymentsWithEnvironments
public DeploymentProjectWithEnvironmentForDashboard getPaginatedDeploymentsWithEnvironments(int start, int limit, @Nullable @Nullable String filter) Description copied from interface:CachedDeploymentProjectService
Retrieve paginated view of DeploymentProject and Environment and information if there are more entries ordered byInternalDeploymentProject.getName()
andInternalEnvironment.getPosition()
. Deployment projects are not operation aware, environments are. In case of null or empty filter no filtering.- Specified by:
getPaginatedDeploymentsWithEnvironments
in interfaceCachedDeploymentProjectService
-
getDeploymentProjectsWithStatusesRelatedToPlanOrBranches
@NotNull public @NotNull List<DeploymentProjectWithEnvironmentStatuses> getDeploymentProjectsWithStatusesRelatedToPlanOrBranches(@NotNull @NotNull PlanKey masterOrBranchPlanKey) Description copied from interface:CachedDeploymentProjectService
Retrieve the deployment projects that are linked to a specific plan or any of its branches. Includes projects their environments + latest status- Specified by:
getDeploymentProjectsWithStatusesRelatedToPlanOrBranches
in interfaceCachedDeploymentProjectService
- Parameters:
masterOrBranchPlanKey
- identifies master plan or branch- Returns:
- a list of all deployment projects linked to a specified plan or any of its branches
-
getDeploymentProjectsWithStatusesRelatedToPlanResult
@NotNull public @NotNull List<DeploymentProjectStatusForResultSummary> getDeploymentProjectsWithStatusesRelatedToPlanResult(@NotNull @NotNull ResultsSummary resultsSummary) Description copied from interface:CachedDeploymentProjectService
Retrieve the deployment projects that are linked to a specific result. Includes projects their environments + latest status- Specified by:
getDeploymentProjectsWithStatusesRelatedToPlanResult
in interfaceCachedDeploymentProjectService
- Parameters:
resultsSummary
- of the linked plan- Returns:
- a list of all deployment projects linked to a specified plan
-
getCacheStats
Description copied from interface:CachedDeploymentProjectService
Retrieve cache statistics- Specified by:
getCacheStats
in interfaceCachedDeploymentProjectService
- Returns:
- Cache statistics
-
getEnvironmentDecorator
Description copied from interface:CachedDeploymentProjectService
Create environment decorator function object. Instances should be used for a single stream operation and should not live long. The function will return null if the user is not allowed to see the corresponding deployment project.- Specified by:
getEnvironmentDecorator
in interfaceCachedDeploymentProjectService
-
findEnvironmentsByRequirementKey
@NotNull public @NotNull Set<RequirementDeploymentMapping> findEnvironmentsByRequirementKey(@NotNull @NotNull String requirementKey) Description copied from interface:CachedDeploymentProjectService
Find environments which rely on requirementKey- Specified by:
findEnvironmentsByRequirementKey
in interfaceCachedDeploymentProjectService
- Parameters:
requirementKey
- on which environments rely- Returns:
- environments or empty set
-
getEnvironmentsMatchingCapabilities
@NotNull public @NotNull PaginatedEnvironmentsForExecutablesView getEnvironmentsMatchingCapabilities(int start, int limit, @Nullable @Nullable String filter, @NotNull @NotNull ReadOnlyCapabilitySet agentCapabilities, @NotNull @NotNull Iterable<AgentAssignmentService.AgentAssignmentExecutor> executors) Description copied from interface:CachedDeploymentProjectService
Provide a paginated list of minimal information about deployment environments matching agent capabilities.- Specified by:
getEnvironmentsMatchingCapabilities
in interfaceCachedDeploymentProjectService
- Parameters:
start
- start by indexlimit
- return no more entries than limitfilter
- filteragentCapabilities
- capabilities of an agentexecutors
- executors of agent assignment- Returns:
- List of ids and name of deployment projects and environments, sorted alphabetically by deployment name and environment position;
-
getDeploymentProjectForEnvironment
Description copied from interface:CachedDeploymentProjectService
Retrieve the deployment project that a specific environment belongs to.- Specified by:
getDeploymentProjectForEnvironment
in interfaceCachedDeploymentProjectService
- Parameters:
environmentId
- of the environment- Returns:
- DeploymentProject environment belongs to
-
getDeploymentProjectCount
public long getDeploymentProjectCount()- Specified by:
getDeploymentProjectCount
in interfaceCachedDeploymentProjectService
- Returns:
- count of all deployment projects
-