Class ZulipUtil

java.lang.Object
jenkins.plugins.zulip.ZulipUtil

public class ZulipUtil extends Object
Static helper methods
  • Constructor Details

    • ZulipUtil

      public ZulipUtil()
  • Method Details

    • isValueSet

      public static boolean isValueSet(String value)
      Tests if value is filled (not null or blank)
      Parameters:
      value - The value to test
      Returns:
      true if value is set
    • getDefaultValue

      public static String getDefaultValue(String value, String defaultValue)
      Gets either supplied value or default value (usually from global config)
      Parameters:
      value - Thee supplied value
      defaultValue - The default value
      Returns:
      The value if filled, otherwise default value
    • getJenkinsUrl

      public static String getJenkinsUrl(DescriptorImpl globalConfig)
      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 InterruptedException
      Expands the variables in the given value by using environment variables from the build process
      Parameters:
      run - A build this is running as part of
      listener - A place to send output
      value - 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 object
      globalConfig - Zulip global configuration
      Returns:
      A string representing the Jenkins model object, with a link if possible.