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:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FailureCause.FailureCauseDescriptor
Descriptor is only used for auto completion of categories.
-
Constructor Summary
Constructors Constructor Description FailureCause()
Default 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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addIndication(Indication indication)
Adds an indication to the list.FormValidation
doCheckDescription(String value)
Deprecated.FormValidation
doCheckName(String value)
Deprecated.void
doConfigSubmit(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
The form submission handler.CauseManagement
getAncestorCauseManagement()
Finds theCauseManagement
ancestor of thecurrent request
.Date
getAndInitiateLastOccurred()
Initiates the last occurrence if it's not already initiated and then returns the date of last modification.List<FailureCauseModification>
getAndInitiateModifications()
Initiates the list of modifications if it's not already initiated and then returns the list.List<String>
getCategories()
Getter for the categories.String
getCategoriesAsString()
Returns the categories as a String, used for the view.String
getComment()
Getter for the comment.String
getDescription()
Getter for the description.FailureCause.FailureCauseDescriptor
getDescriptor()
String
getDisplayName()
String
getIconFileName()
String
getId()
The id.List<Indication>
getIndications()
Getter for the list of indications.Date
getLastOccurred()
Getter for the last occurrence.FailureCauseModification
getLatestModification()
Gets the latestFailureCauseModification
of this FailureCause.List<FailureCauseModification>
getModifications()
Getter for the list of modifications.String
getName()
Getter for the name.String
getUrlName()
void
setCategories(List<String> categories)
Setter for the categories.void
setId(String id)
The id.void
setLastOccurred(Date lastOccurred)
Setter for the last occurrence.FormValidation
validate(String newName, String newDescription, List<Indication> newIndications)
Validates this FailureCause.
-
-
-
Constructor Detail
-
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
public FailureCause(String name, String description)
Standard constructor.- Parameters:
name
- the name of this FailureCause.description
- the description of this FailureCause.
-
FailureCause
public FailureCause(String name, String description, String comment)
Standard constructor.- Parameters:
name
- the name of this FailureCause.description
- the description of this FailureCause.comment
- the comment for this FailureCause.
-
FailureCause
public FailureCause(String name, String description, String comment, String categories)
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 Detail
-
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 public FormValidation doCheckDescription(@QueryParameter String value)
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 public FormValidation doCheckName(@QueryParameter String value)
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.StaplerRequest request, org.kohsuke.stapler.StaplerResponse 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
public void addIndication(Indication indication)
Adds an indication to the list.- Parameters:
indication
- the indication to add.
-
getId
public String getId()
The id.- Returns:
- the id.
-
setId
public void setId(String id)
The id.- Parameters:
id
- the id.
-
getName
public String getName()
Getter for the name.- Specified by:
getName
in interfaceIFailureCauseMetricData
- Returns:
- the name.
-
getDescription
public String getDescription()
Getter for the description.- Returns:
- the description.
-
getComment
public String getComment()
Getter for the comment.- Returns:
- the comment.
-
getLastOccurred
public Date getLastOccurred()
Getter for the last occurrence.- Returns:
- the last occurrence.
-
getAndInitiateLastOccurred
public Date getAndInitiateLastOccurred()
Initiates the last occurrence if it's not already initiated and then returns the date of last modification.- Returns:
- the last occurrence.
-
setLastOccurred
public void setLastOccurred(Date lastOccurred)
Setter for the last occurrence.- Parameters:
lastOccurred
- the occurrence to set.
-
getModifications
public List<FailureCauseModification> getModifications()
Getter for the list of modifications.- Returns:
- the modifications.
-
getAndInitiateModifications
public List<FailureCauseModification> getAndInitiateModifications()
Initiates the list of modifications if it's not already initiated and then returns the list.- Returns:
- list of modifications
-
getCategories
public List<String> getCategories()
Getter for the categories.- Specified by:
getCategories
in interfaceIFailureCauseMetricData
- Returns:
- the categories.
-
getCategoriesAsString
public String getCategoriesAsString()
Returns the categories as a String, used for the view.- Returns:
- the categories as a String.
-
getLatestModification
public FailureCauseModification getLatestModification()
Gets the latestFailureCauseModification
of this FailureCause.- Returns:
- the latest modification
-
setCategories
public void setCategories(List<String> categories)
Setter for the categories.- Parameters:
categories
- the categories.
-
getIndications
public List<Indication> getIndications()
Getter for the list of indications.- Returns:
- the list.
-
getAncestorCauseManagement
public CauseManagement 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
public String getIconFileName()
- Specified by:
getIconFileName
in interfaceAction
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getUrlName
public String getUrlName()
- Specified by:
getUrlName
in interfaceAction
-
getDescriptor
public FailureCause.FailureCauseDescriptor getDescriptor()
- Specified by:
getDescriptor
in interfaceDescribable<FailureCause>
-
-