class MultiOptionUpdater extends java.lang.Object
A utility class that allows for dynamic manipulation of fields that support multiple values.
The MultiOptionUpdater class provides methods to add, remove, and set values for fields
such as labels, components, fix versions, affected versions, multi-select custom fields, checkboxes,
cascading select fields, and user/group pickers.
It accumulates the specified operations, which are then applied to an issue when updating or creating it.
Usage Examples:
When updating an issue:
issue.update {
setLabels {
add("urgent", "backend")
remove("obsolete")
set("new-feature", "api")
setComponents {
add("Database", "UI")
}
setFixVersions {
set("1.0", "2.0")
}
}
}
When creating an issue:
Issues.create("PROJECT", "Task") {
setSummary("New Task")
setDescription("Task description")
setAffectedVersions {
add("1.0")
setCustomFieldValue("My Multi-Select Field") {
set("Option X", "Option Y")
}
}
}
In the examples above, the updater will:
Available Operations:
add(String... items): Add items by their values (e.g., label names, component names).remove(String... items): Remove items by their values.set(String... items): Replace all existing items with the specified values.Notes:
set(String...) method without any arguments.| Modifiers | Name | Description |
|---|---|---|
protected java.util.List<java.util.Map> |
operations |
A list of operations to be performed on the field. |
| Constructor and description |
|---|
MultiOptionUpdater() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
add(java.lang.String[] items)Adds the specified items to the field. |
|
java.util.List |
get()Retrieves the list of accumulated operations. |
|
void |
remove(java.lang.String[] items)Removes the specified items from the field. |
|
void |
set(java.lang.String[] items)Sets the field's value to the specified items, replacing any existing values. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
A list of operations to be performed on the field. Each operation is represented as a map containing the operation type and the values involved.
Adds the specified items to the field.
This method accumulates an "add" operation for each provided item. The items will be added to the field's existing values when the issue is updated or created.
Usage Example within an update or create closure:
add("Label1", "Label2")
items - one or more values to add to the field (e.g., label names, component names)Retrieves the list of accumulated operations.
Removes the specified items from the field.
This method accumulates a "remove" operation for each provided item. The items will be removed from the field's existing values when the issue is updated or created.
Usage Example within an update or create closure:
remove("Label1", "Label2")
items - one or more values to remove from the fieldSets the field's value to the specified items, replacing any existing values.
This method accumulates a "set" operation with the provided items. When the issue is updated or created, the field's value will be set to these items, overwriting any existing values.
To clear the field's value, call this method without any arguments.
Usage Examples within an update or create closure:
// Set the field to specific values
set("Label1", "Label2")
// Clear the field's value
set()
items - zero or more values to set for the field