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 Summary
Constructors Constructor Description TagsAction()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addTag(String tag, 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.String
getDisplayName()
String
getIconFileName()
Map<String,String>
getTags()
Get the tag-value mappingsstatic Map<String,String>
getTags(FlowNode node)
Get the set of tag-value mappings for a nodeString
getTagValue(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.static String
getTagValue(FlowNode node, 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.String
getUrlName()
boolean
removeTag(String tag)
Remove a tag mapping Input is CheckForNull so you can directly pass in values without nullchecks upfront.
-
-
-
Method Detail
-
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-opsvalue
- 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 interfaceAction
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getUrlName
public String getUrlName()
- Specified by:
getUrlName
in interfaceAction
-
-