Package com.atlassian.bamboo.trigger
Class TriggerConfigurationServiceImpl
- java.lang.Object
-
- com.atlassian.bamboo.trigger.TriggerConfigurationServiceImpl
-
- All Implemented Interfaces:
TriggerConfigurationService
public class TriggerConfigurationServiceImpl extends Object implements TriggerConfigurationService
-
-
Field Summary
-
Fields inherited from interface com.atlassian.bamboo.trigger.TriggerConfigurationService
NEW_REPOSITORY_INDICATOR
-
-
Constructor Summary
Constructors Constructor Description TriggerConfigurationServiceImpl(@NotNull BuildDefinitionManager buildDefinitionManager, @NotNull com.opensymphony.xwork2.TextProvider textProvider, @NotNull PlanManager planManager, @NotNull AuditLogService auditLogService, @NotNull ScopedExclusionService scopedExclusionService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTriggeringRepository(@NotNull Chain chain, long repositoryId)Updates all repository aware triggers of Chain by adding a new repository.TriggerDefinitioncreateTrigger(@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 planvoidcreateTriggerList(PlanKey planKey, @NotNull List<TriggerDefinition> triggerDefinitions)Initializes trigger list of a plan with the provided list.voiddeleteTrigger(@NotNull PlanKey planKey, long triggerId)Delete a given trigger DefinitionTriggerDefinitioneditTrigger(@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 triggerDefinitionvoidremoveRepositoryIdsFromTriggers(@NotNull Chain chain, Set<Long> removedRepositoriesIds)Removes listed repository ids from chain's triggersvoidupdateRepositoryIdsInTriggers(@NotNull Chain chain, Map<Long,Long> repositoryIdsChanges)Updates Chain configurations affected by repository edition.voidupdateRepositoryIdsInTriggers(@NotNull Chain chain, Map<Long,Long> repositoryIdsChanges, boolean reactivateTriggers)Updates Chain configurations affected by repository edition.
-
-
-
Constructor Detail
-
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 Detail
-
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,String> triggerConditionsConfiguration) throws IllegalArgumentException
Description copied from interface:TriggerConfigurationServiceCreate a trigger Definition and save it against the plan- Specified by:
createTriggerin interfaceTriggerConfigurationService- Parameters:
planKey- of the plan to add the trigger definition to, plan should beTriggerabletriggerDescriptor- 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 forBuildTriggerConditionplugins- Returns:
- the
TriggerDefinitioncreated - 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, IllegalStateExceptionDescription copied from interface:TriggerConfigurationServiceDelete a given trigger Definition- Specified by:
deleteTriggerin 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,String> triggerConditionsConfiguration) throws IllegalArgumentException
Description copied from interface:TriggerConfigurationServiceUpdate the details of specific triggerDefinition- Specified by:
editTriggerin interfaceTriggerConfigurationService- Parameters:
planKey- - the plan the triggerDefinition belongs to, must beTriggerabletriggerId- - the TriggerDefinition to edituserDescription- - new user descriptionisEnabled- - set new enabled/disabled statetriggeringRepositories- - ids of repositories relevant to this triggertriggerConfigurationMap- - new task ConfigurationtriggerConditionsConfiguration- - configuration forBuildTriggerConditionplugins- Returns:
TriggerDefinitionwith updates.- Throws:
IllegalArgumentException- if planKey or triggerId is invalid.
-
createTriggerList
public void createTriggerList(PlanKey planKey, @NotNull @NotNull List<TriggerDefinition> triggerDefinitions)
Description copied from interface:TriggerConfigurationServiceInitializes 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:
createTriggerListin 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)Description copied from interface:TriggerConfigurationServiceUpdates all repository aware triggers of Chain by adding a new repository.- Specified by:
addTriggeringRepositoryin interfaceTriggerConfigurationService
-
updateRepositoryIdsInTriggers
public void updateRepositoryIdsInTriggers(@NotNull @NotNull Chain chain, Map<Long,Long> repositoryIdsChanges)Description copied from interface:TriggerConfigurationServiceUpdates Chain configurations affected by repository edition. If map contains entry for NEW_REPOSITORY_INDICATOR this repository is added to all the triggers.- Specified by:
updateRepositoryIdsInTriggersin interfaceTriggerConfigurationServicerepositoryIdsChanges- 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:TriggerConfigurationServiceUpdates Chain configurations affected by repository edition. If map contains entry for NEW_REPOSITORY_INDICATOR this repository is added to all the triggers.- Specified by:
updateRepositoryIdsInTriggersin interfaceTriggerConfigurationServicerepositoryIdsChanges- 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:TriggerConfigurationServiceRemoves listed repository ids from chain's triggers- Specified by:
removeRepositoryIdsFromTriggersin interfaceTriggerConfigurationService
-
-