Klasse JenkinsFacade

java.lang.Object
io.jenkins.plugins.util.JenkinsFacade
Alle implementierten Schnittstellen:
Serializable

public class JenkinsFacade extends Object implements 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:
  • Konstruktordetails

    • JenkinsFacade

      public JenkinsFacade()
  • Methodendetails

    • getExtensionsFor

      public <T> List<T> getExtensionsFor(Class<T> extensionType)
      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. Normally ExtensionPoint 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 describable
      D - 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

      public Descriptor getDescriptorOrDie(Class<? extends Describable> describableType)
      Works just like getDescriptor(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

      @CheckForNull public Descriptor getDescriptor(Class<? extends Describable> describableType)
      Gets the Descriptor that corresponds to the given Describable type.

      If you have an instance of type and call Describable.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

      public boolean hasPermission(Permission permission)
      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

      public boolean hasPermission(Permission permission, @CheckForNull Job<?,?> project)
      Checks if the current security principal has this permission for the specified project.
      Parameter:
      permission - the permission to check for
      project - the project to check the permissions for
      Gibt zurück:
      false if the user doesn't have the permission
    • hasPermission

      public boolean hasPermission(Permission permission, @CheckForNull View view)
      Checks if the current security principal has this permission for the specified view.
      Parameter:
      permission - the permission to check for
      view - 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 for
      accessControlled - the access controlled object to check the permissions for
      Gibt zurück:
      false if the user doesn't have the permission
    • hasPermission

      public boolean hasPermission(Permission permission, @CheckForNull AbstractItem item)
      Checks if the current security principal has this permission for the specified item.
      Parameter:
      permission - the permission to check for
      item - the item to check the permissions for
      Gibt zurück:
      false if the user doesn't have the permission
    • getJob

      public Optional<Job<?,?>> getJob(String name)
      Gets a Job by its full name. Full names are like path names, where each name of Item 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

      public Optional<Run<?,?>> getBuild(String id)
      Gets a build 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

      @Deprecated public String getImagePath(BallColor color)
      Veraltet.
      BallColor should not be used anymore, use the icon tag in jelly views or the icon class name of BallColor
      Returns the absolute URL for the specified ball icon.
      Parameter:
      color - the color
      Gibt zurück:
      the absolute URL
    • getSymbol

      public String getSymbol(SymbolRequest symbol)
      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

      public String getImagePath(String icon)
      Returns the absolute URL for the specified icon.
      Parameter:
      icon - the icon URL
      Gibt zurück:
      the absolute URL
    • getAbsoluteUrl

      public String getAbsoluteUrl(String... urlElements)
      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

      public Set<String> getAllJobNames()
      Returns the full names of all available jobs. The full name is given by AbstractItem.getFullName().
      Gibt zurück:
      the full names of all jobs
    • getAllJobs

      public List<Job> getAllJobs()
      Returns all available jobs.
      Gibt zurück:
      all jobs
    • getFullNameOf

      public String getFullNameOf(Job<?,?> job)
      Returns the full name of the specified job.
      Parameter:
      job - the job to get the name for
      Gibt zurück:
      the full name
    • isPluginInstalled

      public boolean isPluginInstalled(String pluginId)
      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

      public String 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