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 BambooCacheStatsRetrieve cache statistics@Nullable DeploymentProjectgetDeploymentProject(long id) Retrieves a deployment project by its ID.long@Nullable DeploymentProjectgetDeploymentProjectForEnvironment(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().voidInitializes the cache.voidrefresh(long deploymentProjectId) Refreshes the cache for the given deployment project by its ID.voidremove(long deploymentProjectId) Removes a deployment project from the cache by its ID.voidresetTriggers(@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:CachedDeploymentProjectServiceInitializes the cache. Do NOT call this method multiple times; cache can be initialized only once.- Specified by:
initialiseCachein interfaceCachedDeploymentProjectService
-
remove
public void remove(long deploymentProjectId) Description copied from interface:CachedDeploymentProjectServiceRemoves a deployment project from the cache by its ID.- Specified by:
removein interfaceCachedDeploymentProjectService- Parameters:
deploymentProjectId- the ID of the deployment project to remove
-
refresh
public void refresh(long deploymentProjectId) Description copied from interface:CachedDeploymentProjectServiceRefreshes the cache for the given deployment project by its ID.- Specified by:
refreshin 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:CachedDeploymentProjectServiceRetrieves a deployment project by its ID.- Specified by:
getDeploymentProjectin 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:CachedDeploymentProjectServiceRetrieves a list of all deployment projects, filtered by permissions and decorated with operations, sorted by name (case-insensitive).- Specified by:
getAllDeploymentProjectsin interfaceCachedDeploymentProjectService- Returns:
- a list of all deployment projects
-
getAllDeploymentProjects
Description copied from interface:CachedDeploymentProjectServiceRetrieves a list of all deployment projects, filtered by permissions and decorated with operations.- Specified by:
getAllDeploymentProjectsin 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:CachedDeploymentProjectServiceRetrieves a list of all deployment projects, unfiltered, undecorated, and unsorted.- Specified by:
getAllInternalDeploymentProjectsin interfaceCachedDeploymentProjectService- Returns:
- a list of all internal deployment projects
-
getDeploymentProjectsRelatedToPlan
@NotNull public @NotNull List<DeploymentProject> getDeploymentProjectsRelatedToPlan(@NotNull @NotNull PlanKey planKey) Description copied from interface:CachedDeploymentProjectServiceRetrieve the deployment projects that are linked to a specific plan- Specified by:
getDeploymentProjectsRelatedToPlanin 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:CachedDeploymentProjectServiceRetrieves a list of deployment projects related to a specific plan.- Specified by:
getInternalDeploymentProjectsRelatedToPlanin 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:CachedDeploymentProjectServiceRetrieve list of deployment projects associated with any of the branches in the plan. The result includes divergent branches.- Specified by:
getInternalDeploymentProjectsRelatedToPlansAndBranchesin 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:CachedDeploymentProjectServiceRetrieve 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:
getInternalDeploymentProjectsRelatedToPlanConfigurationin 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:CachedDeploymentProjectServiceRetrieves a list of internal deployment projects related to a specific artifact definition.- Specified by:
getInternalDeploymentProjectsRelatedToArtifactin 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:CachedDeploymentProjectServiceRetrieves a list of internal deployment projects referencing a specific artifact.- Specified by:
getInternalDeploymentProjectsReferencingArtifactin 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:CachedDeploymentProjectServiceDelete and recreate the triggers for every deployment that's related to this planKey.- Specified by:
resetTriggersin interfaceCachedDeploymentProjectService
-
getPaginatedDeploymentsWithEnvironments
public DeploymentProjectWithEnvironmentForDashboard getPaginatedDeploymentsWithEnvironments(int start, int limit, @Nullable @Nullable String filter) Description copied from interface:CachedDeploymentProjectServiceRetrieve 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:
getPaginatedDeploymentsWithEnvironmentsin interfaceCachedDeploymentProjectService
-
getDeploymentProjectsWithStatusesRelatedToPlanOrBranches
@NotNull public @NotNull List<DeploymentProjectWithEnvironmentStatuses> getDeploymentProjectsWithStatusesRelatedToPlanOrBranches(@NotNull @NotNull PlanKey masterOrBranchPlanKey) Description copied from interface:CachedDeploymentProjectServiceRetrieve the deployment projects that are linked to a specific plan or any of its branches. Includes projects their environments + latest status- Specified by:
getDeploymentProjectsWithStatusesRelatedToPlanOrBranchesin 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:CachedDeploymentProjectServiceRetrieve the deployment projects that are linked to a specific result. Includes projects their environments + latest status- Specified by:
getDeploymentProjectsWithStatusesRelatedToPlanResultin interfaceCachedDeploymentProjectService- Parameters:
resultsSummary- of the linked plan- Returns:
- a list of all deployment projects linked to a specified plan
-
getCacheStats
Description copied from interface:CachedDeploymentProjectServiceRetrieve cache statistics- Specified by:
getCacheStatsin interfaceCachedDeploymentProjectService- Returns:
- Cache statistics
-
getEnvironmentDecorator
Description copied from interface:CachedDeploymentProjectServiceCreate 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:
getEnvironmentDecoratorin interfaceCachedDeploymentProjectService
-
findEnvironmentsByRequirementKey
@NotNull public @NotNull Set<RequirementDeploymentMapping> findEnvironmentsByRequirementKey(@NotNull @NotNull String requirementKey) Description copied from interface:CachedDeploymentProjectServiceFind environments which rely on requirementKey- Specified by:
findEnvironmentsByRequirementKeyin 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:CachedDeploymentProjectServiceProvide a paginated list of minimal information about deployment environments matching agent capabilities.- Specified by:
getEnvironmentsMatchingCapabilitiesin 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:CachedDeploymentProjectServiceRetrieve the deployment project that a specific environment belongs to.- Specified by:
getDeploymentProjectForEnvironmentin interfaceCachedDeploymentProjectService- Parameters:
environmentId- of the environment- Returns:
- DeploymentProject environment belongs to
-
getDeploymentProjectCount
public long getDeploymentProjectCount()- Specified by:
getDeploymentProjectCountin interfaceCachedDeploymentProjectService- Returns:
- count of all deployment projects
-