package hudson.plugins.emailext.plugins.trigger; import hudson.Extension; import hudson.model.AbstractBuild; import hudson.model.Result; import hudson.model.TaskListener; import hudson.plugins.emailext.plugins.EmailTrigger; import hudson.plugins.emailext.plugins.EmailTriggerDescriptor; import hudson.plugins.emailext.plugins.RecipientProvider; import hudson.plugins.emailext.plugins.recipients.DevelopersRecipientProvider; import org.kohsuke.stapler.DataBoundConstructor; import java.util.List; public class UnstableTrigger extends EmailTrigger { public static final String TRIGGER_NAME = "Unstable (Test Failures)"; @DataBoundConstructor public UnstableTrigger(List<RecipientProvider> recipientProviders, String recipientList, String replyTo, String subject, String body, String attachmentsPattern, int attachBuildLog, String contentType) { super(recipientProviders, recipientList, replyTo, subject, body, attachmentsPattern, attachBuildLog, contentType); } @Deprecated public UnstableTrigger(boolean sendToList, boolean sendToDevs, boolean sendToRequester, boolean sendToCulprits, String recipientList, String replyTo, String subject, String body, String attachmentsPattern, int attachBuildLog, String contentType) { super(sendToList, sendToDevs, sendToRequester, sendToCulprits,recipientList, replyTo, subject, body, attachmentsPattern, attachBuildLog, contentType); } @Override public boolean trigger(AbstractBuild<?, ?> build, TaskListener listener) { return build.getResult() == Result.UNSTABLE; } @Extension public static final class DescriptorImpl extends EmailTriggerDescriptor { public DescriptorImpl() { addDefaultRecipientProvider(new DevelopersRecipientProvider()); } @Override public String getDisplayName() { return TRIGGER_NAME; } @Override public EmailTrigger createDefault() { return _createDefault(); } } }