Class OptionSetManagerImpl

java.lang.Object
com.atlassian.jira.issue.fields.option.OptionSetManagerImpl
All Implemented Interfaces:
OptionSetManager

@ParametersAreNonnullByDefault public class OptionSetManagerImpl extends Object implements OptionSetManager
  • Constructor Details

  • Method Details

    • getOptionsForConfig

      @Nonnull public OptionSet getOptionsForConfig(FieldConfig config)
      Description copied from interface: OptionSetManager
      Retrieves an option set that contains the options for the given field configuration.
      Specified by:
      getOptionsForConfig in interface OptionSetManager
      Parameters:
      config - the field configuration whose options are to be retrieved
      Returns:
      an option set containing the options for that field configuration
    • getOptionsForConfig

      @Nonnull public OptionSet getOptionsForConfig(@Nonnull String fieldId, @Nonnull Long configId)
    • createOptionSet

      @Nonnull public OptionSet createOptionSet(FieldConfig config, Collection<String> optionIds)
      Description copied from interface: OptionSetManager
      Creates a new option set or replaces an existing one.

      Well... maybe. For historic reasons, a null value is tolerated for optionIds and is treated the same as calling OptionSetManager.removeOptionSet(FieldConfig). It is now annotated with @Nonnull to warn callers that this should be avoided. Please call OptionSetManager.removeOptionSet(FieldConfig) if that's what you really mean!

      By the way, this method and OptionSetManager.updateOptionSet(FieldConfig, Collection) do exactly the same thing. Don't ask me why we have both of them; I'm sure it seemed like a great idea at the time.

      Specified by:
      createOptionSet in interface OptionSetManager
      Parameters:
      config - the field configuration associated with the option set
      optionIds - the collection of options to include. The options will be ordered by the iteration order of the collection, so it should be a List or SortedSet if you want the results to be predictable.
      Returns:
      the set of options assigned to this field configuration
    • updateOptionSet

      @Nonnull public OptionSet updateOptionSet(FieldConfig config, Collection<String> optionIds)
      Description copied from interface: OptionSetManager
      Creates a new option set or replaces an existing one.

      Well... maybe. For historic reasons, a null value is tolerated for optionIds and is treated the same as calling OptionSetManager.removeOptionSet(FieldConfig). It is now annotated with @Nonnull to warn callers that this should be avoided. Please call OptionSetManager.removeOptionSet(FieldConfig) if that's what you really mean!

      By the way, this method and OptionSetManager.createOptionSet(FieldConfig, Collection) do exactly the same thing. Don't ask me why we have both of them; I'm sure it seemed like a great idea at the time.

      Specified by:
      updateOptionSet in interface OptionSetManager
      Parameters:
      config - the field configuration associated with the option set
      optionIds - the collection of options to include. The options will be ordered by the iteration order of the collection, so it should be a List or SortedSet if you want the results to be predictable.
      Returns:
      the set of options assigned to this field configuration
    • addOptionToOptionSet

      @Nonnull public OptionSet addOptionToOptionSet(FieldConfig config, String optionId)
      Description copied from interface: OptionSetManager
      Adds a new option to the option set. This will be placed in the last position of the set (highest sequence).
      Specified by:
      addOptionToOptionSet in interface OptionSetManager
      Parameters:
      config - the field configuration associated with the option set
      optionId - to add to the option set
      Returns:
      the set of options assigned to this field configuration
    • removeOptionFromOptionSet

      @Nonnull public OptionSet removeOptionFromOptionSet(FieldConfig config, String optionId)
      Description copied from interface: OptionSetManager
      Removes an option from the option set.
      Specified by:
      removeOptionFromOptionSet in interface OptionSetManager
      Parameters:
      config - the field configuration associated with the option set
      optionId - to remove from the option set
      Returns:
      the set of options assigned to this field configuration
    • removeOptionSet

      public void removeOptionSet(FieldConfig config)
      Description copied from interface: OptionSetManager
      Removes all options from this field configuration.
      Specified by:
      removeOptionSet in interface OptionSetManager
      Parameters:
      config - the field configuration to destroy