Class ResultAction
- java.lang.Object
-
- io.jenkins.plugins.analysis.core.model.ResultAction
-
- All Implemented Interfaces:
Action
,HealthReportingAction
,ModelObject
,Serializable
,RunAction2
,SimpleBuildStep.LastBuildAction
,org.kohsuke.stapler.StaplerProxy
public class ResultAction extends Object implements HealthReportingAction, SimpleBuildStep.LastBuildAction, RunAction2, org.kohsuke.stapler.StaplerProxy, Serializable
Controls the life cycle of the analysis results in a job. This action persists the results of a build and displays a summary on the build page. The actual visualization of the results is defined in the matchingsummary.jelly
file. This action also provides access to the static analysis details: these are rendered using a newIssuesDetail
instance.- Author:
- Ullrich Hafner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ResultAction(Run<?,?> owner, AnalysisResult result, HealthDescriptor healthDescriptor, String id, String name, Charset charset)
Creates a new instance ofResultAction
.ResultAction(Run<?,?> owner, AnalysisResult result, HealthDescriptor healthDescriptor, String id, String name, Charset charset, TrendChartType trendChartType)
Creates a new instance ofResultAction
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description History
createBuildHistory()
Returns the build history for this action.boolean
equals(Object o)
String
getAbsoluteUrl()
Gets the absolute path to the build from the owner.HealthReport
getBuildHealth()
String
getDisplayName()
String
getIconFileName()
String
getId()
Returns the ID (and URL) of this action.StaticAnalysisLabelProvider
getLabelProvider()
Returns theStaticAnalysisLabelProvider
for this action.String
getLargeImageName()
Returns the URL of the 48x48 image used in the build summary.String
getName()
Returns the name of the static analysis tool.Run<?,?>
getOwner()
Returns the associated build/run that created the static analysis result.Collection<? extends Action>
getProjectActions()
String
getRelativeUrl()
Returns the URL of this action, relative to the context root of Jenkins.AnalysisResult
getResult()
String
getSmallImage()
Returns the URL of the 24x24 image used in the build link.String
getSmallImageName()
Returns the URL of the 24x24 image used in the build link.String
getSummary()
Returns a summary message of the static analysis run.Object
getTarget()
Returns the detail view for issues for all Stapler requests.String
getUrlName()
int
hashCode()
boolean
hasLargeImage()
Returns whether a large image is defined.boolean
isSuccessful()
Returns whether the static analysis result is considered successfully with respect to the usedQualityGateEvaluator
.void
onAttached(Run<?,?> r)
void
onLoad(Run<?,?> r)
protected Object
readResolve()
Called after de-serialization to retain backward compatibility.String
resetReference()
Empty method as workaround for Stapler bug: JavaScript method in target object is not found.String
toString()
-
-
-
Constructor Detail
-
ResultAction
public ResultAction(Run<?,?> owner, AnalysisResult result, HealthDescriptor healthDescriptor, String id, String name, Charset charset)
Creates a new instance ofResultAction
.- Parameters:
owner
- the associated build/run that created the static analysis resultresult
- the result of the static analysis runhealthDescriptor
- the health descriptor of the static analysis runid
- the ID of the resultsname
- the optional name of the resultscharset
- the charset to use to display source files
-
ResultAction
public ResultAction(Run<?,?> owner, AnalysisResult result, HealthDescriptor healthDescriptor, String id, String name, Charset charset, TrendChartType trendChartType)
Creates a new instance ofResultAction
.- Parameters:
owner
- the associated build/run that created the static analysis resultresult
- the result of the static analysis runhealthDescriptor
- the health descriptor of the static analysis runid
- the ID of the resultsname
- the optional name of the resultscharset
- the charset to use to display source filestrendChartType
- determines if the trend chart will be shown
-
-
Method Detail
-
readResolve
protected Object readResolve()
Called after de-serialization to retain backward compatibility.- Returns:
- this
-
getId
public String getId()
Returns the ID (and URL) of this action.- Returns:
- the ID
-
getName
public String getName()
Returns the name of the static analysis tool.- Returns:
- the ID
-
getOwner
public Run<?,?> getOwner()
Returns the associated build/run that created the static analysis result.- Returns:
- the run
-
createBuildHistory
public History createBuildHistory()
Returns the build history for this action.- Returns:
- the history
-
onAttached
public void onAttached(Run<?,?> r)
- Specified by:
onAttached
in interfaceRunAction2
-
onLoad
public void onLoad(Run<?,?> r)
- Specified by:
onLoad
in interfaceRunAction2
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getUrlName
public String getUrlName()
- Specified by:
getUrlName
in interfaceAction
-
getRelativeUrl
public String getRelativeUrl()
Returns the URL of this action, relative to the context root of Jenkins.- Returns:
- the relative URL, like job/foo/32/analysis/
-
getAbsoluteUrl
public String getAbsoluteUrl()
Gets the absolute path to the build from the owner. This is needed for testing due toRun.getAbsoluteUrl()
being final and therefore not mockable.- Returns:
- the absolute url to the job
-
getBuildHealth
@CheckForNull public HealthReport getBuildHealth()
- Specified by:
getBuildHealth
in interfaceHealthReportingAction
-
getProjectActions
public Collection<? extends Action> getProjectActions()
- Specified by:
getProjectActions
in interfaceSimpleBuildStep.LastBuildAction
-
getResult
public AnalysisResult getResult()
-
getIconFileName
public String getIconFileName()
- Specified by:
getIconFileName
in interfaceAction
-
hasLargeImage
public boolean hasLargeImage()
Returns whether a large image is defined.- Returns:
true
if a large image is defined,false
otherwise
-
getLargeImageName
public String getLargeImageName()
Returns the URL of the 48x48 image used in the build summary.- Returns:
- the URL of the image
-
getSmallImageName
public String getSmallImageName()
Returns the URL of the 24x24 image used in the build link.- Returns:
- the URL of the image
-
getSmallImage
public String getSmallImage()
Returns the URL of the 24x24 image used in the build link.- Returns:
- the URL of the image
-
getSummary
public String getSummary()
Returns a summary message of the static analysis run. This message is shown in the 'summary.jelly' view.- Returns:
- summary message (HTML)
-
isSuccessful
public boolean isSuccessful()
Returns whether the static analysis result is considered successfully with respect to the usedQualityGateEvaluator
.- Returns:
true
if the result is successful,false
if the result has been set toResult.UNSTABLE
orResult.FAILURE
.- See Also:
QualityGateEvaluator
-
getLabelProvider
public StaticAnalysisLabelProvider getLabelProvider()
Returns theStaticAnalysisLabelProvider
for this action.- Returns:
- the label provider for this tool
-
getTarget
public Object getTarget()
Returns the detail view for issues for all Stapler requests.- Specified by:
getTarget
in interfaceorg.kohsuke.stapler.StaplerProxy
- Returns:
- the detail view for issues
-
resetReference
@JavaScriptMethod public String resetReference()
Empty method as workaround for Stapler bug: JavaScript method in target object is not found.- Returns:
- unused string (since Firefox requires that Ajax calls return something)
-
-