Interface TriggerConfigurationService

    • Field Detail

    • Method Detail

      • createTrigger

        TriggerDefinition createTrigger​(@NotNull
                                        @NotNull PlanKey planKey,
                                        @NotNull
                                        @NotNull TriggerModuleDescriptor triggerModuleDescriptor,
                                        @Nullable
                                        @Nullable String userDescription,
                                        boolean isEnabled,
                                        @Nullable
                                        @Nullable Set<Long> triggeringRepositories,
                                        @NotNull
                                        @NotNull Map<String,​String> configuration,
                                        @NotNull
                                        @NotNull Map<String,​String> triggerConditionsConfiguration)
                                 throws IllegalArgumentException
        Create a trigger Definition and save it against the plan
        Parameters:
        planKey - of the plan to add the trigger definition to, plan should be Triggerable
        triggerModuleDescriptor - for the TriggerDefinition to be added
        userDescription - description the user has specified for this TriggerDefinition
        isEnabled - - set enabled/disabled state of the newly created trigger
        triggeringRepositories - - ids of repositories relevant to this trigger
        configuration - configuration from the plugin for this TriggerDefinition
        triggerConditionsConfiguration - - configuration for BuildTriggerCondition plugins
        Returns:
        the TriggerDefinition created
        Throws:
        IllegalArgumentException - if planKey is invalid (e.g. doesn't exist or is not a buildable)
      • deleteTrigger

        void deleteTrigger​(@NotNull
                           @NotNull PlanKey planKey,
                           long triggerId)
                    throws IllegalArgumentException,
                           IllegalStateException
        Delete a given trigger Definition
        Parameters:
        planKey - for the plan to delete the TriggerDefinition from
        triggerId - 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

        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
        Update the details of specific triggerDefinition
        Parameters:
        planKey - - the plan the triggerDefinition belongs to, must be Triggerable
        triggerId - - the TriggerDefinition to edit
        userDescription - - new user description
        isEnabled - - set new enabled/disabled state
        triggeringRepositories - - ids of repositories relevant to this trigger
        triggerConfigurationMap - - new task Configuration
        triggerConditionsConfiguration - - configuration for BuildTriggerCondition plugins
        Returns:
        TriggerDefinition with updates.
        Throws:
        IllegalArgumentException - if planKey or triggerId is invalid.
      • createTriggerList

        void createTriggerList​(PlanKey planKey,
                               @NotNull
                               @NotNull List<TriggerDefinition> triggerDefinitions)
        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.
        Parameters:
        planKey - - the plan the task list belongs to
        triggerDefinitions - - list of the tasks to be added
        Throws:
        IllegalArgumentException - if plan does not exist
      • updateRepositoryIdsInTriggers

        void updateRepositoryIdsInTriggers​(@NotNull
                                           @NotNull Chain chain,
                                           Map<Long,​Long> repositoryIdsChanges)
        Updates Chain configurations affected by repository edition. If map contains entry for NEW_REPOSITORY_INDICATOR this repository is added to all the triggers.
        Parameters:
        chain -
        repositoryIdsChanges - mapping between old and new repositories ids
      • updateRepositoryIdsInTriggers

        void updateRepositoryIdsInTriggers​(@NotNull
                                           @NotNull Chain chain,
                                           Map<Long,​Long> repositoryIdsChanges,
                                           boolean reactivateTriggers)
        Updates Chain configurations affected by repository edition. If map contains entry for NEW_REPOSITORY_INDICATOR this repository is added to all the triggers.
        Parameters:
        chain -
        repositoryIdsChanges - mapping between old and new repositories ids
        reactivateTriggers - indicates if triggers need to be (re)activated
      • addTriggeringRepository

        @Deprecated
        default void addTriggeringRepository​(@NotNull
                                             @NotNull Chain chain,
                                             long repositoryId)
        Deprecated.
        since 9.4 use
        Updates all repository aware triggers of Chain by adding a new repository.
        Parameters:
        chain -
        repositoryId -
      • addTriggeringRepository

        void addTriggeringRepository​(@NotNull
                                     @NotNull Chain chain,
                                     long repositoryId,
                                     boolean reactivateTriggers)
        Updates all repository aware triggers of Chain by adding a new repository.
        Parameters:
        chain -
        repositoryId -
        reactivateTriggers - true if triggers should be restarted
        Since:
        9.4
      • removeRepositoryIdsFromTriggers

        void removeRepositoryIdsFromTriggers​(@NotNull
                                             @NotNull Chain chain,
                                             @NotNull
                                             @NotNull Set<Long> removedRepositoriesIds)
        Removes listed repository ids from chain's triggers
        Parameters:
        chain -
        removedRepositoriesIds -