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) |
| Modifier and Type | Method and Description |
|---|---|
Environment |
addEnvironment(long deploymentProjectId,
String name,
String description)
Creates a new environment in the specified deployment project.
|
void |
addNotification(long environmentId,
NotificationRule newRule)
Adds a new notification to the environment notifications
|
Environment |
cloneEnvironment(long deploymentProjectId,
long environmentId,
String name,
String description)
Create new environment as a clone of existing one
|
Environment |
createImmutableEnvironment(MutableEnvironment mutableEnvironment)
Converts mutable environment to immutable.
|
protected Environment |
createOperationsAwareImmutableEnvironment(Environment environment) |
Environment |
createOperationsAwareImmutableEnvironment(MutableEnvironment environment)
Create operation aware immutable environment
|
void |
deleteNotification(long environmentId,
long notificationId)
Removes notification from the environment's notification set.
|
Environment |
editEnvironment(long environmentId,
String name,
String description)
Edit the details of an existing environment
|
Environment |
findEnvironmentByName(long deploymentProjectId,
String name)
Find environment with specified name in a deployment project
|
Set<RequirementDeploymentMapping> |
findEnvironmentsByRequirementKey(String requirementKey)
Find environments which rely on requirementKey
|
Iterable<Environment> |
getAllEnvironments()
Retrieve all
Environment defined in the system. |
Collection<Environment> |
getAllEnvironmentsForDashboard()
Retrieve all
Environment defined in the system. |
Iterable<Environment> |
getAllEnvironmentsNoUserContext()
Retrieve all
Environment defined in the system without filling in operations permitted for the user. |
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) |
RequirementSet |
getEnvironmentRequirementSet(long environmentId)
Retrieve Agent Requirement set for environment, if environment with id exists.
|
List<Environment> |
getEnvironmentsForDeploymentProject(long deploymentProjectId)
Get all environments for a particular deployment project.
|
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
|
NotificationSet |
getNotificationSet(long environmentId)
Retrieve notification set for environment, if environment with id exists.
|
PaginatedEnvironmentsForDashboard |
getPaginatedEnvironmentsForDeploymentProject(long deploymentProjectId,
int start,
int limit,
String filter)
Get paginated environments for a particular deployment project ordered by position.
|
List<PlanRepositoryDefinition> |
getPlanRepositoryDefinitionsForEnvironment(Environment environment)
Retrieves all repositories used in environment source checkout tasks
|
List<PlanRepositoryDefinition> |
getPlanRepositoryDefinitionsForEnvironment(InternalEnvironment environment)
Retrieves all repositories used in environment source checkout tasks
|
List<RepositoryDefinition> |
getRepositoryDefinitionsForEnvironment(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.
|
ErrorCollection |
moveEnvironmentDown(long deploymentProjectId,
long environmentId,
int currentPosition)
Moves an environment down the list
|
ErrorCollection |
moveEnvironmentUp(long deploymentProjectId,
long environmentId,
int currentPosition)
Moves an environment up the list
|
void |
removeRepositoryFromEnvironment(EnvironmentRepositoryLink environmentRepository)
Remove
EnvironmentRepositoryLink from environment |
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(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(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,
ConfigurationState configurationState)
Update the configurationState of this environment
|
void |
updatePlanKey(long deploymentProjectId,
PlanKey originalPlanKey,
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 |
ErrorCollection |
validateAddEnvironment(long deploymentProjectId,
String name,
String description)
Validates values to be used for creating a new environment.
|
ErrorCollection |
validateEditEnvironment(long environmentId,
String name,
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)
@NotNull public List<Environment> getEnvironmentsForDeploymentProject(long deploymentProjectId)
EnvironmentServicegetEnvironmentsForDeploymentProject in interface EnvironmentServicedeploymentProjectId - of the deployment project to get environments for@NotNull public PaginatedEnvironmentsForDashboard getPaginatedEnvironmentsForDeploymentProject(long deploymentProjectId, int start, int limit, @Nullable String filter)
EnvironmentServicegetPaginatedEnvironmentsForDeploymentProject in interface EnvironmentServicedeploymentProjectId - of the deployment project to get environments forstart - start by indexlimit - return no more entries than limitfilter - filterInternalEnvironment.getPosition()@NotNull public List<EnvironmentStub> getEnvironmentStubsForDeploymentProject(long deploymentProjectId)
EnvironmentServicegetEnvironmentStubsForDeploymentProject in interface EnvironmentServicedeploymentProjectId - of the deployment project to get environments for@Nullable public Environment getEnvironment(long environmentId)
EnvironmentServicegetEnvironment in interface EnvironmentServiceenvironmentId - ID to search for@Nullable public Environment findEnvironmentByName(long deploymentProjectId, String name)
EnvironmentServicefindEnvironmentByName in interface EnvironmentService@NotNull public Iterable<Environment> getAllEnvironments()
EnvironmentServiceEnvironment 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 Collection<Environment> getAllEnvironmentsForDashboard()
EnvironmentServiceEnvironment 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 Iterable<Environment> getAllEnvironmentsNoUserContext()
EnvironmentServiceEnvironment defined in the system without filling in operations permitted for the user.getAllEnvironmentsNoUserContext in interface EnvironmentService@NotNull public Environment createImmutableEnvironment(@NotNull MutableEnvironment mutableEnvironment)
EnvironmentServicecreateImmutableEnvironment in interface EnvironmentService@NotNull protected Environment createOperationsAwareImmutableEnvironment(Environment environment)
@NotNull public Environment createOperationsAwareImmutableEnvironment(@NotNull MutableEnvironment environment)
EnvironmentServicecreateOperationsAwareImmutableEnvironment in interface EnvironmentServiceOperations@NotNull public ErrorCollection validateAddEnvironment(long deploymentProjectId, @Nullable String name, @Nullable String description)
EnvironmentServicevalidateAddEnvironment in interface EnvironmentService@NotNull public Environment addEnvironment(long deploymentProjectId, @Nullable String name, @Nullable String description) throws WebValidationException
EnvironmentServiceaddEnvironment in interface EnvironmentServicedeploymentProjectId - to create environment inname - of the environment.description - of the environment.WebValidationException@NotNull public Environment cloneEnvironment(long deploymentProjectId, long environmentId, @Nullable String name, @Nullable String description) throws WebValidationException
EnvironmentServicecloneEnvironment in interface EnvironmentServiceWebValidationException@NotNull public ErrorCollection validateEditEnvironment(long environmentId, @Nullable String name, @Nullable String description)
EnvironmentServicevalidateEditEnvironment in interface EnvironmentServiceenvironmentId - environment to editname - of the environmentdescription - of the environment@NotNull public Environment editEnvironment(long environmentId, String name, String description) throws WebValidationException
EnvironmentServiceeditEnvironment in interface EnvironmentServiceenvironmentId - environment to editname - of the environmentdescription - of the environmentWebValidationExceptionpublic void updateEnvironmentConfigurationState(long environmentId,
@NotNull
ConfigurationState configurationState)
EnvironmentServiceupdateEnvironmentConfigurationState in interface EnvironmentServiceenvironmentId - of environment to updateconfigurationState - new configuration state@Nullable public RequirementSet getEnvironmentRequirementSet(long environmentId)
EnvironmentServicegetEnvironmentRequirementSet in interface EnvironmentServiceenvironmentId - of environment@NotNull public List<RepositoryDefinition> getRepositoryDefinitionsForEnvironment(@NotNull Environment environment)
EnvironmentServicegetRepositoryDefinitionsForEnvironment in interface EnvironmentService@NotNull public List<PlanRepositoryDefinition> getPlanRepositoryDefinitionsForEnvironment(@NotNull Environment environment)
EnvironmentServicegetPlanRepositoryDefinitionsForEnvironment in interface EnvironmentService@NotNull public List<PlanRepositoryDefinition> getPlanRepositoryDefinitionsForEnvironment(@NotNull InternalEnvironment environment)
EnvironmentServicegetPlanRepositoryDefinitionsForEnvironment in interface EnvironmentServicepublic List<EnvironmentRepositoryLink> getEnvironmentsUsingRepository(long repositoryId)
getEnvironmentsUsingRepository in interface EnvironmentServicepublic List<EnvironmentRepositoryLink> getEnvironmentRepositoryLinksForRepository(long repositoryId)
getEnvironmentRepositoryLinksForRepository in interface EnvironmentServicerepositoryId - repository idpublic List<Environment> getEnvironmentsUsingRepositoryDataEntity(long repositoryId)
EnvironmentServicegetEnvironmentsUsingRepositoryDataEntity in interface EnvironmentServicerepositoryId - repository idEnvironments that use given repositorypublic void removeRepositoryFromEnvironment(@NotNull
EnvironmentRepositoryLink environmentRepository)
EnvironmentServiceEnvironmentRepositoryLink from environmentremoveRepositoryFromEnvironment in interface EnvironmentServicepublic RepositoryDefinition updateRepositoryLinkInEnvironment(EnvironmentRepositoryLink environmentRepositoryLink, RepositoryDataEntity newRepositoryEntity)
EnvironmentServiceEnvironmentRepositoryLink dataupdateRepositoryLinkInEnvironment in interface EnvironmentServicepublic void addNotification(long environmentId,
@NotNull
NotificationRule newRule)
throws WebValidationException
EnvironmentServiceaddNotification in interface EnvironmentServiceWebValidationExceptionpublic NotificationSet getNotificationSet(long environmentId)
EnvironmentServicegetNotificationSet in interface EnvironmentServiceenvironmentId - of environmentpublic void deleteNotification(long environmentId,
long notificationId)
throws WebValidationException
EnvironmentServicedeleteNotification in interface EnvironmentServiceWebValidationExceptionpublic void stopAllTriggers(@NotNull
Environment environment)
EnvironmentServiceInternalEnvironmentstopAllTriggers in interface EnvironmentServicepublic void startAllTriggers(@NotNull
Environment environment)
EnvironmentServiceInternalEnvironmentstartAllTriggers in interface EnvironmentServicepublic void stopAllTriggersForDeploymentProject(long deploymentProjectId)
EnvironmentServiceEnvironment related to a DeploymentProjectstopAllTriggersForDeploymentProject in interface EnvironmentServicepublic void startAllTriggersForDeploymentProject(long deploymentProjectId)
EnvironmentServiceEnvironment related to a DeploymentProjectstartAllTriggersForDeploymentProject in interface EnvironmentServicepublic void restartAllTriggeringForDeploymentProject(long deploymentProjectId)
EnvironmentServiceEnvironment 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 ErrorCollection moveEnvironmentUp(long deploymentProjectId, long environmentId, int currentPosition)
EnvironmentServicemoveEnvironmentUp in interface EnvironmentService@NotNull public ErrorCollection moveEnvironmentDown(long deploymentProjectId, long environmentId, int currentPosition)
EnvironmentServicemoveEnvironmentDown in interface EnvironmentServicepublic ErrorCollection moveEnvironment(MoveEnvironmentStrategy moveEnvironmentStrategy, long deploymentProjectId, long environmentId, int currentPosition, Optional<Long> relatedEnvId)
EnvironmentServiceMoveEnvironmentStrategy.AFTER or MoveEnvironmentStrategy.BEFOREmoveEnvironment in interface EnvironmentServicepublic int getEnvironmentCount()
getEnvironmentCount in interface EnvironmentServicepublic int getEnvironmentCountForProject(DeploymentProject deploymentProject)
getEnvironmentCountForProject in interface EnvironmentServicepublic void updatePlanKey(long deploymentProjectId,
@NotNull
PlanKey originalPlanKey,
@NotNull
PlanKey newPlanKey)
EnvironmentServiceDeploymentProjectService.updatePlanKey(PlanKey, PlanKey) after DeploymentProject has been updated.updatePlanKey in interface EnvironmentServicedeploymentProjectId - id of deployment project which environments have to be checkedoriginalPlanKey - original PlanKeynewPlanKey - new PlanKeypublic void resetTriggersForDeployment(long deploymentProjectId)
EnvironmentServiceresetTriggersForDeployment in interface EnvironmentServicepublic Function<Environment,DecoratedEnvironment> getEnvironmentDecorator()
EnvironmentServicegetEnvironmentDecorator in interface EnvironmentService@NotNull public Set<RequirementDeploymentMapping> findEnvironmentsByRequirementKey(@NotNull String requirementKey)
EnvironmentServicefindEnvironmentsByRequirementKey in interface EnvironmentServicerequirementKey - on which environments relyCopyright © 2019 Atlassian Software Systems Pty Ltd. All rights reserved.