Class GerritTrigger

  • All Implemented Interfaces:
    ExtensionPoint, Describable<Trigger<?>>

    public class GerritTrigger
    extends Trigger<Job>
    Triggers a build based on Gerrit events.
    Author:
    Robert Sandell <robert.sandell@sonyericsson.com>
    • Constructor Detail

      • GerritTrigger

        @DataBoundConstructor
        public GerritTrigger​(List<GerritProject> gerritProjects)
        Default DataBound Constructor.
        Parameters:
        gerritProjects - the set of triggering rules.
      • GerritTrigger

        @Deprecated
        public GerritTrigger​(List<GerritProject> gerritProjects,
                             SkipVote skipVote,
                             Integer gerritBuildStartedVerifiedValue,
                             Integer gerritBuildStartedCodeReviewValue,
                             Integer gerritBuildSuccessfulVerifiedValue,
                             Integer gerritBuildSuccessfulCodeReviewValue,
                             Integer gerritBuildFailedVerifiedValue,
                             Integer gerritBuildFailedCodeReviewValue,
                             Integer gerritBuildUnstableVerifiedValue,
                             Integer gerritBuildUnstableCodeReviewValue,
                             Integer gerritBuildNotBuiltVerifiedValue,
                             Integer gerritBuildNotBuiltCodeReviewValue,
                             boolean silentMode,
                             boolean silentStartMode,
                             boolean escapeQuotes,
                             boolean noNameAndEmailParameters,
                             boolean readableMessage,
                             String dependencyJobsNames,
                             String buildStartMessage,
                             String buildSuccessfulMessage,
                             String buildUnstableMessage,
                             String buildFailureMessage,
                             String buildNotBuiltMessage,
                             String buildUnsuccessfulFilepath,
                             String customUrl,
                             String serverName,
                             String gerritSlaveId,
                             List<PluginGerritEvent> triggerOnEvents,
                             boolean dynamicTriggerConfiguration,
                             String triggerConfigURL,
                             String notificationLevel)
        Deprecated.
        Old DataBound Constructor. Replaced with GerritTrigger(List) and DataBoundSetters.
        Parameters:
        gerritProjects - the set of triggering rules.
        skipVote - what votes if any should be skipped in the final verified/code review calculation.
        gerritBuildStartedVerifiedValue - Job specific Gerrit verified vote when a build is started, null means that the global value should be used.
        gerritBuildStartedCodeReviewValue - Job specific Gerrit code review vote when a build is started, null means that the global value should be used.
        gerritBuildSuccessfulVerifiedValue - Job specific Gerrit verified vote when a build is successful, null means that the global value should be used.
        gerritBuildSuccessfulCodeReviewValue - Job specific Gerrit code review vote when a build is successful, null means that the global value should be used.
        gerritBuildFailedVerifiedValue - Job specific Gerrit verified vote when a build is failed, null means that the global value should be used.
        gerritBuildFailedCodeReviewValue - Job specific Gerrit code review vote when a build is failed, null means that the global value should be used.
        gerritBuildUnstableVerifiedValue - Job specific Gerrit verified vote when a build is unstable, null means that the global value should be used.
        gerritBuildUnstableCodeReviewValue - Job specific Gerrit code review vote when a build is unstable, null means that the global value should be used.
        gerritBuildNotBuiltVerifiedValue - Job specific Gerrit verified vote when a build is not built, null means that the global value should be used.
        gerritBuildNotBuiltCodeReviewValue - Job specific Gerrit code review vote when a build is not built, null means that the global value should be used.
        silentMode - Silent Mode on or off.
        silentStartMode - Silent Start Mode on or off.
        escapeQuotes - EscapeQuotes on or off.
        noNameAndEmailParameters - Whether to create parameters containing name and email
        readableMessage - Human readable message or not.
        dependencyJobsNames - The list of jobs on which this job depends
        buildStartMessage - Message to write to Gerrit when a build begins
        buildSuccessfulMessage - Message to write to Gerrit when a build succeeds
        buildUnstableMessage - Message to write to Gerrit when a build is unstable
        buildFailureMessage - Message to write to Gerrit when a build fails
        buildNotBuiltMessage - Message to write to Gerrit when all builds are not built
        buildUnsuccessfulFilepath - Filename to retrieve Gerrit comment message from, in the case of an unsuccessful build.
        customUrl - Custom URL to send to Gerrit instead of build URL
        serverName - The selected server
        gerritSlaveId - The selected slave associated to this job, if enabled in server configs
        triggerOnEvents - The list of event types to trigger on.
        dynamicTriggerConfiguration - Dynamic trigger configuration on or off
        triggerConfigURL - Where to fetch the configuration file from
        notificationLevel - Whom to notify.
    • Method Detail

      • setSkipVote

        @DataBoundSetter
        public void setSkipVote​(SkipVote skipVote)
        The skip vote selection. "Skipping" the vote means that if more than one build of this job is triggered by a Gerrit event the outcome of this build won't be counted when the final vote is sent to Gerrit.
        Parameters:
        skipVote - what votes if any should be skipped in the final
      • getServerName

        public String getServerName()
        Returns name of server.
        Returns:
        the server name
      • setServerName

        @DataBoundSetter
        public void setServerName​(String name)
        Set the selected server.
        Parameters:
        name - the name of the newly selected server.
      • getGerritSlaveId

        public String getGerritSlaveId()
        The selected slave associated to this job, if enabled in server configs.
        Returns:
        the id of the gerrit slave
        See Also:
        GerritSlave
      • setGerritSlaveId

        @DataBoundSetter
        public void setGerritSlaveId​(String gerritSlaveId)
        The selected slave associated to this job, if enabled in server configs.
        Parameters:
        gerritSlaveId - the id of the gerrit slave
        See Also:
        GerritSlave
      • getTrigger

        public static GerritTrigger getTrigger​(@Nullable
                                               Job project)
        Finds the GerritTrigger in a project.
        Parameters:
        project - the project.
        Returns:
        the trigger if there is one, null otherwise.
      • cancelTimer

        public void cancelTimer()
        Cancels the timerTask, if it exists.
      • start

        public void start​(Job project,
                          boolean newInstance)
        Overrides:
        start in class Trigger<Job>
      • createParameters

        @Deprecated
        protected ParametersAction createParameters​(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event,
                                                    Job project)
        Creates a ParameterAction and fills it with the project's default parameters + the Standard Gerrit parameters.
        Parameters:
        event - the event.
        project - the project.
        Returns:
        the ParameterAction.
      • doFillVerdictCategoryItems

        public ListBoxModel doFillVerdictCategoryItems()
        Fills the verdict category drop-down list for the comment-added events.
        Returns:
        a ListBoxModel for the drop-down list.
      • notifyBuildEnded

        public void notifyBuildEnded​(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event)
        Used to inform the server that the builds for a job have ended. This allows us to clean up our list of what jobs we're running.
        Parameters:
        event - the event.
      • getBuildScheduleDelay

        public int getBuildScheduleDelay()
        getBuildScheduleDelay method will return configured buildScheduledelay value. If the value is missing or invalid it the method will return default schedule delay or GerritDefaultValues.DEFAULT_BUILD_SCHEDULE_DELAY.
        Returns:
        buildScheduleDelay.
      • retriggerThisBuild

        public void retriggerThisBuild​(TriggerContext context)
        Re-triggers the build in TriggerContext.getThisBuild() for the context's event. Will not do any isInteresting(GerritTriggeredEvent) checks. If more than one build was triggered by the event the results from those builds will be counted again, but they won't be re-triggered. If any builds for the event are still running, this new scheduled build will replace its predesessor. If the project is currently building the event, no scheduling will be done.
        Parameters:
        context - the previous context.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isOnlyAbortRunningBuild

        public boolean isOnlyAbortRunningBuild​(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event)
        Checks based on the current event if the job should just be aborted, or even a new job should be triggered.
        Parameters:
        event - The ChangeBasedEvent.
        Returns:
        true if the job should only be aborted without triggering a new one, otherwise false.
      • isInteresting

        public boolean isInteresting​(com.sonymobile.tools.gerrit.gerritevents.dto.events.GerritTriggeredEvent event)
        Should we trigger on this event?
        Parameters:
        event - the event
        Returns:
        true if we should.
      • getGerritProjects

        public List<GerritProject> getGerritProjects()
        The list of GerritProject triggering rules.
        Returns:
        the rule-set.
      • getDynamicGerritProjects

        public List<GerritProject> getDynamicGerritProjects()
        The list of dynamically configured triggering rules.
        Returns:
        the rule-set.
      • setGerritProjects

        public void setGerritProjects​(List<GerritProject> gerritProjects)
        The list of GerritProject triggering rules.
        Parameters:
        gerritProjects - the rule-set
      • getGerritBuildFailedCodeReviewValue

        public Integer getGerritBuildFailedCodeReviewValue()
        Job specific Gerrit code review vote when a build is failed, null means that the global value should be used.
        Returns:
        the vote value.
      • setGerritBuildFailedCodeReviewValue

        @DataBoundSetter
        public void setGerritBuildFailedCodeReviewValue​(Integer gerritBuildFailedCodeReviewValue)
        Job specific Gerrit code review vote when a build is failed, providing null means that the global value should be used.
        Parameters:
        gerritBuildFailedCodeReviewValue - the vote value.
      • getGerritBuildFailedVerifiedValue

        public Integer getGerritBuildFailedVerifiedValue()
        Job specific Gerrit verified vote when a build is failed, null means that the global value should be used.
        Returns:
        the vote value.
      • setGerritBuildFailedVerifiedValue

        @DataBoundSetter
        public void setGerritBuildFailedVerifiedValue​(Integer gerritBuildFailedVerifiedValue)
        Job specific Gerrit verified vote when a build is failed, providing null means that the global value should be used.
        Parameters:
        gerritBuildFailedVerifiedValue - the vote value.
      • getGerritBuildStartedCodeReviewValue

        public Integer getGerritBuildStartedCodeReviewValue()
        Job specific Gerrit code review vote when a build is started, null means that the global value should be used.
        Returns:
        the vote value.
      • setGerritBuildStartedCodeReviewValue

        @DataBoundSetter
        public void setGerritBuildStartedCodeReviewValue​(Integer gerritBuildStartedCodeReviewValue)
        Job specific Gerrit code review vote when a build is started, providing null means that the global value should be used.
        Parameters:
        gerritBuildStartedCodeReviewValue - the vote value.
      • getGerritBuildStartedVerifiedValue

        public Integer getGerritBuildStartedVerifiedValue()
        Job specific Gerrit verified vote when a build is started, null means that the global value should be used.
        Returns:
        the vote value.
      • setGerritBuildStartedVerifiedValue

        @DataBoundSetter
        public void setGerritBuildStartedVerifiedValue​(Integer gerritBuildStartedVerifiedValue)
        Job specific Gerrit verified vote when a build is started, providing null means that the global value should be used.
        Parameters:
        gerritBuildStartedVerifiedValue - the vote value.
      • getGerritBuildSuccessfulCodeReviewValue

        public Integer getGerritBuildSuccessfulCodeReviewValue()
        Job specific Gerrit code review vote when a build is successful, null means that the global value should be used.
        Returns:
        the vote value.
      • setGerritBuildSuccessfulCodeReviewValue

        @DataBoundSetter
        public void setGerritBuildSuccessfulCodeReviewValue​(Integer gerritBuildSuccessfulCodeReviewValue)
        Job specific Gerrit code review vote when a build is successful, providing null means that the global value should be used.
        Parameters:
        gerritBuildSuccessfulCodeReviewValue - the vote value.
      • getGerritBuildSuccessfulVerifiedValue

        public Integer getGerritBuildSuccessfulVerifiedValue()
        Job specific Gerrit verified vote when a build is successful, null means that the global value should be used.
        Returns:
        the vote value.
      • setGerritBuildSuccessfulVerifiedValue

        @DataBoundSetter
        public void setGerritBuildSuccessfulVerifiedValue​(Integer gerritBuildSuccessfulVerifiedValue)
        Job specific Gerrit verified vote when a build is successful, providing null means that the global value should be used.
        Parameters:
        gerritBuildSuccessfulVerifiedValue - the vote value.
      • getGerritBuildUnstableCodeReviewValue

        public Integer getGerritBuildUnstableCodeReviewValue()
        Job specific Gerrit code review vote when a build is unstable, null means that the global value should be used.
        Returns:
        the vote value.
      • setGerritBuildUnstableCodeReviewValue

        @DataBoundSetter
        public void setGerritBuildUnstableCodeReviewValue​(Integer gerritBuildUnstableCodeReviewValue)
        Job specific Gerrit code review vote when a build is unstable, providing null means that the global value should be used.
        Parameters:
        gerritBuildUnstableCodeReviewValue - the vote value.
      • getGerritBuildUnstableVerifiedValue

        public Integer getGerritBuildUnstableVerifiedValue()
        Job specific Gerrit verified vote when a build is unstable, null means that the global value should be used.
        Returns:
        the vote value.
      • setGerritBuildUnstableVerifiedValue

        @DataBoundSetter
        public void setGerritBuildUnstableVerifiedValue​(Integer gerritBuildUnstableVerifiedValue)
        Job specific Gerrit verified vote when a build is unstable, providing null means that the global value should be used.
        Parameters:
        gerritBuildUnstableVerifiedValue - the vote value.
      • getGerritBuildNotBuiltCodeReviewValue

        public Integer getGerritBuildNotBuiltCodeReviewValue()
        Job specific Gerrit code review vote when a build is not built, null means that the global value should be used.
        Returns:
        the vote value.
      • setGerritBuildNotBuiltCodeReviewValue

        @DataBoundSetter
        public void setGerritBuildNotBuiltCodeReviewValue​(Integer gerritBuildNotBuiltCodeReviewValue)
        Job specific Gerrit code review vote when a build is not built, providing null means that the global value should be used.
        Parameters:
        gerritBuildNotBuiltCodeReviewValue - the vote value.
      • getGerritBuildNotBuiltVerifiedValue

        public Integer getGerritBuildNotBuiltVerifiedValue()
        Job specific Gerrit verified vote when a build is not built, null means that the global value should be used.
        Returns:
        the vote value.
      • setGerritBuildNotBuiltVerifiedValue

        @DataBoundSetter
        public void setGerritBuildNotBuiltVerifiedValue​(Integer gerritBuildNotBuiltVerifiedValue)
        Job specific Gerrit verified vote when a build is not built, providing null means that the global value should be used.
        Parameters:
        gerritBuildNotBuiltVerifiedValue - the vote value.
      • getGerritBuildAbortedCodeReviewValue

        public Integer getGerritBuildAbortedCodeReviewValue()
        Job specific Gerrit code review vote when a build is aborted, null means that the global value should be used.
        Returns:
        the vote value.
      • setGerritBuildAbortedCodeReviewValue

        @DataBoundSetter
        public void setGerritBuildAbortedCodeReviewValue​(Integer gerritBuildAbortedCodeReviewValue)
        Job specific Gerrit code review vote when a build is aborted, providing null means that the global value should be used.
        Parameters:
        gerritBuildAbortedCodeReviewValue - the vote value.
      • getGerritBuildAbortedVerifiedValue

        public Integer getGerritBuildAbortedVerifiedValue()
        Job specific Gerrit verified vote when a build is aborted, null means that the global value should be used.
        Returns:
        the vote value.
      • setGerritBuildAbortedVerifiedValue

        @DataBoundSetter
        public void setGerritBuildAbortedVerifiedValue​(Integer gerritBuildAbortedVerifiedValue)
        Job specific Gerrit verified vote when a build is aborted, providing null means that the global value should be used.
        Parameters:
        gerritBuildAbortedVerifiedValue - the vote value.
      • setBuildUnsuccessfulFilepath

        @DataBoundSetter
        public void setBuildUnsuccessfulFilepath​(String buildUnsuccessfulFilepath)
        Sets the path to a file that contains the unsuccessful Gerrit comment message. Filename to retrieve Gerrit comment message from, in the case of an unsuccessful build.
        Parameters:
        buildUnsuccessfulFilepath - The unsuccessful message comment file path
      • getTriggerOnEvents

        public List<PluginGerritEvent> getTriggerOnEvents()
        Getter for the triggerOnEvents list.
        Returns:
        the list.
      • setTriggerOnEvents

        @DataBoundSetter
        public void setTriggerOnEvents​(List<PluginGerritEvent> triggerOnEvents)
        The list of event types to trigger on.
        Parameters:
        triggerOnEvents - the list
      • isDynamicTriggerConfiguration

        public boolean isDynamicTriggerConfiguration()
        If trigger configuration should be fetched from a URL or not.
        Returns:
        true if trigger configuration should be fetched from a URL.
      • setDynamicTriggerConfiguration

        @DataBoundSetter
        public void setDynamicTriggerConfiguration​(boolean dynamicTriggerConfiguration)
        Set if dynamic trigger configuration should be enabled or not.
        Parameters:
        dynamicTriggerConfiguration - true if dynamic trigger configuration should be enabled.
      • getTriggerConfigURL

        public String getTriggerConfigURL()
        The URL where the trigger configuration should be fetched from.
        Returns:
        the URL, or null if this feature is not used.
      • setTriggerConfigURL

        @DataBoundSetter
        public void setTriggerConfigURL​(String triggerConfigURL)
        Set the URL where the trigger configuration should be fetched from.
        Parameters:
        triggerConfigURL - the URL where the trigger configuration should be fetched from.
        See Also:
        dynamicTriggerConfiguration, dynamicGerritProjects
      • getDependencyJobsNames

        public String getDependencyJobsNames()
        The list of dependency jobs, ie jobs on which this job depends.
        Returns:
        the string of jobs, or null if this feature is not used.
      • setDependencyJobsNames

        @DataBoundSetter
        public void setDependencyJobsNames​(String dependencyJobsNames)
        The list of jobs on which this job depends.
        Parameters:
        dependencyJobsNames - the string containing a comma-separated list of job names.
      • isSilentMode

        public boolean isSilentMode()
        If silent mode is on or off. When silent mode is on there will be no communication back to Gerrit, i.e. no build started/failed/successful approve messages etc. Default is false.
        Returns:
        true if silent mode is on.
      • isSilentStartMode

        public boolean isSilentStartMode()
        If silent start mode is on or off. When silent start mode is on there will be no 'build started' message back to Gerrit. Default is false.
        Returns:
        true if silent start mode is on.
      • getNotificationLevel

        public String getNotificationLevel()
        Whom to notify.
        Returns:
        the notification level value
      • isEscapeQuotes

        public boolean isEscapeQuotes()
        if escapeQuotes is on or off. When escapeQuotes is on this plugin will escape quotes in Gerrit event parameter string Default is true
        Returns:
        true if escapeQuotes is on.
      • setEscapeQuotes

        @DataBoundSetter
        public void setEscapeQuotes​(boolean escapeQuotes)
        Sets escapeQuotes to on or off. When escapeQuotes is on plugin will escape quotes in Gerrit event parameter string. Default is false.
        Parameters:
        escapeQuotes - is true if escapeQuotes should be on.
      • isNoNameAndEmailParameters

        @Deprecated
        public boolean isNoNameAndEmailParameters()
        Deprecated.
        If noNameAndEmailParameters is on or off. When this is set on this plugin will not create parameters which combine a name with an email (this applies change owner, restorer, etc). These parameters cause problems with some configurations.
        Returns:
        true if noNameAndEmailParameters is on.
      • setNoNameAndEmailParameters

        @Deprecated
        public void setNoNameAndEmailParameters​(boolean noNameAndEmailParameters)
        Sets noNameAndEmailParameters to on or off. When this is set on this plugin will not create parameters which combine a name with an email (this applies change owner, restorer, etc). These parameters cause problems with some configurations.
        Parameters:
        noNameAndEmailParameters - is true if problematic parameters should be omitted.
      • isReadableMessage

        @Deprecated
        public boolean isReadableMessage()
        Deprecated.
        If readableMessage is on or off. When this is set on this plugin will create parameters for multiline text, e.g. commit message, as human readable message. When this is set off, it will be encoded.
        Returns:
        true if readableMessage is on.
      • setReadableMessage

        @Deprecated
        public void setReadableMessage​(boolean readableMessage)
        Sets readableMessage to on or off. When this is set on this plugin will create parameters for multiline text, e.g. commit message, as human readable message. when this is set off, it will be encoded.
        Parameters:
        readableMessage - is true if human readable message is set.
      • getBuildStartMessage

        public String getBuildStartMessage()
        The message to show users when a build starts, if custom messages are enabled.
        Returns:
        The build start message
      • setBuildStartMessage

        @DataBoundSetter
        public void setBuildStartMessage​(String buildStartMessage)
        Message to write to Gerrit when a build begins.
        Parameters:
        buildStartMessage - The build start message
      • getBuildCancellationPolicy

        public BuildCancellationPolicy getBuildCancellationPolicy()
        Returns:
        the buildCurrentPatchesOnly
      • isBuildCurrentPatchesOnly

        public boolean isBuildCurrentPatchesOnly()
        The build cancellation policy regarding building current patch sets only.
        Returns:
        the policy
      • setBuildCancellationPolicy

        @DataBoundSetter
        public void setBuildCancellationPolicy​(BuildCancellationPolicy buildCancellationPolicy)
        The build cancellation policy regarding building current patch sets only.
        Parameters:
        buildCancellationPolicy - the policy
      • getBuildSuccessfulMessage

        public String getBuildSuccessfulMessage()
        The message to show users when a build succeeds, if custom messages are enabled.
        Returns:
        The build successful message
      • setBuildSuccessfulMessage

        @DataBoundSetter
        public void setBuildSuccessfulMessage​(String buildSuccessfulMessage)
        Message to write to Gerrit when a build succeeds.
        Parameters:
        buildSuccessfulMessage - The build successful message
      • getBuildUnstableMessage

        public String getBuildUnstableMessage()
        The message to show users when a build is unstable, if custom messages are enabled.
        Returns:
        The build unstable message
      • setBuildUnstableMessage

        @DataBoundSetter
        public void setBuildUnstableMessage​(String buildUnstableMessage)
        Message to write to Gerrit when a build is unstable.
        Parameters:
        buildUnstableMessage - The build unstable message
      • getBuildFailureMessage

        public String getBuildFailureMessage()
        The message to show users when a build finishes, if custom messages are enabled.
        Returns:
        The build failure message
      • setBuildFailureMessage

        @DataBoundSetter
        public void setBuildFailureMessage​(String buildFailureMessage)
        Message to write to Gerrit when a build fails.
        Parameters:
        buildFailureMessage - The build failure message
      • getBuildNotBuiltMessage

        public String getBuildNotBuiltMessage()
        The message to show users when all builds are not built, if custom messages are enabled.
        Returns:
        The build not built message
      • setBuildNotBuiltMessage

        @DataBoundSetter
        public void setBuildNotBuiltMessage​(String buildNotBuiltMessage)
        Message to write to Gerrit when all builds are not built.
        Parameters:
        buildNotBuiltMessage - The build not built message
      • getBuildAbortedMessage

        public String getBuildAbortedMessage()
        The message to show users when a build is aborted, if custom messages are enabled.
        Returns:
        The build aborted message
      • setBuildAbortedMessage

        @DataBoundSetter
        public void setBuildAbortedMessage​(String buildAbortedMessage)
        Message to write to Gerrit when a build is aborted.
        Parameters:
        buildAbortedMessage - The build aborted message
      • getBuildUnsuccessfulFilepath

        public String getBuildUnsuccessfulFilepath()
        The path to a file that contains the unsuccessful Gerrit comment message.
        Returns:
        The unsuccessful message comment file path
      • setSilentMode

        @DataBoundSetter
        public void setSilentMode​(boolean silentMode)
        Sets silent mode to on or off. When silent mode is on there will be no communication back to Gerrit, i.e. no build started/failed/successful approve messages etc. Default is false.
        Parameters:
        silentMode - true if silent mode should be on.
      • setEnableTopicAssociation

        @Deprecated
        public void setEnableTopicAssociation​(boolean enable)
        Deprecated.
        Enable or disable Topic Association option. Replaced by setTopicAssociation(TopicAssociation) ()
        Parameters:
        enable - true or false.
      • isEnableTopicAssociation

        @Deprecated
        public boolean isEnableTopicAssociation()
        Deprecated.
        Check if topic association is enabled.
        Returns:
        true if so.
      • setTopicAssociation

        @DataBoundSetter
        public void setTopicAssociation​(TopicAssociation topicAssociation)
        DataBoundSetter for TopicAssociation. Used for jelly file.
        Parameters:
        topicAssociation - the TopicAssociation object.
      • getTopicAssociation

        @CheckForNull
        public TopicAssociation getTopicAssociation()
        Returns the assigned TopicAssociation object. Used for jelly file.
        Returns:
        TopicAssociation object
      • setSilentStartMode

        @DataBoundSetter
        public void setSilentStartMode​(boolean silentStartMode)
        Sets silent start mode to on or off. When silent start mode is on there will be no 'silent start' message back to Gerrit. Default is false.
        Parameters:
        silentStartMode - true if silent start mode should be on.
      • setNotificationLevel

        @DataBoundSetter
        public void setNotificationLevel​(String notificationLevel)
        Whom to notify.
        Parameters:
        notificationLevel - the notification level.
      • getCustomUrl

        public String getCustomUrl()
        URL to send in comment to Gerrit.
        Returns:
        custom URL to post back to Gerrit
      • setCustomUrl

        @DataBoundSetter
        public void setCustomUrl​(String customUrl)
        Custom URL to send to Gerrit instead of build URL.
        Parameters:
        customUrl - URL to set
      • isFileTriggerEnabled

        public boolean isFileTriggerEnabled()
        Convenience method for finding it out if file triggering is enabled in the Gerrit version.
        Returns:
        true if file triggering is enabled in the Gerrit version.
      • updateTriggerConfigURL

        public void updateTriggerConfigURL()
        This method is called by the timer thread at regular intervals. It fetches the URL, determines if the result is different than from the last fetch, and if so, replaces the current URL trigger configuration with the fetched one.
      • isTriggerOnDraftPublishedEnabled

        public boolean isTriggerOnDraftPublishedEnabled()
        Convenience method for finding it out if triggering on draft published is enabled in the Gerrit version.
        Returns:
        true if triggering on draft published is enabled in the Gerrit version.
      • gerritSlavesToWaitFor

        public List<GerritSlave> gerritSlavesToWaitFor​(String gerritServerName)
        Convenience method to get the list of GerritSlave to which replication should be done before letting the build execute.
        Parameters:
        gerritServerName - The Gerrit server name
        Returns:
        list of GerritSlave (can be empty but never null)
      • getSkipVote

        public SkipVote getSkipVote()
        The skip vote selection. "Skipping" the vote means that if more than one build of this job is triggered by a Gerrit event the outcome of this build won't be counted when the final vote is sent to Gerrit.
        Returns:
        data structure for what build results to skip.
      • readResolve

        public Object readResolve()
                           throws ObjectStreamException
        Converts old trigger configs when only patchset created was available as event and when jobs were not associated to Gerrit servers.
        Overrides:
        readResolve in class Trigger<Job>
        Returns:
        the resolved instance.
        Throws:
        ObjectStreamException - if something beneath goes wrong.
      • abortBecauseOfTopic

        protected boolean abortBecauseOfTopic​(com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent event,
                                              BuildCancellationPolicy policy,
                                              com.sonymobile.tools.gerrit.gerritevents.dto.events.ChangeBasedEvent runningChange)
        Checks that execution must be aborted because of topic.
        Parameters:
        event - the event.
        policy - the cancellation policy.
        runningChange - the ongoing change.
        Returns:
        true if so.