Package io.jenkins.plugins.util
Klasse JenkinsFacade
java.lang.Object
io.jenkins.plugins.util.JenkinsFacade
- Alle implementierten Schnittstellen:
Serializable
Facade to Jenkins server. Encapsulates all calls to the running Jenkins server so that tests can replace this facade
with a stub.
- Autor:
- Ullrich Hafner
- Siehe auch:
-
Konstruktorübersicht
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibunggetAbsoluteUrl
(String... urlElements) Returns an absolute URL for the specified url elements: e.g., creates the sequence ${rootUrl}/element1/element2.Returns the full names of all available jobs.Returns all available jobs.Gets abuild
by the full ID.getDescriptor
(Class<? extends Describable> describableType) Gets theDescriptor
that corresponds to the givenDescribable
type.getDescriptorOrDie
(Class<? extends Describable> describableType) Works just likegetDescriptor(Class)
but don't take no for an answer.<T extends Describable<T>,
D extends Descriptor<T>>
DescriptorExtensionList<T, D> getDescriptorsFor
(Class<T> describableType) Returns the discovered instances for the given descriptor type.<T> List
<T> getExtensionsFor
(Class<T> extensionType) Returns the discovered instances for the given extension type.getFullNameOf
(Job<?, ?> job) Returns the full name of the specified job.getImagePath
(BallColor color) Veraltet.getImagePath
(String icon) Returns the absolute URL for the specified icon.Gets aJob
by its full name.Returns the unique identifier of this Jenkins that has been historically used to identify this Jenkins to the outside world.getSymbol
(SymbolRequest symbol) Returns a symbol that can be embedded in a page.boolean
hasPermission
(Permission permission) Checks if the current security principal has this permission.boolean
hasPermission
(Permission permission, AbstractItem item) Checks if the current security principal has this permission for the specified item.boolean
hasPermission
(Permission permission, Job<?, ?> project) Checks if the current security principal has this permission for the specified project.boolean
hasPermission
(Permission permission, View view) Checks if the current security principal has this permission for the specified view.boolean
hasPermission
(Permission permission, AccessControlled accessControlled) Checks if the current security principal has this permission for the specified access controlled object.boolean
isPluginInstalled
(String pluginId) Returns whether the plugin with the specified ID (short name, artifact ID) is installed.
-
Konstruktordetails
-
JenkinsFacade
public JenkinsFacade()
-
-
Methodendetails
-
getExtensionsFor
Returns the discovered instances for the given extension type.- Typparameter:
T
- type of the extension- Parameter:
extensionType
- The base type that represents the extension point. NormallyExtensionPoint
subtype but that's not a hard requirement.- Gibt zurück:
- the discovered instances, might be an empty list
-
getDescriptorsFor
public <T extends Describable<T>,D extends Descriptor<T>> DescriptorExtensionList<T,D> getDescriptorsFor(Class<T> describableType) Returns the discovered instances for the given descriptor type.- Typparameter:
T
- type of the describableD
- type of the descriptor- Parameter:
describableType
- the base type that represents the descriptor of the describable- Gibt zurück:
- the discovered instances, might be an empty list
-
getDescriptorOrDie
Works just likegetDescriptor(Class)
but don't take no for an answer.- Parameter:
describableType
- the base type that represents the descriptor of the describable- Gibt zurück:
- the discovered descriptor
- Löst aus:
AssertionError
- If the descriptor is missing.
-
getDescriptor
Gets theDescriptor
that corresponds to the givenDescribable
type.If you have an instance of
type
and callDescribable.getDescriptor()
, you'll get the same instance that this method returns.- Parameter:
describableType
- the base type that represents the descriptor of the describable- Gibt zurück:
- the discovered descriptor, or
null
if no such descriptor has been found
-
hasPermission
Checks if the current security principal has this permission.- Parameter:
permission
- the permission to check for- Gibt zurück:
false
if the user doesn't have the permission
-
hasPermission
Checks if the current security principal has this permission for the specified project.- Parameter:
permission
- the permission to check forproject
- the project to check the permissions for- Gibt zurück:
false
if the user doesn't have the permission
-
hasPermission
Checks if the current security principal has this permission for the specified view.- Parameter:
permission
- the permission to check forview
- the view to check the permissions for- Gibt zurück:
false
if the user doesn't have the permission
-
hasPermission
public boolean hasPermission(Permission permission, @CheckForNull AccessControlled accessControlled) Checks if the current security principal has this permission for the specified access controlled object.- Parameter:
permission
- the permission to check foraccessControlled
- the access controlled object to check the permissions for- Gibt zurück:
false
if the user doesn't have the permission
-
hasPermission
Checks if the current security principal has this permission for the specified item.- Parameter:
permission
- the permission to check foritem
- the item to check the permissions for- Gibt zurück:
false
if the user doesn't have the permission
-
getJob
Gets aJob
by its full name. Full names are like path names, where each name ofItem
is combined by '/'.- Parameter:
name
- the full name of the job- Gibt zurück:
- the selected job, if it exists under the given full name and if it is accessible
-
getBuild
Gets abuild
by the full ID.- Parameter:
id
- the ID of the build- Gibt zurück:
- the selected build, if it exists with the given ID and if it is accessible
-
getImagePath
Veraltet.BallColor should not be used anymore, use theicon
tag in jelly views or the icon class name ofBallColor
Returns the absolute URL for the specified ball icon.- Parameter:
color
- the color- Gibt zurück:
- the absolute URL
-
getSymbol
Returns a symbol that can be embedded in a page. The returned String is a well formatted HTML snippet that can be embedded in a page.- Parameter:
symbol
- the symbol- Gibt zurück:
- the symbol
-
getImagePath
Returns the absolute URL for the specified icon.- Parameter:
icon
- the icon URL- Gibt zurück:
- the absolute URL
-
getAbsoluteUrl
Returns an absolute URL for the specified url elements: e.g., creates the sequence ${rootUrl}/element1/element2.- Parameter:
urlElements
- the url elements- Gibt zurück:
- the absolute URL
-
getAllJobNames
Returns the full names of all available jobs. The full name is given byAbstractItem.getFullName()
.- Gibt zurück:
- the full names of all jobs
-
getAllJobs
Returns all available jobs.- Gibt zurück:
- all jobs
-
getFullNameOf
Returns the full name of the specified job.- Parameter:
job
- the job to get the name for- Gibt zurück:
- the full name
-
isPluginInstalled
Returns whether the plugin with the specified ID (short name, artifact ID) is installed.- Parameter:
pluginId
- the ID of the plugin- Gibt zurück:
true
if the plugin is installed,false
if not
-
getLegacyInstanceId
Returns the unique identifier of this Jenkins that has been historically used to identify this Jenkins to the outside world.- Gibt zurück:
- legacy instance id of this Jenkins
-
icon
tag in jelly views or the icon class name ofBallColor