Class ViewOptionHandler

java.lang.Object
org.kohsuke.args4j.spi.OptionHandler<View>
hudson.cli.handlers.ViewOptionHandler

@MetaInfServices public class ViewOptionHandler extends org.kohsuke.args4j.spi.OptionHandler<View>
Refers to View by its name.

For example:

my_view_name
refers to a top level view with given name.
nested/inner
refers to a view named inner inside of a top level view group named nested.

View name is a non-empty sequence of View names delimited by '/'. Handler traverse the view names from left to right. First one is expected to be a top level view and all but the last one are expected to be instances of ViewGroup. Handler fails to resolve view provided a view with given name does not exist or a user was not granted View.READ permission.

Since:
1.538
Author:
ogondza
  • Field Summary

    Fields inherited from class org.kohsuke.args4j.spi.OptionHandler

    option, owner, setter
  • Constructor Summary

    Constructors
    Constructor
    Description
    ViewOptionHandler(org.kohsuke.args4j.CmdLineParser parser, org.kohsuke.args4j.OptionDef option, org.kohsuke.args4j.spi.Setter<View> setter)
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    Gets a view by its name Note: Personal user's views aren't supported now.
    int
    parseArguments(org.kohsuke.args4j.spi.Parameters params)
     

    Methods inherited from class org.kohsuke.args4j.spi.OptionHandler

    getMetaVariable, getNameAndMeta, getNameAndMeta, print, printDefaultValue

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ViewOptionHandler

      public ViewOptionHandler(org.kohsuke.args4j.CmdLineParser parser, org.kohsuke.args4j.OptionDef option, org.kohsuke.args4j.spi.Setter<View> setter)
  • Method Details

    • parseArguments

      public int parseArguments(org.kohsuke.args4j.spi.Parameters params) throws org.kohsuke.args4j.CmdLineException
      Specified by:
      parseArguments in class org.kohsuke.args4j.spi.OptionHandler<View>
      Throws:
      org.kohsuke.args4j.CmdLineException
    • getView

      @CheckForNull public View getView(String name)
      Gets a view by its name Note: Personal user's views aren't supported now.
      Parameters:
      name - A view name
      Returns:
      The View instance. Null if name is empty string
      Throws:
      IllegalArgumentException - If the view isn't found
      IllegalStateException - If cannot get active Jenkins instance or view can't contain a views
      org.springframework.security.access.AccessDeniedException - If user doesn't have a READ permission for the view
      Since:
      1.618
    • getDefaultMetaVariable

      public String getDefaultMetaVariable()
      Specified by:
      getDefaultMetaVariable in class org.kohsuke.args4j.spi.OptionHandler<View>