org.jenkinsci.plugins.buildenvironment.actions
Class BuildEnvironmentBuildAction

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.Actionable
          extended by org.jenkinsci.plugins.buildenvironment.actions.BuildEnvironmentBuildAction
All Implemented Interfaces:
hudson.model.Action, hudson.model.ModelObject, hudson.search.SearchableModelObject, hudson.search.SearchItem, jenkins.model.ModelObjectWithContextMenu

public class BuildEnvironmentBuildAction
extends hudson.model.Actionable
implements hudson.model.Action

Main class for this plugin. Contains most of the functionality. Here also reside all method used for visualizing information(used in index.jelly, summary.jelly, environment_export.jelly). The class implements an Action that is added to every build on its completion. The action is added by build.addAction() (see EnvironmentDataWriter class), meaning it is persistent.

Author:
yboev

Nested Class Summary
 
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
jenkins.model.ModelObjectWithContextMenu.ContextMenu, jenkins.model.ModelObjectWithContextMenu.MenuItem
 
Constructor Summary
BuildEnvironmentBuildAction(hudson.model.Run<?,?> build)
          Constructor method.
 
Method Summary
 void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Method to populate values and implement functionality of a HTML form.
 hudson.model.AbstractProject<?,?> getAbstractProject()
          Returns the parent of this build.
 String getBackgroundColor(boolean change)
          Return the background color according to a boolean value.
 hudson.model.AbstractBuild<?,?> getBuild()
          Return the current build.
 hudson.model.AbstractBuild<?,?> getBuild1()
          Passes the build1 Attribute.
 hudson.model.AbstractBuild<?,?> getBuild2()
          Passes the build2 Attribute.
 hudson.util.RunList<?> getBuilds()
          Returns all build for the current project.
 List<hudson.model.AbstractBuild<?,?>> getBuildsWithAction()
          Returns all build for the current project that have this Action listed.
 List<Data> getDataHoldersList()
          Returns the list with Data objects.
 List<DataDifferenceObject> getDifference()
          Returns a list with DataDifferenceObjects representing the difference between build1 nad build2 set for this Action.
 int getDifferentCount(Data data)
          Returns the number of different entries between Data object for this build and a given Data object.
 String getDisplayName()
          Display name for this Action.
 ArrayList<String> getEnvironmentVariablesForExport()
          Returns all environment variables defined in this build as a list, ready to be exportedin bash for example.
 String getIconFileName()
          Icon file for this Action.
 hudson.model.Job<?,?> getProject()
          Returns the parent of this build.
 String getSearchUrl()
          Search url for this Acion.
 String getSummaryIconFilename()
          Summary icon file for this Action.
 String getUrlName()
          Url for this Action.
 boolean isDifferentFromPrevious(Data data, String key)
          Checks if a given entry in a given Data object is different from what has been recorded in the previous build.
 boolean isOnlyDifference()
          Passes the value of diffOption.
 String trueFalseToYesNo(boolean value)
          Converts true/false -> yes/no.
 
Methods inherited from class hudson.model.Actionable
addAction, doContextMenu, getAction, getAction, getActions, getActions, getDynamic
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuildEnvironmentBuildAction

public BuildEnvironmentBuildAction(hudson.model.Run<?,?> build)
Constructor method.

Parameters:
build - build for which the action is constructed.
Method Detail

getDisplayName

public String getDisplayName()
Display name for this Action.

Specified by:
getDisplayName in interface hudson.model.Action
Specified by:
getDisplayName in interface hudson.model.ModelObject
Returns:
display name as String.

getIconFileName

public String getIconFileName()
Icon file for this Action.

Specified by:
getIconFileName in interface hudson.model.Action
Returns:
icon url as String.

getSummaryIconFilename

public String getSummaryIconFilename()
Summary icon file for this Action.

Returns:
the file as String.

getUrlName

public String getUrlName()
Url for this Action.

Specified by:
getUrlName in interface hudson.model.Action
Returns:
urls as String.

getSearchUrl

public String getSearchUrl()
Search url for this Acion.

Specified by:
getSearchUrl in interface hudson.search.SearchItem
Returns:
search url as String.

getDataHoldersList

public List<Data> getDataHoldersList()
Returns the list with Data objects.

Returns:
list with every Data object for this build.

trueFalseToYesNo

public String trueFalseToYesNo(boolean value)
Converts true/false -> yes/no.

Parameters:
value - boolean to be converted.
Returns:
if value was true then "yes", otherwise "no".

getBuildsWithAction

public List<hudson.model.AbstractBuild<?,?>> getBuildsWithAction()
Returns all build for the current project that have this Action listed.

Returns:
list of AbstractBuild objects.

getEnvironmentVariablesForExport

public ArrayList<String> getEnvironmentVariablesForExport()
Returns all environment variables defined in this build as a list, ready to be exportedin bash for example. There are 2 entries for every variable, the first assings a value and the second exports the variable. example: FOO=123 export FOO

Returns:
a list containing the two lines for every variable.

getBuilds

public hudson.util.RunList<?> getBuilds()
Returns all build for the current project.

Returns:
all builds as list.

getBuild

public hudson.model.AbstractBuild<?,?> getBuild()
Return the current build.

Returns:
the current build as AbstractBuild object.

getProject

public hudson.model.Job<?,?> getProject()
Returns the parent of this build.

Returns:
the current project as Job object.

getAbstractProject

public hudson.model.AbstractProject<?,?> getAbstractProject()
Returns the parent of this build.

Returns:
the current project as Abstractproject

doConfigSubmit

public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req,
                           org.kohsuke.stapler.StaplerResponse rsp)
                    throws IOException,
                           javax.servlet.ServletException
Method to populate values and implement functionality of a HTML form. The form can be found in index.jelly.

Parameters:
req - the Request
rsp - the Response
Throws:
IOException - read problem
javax.servlet.ServletException - servlet problem

isOnlyDifference

public boolean isOnlyDifference()
Passes the value of diffOption.

Returns:
same as diffOption, false if diffOption is null.

getBuild1

public hudson.model.AbstractBuild<?,?> getBuild1()
Passes the build1 Attribute.

Returns:
the build1 object.

getBuild2

public hudson.model.AbstractBuild<?,?> getBuild2()
Passes the build2 Attribute.

Returns:
the build2 object.

getBackgroundColor

public String getBackgroundColor(boolean change)
Return the background color according to a boolean value.

Parameters:
change - the boolean value indicating if there was a change is an entry.
Returns:
the corresponding color as String.

getDifferentCount

public int getDifferentCount(Data data)
Returns the number of different entries between Data object for this build and a given Data object. Note that the two Data objects should have the same name. If no such 2 objects exist then zero is returned as difference count.

Parameters:
data - the Data object.
Returns:
number of difference entries as int.

isDifferentFromPrevious

public boolean isDifferentFromPrevious(Data data,
                                       String key)
Checks if a given entry in a given Data object is different from what has been recorded in the previous build.

Parameters:
data - the Data object.
key - the key Object.
Returns:
true if they are different, false otherwise.

getDifference

public List<DataDifferenceObject> getDifference()
Returns a list with DataDifferenceObjects representing the difference between build1 nad build2 set for this Action.

Returns:
the list with difference objects.


Copyright © 2004-2013. All Rights Reserved.