Class EnvironmentServiceImpl
- java.lang.Object
-
- com.atlassian.bamboo.deployments.environments.service.EnvironmentServiceImpl
-
- All Implemented Interfaces:
EnvironmentService
public class EnvironmentServiceImpl extends Object implements EnvironmentService
-
-
Field Summary
-
Fields inherited from interface com.atlassian.bamboo.deployments.environments.service.EnvironmentService
DEFAULT_ARTIFACT_TASK_NAME
-
-
Constructor Summary
Constructors Constructor 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, InternalEnvironmentService internalEnvironmentService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull Environment
addEnvironment(long deploymentProjectId, @Nullable String name, @Nullable String description, @Nullable ReleaseApprovalPrerequisite releaseApprovalPrerequisite)
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' configurationlong
countAll()
@NotNull Environment
createImmutableEnvironment(@NotNull MutableEnvironment mutableEnvironment)
Converts mutable environment to immutable.@NotNull Environment
createOperationsAwareImmutableEnvironment(@NotNull MutableEnvironment environment)
Create operation aware immutable environmentprotected @NotNull Environment
createOperationsAwareImmutableEnvironment(Environment 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@NotNull Environment
editEnvironment(long environmentId, String name, String description, @Nullable ReleaseApprovalPrerequisite releaseApprovalPrerequisite)
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 allEnvironment
defined in the system.@NotNull Collection<Environment>
getAllEnvironmentsForDashboard()
Retrieve allEnvironment
defined in the system.@NotNull Iterable<Environment>
getAllEnvironmentsNoUserContext()
Retrieve allEnvironment
defined in the system without filling in operations permitted for the user.Iterable<Environment>
getAllEnvironmentsNoUserContext(int firstResult, int pageSize)
Retrieve allEnvironment
defined in the system without filling in operations permitted for the user.Iterable<InternalEnvironment>
getAllInternalEnvironmentsNoUserContext(int firstResult, int maxResults)
Retrieve allEnvironment
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, @NotNull ReadOnlyCapabilitySet agentCapabilities)
Provide a paginated list of minimal information about deployment environments matching agent capabilities.@NotNull PaginatedEnvironmentsForExecutablesView
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.@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 tasksErrorCollection
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 listvoid
removeRepositoryFromEnvironment(@NotNull EnvironmentRepositoryLink environmentRepository)
RemoveEnvironmentRepositoryLink
from environmentvoid
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 deploymentvoid
restartAllTriggeringForDeploymentProject(long deploymentProjectId)
Restart all automatic triggering on everyEnvironment
related to aDeploymentProject
.void
startAllTriggers(@NotNull Environment environment)
Start all automatic triggering onInternalEnvironment
void
startAllTriggersForDeploymentProject(long deploymentProjectId)
Start all automatic triggering on everyEnvironment
related to aDeploymentProject
void
stopAllTriggers(@NotNull Environment environment)
Stop all automatic triggering onInternalEnvironment
void
stopAllTriggersForDeploymentProject(long deploymentProjectId)
Stop all automatic triggering on everyEnvironment
related to aDeploymentProject
void
updateEnvironmentConfigurationState(long environmentId, @NotNull ConfigurationState configurationState)
Update the configurationState of this environmentvoid
updateEnvironmentPrerequisites(long environmentId, @NotNull ReleaseApprovalPrerequisite releaseApprovalPrerequisite)
Updates the prerequisites of the environment with requested ID needed to launch the release.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)
UpdateEnvironmentRepositoryLink
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.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.bamboo.deployments.environments.service.EnvironmentService
addEnvironment
-
-
-
-
Constructor Detail
-
EnvironmentServiceImpl
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, InternalEnvironmentService internalEnvironmentService)
-
-
Method Detail
-
getEnvironmentsForDeploymentProject
@NotNull public @NotNull List<Environment> getEnvironmentsForDeploymentProject(long deploymentProjectId)
Description copied from interface:EnvironmentService
Get all environments for a particular deployment project. Does not validate deployment project actually exists.- Specified by:
getEnvironmentsForDeploymentProject
in interfaceEnvironmentService
- Parameters:
deploymentProjectId
- of the deployment project to get environments for- Returns:
- List of environments for a single deployment project. Sorted by position, name.
-
getPaginatedEnvironmentsForDeploymentProject
@NotNull public @NotNull PaginatedEnvironmentsForDashboard getPaginatedEnvironmentsForDeploymentProject(long deploymentProjectId, int start, int limit, @Nullable @Nullable String filter)
Description copied from interface:EnvironmentService
Get paginated environments for a particular deployment project ordered by position. Does not validate deployment project actually exists. Filtering requires at least one character. If filter is null or empty then no filtering.- Specified by:
getPaginatedEnvironmentsForDeploymentProject
in interfaceEnvironmentService
- Parameters:
deploymentProjectId
- of the deployment project to get environments forstart
- start by indexlimit
- return no more entries than limitfilter
- filter- Returns:
- List of environments for a single deployment project. Sorted by position.
- See Also:
InternalEnvironment.getPosition()
-
getEnvironmentStubsForDeploymentProject
@NotNull public @NotNull List<EnvironmentStub> getEnvironmentStubsForDeploymentProject(long deploymentProjectId)
Description copied from interface:EnvironmentService
Get all environment stubs for a particular deployment project. Does not validate deployment project actually exists. Returns minimum data set required for rendering on deployment project pages.- Specified by:
getEnvironmentStubsForDeploymentProject
in interfaceEnvironmentService
- Parameters:
deploymentProjectId
- of the deployment project to get environments for- Returns:
- List of environments for a single deployment project. Sorted by position, name.
-
getEnvironmentUnrestricted
@Nullable public @Nullable Environment getEnvironmentUnrestricted(long environmentId)
Description copied from interface:EnvironmentService
Get specific environment by ID. Does not check permissions.- Specified by:
getEnvironmentUnrestricted
in interfaceEnvironmentService
- Parameters:
environmentId
- ID to search for- Returns:
- environment with given ID or null if one could not be found.
-
getEnvironment
@Nullable public @Nullable Environment getEnvironment(long environmentId) throws org.acegisecurity.AccessDeniedException
Description copied from interface:EnvironmentService
Get specific environment by ID.- Specified by:
getEnvironment
in interfaceEnvironmentService
- Parameters:
environmentId
- ID to search for- Returns:
- environment with given ID or null if one could not be found.
- Throws:
org.acegisecurity.AccessDeniedException
- when user doesn't have permissions to view environment
-
findEnvironmentByName
@Nullable public @Nullable Environment findEnvironmentByName(long deploymentProjectId, String name)
Description copied from interface:EnvironmentService
Find environment with specified name in a deployment project- Specified by:
findEnvironmentByName
in interfaceEnvironmentService
-
getAllEnvironments
@NotNull public @NotNull Iterable<Environment> getAllEnvironments()
Description copied from interface:EnvironmentService
Retrieve allEnvironment
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.- Specified by:
getAllEnvironments
in interfaceEnvironmentService
-
getAllEnvironmentsForDashboard
@NotNull public @NotNull Collection<Environment> getAllEnvironmentsForDashboard()
Description copied from interface:EnvironmentService
Retrieve allEnvironment
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.- Specified by:
getAllEnvironmentsForDashboard
in interfaceEnvironmentService
-
getAllEnvironmentsNoUserContext
@NotNull public @NotNull Iterable<Environment> getAllEnvironmentsNoUserContext()
Description copied from interface:EnvironmentService
Retrieve allEnvironment
defined in the system without filling in operations permitted for the user.- Specified by:
getAllEnvironmentsNoUserContext
in interfaceEnvironmentService
-
getAllEnvironmentsNoUserContext
public Iterable<Environment> getAllEnvironmentsNoUserContext(int firstResult, int pageSize)
Description copied from interface:EnvironmentService
Retrieve allEnvironment
defined in the system without filling in operations permitted for the user.- Specified by:
getAllEnvironmentsNoUserContext
in interfaceEnvironmentService
-
getAllInternalEnvironmentsNoUserContext
public Iterable<InternalEnvironment> getAllInternalEnvironmentsNoUserContext(int firstResult, int maxResults)
Description copied from interface:EnvironmentService
Retrieve allEnvironment
defined in the system without filling in operations permitted for the user.- Specified by:
getAllInternalEnvironmentsNoUserContext
in interfaceEnvironmentService
-
countAll
public long countAll()
- Specified by:
countAll
in interfaceEnvironmentService
-
createImmutableEnvironment
@NotNull public @NotNull Environment createImmutableEnvironment(@NotNull @NotNull MutableEnvironment mutableEnvironment)
Description copied from interface:EnvironmentService
Converts mutable environment to immutable.- Specified by:
createImmutableEnvironment
in interfaceEnvironmentService
-
createOperationsAwareImmutableEnvironment
@NotNull protected @NotNull Environment createOperationsAwareImmutableEnvironment(Environment environment)
-
createOperationsAwareImmutableEnvironment
@NotNull public @NotNull Environment createOperationsAwareImmutableEnvironment(@NotNull @NotNull MutableEnvironment environment)
Description copied from interface:EnvironmentService
Create operation aware immutable environment- Specified by:
createOperationsAwareImmutableEnvironment
in interfaceEnvironmentService
- See Also:
Operations
-
updateEnvironmentPrerequisites
public void updateEnvironmentPrerequisites(long environmentId, @NotNull @NotNull ReleaseApprovalPrerequisite releaseApprovalPrerequisite)
Description copied from interface:EnvironmentService
Updates the prerequisites of the environment with requested ID needed to launch the release.- Specified by:
updateEnvironmentPrerequisites
in interfaceEnvironmentService
- Parameters:
environmentId
- id of the environmentreleaseApprovalPrerequisite
- new prerequisites
-
validateAddEnvironment
@NotNull public @NotNull ErrorCollection validateAddEnvironment(long deploymentProjectId, @Nullable @Nullable String name, @Nullable @Nullable String description)
Description copied from interface:EnvironmentService
Validates values to be used for creating a new environment.- Specified by:
validateAddEnvironment
in interfaceEnvironmentService
- Returns:
- errorCollection containing any errors found. If no errors, an empty errorCollection will be returned.
-
addEnvironment
@NotNull public @NotNull Environment addEnvironment(long deploymentProjectId, @Nullable @Nullable String name, @Nullable @Nullable String description, @Nullable @Nullable ReleaseApprovalPrerequisite releaseApprovalPrerequisite) throws WebValidationException
Description copied from interface:EnvironmentService
Creates a new environment in the specified deployment project.- Specified by:
addEnvironment
in interfaceEnvironmentService
- Parameters:
deploymentProjectId
- to create environment inname
- of the environment.description
- of the environment.releaseApprovalPrerequisite
- prerequisites needed to be met before launching release is possible- Throws:
WebValidationException
-
cloneEnvironment
@NotNull public @NotNull Environment cloneEnvironment(long deploymentProjectId, long environmentId, @Nullable @Nullable String name, @Nullable @Nullable String description) throws WebValidationException
Description copied from interface:EnvironmentService
Create new environment as a clone of existing one- Specified by:
cloneEnvironment
in interfaceEnvironmentService
- Returns:
- Throws:
WebValidationException
- when user has no permission to clone environment with dedicated agents or deployment/environment not found
-
cloneEnvironment
@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
Description copied from interface:EnvironmentService
Create new environment as a clone of existing one and if necessary update triggers' configuration- Specified by:
cloneEnvironment
in interfaceEnvironmentService
- Returns:
- Throws:
WebValidationException
- when user has no permission to clone environment with dedicated agents or deployment/environment not found
-
validateEditEnvironment
@NotNull public @NotNull ErrorCollection validateEditEnvironment(long environmentId, @Nullable @Nullable String name, @Nullable @Nullable String description)
Description copied from interface:EnvironmentService
Validates values to be used when editing existing environment.- Specified by:
validateEditEnvironment
in interfaceEnvironmentService
- Parameters:
environmentId
- environment to editname
- of the environmentdescription
- of the environment- Returns:
- errorCollection containing any errors found. If no errors, an empty errorCollection will be returned.
-
editEnvironment
@NotNull public @NotNull Environment editEnvironment(long environmentId, String name, String description) throws WebValidationException
Description copied from interface:EnvironmentService
Edit the details of an existing environment- Specified by:
editEnvironment
in interfaceEnvironmentService
- Parameters:
environmentId
- environment to editname
- of the environmentdescription
- of the environment- Returns:
- the updated environment
- Throws:
WebValidationException
-
editEnvironment
@NotNull public @NotNull Environment editEnvironment(long environmentId, String name, String description, @Nullable @Nullable ReleaseApprovalPrerequisite releaseApprovalPrerequisite) throws WebValidationException
Description copied from interface:EnvironmentService
Edit the details of an existing environment- Specified by:
editEnvironment
in interfaceEnvironmentService
- Parameters:
environmentId
- environment to editname
- of the environmentdescription
- of the environmentreleaseApprovalPrerequisite
- prerequisites needed to be met before launching release is possible- Returns:
- the updated environment
- Throws:
WebValidationException
-
updateEnvironmentConfigurationState
public void updateEnvironmentConfigurationState(long environmentId, @NotNull @NotNull ConfigurationState configurationState)
Description copied from interface:EnvironmentService
Update the configurationState of this environment- Specified by:
updateEnvironmentConfigurationState
in interfaceEnvironmentService
- Parameters:
environmentId
- of environment to updateconfigurationState
- new configuration state
-
getEnvironmentRequirementSet
@Nullable public @Nullable RequirementSet getEnvironmentRequirementSet(long environmentId)
Description copied from interface:EnvironmentService
Retrieve Agent Requirement set for environment, if environment with id exists.- Specified by:
getEnvironmentRequirementSet
in interfaceEnvironmentService
- Parameters:
environmentId
- of environment- Returns:
- all requirements this environment has.
-
getRepositoryDefinitionsForEnvironment
@NotNull public @NotNull List<RepositoryDefinition> getRepositoryDefinitionsForEnvironment(@NotNull @NotNull Environment environment)
Description copied from interface:EnvironmentService
Retrieves all repositories used in environment source checkout tasks- Specified by:
getRepositoryDefinitionsForEnvironment
in interfaceEnvironmentService
- Returns:
-
getPlanRepositoryDefinitionsForEnvironment
@NotNull public @NotNull List<PlanRepositoryDefinition> getPlanRepositoryDefinitionsForEnvironment(@NotNull @NotNull Environment environment)
Description copied from interface:EnvironmentService
Retrieves all repositories used in environment source checkout tasks- Specified by:
getPlanRepositoryDefinitionsForEnvironment
in interfaceEnvironmentService
- Returns:
-
getPlanRepositoryDefinitionsForEnvironment
@NotNull public @NotNull List<PlanRepositoryDefinition> getPlanRepositoryDefinitionsForEnvironment(@NotNull @NotNull InternalEnvironment environment)
Description copied from interface:EnvironmentService
Retrieves all repositories used in environment source checkout tasks- Specified by:
getPlanRepositoryDefinitionsForEnvironment
in interfaceEnvironmentService
- Returns:
-
getEnvironmentsUsingRepository
public List<EnvironmentRepositoryLink> getEnvironmentsUsingRepository(long repositoryId)
- Specified by:
getEnvironmentsUsingRepository
in interfaceEnvironmentService
-
getEnvironmentRepositoryLinksForRepository
public List<EnvironmentRepositoryLink> getEnvironmentRepositoryLinksForRepository(long repositoryId)
- Specified by:
getEnvironmentRepositoryLinksForRepository
in interfaceEnvironmentService
- Parameters:
repositoryId
- repository id- Returns:
- list of Source Repository relationships defined for the given repository
-
getEnvironmentsUsingRepositoryDataEntity
public List<Environment> getEnvironmentsUsingRepositoryDataEntity(long repositoryId)
Description copied from interface:EnvironmentService
TODO 6.0 rename to getEnvironmentsUsingRepository- Specified by:
getEnvironmentsUsingRepositoryDataEntity
in interfaceEnvironmentService
- Parameters:
repositoryId
- repository id- Returns:
- list of immutable
Environment
s that use given repository
-
removeRepositoryFromEnvironment
public void removeRepositoryFromEnvironment(@NotNull @NotNull EnvironmentRepositoryLink environmentRepository)
Description copied from interface:EnvironmentService
RemoveEnvironmentRepositoryLink
from environment- Specified by:
removeRepositoryFromEnvironment
in interfaceEnvironmentService
-
updateRepositoryLinkInEnvironment
public RepositoryDefinition updateRepositoryLinkInEnvironment(EnvironmentRepositoryLink environmentRepositoryLink, RepositoryDataEntity newRepositoryEntity)
Description copied from interface:EnvironmentService
UpdateEnvironmentRepositoryLink
data- Specified by:
updateRepositoryLinkInEnvironment
in interfaceEnvironmentService
- Returns:
-
addNotification
public void addNotification(long environmentId, @NotNull @NotNull NotificationRule newRule) throws WebValidationException
Description copied from interface:EnvironmentService
Adds a new notification to the environment notifications- Specified by:
addNotification
in interfaceEnvironmentService
- Throws:
WebValidationException
-
getNotificationSet
public NotificationSet getNotificationSet(long environmentId)
Description copied from interface:EnvironmentService
Retrieve notification set for environment, if environment with id exists.- Specified by:
getNotificationSet
in interfaceEnvironmentService
- Parameters:
environmentId
- of environment
-
deleteNotification
public void deleteNotification(long environmentId, long notificationId) throws WebValidationException
Description copied from interface:EnvironmentService
Removes notification from the environment's notification set.- Specified by:
deleteNotification
in interfaceEnvironmentService
- Throws:
WebValidationException
-
replaceNotification
public void replaceNotification(long environmentId, long oldNotificationId, @NotNull @NotNull NotificationRule newRule) throws WebValidationException
Description copied from interface:EnvironmentService
Replaces notification in the environment's notification set.- Specified by:
replaceNotification
in interfaceEnvironmentService
- Throws:
WebValidationException
-
stopAllTriggers
public void stopAllTriggers(@NotNull @NotNull Environment environment)
Description copied from interface:EnvironmentService
Stop all automatic triggering onInternalEnvironment
- Specified by:
stopAllTriggers
in interfaceEnvironmentService
-
startAllTriggers
public void startAllTriggers(@NotNull @NotNull Environment environment)
Description copied from interface:EnvironmentService
Start all automatic triggering onInternalEnvironment
- Specified by:
startAllTriggers
in interfaceEnvironmentService
-
stopAllTriggersForDeploymentProject
public void stopAllTriggersForDeploymentProject(long deploymentProjectId)
Description copied from interface:EnvironmentService
Stop all automatic triggering on everyEnvironment
related to aDeploymentProject
- Specified by:
stopAllTriggersForDeploymentProject
in interfaceEnvironmentService
-
startAllTriggersForDeploymentProject
public void startAllTriggersForDeploymentProject(long deploymentProjectId)
Description copied from interface:EnvironmentService
Start all automatic triggering on everyEnvironment
related to aDeploymentProject
- Specified by:
startAllTriggersForDeploymentProject
in interfaceEnvironmentService
-
restartAllTriggeringForDeploymentProject
public void restartAllTriggeringForDeploymentProject(long deploymentProjectId)
Description copied from interface:EnvironmentService
Restart all automatic triggering on everyEnvironment
related to aDeploymentProject
. When using this method please keep in mind that triggers should be stopped before modifying their configuration and restarted afterwards. ThusEnvironmentService.stopAllTriggersForDeploymentProject(long)
andEnvironmentService.startAllTriggersForDeploymentProject(long)
might be more useful.- Specified by:
restartAllTriggeringForDeploymentProject
in interfaceEnvironmentService
-
moveEnvironmentUp
@NotNull public @NotNull ErrorCollection moveEnvironmentUp(long deploymentProjectId, long environmentId, int currentPosition)
Description copied from interface:EnvironmentService
Moves an environment up the list- Specified by:
moveEnvironmentUp
in interfaceEnvironmentService
-
moveEnvironmentDown
@NotNull public @NotNull ErrorCollection moveEnvironmentDown(long deploymentProjectId, long environmentId, int currentPosition)
Description copied from interface:EnvironmentService
Moves an environment down the list- Specified by:
moveEnvironmentDown
in interfaceEnvironmentService
-
moveEnvironment
public ErrorCollection moveEnvironment(MoveEnvironmentStrategy moveEnvironmentStrategy, long deploymentProjectId, long environmentId, int currentPosition, Optional<Long> relatedEnvId)
Description copied from interface:EnvironmentService
Move Environment in given deploymentProject with given strategy. relatedEnvId is optional for most cases. It is only required for strategyMoveEnvironmentStrategy.AFTER
orMoveEnvironmentStrategy.BEFORE
- Specified by:
moveEnvironment
in interfaceEnvironmentService
- Returns:
- error collection
-
getEnvironmentCount
public int getEnvironmentCount()
- Specified by:
getEnvironmentCount
in interfaceEnvironmentService
- Returns:
- number of all environments
-
getEnvironmentCountForProject
public int getEnvironmentCountForProject(DeploymentProject deploymentProject)
- Specified by:
getEnvironmentCountForProject
in interfaceEnvironmentService
- Returns:
- number of environments defined for project
-
updatePlanKey
public void updatePlanKey(long deploymentProjectId, @NotNull @NotNull PlanKey originalPlanKey, @NotNull @NotNull PlanKey newPlanKey)
Description copied from interface:EnvironmentService
Update planKey in Environment related configuration when plan key has changed (ie after moving plan). This method is called byDeploymentProjectService.updatePlanKey(PlanKey, PlanKey)
after DeploymentProject has been updated.- Specified by:
updatePlanKey
in interfaceEnvironmentService
- Parameters:
deploymentProjectId
- id of deployment project which environments have to be checkedoriginalPlanKey
- original PlanKeynewPlanKey
- new PlanKey
-
getEnvironmentsMatchingCapabilities
@NotNull public @NotNull PaginatedEnvironmentsForExecutablesView getEnvironmentsMatchingCapabilities(int start, int limit, @Nullable @Nullable String filter, @NotNull @NotNull ReadOnlyCapabilitySet agentCapabilities)
Description copied from interface:EnvironmentService
Provide a paginated list of minimal information about deployment environments matching agent capabilities.- Specified by:
getEnvironmentsMatchingCapabilities
in interfaceEnvironmentService
- Parameters:
start
- start by indexlimit
- return no more entries than limitfilter
- filteragentCapabilities
- capabilities of an agent- Returns:
- List of ids and name of deployment projects and environments, sorted alphabetically by deployment name and environment position;
-
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:EnvironmentService
Provide a paginated list of minimal information about deployment environments matching agent capabilities.- Specified by:
getEnvironmentsMatchingCapabilities
in interfaceEnvironmentService
- 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;
-
resetTriggersForDeployment
public void resetTriggersForDeployment(long deploymentProjectId)
Description copied from interface:EnvironmentService
Delete and recreate triggers for all environments for this deployment- Specified by:
resetTriggersForDeployment
in interfaceEnvironmentService
-
getEnvironmentDecorator
public Function<Environment,DecoratedEnvironment> getEnvironmentDecorator()
Description copied from interface:EnvironmentService
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 interfaceEnvironmentService
-
findEnvironmentsByRequirementKey
@NotNull public @NotNull Set<RequirementDeploymentMapping> findEnvironmentsByRequirementKey(@NotNull @NotNull String requirementKey)
Description copied from interface:EnvironmentService
Find environments which rely on requirementKey- Specified by:
findEnvironmentsByRequirementKey
in interfaceEnvironmentService
- Parameters:
requirementKey
- on which environments rely- Returns:
- environments or empty set
-
-