com.sonyericsson.jenkins.plugins.bfa.model
Class FailureCause

java.lang.Object
  extended by com.sonyericsson.jenkins.plugins.bfa.model.FailureCause
All Implemented Interfaces:
hudson.model.Action, hudson.model.Describable<FailureCause>, hudson.model.ModelObject, Serializable

public class FailureCause
extends Object
implements Serializable, hudson.model.Action, hudson.model.Describable<FailureCause>

FailureCause of a build.

Author:
Tomas Westling <thomas.westling@sonyericsson.com>
See Also:
Serialized Form

Nested Class Summary
static class FailureCause.FailureCauseDescriptor
          Descriptor is only used for auto completion of categories.
 
Constructor Summary
FailureCause()
          Default constructor.
FailureCause(String name, String description)
          Standard constructor.
FailureCause(String id, String name, String description, List<String> categories, List<Indication> indications)
          JSON constructor.
FailureCause(String id, String name, String description, String categories, List<Indication> indications)
          Standard data bound constructor.
 
Method Summary
 void addIndication(Indication indication)
          Adds an indication to the list.
 hudson.util.FormValidation doCheckDescription(String value)
          Form validation for description.
 hudson.util.FormValidation doCheckName(String value)
          Form validation for name.
 void doConfigSubmit(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          The form submission handler.
 CauseManagement getAncestorCauseManagement()
          Finds the CauseManagement ancestor of the current request.
 List<String> getCategories()
          Getter for the categories.
 String getCategoriesAsString()
          Returns the categories as a String, used for the view.
 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.
 String getName()
          Getter for the name.
 String getUrlName()
           
 void setCategories(List<String> categories)
          Setter for the categories.
 void setId(String id)
          The id.
 hudson.util.FormValidation validate(String newName, String newDescription, List<Indication> newIndications)
          Validates this FailureCause.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FailureCause

@DataBoundConstructor
public FailureCause(String id,
                                         String name,
                                         String description,
                                         String categories,
                                         List<Indication> indications)
Standard data bound constructor.

Parameters:
id - the id.
name - the name of this FailureCause.
description - the description of this FailureCause.
categories - the categories of this FailureCause.
indications - the list of indications

FailureCause

public FailureCause(String id,
                    String name,
                    String description,
                    List<String> categories,
                    List<Indication> indications)
JSON constructor.

Parameters:
id - the id.
name - the name of this FailureCause.
description - the description of this FailureCause.
categories - the categories of this FailureCause.
indications - the list of indications

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()
Default constructor. Do not use this unless you are a serializer.

Method Detail

validate

public hudson.util.FormValidation validate(String newName,
                                           String newDescription,
                                           List<Indication> newIndications)
Validates this FailureCause. Checks for: doCheckName(String), doCheckDescription(String), Indications.size > 0. and Indication.validate().

Parameters:
newName - the name to validate
newDescription - the description
newIndications - the list of indications
Returns:
FormValidation.ok() if everything is fine.

doCheckDescription

public hudson.util.FormValidation doCheckDescription(@QueryParameter
                                                     String value)
Form validation for description. Checks for not empty and not "Description..."

Parameters:
value - the form value.
Returns:
FormValidation.ok() if everything is well.

doCheckName

public hudson.util.FormValidation doCheckName(@QueryParameter
                                              String value)
Form validation for name. 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.

Returns:
the name.

getDescription

public String getDescription()
Getter for the description.

Returns:
the description.

getCategories

public List<String> getCategories()
Getter for the categories.

Returns:
the categories.

getCategoriesAsString

public String getCategoriesAsString()
Returns the categories as a String, used for the view.

Returns:
the categories as a String.

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 the CauseManagement ancestor of the current 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 interface hudson.model.Action

getDisplayName

public String getDisplayName()
Specified by:
getDisplayName in interface hudson.model.Action
Specified by:
getDisplayName in interface hudson.model.ModelObject

getUrlName

public String getUrlName()
Specified by:
getUrlName in interface hudson.model.Action

getDescriptor

public FailureCause.FailureCauseDescriptor getDescriptor()
Specified by:
getDescriptor in interface hudson.model.Describable<FailureCause>


Copyright © 2004-2014. All Rights Reserved.