Class FailureCause
java.lang.Object
com.sonyericsson.jenkins.plugins.bfa.model.FailureCause
- All Implemented Interfaces:
IFailureCauseMetricData
,Action
,Describable<FailureCause>
,ModelObject
,Serializable
public class FailureCause
extends Object
implements Serializable, Action, Describable<FailureCause>, IFailureCauseMetricData
FailureCause of a build.
- Author:
- Tomas Westling <thomas.westling@sonyericsson.com>
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Descriptor is only used for auto completion of categories. -
Constructor Summary
ConstructorDescriptionDefault constructor.FailureCause
(String name, String description) Standard constructor.FailureCause
(String name, String description, String comment) Standard constructor.FailureCause
(String name, String description, String comment, String categories) Standard constructor.FailureCause
(String id, String name, String description, String comment, Date lastOccurred, String categories, List<Indication> indications, List<FailureCauseModification> modifications) Standard data bound constructor.FailureCause
(String id, String name, String description, String comment, Date lastOccurred, List<String> categories, List<Indication> indications, List<FailureCauseModification> modifications) JSON constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addIndication
(Indication indication) Adds an indication to the list.doCheckDescription
(String value) Deprecated.doCheckName
(String value) Deprecated.void
doConfigSubmit
(org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) The form submission handler.Finds theCauseManagement
ancestor of thecurrent request
.Initiates the last occurrence if it's not already initiated and then returns the date of last modification.Initiates the list of modifications if it's not already initiated and then returns the list.Getter for the categories.Returns the categories as a String, used for the view.Getter for the comment.Getter for the description.getId()
The id.Getter for the list of indications.Getter for the last occurrence.Gets the latestFailureCauseModification
of this FailureCause.Getter for the list of modifications.getName()
Getter for the name.void
setCategories
(List<String> categories) Setter for the categories.void
The id.void
setLastOccurred
(Date lastOccurred) Setter for the last occurrence.validate
(String newName, String newDescription, List<Indication> newIndications) Validates this FailureCause.
-
Constructor Details
-
FailureCause
@DataBoundConstructor public FailureCause(String id, String name, String description, String comment, Date lastOccurred, String categories, List<Indication> indications, List<FailureCauseModification> modifications) Standard data bound constructor.- Parameters:
id
- the id.name
- the name of this FailureCause.description
- the description of this FailureCause.comment
- the comment of this FailureCause.lastOccurred
- the time at which this FailureCause last occurred.categories
- the categories of this FailureCause.indications
- the list of indicationsmodifications
- the modification history of this FailureCause.
-
FailureCause
public FailureCause(String id, String name, String description, String comment, Date lastOccurred, List<String> categories, List<Indication> indications, List<FailureCauseModification> modifications) JSON constructor.- Parameters:
id
- the id.name
- the name of this FailureCause.description
- the description of this FailureCause.comment
- the comment of this FailureCause.lastOccurred
- the last time this FailureCause occurred.categories
- the categories of this FailureCause.indications
- the list of indicationsmodifications
- the modification history of this FailureCause.
-
FailureCause
Standard constructor.- Parameters:
name
- the name of this FailureCause.description
- the description of this FailureCause.
-
FailureCause
Standard constructor.- Parameters:
name
- the name of this FailureCause.description
- the description of this FailureCause.comment
- the comment for this FailureCause.
-
FailureCause
Standard constructor.- Parameters:
name
- the name of this FailureCause.description
- the description of this FailureCause.comment
- the comment for this FailureCause.categories
- the categories of this FailureCause.
-
FailureCause
public FailureCause()Default constructor. Do not use this unless you are a serializer.
-
-
Method Details
-
validate
public FormValidation validate(String newName, String newDescription, List<Indication> newIndications) Validates this FailureCause. Checks for:FailureCause.FailureCauseDescriptor.doCheckName(String, String)
,FailureCause.FailureCauseDescriptor.doCheckDescription(String)
, Indications.size > 0. andIndication.validate()
.- Parameters:
newName
- the name to validatenewDescription
- the descriptionnewIndications
- the list of indications- Returns:
FormValidation.ok()
if everything is fine.
-
doCheckDescription
Deprecated.Form validation fordescription
. Checks for not empty and not "Description..."- Parameters:
value
- the form value.- Returns:
FormValidation.ok()
if everything is well.
-
doCheckName
Deprecated.Form validation forname
. Checks for not empty, not "New...",Jenkins.checkGoodName(String)
and that it is unique based on the cache of existing causes.- Parameters:
value
- the form value.- Returns:
FormValidation.ok()
if everything is well.
-
doConfigSubmit
public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) throws Exception The form submission handler. Takes the input form and stores the data. Called by Stapler.- Parameters:
request
- the request.response
- the response- Throws:
Exception
- if it fails to save to the knowledge base or a validation error occurs.
-
addIndication
Adds an indication to the list.- Parameters:
indication
- the indication to add.
-
getId
The id.- Returns:
- the id.
-
setId
The id.- Parameters:
id
- the id.
-
getName
Getter for the name.- Specified by:
getName
in interfaceIFailureCauseMetricData
- Returns:
- the name.
-
getDescription
Getter for the description.- Returns:
- the description.
-
getComment
Getter for the comment.- Returns:
- the comment.
-
getLastOccurred
Getter for the last occurrence.- Returns:
- the last occurrence.
-
getAndInitiateLastOccurred
Initiates the last occurrence if it's not already initiated and then returns the date of last modification.- Returns:
- the last occurrence.
-
setLastOccurred
Setter for the last occurrence.- Parameters:
lastOccurred
- the occurrence to set.
-
getModifications
Getter for the list of modifications.- Returns:
- the modifications.
-
getAndInitiateModifications
Initiates the list of modifications if it's not already initiated and then returns the list.- Returns:
- list of modifications
-
getCategories
Getter for the categories.- Specified by:
getCategories
in interfaceIFailureCauseMetricData
- Returns:
- the categories.
-
getCategoriesAsString
Returns the categories as a String, used for the view.- Returns:
- the categories as a String.
-
getLatestModification
Gets the latestFailureCauseModification
of this FailureCause.- Returns:
- the latest modification
-
setCategories
Setter for the categories.- Parameters:
categories
- the categories.
-
getIndications
Getter for the list of indications.- Returns:
- the list.
-
getAncestorCauseManagement
Finds theCauseManagement
ancestor of thecurrent request
.- Returns:
- the management action or a derivative of it, or null if no management action is found.
- Throws:
IllegalStateException
- if no ancestor is found.
-
getIconFileName
- Specified by:
getIconFileName
in interfaceAction
-
getDisplayName
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getUrlName
- Specified by:
getUrlName
in interfaceAction
-
getDescriptor
- Specified by:
getDescriptor
in interfaceDescribable<FailureCause>
-
FailureCause.FailureCauseDescriptor.doCheckDescription(String)
instead