Package com.atlassian.bamboo.trigger
Class TriggerConfigurationServiceImpl
java.lang.Object
com.atlassian.bamboo.trigger.TriggerConfigurationServiceImpl
- All Implemented Interfaces:
TriggerConfigurationService
-
Field Summary
Fields inherited from interface com.atlassian.bamboo.trigger.TriggerConfigurationService
NEW_REPOSITORY_INDICATOR
-
Constructor Summary
ConstructorDescriptionTriggerConfigurationServiceImpl
(@NotNull BuildDefinitionManager buildDefinitionManager, @NotNull com.opensymphony.xwork2.TextProvider textProvider, @NotNull PlanManager planManager, @NotNull AuditLogService auditLogService, @NotNull ScopedExclusionService scopedExclusionService) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTriggeringRepository
(@NotNull Chain chain, long repositoryId, boolean reactivateTriggers) Updates all repository aware triggers of Chain by adding a new repository.createTrigger
(@NotNull PlanKey planKey, @NotNull TriggerModuleDescriptor triggerDescriptor, @NotNull String userDescription, boolean isEnabled, @Nullable Set<Long> triggeringRepositories, @NotNull Map<String, String> configuration, @NotNull Map<String, String> triggerConditionsConfiguration) Create a trigger Definition and save it against the planvoid
createTriggerList
(PlanKey planKey, @NotNull List<TriggerDefinition> triggerDefinitions) Initializes trigger list of a plan with the provided list.void
deleteTrigger
(@NotNull PlanKey planKey, long triggerId) Delete a given trigger DefinitioneditTrigger
(@NotNull PlanKey planKey, long triggerId, @Nullable String userDescription, boolean isEnabled, @Nullable Set<Long> triggeringRepositories, @NotNull Map<String, String> triggerConfigurationMap, @NotNull Map<String, String> triggerConditionsConfiguration) Update the details of specific triggerDefinitionvoid
removeRepositoryIdsFromTriggers
(@NotNull Chain chain, Set<Long> removedRepositoriesIds) Removes listed repository ids from chain's triggersvoid
updateRepositoryIdsInTriggers
(@NotNull Chain chain, Map<Long, Long> repositoryIdsChanges) Updates Chain configurations affected by repository edition.void
updateRepositoryIdsInTriggers
(@NotNull Chain chain, Map<Long, Long> repositoryIdsChanges, boolean reactivateTriggers) Updates Chain configurations affected by repository edition.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.trigger.TriggerConfigurationService
addTriggeringRepository
-
Constructor Details
-
TriggerConfigurationServiceImpl
public TriggerConfigurationServiceImpl(@NotNull @NotNull BuildDefinitionManager buildDefinitionManager, @NotNull @NotNull com.opensymphony.xwork2.TextProvider textProvider, @NotNull @NotNull PlanManager planManager, @NotNull @NotNull AuditLogService auditLogService, @NotNull @NotNull ScopedExclusionService scopedExclusionService)
-
-
Method Details
-
createTrigger
public TriggerDefinition createTrigger(@NotNull @NotNull PlanKey planKey, @NotNull @NotNull TriggerModuleDescriptor triggerDescriptor, @NotNull @NotNull String userDescription, boolean isEnabled, @Nullable @Nullable Set<Long> triggeringRepositories, @NotNull @NotNull Map<String, String> configuration, @NotNull @NotNull Map<String, throws IllegalArgumentExceptionString> triggerConditionsConfiguration) Description copied from interface:TriggerConfigurationService
Create a trigger Definition and save it against the plan- Specified by:
createTrigger
in interfaceTriggerConfigurationService
- Parameters:
planKey
- of the plan to add the trigger definition to, plan should beTriggerable
triggerDescriptor
- for the TriggerDefinition to be addeduserDescription
- description the user has specified for this TriggerDefinitionisEnabled
- - set enabled/disabled state of the newly created triggertriggeringRepositories
- - ids of repositories relevant to this triggerconfiguration
- configuration from the plugin for this TriggerDefinitiontriggerConditionsConfiguration
- - configuration forBuildTriggerCondition
plugins- Returns:
- the
TriggerDefinition
created - Throws:
IllegalArgumentException
- if planKey is invalid (e.g. doesn't exist or is not a buildable)
-
deleteTrigger
public void deleteTrigger(@NotNull @NotNull PlanKey planKey, long triggerId) throws IllegalArgumentException, IllegalStateException Description copied from interface:TriggerConfigurationService
Delete a given trigger Definition- Specified by:
deleteTrigger
in interfaceTriggerConfigurationService
- Parameters:
planKey
- for the plan to delete the TriggerDefinition fromtriggerId
- of the TriggerDefinition to delete.- Throws:
IllegalArgumentException
- if planKey is invalid (e.g. doesn't exist or is not a buildable),IllegalStateException
- if the task list has changed since submitting request, i.e the task isn't there to delete anymore.
-
editTrigger
public TriggerDefinition editTrigger(@NotNull @NotNull PlanKey planKey, long triggerId, @Nullable @Nullable String userDescription, boolean isEnabled, @Nullable @Nullable Set<Long> triggeringRepositories, @NotNull @NotNull Map<String, String> triggerConfigurationMap, @NotNull @NotNull Map<String, throws IllegalArgumentExceptionString> triggerConditionsConfiguration) Description copied from interface:TriggerConfigurationService
Update the details of specific triggerDefinition- Specified by:
editTrigger
in interfaceTriggerConfigurationService
- Parameters:
planKey
- - the plan the triggerDefinition belongs to, must beTriggerable
triggerId
- - the TriggerDefinition to edituserDescription
- - new user descriptionisEnabled
- - set new enabled/disabled statetriggeringRepositories
- - ids of repositories relevant to this triggertriggerConfigurationMap
- - new task ConfigurationtriggerConditionsConfiguration
- - configuration forBuildTriggerCondition
plugins- Returns:
TriggerDefinition
with updates.- Throws:
IllegalArgumentException
- if planKey or triggerId is invalid.
-
createTriggerList
public void createTriggerList(PlanKey planKey, @NotNull @NotNull List<TriggerDefinition> triggerDefinitions) Description copied from interface:TriggerConfigurationService
Initializes trigger list of a plan with the provided list. WARNING: If plan has existing triggers they are erased. It is assumed that the list is well-formed (i.e. ids are properly initialized) It can be used when automatically creating Plans.- Specified by:
createTriggerList
in interfaceTriggerConfigurationService
- Parameters:
planKey
- - the plan the task list belongs totriggerDefinitions
- - list of the tasks to be added
-
addTriggeringRepository
public void addTriggeringRepository(@NotNull @NotNull Chain chain, long repositoryId, boolean reactivateTriggers) Description copied from interface:TriggerConfigurationService
Updates all repository aware triggers of Chain by adding a new repository.- Specified by:
addTriggeringRepository
in interfaceTriggerConfigurationService
reactivateTriggers
- true if triggers should be restarted
-
updateRepositoryIdsInTriggers
public void updateRepositoryIdsInTriggers(@NotNull @NotNull Chain chain, Map<Long, Long> repositoryIdsChanges) Description copied from interface:TriggerConfigurationService
Updates Chain configurations affected by repository edition. If map contains entry for NEW_REPOSITORY_INDICATOR this repository is added to all the triggers.- Specified by:
updateRepositoryIdsInTriggers
in interfaceTriggerConfigurationService
repositoryIdsChanges
- mapping between old and new repositories ids
-
updateRepositoryIdsInTriggers
public void updateRepositoryIdsInTriggers(@NotNull @NotNull Chain chain, Map<Long, Long> repositoryIdsChanges, boolean reactivateTriggers) Description copied from interface:TriggerConfigurationService
Updates Chain configurations affected by repository edition. If map contains entry for NEW_REPOSITORY_INDICATOR this repository is added to all the triggers.- Specified by:
updateRepositoryIdsInTriggers
in interfaceTriggerConfigurationService
repositoryIdsChanges
- mapping between old and new repositories idsreactivateTriggers
- indicates if triggers need to be (re)activated
-
removeRepositoryIdsFromTriggers
public void removeRepositoryIdsFromTriggers(@NotNull @NotNull Chain chain, Set<Long> removedRepositoriesIds) Description copied from interface:TriggerConfigurationService
Removes listed repository ids from chain's triggers- Specified by:
removeRepositoryIdsFromTriggers
in interfaceTriggerConfigurationService
-