public class EnvironmentServiceImpl extends Object implements EnvironmentService
DEFAULT_ARTIFACT_TASK_NAME
Constructor and Description |
---|
EnvironmentServiceImpl(BambooAclUpdateHelper aclUpdateHelper,
HibernateMutableAclService aclService,
AuditLogService auditLogService,
BambooAuthenticationContext authenticationContext,
DeploymentProjectDao deploymentProjectDao,
EnvironmentDao environmentDao,
EnvironmentRepositoryLinkDao environmentRepositoryLinkDao,
PlanScheduler planScheduler,
RepositoryDefinitionDao repositoryDefinitionDao,
ScopedExclusionService scopedExclusionService,
com.opensymphony.xwork2.TextProvider textProvider,
ValidationService validationService,
com.atlassian.event.api.EventPublisher eventPublisher,
DeploymentVersionLinkedJiraIssueDao deploymentVersionLinkedJiraIssueDao,
NotificationManager notificationManager,
VariableConfigurationService variableConfigurationService,
VariableDefinitionManager variableDefinitionManager,
TriggerTypeManager triggerTypeManager,
RepositoryDefinitionManager repositoryDefinitionManager,
BambooCachingPermissionManagerFacadeFactory cachingPermissionManagerFacadeFactory,
CapabilityRequirementsMatcher capabilityRequirementsMatcher) |
Modifier and Type | Method and Description |
---|---|
@NotNull Environment |
addEnvironment(long deploymentProjectId,
@Nullable String name,
@Nullable String description)
Creates a new environment in the specified deployment project.
|
void |
addNotification(long environmentId,
@NotNull NotificationRule newRule)
Adds a new notification to the environment notifications
|
@NotNull Environment |
cloneEnvironment(long deploymentProjectId,
long environmentId,
@Nullable String name,
@Nullable String description)
Create new environment as a clone of existing one
|
@NotNull Environment |
cloneEnvironment(long deploymentProjectId,
long environmentId,
@Nullable String name,
@Nullable String description,
@NotNull Map<String,String> oldAndClonedEnvironmentIds)
Create new environment as a clone of existing one and if necessary update triggers' configuration
|
@NotNull Environment |
createImmutableEnvironment(@NotNull MutableEnvironment mutableEnvironment)
Converts mutable environment to immutable.
|
protected @NotNull Environment |
createOperationsAwareImmutableEnvironment(Environment environment) |
@NotNull Environment |
createOperationsAwareImmutableEnvironment(@NotNull MutableEnvironment environment)
Create operation aware immutable environment
|
void |
deleteNotification(long environmentId,
long notificationId)
Removes notification from the environment's notification set.
|
@NotNull Environment |
editEnvironment(long environmentId,
String name,
String description)
Edit the details of an existing environment
|
@Nullable Environment |
findEnvironmentByName(long deploymentProjectId,
String name)
Find environment with specified name in a deployment project
|
@NotNull Set<RequirementDeploymentMapping> |
findEnvironmentsByRequirementKey(@NotNull String requirementKey)
Find environments which rely on requirementKey
|
@NotNull Iterable<Environment> |
getAllEnvironments()
Retrieve all
Environment defined in the system. |
@NotNull Collection<Environment> |
getAllEnvironmentsForDashboard()
Retrieve all
Environment defined in the system. |
@NotNull Iterable<Environment> |
getAllEnvironmentsNoUserContext()
Retrieve all
Environment defined in the system without filling in operations permitted for the user. |
@Nullable Environment |
getEnvironment(long environmentId)
Get specific environment by ID.
|
int |
getEnvironmentCount() |
int |
getEnvironmentCountForProject(DeploymentProject deploymentProject) |
Function<Environment,DecoratedEnvironment> |
getEnvironmentDecorator()
Create environment decorator function object.
|
List<EnvironmentRepositoryLink> |
getEnvironmentRepositoryLinksForRepository(long repositoryId) |
@Nullable RequirementSet |
getEnvironmentRequirementSet(long environmentId)
Retrieve Agent Requirement set for environment, if environment with id exists.
|
@NotNull List<Environment> |
getEnvironmentsForDeploymentProject(long deploymentProjectId)
Get all environments for a particular deployment project.
|
@NotNull PaginatedEnvironmentsForExecutablesView |
getEnvironmentsMatchingCapabilities(int start,
int limit,
@Nullable String filter,
ReadOnlyCapabilitySet agentCapabilities)
Provide a paginated list of minimal information about deployment environments matching agent capabilities
|
@NotNull List<EnvironmentStub> |
getEnvironmentStubsForDeploymentProject(long deploymentProjectId)
Get all environment stubs for a particular deployment project.
|
List<EnvironmentRepositoryLink> |
getEnvironmentsUsingRepository(long repositoryId) |
List<Environment> |
getEnvironmentsUsingRepositoryDataEntity(long repositoryId)
TODO 6.0 rename to getEnvironmentsUsingRepository
|
@Nullable Environment |
getEnvironmentUnrestricted(long environmentId)
Get specific environment by ID.
|
NotificationSet |
getNotificationSet(long environmentId)
Retrieve notification set for environment, if environment with id exists.
|
@NotNull PaginatedEnvironmentsForDashboard |
getPaginatedEnvironmentsForDeploymentProject(long deploymentProjectId,
int start,
int limit,
@Nullable String filter)
Get paginated environments for a particular deployment project ordered by position.
|
@NotNull List<PlanRepositoryDefinition> |
getPlanRepositoryDefinitionsForEnvironment(@NotNull Environment environment)
Retrieves all repositories used in environment source checkout tasks
|
@NotNull List<PlanRepositoryDefinition> |
getPlanRepositoryDefinitionsForEnvironment(@NotNull InternalEnvironment environment)
Retrieves all repositories used in environment source checkout tasks
|
@NotNull List<RepositoryDefinition> |
getRepositoryDefinitionsForEnvironment(@NotNull Environment environment)
Retrieves all repositories used in environment source checkout tasks
|
ErrorCollection |
moveEnvironment(MoveEnvironmentStrategy moveEnvironmentStrategy,
long deploymentProjectId,
long environmentId,
int currentPosition,
Optional<Long> relatedEnvId)
Move Environment in given deploymentProject with given strategy.
|
@NotNull ErrorCollection |
moveEnvironmentDown(long deploymentProjectId,
long environmentId,
int currentPosition)
Moves an environment down the list
|
@NotNull ErrorCollection |
moveEnvironmentUp(long deploymentProjectId,
long environmentId,
int currentPosition)
Moves an environment up the list
|
void |
removeRepositoryFromEnvironment(@NotNull EnvironmentRepositoryLink environmentRepository)
Remove
EnvironmentRepositoryLink from environment |
void |
replaceNotification(long environmentId,
long oldNotificationId,
@NotNull NotificationRule newRule)
Replaces notification in the environment's notification set.
|
void |
resetTriggersForDeployment(long deploymentProjectId)
Delete and recreate triggers for all environments for this deployment
|
void |
restartAllTriggeringForDeploymentProject(long deploymentProjectId)
Restart all automatic triggering on every
Environment related to a DeploymentProject . |
void |
startAllTriggers(@NotNull Environment environment)
Start all automatic triggering on
InternalEnvironment |
void |
startAllTriggersForDeploymentProject(long deploymentProjectId)
Start all automatic triggering on every
Environment related to a DeploymentProject |
void |
stopAllTriggers(@NotNull Environment environment)
Stop all automatic triggering on
InternalEnvironment |
void |
stopAllTriggersForDeploymentProject(long deploymentProjectId)
Stop all automatic triggering on every
Environment related to a DeploymentProject |
void |
updateEnvironmentConfigurationState(long environmentId,
@NotNull ConfigurationState configurationState)
Update the configurationState of this environment
|
void |
updatePlanKey(long deploymentProjectId,
@NotNull PlanKey originalPlanKey,
@NotNull PlanKey newPlanKey)
Update planKey in Environment related configuration when plan key has changed (ie after moving plan).
|
RepositoryDefinition |
updateRepositoryLinkInEnvironment(EnvironmentRepositoryLink environmentRepositoryLink,
RepositoryDataEntity newRepositoryEntity)
Update
EnvironmentRepositoryLink data |
@NotNull ErrorCollection |
validateAddEnvironment(long deploymentProjectId,
@Nullable String name,
@Nullable String description)
Validates values to be used for creating a new environment.
|
@NotNull ErrorCollection |
validateEditEnvironment(long environmentId,
@Nullable String name,
@Nullable String description)
Validates values to be used when editing existing environment.
|
public EnvironmentServiceImpl(BambooAclUpdateHelper aclUpdateHelper, HibernateMutableAclService aclService, AuditLogService auditLogService, BambooAuthenticationContext authenticationContext, DeploymentProjectDao deploymentProjectDao, EnvironmentDao environmentDao, EnvironmentRepositoryLinkDao environmentRepositoryLinkDao, PlanScheduler planScheduler, RepositoryDefinitionDao repositoryDefinitionDao, ScopedExclusionService scopedExclusionService, com.opensymphony.xwork2.TextProvider textProvider, ValidationService validationService, com.atlassian.event.api.EventPublisher eventPublisher, DeploymentVersionLinkedJiraIssueDao deploymentVersionLinkedJiraIssueDao, NotificationManager notificationManager, VariableConfigurationService variableConfigurationService, VariableDefinitionManager variableDefinitionManager, TriggerTypeManager triggerTypeManager, RepositoryDefinitionManager repositoryDefinitionManager, BambooCachingPermissionManagerFacadeFactory cachingPermissionManagerFacadeFactory, CapabilityRequirementsMatcher capabilityRequirementsMatcher)
@NotNull public @NotNull List<Environment> getEnvironmentsForDeploymentProject(long deploymentProjectId)
EnvironmentService
getEnvironmentsForDeploymentProject
in interface EnvironmentService
deploymentProjectId
- of the deployment project to get environments for@NotNull public @NotNull PaginatedEnvironmentsForDashboard getPaginatedEnvironmentsForDeploymentProject(long deploymentProjectId, int start, int limit, @Nullable @Nullable String filter)
EnvironmentService
getPaginatedEnvironmentsForDeploymentProject
in interface EnvironmentService
deploymentProjectId
- of the deployment project to get environments forstart
- start by indexlimit
- return no more entries than limitfilter
- filterInternalEnvironment.getPosition()
@NotNull public @NotNull List<EnvironmentStub> getEnvironmentStubsForDeploymentProject(long deploymentProjectId)
EnvironmentService
getEnvironmentStubsForDeploymentProject
in interface EnvironmentService
deploymentProjectId
- of the deployment project to get environments for@Nullable public @Nullable Environment getEnvironmentUnrestricted(long environmentId)
EnvironmentService
getEnvironmentUnrestricted
in interface EnvironmentService
environmentId
- ID to search for@Nullable public @Nullable Environment getEnvironment(long environmentId) throws org.acegisecurity.AccessDeniedException
EnvironmentService
getEnvironment
in interface EnvironmentService
environmentId
- ID to search fororg.acegisecurity.AccessDeniedException
- when user doesn't have permissions to view environment@Nullable public @Nullable Environment findEnvironmentByName(long deploymentProjectId, String name)
EnvironmentService
findEnvironmentByName
in interface EnvironmentService
@NotNull public @NotNull Iterable<Environment> getAllEnvironments()
EnvironmentService
Environment
defined in the system. The result is filtered by environment permissions and
sorted by deployment project id and environment position. Environments belonging to inaccessible projects are
not currently filtered out, but their operations show them to be inaccessible.getAllEnvironments
in interface EnvironmentService
@NotNull public @NotNull Collection<Environment> getAllEnvironmentsForDashboard()
EnvironmentService
Environment
defined in the system. The result is filtered by environment permissions and
sorted by deployment project id and environment position. Environments belonging to inaccessible projects are
not currently filtered out, but their operations show them to be inaccessible. Some data inside the object may be
unavailable.getAllEnvironmentsForDashboard
in interface EnvironmentService
@NotNull public @NotNull Iterable<Environment> getAllEnvironmentsNoUserContext()
EnvironmentService
Environment
defined in the system without filling in operations permitted for the user.getAllEnvironmentsNoUserContext
in interface EnvironmentService
@NotNull public @NotNull Environment createImmutableEnvironment(@NotNull @NotNull MutableEnvironment mutableEnvironment)
EnvironmentService
createImmutableEnvironment
in interface EnvironmentService
@NotNull protected @NotNull Environment createOperationsAwareImmutableEnvironment(Environment environment)
@NotNull public @NotNull Environment createOperationsAwareImmutableEnvironment(@NotNull @NotNull MutableEnvironment environment)
EnvironmentService
createOperationsAwareImmutableEnvironment
in interface EnvironmentService
Operations
@NotNull public @NotNull ErrorCollection validateAddEnvironment(long deploymentProjectId, @Nullable @Nullable String name, @Nullable @Nullable String description)
EnvironmentService
validateAddEnvironment
in interface EnvironmentService
@NotNull public @NotNull Environment addEnvironment(long deploymentProjectId, @Nullable @Nullable String name, @Nullable @Nullable String description) throws WebValidationException
EnvironmentService
addEnvironment
in interface EnvironmentService
deploymentProjectId
- to create environment inname
- of the environment.description
- of the environment.WebValidationException
@NotNull public @NotNull Environment cloneEnvironment(long deploymentProjectId, long environmentId, @Nullable @Nullable String name, @Nullable @Nullable String description) throws WebValidationException
EnvironmentService
cloneEnvironment
in interface EnvironmentService
WebValidationException
- when user has no permission to clone environment with dedicated agents or deployment/environment not found@NotNull public @NotNull Environment cloneEnvironment(long deploymentProjectId, long environmentId, @Nullable @Nullable String name, @Nullable @Nullable String description, @NotNull @NotNull Map<String,String> oldAndClonedEnvironmentIds) throws WebValidationException
EnvironmentService
cloneEnvironment
in interface EnvironmentService
WebValidationException
- when user has no permission to clone environment with dedicated agents or deployment/environment not found@NotNull public @NotNull ErrorCollection validateEditEnvironment(long environmentId, @Nullable @Nullable String name, @Nullable @Nullable String description)
EnvironmentService
validateEditEnvironment
in interface EnvironmentService
environmentId
- environment to editname
- of the environmentdescription
- of the environment@NotNull public @NotNull Environment editEnvironment(long environmentId, String name, String description) throws WebValidationException
EnvironmentService
editEnvironment
in interface EnvironmentService
environmentId
- environment to editname
- of the environmentdescription
- of the environmentWebValidationException
public void updateEnvironmentConfigurationState(long environmentId, @NotNull @NotNull ConfigurationState configurationState)
EnvironmentService
updateEnvironmentConfigurationState
in interface EnvironmentService
environmentId
- of environment to updateconfigurationState
- new configuration state@Nullable public @Nullable RequirementSet getEnvironmentRequirementSet(long environmentId)
EnvironmentService
getEnvironmentRequirementSet
in interface EnvironmentService
environmentId
- of environment@NotNull public @NotNull List<RepositoryDefinition> getRepositoryDefinitionsForEnvironment(@NotNull @NotNull Environment environment)
EnvironmentService
getRepositoryDefinitionsForEnvironment
in interface EnvironmentService
@NotNull public @NotNull List<PlanRepositoryDefinition> getPlanRepositoryDefinitionsForEnvironment(@NotNull @NotNull Environment environment)
EnvironmentService
getPlanRepositoryDefinitionsForEnvironment
in interface EnvironmentService
@NotNull public @NotNull List<PlanRepositoryDefinition> getPlanRepositoryDefinitionsForEnvironment(@NotNull @NotNull InternalEnvironment environment)
EnvironmentService
getPlanRepositoryDefinitionsForEnvironment
in interface EnvironmentService
public List<EnvironmentRepositoryLink> getEnvironmentsUsingRepository(long repositoryId)
getEnvironmentsUsingRepository
in interface EnvironmentService
public List<EnvironmentRepositoryLink> getEnvironmentRepositoryLinksForRepository(long repositoryId)
getEnvironmentRepositoryLinksForRepository
in interface EnvironmentService
repositoryId
- repository idpublic List<Environment> getEnvironmentsUsingRepositoryDataEntity(long repositoryId)
EnvironmentService
getEnvironmentsUsingRepositoryDataEntity
in interface EnvironmentService
repositoryId
- repository idEnvironment
s that use given repositorypublic void removeRepositoryFromEnvironment(@NotNull @NotNull EnvironmentRepositoryLink environmentRepository)
EnvironmentService
EnvironmentRepositoryLink
from environmentremoveRepositoryFromEnvironment
in interface EnvironmentService
public RepositoryDefinition updateRepositoryLinkInEnvironment(EnvironmentRepositoryLink environmentRepositoryLink, RepositoryDataEntity newRepositoryEntity)
EnvironmentService
EnvironmentRepositoryLink
dataupdateRepositoryLinkInEnvironment
in interface EnvironmentService
public void addNotification(long environmentId, @NotNull @NotNull NotificationRule newRule) throws WebValidationException
EnvironmentService
addNotification
in interface EnvironmentService
WebValidationException
public NotificationSet getNotificationSet(long environmentId)
EnvironmentService
getNotificationSet
in interface EnvironmentService
environmentId
- of environmentpublic void deleteNotification(long environmentId, long notificationId) throws WebValidationException
EnvironmentService
deleteNotification
in interface EnvironmentService
WebValidationException
public void replaceNotification(long environmentId, long oldNotificationId, @NotNull @NotNull NotificationRule newRule) throws WebValidationException
EnvironmentService
replaceNotification
in interface EnvironmentService
WebValidationException
public void stopAllTriggers(@NotNull @NotNull Environment environment)
EnvironmentService
InternalEnvironment
stopAllTriggers
in interface EnvironmentService
public void startAllTriggers(@NotNull @NotNull Environment environment)
EnvironmentService
InternalEnvironment
startAllTriggers
in interface EnvironmentService
public void stopAllTriggersForDeploymentProject(long deploymentProjectId)
EnvironmentService
Environment
related to a DeploymentProject
stopAllTriggersForDeploymentProject
in interface EnvironmentService
public void startAllTriggersForDeploymentProject(long deploymentProjectId)
EnvironmentService
Environment
related to a DeploymentProject
startAllTriggersForDeploymentProject
in interface EnvironmentService
public void restartAllTriggeringForDeploymentProject(long deploymentProjectId)
EnvironmentService
Environment
related to a DeploymentProject
.
When using this method please keep in mind that triggers should be stopped before modifying their configuration
and restarted afterwards. Thus EnvironmentService.stopAllTriggersForDeploymentProject(long)
and
EnvironmentService.startAllTriggersForDeploymentProject(long)
might be more useful.restartAllTriggeringForDeploymentProject
in interface EnvironmentService
@NotNull public @NotNull ErrorCollection moveEnvironmentUp(long deploymentProjectId, long environmentId, int currentPosition)
EnvironmentService
moveEnvironmentUp
in interface EnvironmentService
@NotNull public @NotNull ErrorCollection moveEnvironmentDown(long deploymentProjectId, long environmentId, int currentPosition)
EnvironmentService
moveEnvironmentDown
in interface EnvironmentService
public ErrorCollection moveEnvironment(MoveEnvironmentStrategy moveEnvironmentStrategy, long deploymentProjectId, long environmentId, int currentPosition, Optional<Long> relatedEnvId)
EnvironmentService
MoveEnvironmentStrategy.AFTER
or MoveEnvironmentStrategy.BEFORE
moveEnvironment
in interface EnvironmentService
public int getEnvironmentCount()
getEnvironmentCount
in interface EnvironmentService
public int getEnvironmentCountForProject(DeploymentProject deploymentProject)
getEnvironmentCountForProject
in interface EnvironmentService
public void updatePlanKey(long deploymentProjectId, @NotNull @NotNull PlanKey originalPlanKey, @NotNull @NotNull PlanKey newPlanKey)
EnvironmentService
DeploymentProjectService.updatePlanKey(PlanKey, PlanKey)
after DeploymentProject has been updated.updatePlanKey
in interface EnvironmentService
deploymentProjectId
- id of deployment project which environments have to be checkedoriginalPlanKey
- original PlanKeynewPlanKey
- new PlanKey@NotNull public @NotNull PaginatedEnvironmentsForExecutablesView getEnvironmentsMatchingCapabilities(int start, int limit, @Nullable @Nullable String filter, ReadOnlyCapabilitySet agentCapabilities)
EnvironmentService
getEnvironmentsMatchingCapabilities
in interface EnvironmentService
start
- start by indexlimit
- return no more entries than limitfilter
- filteragentCapabilities
- capabilities of an agentpublic void resetTriggersForDeployment(long deploymentProjectId)
EnvironmentService
resetTriggersForDeployment
in interface EnvironmentService
public Function<Environment,DecoratedEnvironment> getEnvironmentDecorator()
EnvironmentService
getEnvironmentDecorator
in interface EnvironmentService
@NotNull public @NotNull Set<RequirementDeploymentMapping> findEnvironmentsByRequirementKey(@NotNull @NotNull String requirementKey)
EnvironmentService
findEnvironmentsByRequirementKey
in interface EnvironmentService
requirementKey
- on which environments relyCopyright © 2022 Atlassian Software Systems Pty Ltd. All rights reserved.