Package hudson.cli.handlers
Class ViewOptionHandler
java.lang.Object
org.kohsuke.args4j.spi.OptionHandler<View>
hudson.cli.handlers.ViewOptionHandler
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 namednested
.
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
ConstructorDescriptionViewOptionHandler
(org.kohsuke.args4j.CmdLineParser parser, org.kohsuke.args4j.OptionDef option, org.kohsuke.args4j.spi.Setter<View> setter) -
Method Summary
Modifier and TypeMethodDescriptionGets 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
-
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 classorg.kohsuke.args4j.spi.OptionHandler<View>
- Throws:
org.kohsuke.args4j.CmdLineException
-
getView
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 foundIllegalStateException
- If cannot get active Jenkins instance or view can't contain a viewsorg.springframework.security.access.AccessDeniedException
- If user doesn't have a READ permission for the view- Since:
- 1.618
-
getDefaultMetaVariable
- Specified by:
getDefaultMetaVariable
in classorg.kohsuke.args4j.spi.OptionHandler<View>
-