com.sonyericsson.hudson.plugins.gerrit.trigger.gerritnotifier
Class ParameterExpander

java.lang.Object
  extended by com.sonyericsson.hudson.plugins.gerrit.trigger.gerritnotifier.ParameterExpander

public class ParameterExpander
extends java.lang.Object

Expands a parameterized string to its full potential.

Author:
Robert Sandell <robert.sandell@sonyericsson.com>

Field Summary
static int DEFAULT_PARAMETERS_COUNT
          How many default parameters there are (plus one) to initialize the size of the parameters-map.
static java.lang.String MESSAGE_DELIMITER
          The delimiter used to separate build URLs from their messages.
 
Constructor Summary
ParameterExpander(IGerritHudsonTriggerConfig config)
          Constructor.
ParameterExpander(IGerritHudsonTriggerConfig config, hudson.model.Hudson hudson)
          Constructor.
 
Method Summary
 java.lang.String getBuildCompletedCommand(BuildMemory.MemoryImprint memoryImprint, hudson.model.TaskListener listener)
          Gets the "expanded" build completed command to send to gerrit.
 java.lang.String getBuildStartedCommand(hudson.model.AbstractBuild r, hudson.model.TaskListener taskListener, PatchsetCreated event, BuildsStartedStats stats)
          Gets the expanded string to send to Gerrit for a build-started event.
protected  int getCodeReviewValue(hudson.model.Result res, GerritTrigger trigger)
          Finds the code review value for the specified build result on the configured trigger.
protected  int getMinimumCodeReviewValue(BuildMemory.MemoryImprint memoryImprint)
          Returns the minimum code review value for the build results in the memory.
protected  int getMinimumVerifiedValue(BuildMemory.MemoryImprint memoryImprint)
          Returns the minimum verified value for the build results in the memory.
protected  int getVerifiedValue(hudson.model.Result res, GerritTrigger trigger)
          Finds the verified value for the specified build result on the configured trigger.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PARAMETERS_COUNT

public static final int DEFAULT_PARAMETERS_COUNT
How many default parameters there are (plus one) to initialize the size of the parameters-map.

See Also:
Constant Field Values

MESSAGE_DELIMITER

public static final java.lang.String MESSAGE_DELIMITER
The delimiter used to separate build URLs from their messages.

See Also:
Constant Field Values
Constructor Detail

ParameterExpander

public ParameterExpander(IGerritHudsonTriggerConfig config,
                         hudson.model.Hudson hudson)
Constructor.

Parameters:
config - the global config.
hudson - the Hudson instance.

ParameterExpander

public ParameterExpander(IGerritHudsonTriggerConfig config)
Constructor.

Parameters:
config - the global config.
Method Detail

getBuildStartedCommand

public java.lang.String getBuildStartedCommand(hudson.model.AbstractBuild r,
                                               hudson.model.TaskListener taskListener,
                                               PatchsetCreated event,
                                               BuildsStartedStats stats)
Gets the expanded string to send to Gerrit for a build-started event.

Parameters:
r - the build.
taskListener - the taskListener.
event - the event.
stats - the statistics.
Returns:
the "expanded" command string.

getCodeReviewValue

protected int getCodeReviewValue(hudson.model.Result res,
                                 GerritTrigger trigger)
Finds the code review value for the specified build result on the configured trigger.

Parameters:
res - the build result.
trigger - the trigger that might have overridden values.
Returns:
the value.

getVerifiedValue

protected int getVerifiedValue(hudson.model.Result res,
                               GerritTrigger trigger)
Finds the verified value for the specified build result on the configured trigger.

Parameters:
res - the build result.
trigger - the trigger that might have overridden values.
Returns:
the value.

getMinimumVerifiedValue

protected int getMinimumVerifiedValue(BuildMemory.MemoryImprint memoryImprint)
Returns the minimum verified value for the build results in the memory.

Parameters:
memoryImprint - the memory.
Returns:
the lowest verified value.

getMinimumCodeReviewValue

protected int getMinimumCodeReviewValue(BuildMemory.MemoryImprint memoryImprint)
Returns the minimum code review value for the build results in the memory.

Parameters:
memoryImprint - the memory
Returns:
the lowest code review value.

getBuildCompletedCommand

public java.lang.String getBuildCompletedCommand(BuildMemory.MemoryImprint memoryImprint,
                                                 hudson.model.TaskListener listener)
Gets the "expanded" build completed command to send to gerrit.

Parameters:
memoryImprint - the memory with all the information
listener - the taskListener
Returns:
the command.


Copyright © 2004-2012. All Rights Reserved.