Class TagsAction

java.lang.Object
org.jenkinsci.plugins.workflow.actions.TagsAction
All Implemented Interfaces:
Action, ModelObject, PersistentAction

public class TagsAction extends Object implements PersistentAction
Tracks arbitrary annotations on FlowNode used for a variety of purposes This is designed to have a single action on the FlowNode to track all tags, for sanity. Flexible implementation of JENKINS-26522, with Strings for the annotation.
  • Constructor Details

    • TagsAction

      public TagsAction()
  • Method Details

    • addTag

      public void addTag(@CheckForNull String tag, @CheckForNull String value)
      Add a tag key:value pair to this FlowNode, null or empty values are ignored Inputs are CheckForNull so you can directly pass in values without nullchecks upfront.
      Parameters:
      tag - Tag to add to, null or empty values are no-ops
      value - Tag to add to, null or empty values are no-ops
    • removeTag

      public boolean removeTag(@CheckForNull String tag)
      Remove a tag mapping Input is CheckForNull so you can directly pass in values without nullchecks upfront.
      Parameters:
      tag - Tag to add to, null or empty values are no-ops
      Returns:
      True if we had something to remove, else false
    • getTagValue

      @CheckForNull public String getTagValue(@CheckForNull String tag)
      Get the value for a tag, null if not set Input is CheckForNull so you can directly pass in values without nullchecks upfront.
      Parameters:
      tag - Tag of interest to, null or empty values are no-ops
      Returns:
      Tag value or null if not set
    • getTags

      @NonNull public Map<String,String> getTags()
      Get the tag-value mappings
      Returns:
      Unmodifiable view of tag-value mappings
    • getTags

      @NonNull public static Map<String,String> getTags(@NonNull FlowNode node)
      Get the set of tag-value mappings for a node
      Returns:
      Unmodifiable view of tag-value mappings
    • getTagValue

      @CheckForNull public static String getTagValue(@NonNull FlowNode node, @CheckForNull String tag)
      Get the value for a tag on a flownode, null if not set (convenience) Input is CheckForNull so you can directly pass in values without nullchecks upfront.
      Parameters:
      tag - Tag of interest to, null or empty values are no-ops
      Returns:
      Tag value or null if not set
    • getIconFileName

      public String getIconFileName()
      Specified by:
      getIconFileName in interface Action
    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in interface Action
      Specified by:
      getDisplayName in interface ModelObject
    • getUrlName

      public String getUrlName()
      Specified by:
      getUrlName in interface Action