hudson.plugins.promoted_builds
Class Status

java.lang.Object
  extended by hudson.plugins.promoted_builds.Status

public final class Status
extends java.lang.Object

Promotion status of a build wrt a specific PromotionProcess.

Author:
Kohsuke Kawaguchi
See Also:
PromotedBuildAction.statuses

Field Summary
 java.lang.String name
          Matches with AbstractItem.name.
 java.util.Calendar timestamp
          When did the build qualify for a promotion?
 
Constructor Summary
Status(PromotionProcess process, java.util.Collection<? extends PromotionBadge> badges)
           
 
Method Summary
 void buildEnvVars(hudson.model.AbstractBuild<?,?> build, hudson.EnvVars env)
          Called by Promotion to allow status to contribute environment variables.
 void doBuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Schedules a new build.
 java.util.List<PromotionBadge> getBadges()
          Gets the badges indicating how did a build qualify for a promotion.
 java.lang.String getDelayString(hudson.model.AbstractBuild<?,?> owner)
          Gets the string that says how long did it toook for this build to be promoted.
 java.lang.String getIcon(java.lang.String size)
          Gets the icon that should represent this promotion (that is potentially attempted but failed.)
 Promotion getLast()
           
 Promotion getLastFailed()
          Gets the last successful Promotion.
 Promotion getLastSuccessful()
          Gets the last successful Promotion.
 java.lang.String getName()
           
 PromotedBuildAction getParent()
          Gets the parent Status that owns this object.
 PromotionProcess getProcess()
          Gets the PromotionProcess that this object deals with.
 Promotion getPromotionBuild(int number)
          Gets the promotion build by build number.
 java.util.List<Promotion> getPromotionBuilds()
          Gets all the promotion builds.
 Promotion getSuccessfulPromotion(JobPropertyImpl jp)
          Returns the Promotion object that represents the successful promotion.
 hudson.model.AbstractBuild<?,?> getTarget()
          Gets the build that was qualified for a promotion.
 java.lang.String getTimestampString()
          Gets the string that says how long since this promotion had happened.
 boolean isFor(PromotionProcess process)
           
 boolean isInQueue()
          Returns true if the promotion for this is pending in the queue, waiting to be executed.
 boolean isPromotionAttempted()
          Returns true if at least one Promotion activity is attempted.
 boolean isPromotionSuccessful()
          Returns true if the promotion was successfully completed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

public final java.lang.String name
Matches with AbstractItem.name.


timestamp

public final java.util.Calendar timestamp
When did the build qualify for a promotion?

Constructor Detail

Status

public Status(PromotionProcess process,
              java.util.Collection<? extends PromotionBadge> badges)
Method Detail

getName

public java.lang.String getName()

getParent

public PromotedBuildAction getParent()
Gets the parent Status that owns this object.


getProcess

public PromotionProcess getProcess()
Gets the PromotionProcess that this object deals with.


getIcon

public java.lang.String getIcon(java.lang.String size)
Gets the icon that should represent this promotion (that is potentially attempted but failed.)


getTarget

public hudson.model.AbstractBuild<?,?> getTarget()
Gets the build that was qualified for a promotion.


buildEnvVars

public void buildEnvVars(hudson.model.AbstractBuild<?,?> build,
                         hudson.EnvVars env)
Called by Promotion to allow status to contribute environment variables.

Parameters:
build - The calling build. Never null.
env - Environment variables should be added to this map.

getTimestampString

public java.lang.String getTimestampString()
Gets the string that says how long since this promotion had happened.

Returns:
string like "3 minutes" "1 day" etc.

getDelayString

public java.lang.String getDelayString(hudson.model.AbstractBuild<?,?> owner)
Gets the string that says how long did it toook for this build to be promoted.


isFor

public boolean isFor(PromotionProcess process)

getSuccessfulPromotion

public Promotion getSuccessfulPromotion(JobPropertyImpl jp)
Returns the Promotion object that represents the successful promotion.

Returns:
null if the promotion has never been successful, or if it was but the record is already lost.

isPromotionSuccessful

public boolean isPromotionSuccessful()
Returns true if the promotion was successfully completed.


isPromotionAttempted

public boolean isPromotionAttempted()
Returns true if at least one Promotion activity is attempted. False if none is executed yet (this includes the case where it's in the queue.)


isInQueue

public boolean isInQueue()
Returns true if the promotion for this is pending in the queue, waiting to be executed.


getBadges

public java.util.List<PromotionBadge> getBadges()
Gets the badges indicating how did a build qualify for a promotion.


getLastSuccessful

public Promotion getLastSuccessful()
Gets the last successful Promotion.


getLastFailed

public Promotion getLastFailed()
Gets the last successful Promotion.


getLast

public Promotion getLast()

getPromotionBuilds

public java.util.List<Promotion> getPromotionBuilds()
Gets all the promotion builds.


getPromotionBuild

public Promotion getPromotionBuild(int number)
Gets the promotion build by build number.

Parameters:
number - build number
Returns:
promotion build

doBuild

public void doBuild(org.kohsuke.stapler.StaplerRequest req,
                    org.kohsuke.stapler.StaplerResponse rsp)
             throws java.io.IOException,
                    javax.servlet.ServletException
Schedules a new build.

Throws:
java.io.IOException
javax.servlet.ServletException


Copyright © 2004-2011. All Rights Reserved.