Package jenkins.plugins.zulip
Class ZulipUtil
java.lang.Object
jenkins.plugins.zulip.ZulipUtil
Static helper methods
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
displayItem
(Item item, DescriptorImpl globalConfig, boolean fullPath, boolean displayLinks) Helper method to display an item, optionally with links.static String
displayObjectWithLink
(ModelObject object, String url, DescriptorImpl globalConfig) Helper method to display a Jenkins model object with a link.static String
expandVariables
(Run<?, ?> run, TaskListener listener, String value) Expands the variables in the given value by using environment variables from the build processstatic String
getDefaultValue
(String value, String defaultValue) Gets either supplied value or default value (usually from global config)static String
getJenkinsUrl
(DescriptorImpl globalConfig) Gets Url pointing to Jenkins instance.static boolean
isValueSet
(String value) Tests if value is filled (not null or blank)
-
Constructor Details
-
ZulipUtil
public ZulipUtil()
-
-
Method Details
-
isValueSet
Tests if value is filled (not null or blank)- Parameters:
value
- The value to test- Returns:
- true if value is set
-
getDefaultValue
Gets either supplied value or default value (usually from global config)- Parameters:
value
- Thee supplied valuedefaultValue
- The default value- Returns:
- The value if filled, otherwise default value
-
getJenkinsUrl
Gets Url pointing to Jenkins instance. By default use value from Zulip config, if it's blank, fallback to Jenkins instance settings- Parameters:
globalConfig
- Zulip global configuration- Returns:
- The Jenkins instance Url
-
expandVariables
public static String expandVariables(@Nonnull Run<?, ?> run, @Nonnull TaskListener listener, String value) throws InterruptedExceptionExpands the variables in the given value by using environment variables from the build process- Parameters:
run
- A build this is running as part oflistener
- A place to send outputvalue
- A value to expand variables in- Returns:
- The value with expanded variables
- Throws:
InterruptedException
-
displayItem
public static String displayItem(Item item, DescriptorImpl globalConfig, boolean fullPath, boolean displayLinks) Helper method to display an item, optionally with links.- Parameters:
item
- The item to display.globalConfig
- Zulip global configuration.fullPath
- Whether to display the full path including the display name of parent items (true
) or just this item's display name (false
).displayLinks
- Whether to display links to the item and (if relevant) its parent items.- Returns:
- A string representing the item.
-
displayObjectWithLink
public static String displayObjectWithLink(ModelObject object, String url, DescriptorImpl globalConfig) Helper method to display a Jenkins model object with a link.- Parameters:
object
- The Jenkins model object (item, run, ...)url
- The Url to the Jenkins model objectglobalConfig
- Zulip global configuration- Returns:
- A string representing the Jenkins model object, with a link if possible.
-