Klasse CoverageViewModel

java.lang.Object
io.jenkins.plugins.datatables.DefaultAsyncTableContentProvider
io.jenkins.plugins.coverage.metrics.steps.CoverageViewModel
Alle implementierten Schnittstellen:
ModelObject, io.jenkins.plugins.datatables.AsyncTableContentProvider

public class CoverageViewModel extends io.jenkins.plugins.datatables.DefaultAsyncTableContentProvider implements ModelObject
Server side model that provides the data for the details view of the coverage results. The layout of the associated view is defined corresponding jelly view 'index.jelly'.
Autor:
Ullrich Hafner, Florian Orendi
  • Methodendetails

    • getId

      public String getId()
    • getOwner

      public Run<?,?> getOwner()
    • getNode

      public edu.hm.hafner.coverage.Node getNode()
    • getFormatter

      public ElementFormatter getFormatter()
    • getTreeMetrics

      public NavigableSet<edu.hm.hafner.coverage.Metric> getTreeMetrics()
      Returns the value metrics that should be visualized in a tree map.
      Gibt zurück:
      the value metrics
    • getDisplayName

      public String getDisplayName()
      Angegeben von:
      getDisplayName in Schnittstelle ModelObject
    • getApi

      public Api getApi()
      Gets the remote API for this action. Depending on the path, a different result is selected.
      Gibt zurück:
      the remote API
    • getJenkinsColorIDs

      @JavaScriptMethod public Set<String> getJenkinsColorIDs()
      Gets a set of color IDs which can be used to dynamically load the defined Jenkins colors.
      Gibt zurück:
      the available color IDs
    • setJenkinsColors

      @JavaScriptMethod public void setJenkinsColors(String colors)
      Creates a new ColorProvider based on the passed color json string which contains the set Jenkins colors.
      Parameter:
      colors - The dynamically loaded Jenkins colors to be used for highlighting the coverage tree as json string
    • getOverview

      @JavaScriptMethod public CoverageViewModel.CoverageOverview getOverview()
    • getTrendChart

      @JavaScriptMethod public String getTrendChart(String configuration)
      Returns the trend chart configuration.
      Parameter:
      configuration - JSON object to configure optional properties for the trend chart
      Gibt zurück:
      the trend chart model (converted to a JSON string)
    • getCoverageTree

      @JavaScriptMethod public edu.hm.hafner.echarts.LabeledTreeMapNode getCoverageTree(String coverageMetric)
      Returns the root of the tree of nodes for the ECharts treemap. This tree is used as a model for the chart on the client side.
      Parameter:
      coverageMetric - the used coverage metric (line, branch, instruction, mutation)
      Gibt zurück:
      the tree of nodes for the ECharts treemap
    • getTableModel

      public io.jenkins.plugins.datatables.TableModel getTableModel(String tableId)
      Returns the table model that matches with the passed table ID and shows the files along with the branch and line coverage.
      Angegeben von:
      getTableModel in Schnittstelle io.jenkins.plugins.datatables.AsyncTableContentProvider
      Parameter:
      tableId - ID of the table model
      Gibt zurück:
      the table model with the specified ID
    • getUrlForBuild

      @JavaScriptMethod public String getUrlForBuild(String selectedBuildDisplayName, String currentUrl)
      Returns the URL for coverage results of the selected build. Based on the current URL, the new URL will be composed by replacing the current build number with the selected build number.
      Parameter:
      selectedBuildDisplayName - the selected build to open the new results for
      currentUrl - the absolute URL to this details view results
      Gibt zurück:
      the URL to the results or an empty string if the results are not available
    • getSourceCode

      @JavaScriptMethod public String getSourceCode(String fileHash, String tableId)
      Gets the source code of the file which is represented by the passed hash code. The coverage of the source code is highlighted by using HTML. Depending on the passed table ID, the source code is returned filtered with only the relevant lines of code.
      Parameter:
      fileHash - The hash code of the requested file
      tableId - The ID of the source file table
      Gibt zurück:
      the highlighted source code
    • hasSourceCode

      @JavaScriptMethod public boolean hasSourceCode()
      Checks whether source files are stored.
      Gibt zurück:
      true when source files are stored, false otherwise
    • hasModifiedLinesCoverage

      public boolean hasModifiedLinesCoverage()
      Checks whether modified lines coverage exists.
      Gibt zurück:
      true whether modified lines coverage exists, else false
    • hasIndirectCoverageChanges

      public boolean hasIndirectCoverageChanges()
      Checks whether indirect coverage changes exist.
      Gibt zurück:
      true whether indirect coverage changes exist, else false
    • isSourceFileAvailable

      public boolean isSourceFileAvailable(edu.hm.hafner.coverage.FileNode coverageNode)
      Returns whether the source file is available in Jenkins build folder.
      Parameter:
      coverageNode - The Node which is checked if there is a source file available
      Gibt zurück:
      true if the source file is available, false otherwise
    • getDynamic

      @CheckForNull public Object getDynamic(String link, org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
      Returns a new subpage for the selected link.
      Parameter:
      link - the link to identify the subpage to show
      request - Stapler request
      response - Stapler response
      Gibt zurück:
      the new subpage