All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.atlassian.bamboo.specs.api.builders.trigger.Trigger Maven / Gradle / Ivy

There is a newer version: 6.7.1
Show newest version
package com.atlassian.bamboo.specs.api.builders.trigger;

import com.atlassian.bamboo.specs.api.builders.EntityPropertiesBuilder;
import com.atlassian.bamboo.specs.api.model.trigger.TriggerConditionProperties;
import com.atlassian.bamboo.specs.api.model.trigger.TriggerProperties;
import com.atlassian.bamboo.specs.api.util.EntityPropertiesBuilders;

import java.util.LinkedHashSet;
import java.util.Set;

/**
 * Represents a definition of trigger.
 * 

* This class contains common data only. In order to define a specific type of trigger one should use the specialised * implementation or, if such is not available, {@link AnyTrigger} class. */ public abstract class Trigger, P extends TriggerProperties> extends EntityPropertiesBuilder

{ protected boolean triggerEnabled; protected String name; protected String description; protected Set conditions = new LinkedHashSet<>(); protected Trigger() { triggerEnabled = true; name = null; description = ""; } /** * Sets the name of this trigger. Used as an visual identifier in Bamboo UI. *

* The name property must be specified by user */ public T name(final String name) { this.name = name; return (T) this; } /** * Sets the trigger description. Defaults to empty value. */ public T description(final String description) { this.description = description; return (T) this; } /** * Enables/disables the trigger. Defaults to enabled state. */ public T enabled(final boolean taskEnabled) { this.triggerEnabled = taskEnabled; return (T) this; } public T conditions(TriggerCondition, ? extends TriggerConditionProperties>... conditions) { for (TriggerCondition condition : conditions) { this.conditions.add((TriggerConditionProperties) EntityPropertiesBuilders.build(condition)); } return (T) this; } protected abstract P build(); }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy