Package hudson.cli.handlers
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 toView
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 ofViewGroup
. Handler fails to resolve view provided a view with given name does not exist or a user was not grantedView.READ
permission.- Since:
- 1.538
- Author:
- ogondza
-
-
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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getDefaultMetaVariable()
View
getView(String name)
Gets a view by its name Note: Personal user's views aren't supported now.int
parseArguments(org.kohsuke.args4j.spi.Parameters params)
-
-
-
Constructor Detail
-
ViewOptionHandler
public ViewOptionHandler(org.kohsuke.args4j.CmdLineParser parser, org.kohsuke.args4j.OptionDef option, org.kohsuke.args4j.spi.Setter<View> setter)
-
-
Method Detail
-
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
@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 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
-
-