com.atlassian.bamboo.plan.cache
Class AbstractImmutablePlan

java.lang.Object
  extended by com.atlassian.bamboo.plan.cache.AbstractImmutablePlan
All Implemented Interfaces:
BambooIdProvider, ImmutablePlan, PlanIdentifier, PlanKeyProvider, DescriptionProvider, NameProvider
Direct Known Subclasses:
AbstractImmutableChain, ImmutableJobImpl

public abstract class AbstractImmutablePlan
extends Object
implements ImmutablePlan


Field Summary
protected  com.atlassian.util.concurrent.LazyReference<Long> averageBuildDuration
           
protected  ResultsSummaryManager resultsSummaryManager
           
 
Fields inherited from interface com.atlassian.bamboo.plan.cache.ImmutablePlan
MAX_NUMBER_LOG_ENTRIES, MAX_PREVIOUS_BUILD_FOR_AVE, STATUS_CURRENTLY_BUILDING, STATUS_FAIL, STATUS_NO_BUILDS, STATUS_NOT_RUN, STATUS_SUCCESS
 
Fields inherited from interface com.atlassian.bamboo.plan.PlanIdentifier
getPlanKeyFunction
 
Fields inherited from interface com.atlassian.bamboo.plan.PlanKeyProvider
getPlanKey
 
Constructor Summary
AbstractImmutablePlan(ImmutablePlan plan, BuildLoggerManager buildLoggerManager, LabelManager labelManager, VariableDefinitionManager variableDefinitionManager, BuildDefinition buildDefinition, ResultsSummaryManager resultsSummaryManager)
           
 
Method Summary
 int compareTo(ImmutablePlan plan)
           
 boolean equals(Object o)
           
protected  void exceptionOnModification()
           
 long getAverageBuildDuration()
          Returns an average duration of the recent builds
 BuildDefinition getBuildDefinition()
          Returns the BuildDefinition that backs this Plan
 String getBuildKey()
          This objects specific portion of the key.
 BuildLogger getBuildLogger()
          Returns the helper object to deal with logging
 String getBuildName()
           
 String getCurrentStatus()
          Retuns a string key as to what the status is.
 String getDescription()
           
 List<VariableDefinition> getEffectiveVariables()
          Return effective list of VariableDefinitions bind to this Plan.
 int getFirstBuildNumber()
          What the number of the first build we have? It may not be 1 as some may have been removed!
 long getId()
           
 String getKey()
          Obtain the plan's unique key (uppercase alphanumeric).
 List<Labelling> getLabellings()
           
 List<String> getLabelNames()
          Returns all the names of related labels with a namesapce of :label
 int getLastBuildNumber()
          What was the number of the latest build (may be being built)
 long getMasterId()
          Database id of master of this ChainBranch
 String getName()
          Returns the full name for the build in the form of "project name - build name" e.g.
 int getNextBuildNumber()
          The next build number represents the number of the next build result that's to be executed
 PlanKey getPlanKey()
          Get the PlanKey identifier for this Plan
 PlanType getPlanType()
           
 Project getProject()
          Returns the parent Project
 List<Labelling> getRelatedLabellings()
           
 String getType()
          Returns the string representation of the type.
 List<VariableDefinition> getVariables()
          Return list of VariableDefinitions bind to this Plan
 int hashCode()
           
 boolean hasMaster()
           
 boolean isMarkedForDeletion()
          Is the plan set to be deleted in the future
 boolean isSuspendedFromBuilding()
          Checks if the build has been enabled / disabled.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.atlassian.bamboo.plan.cache.ImmutablePlan
getLatestResultsSummary, getMaster, isActive, isBusy, isExecuting
 

Field Detail

resultsSummaryManager

protected final ResultsSummaryManager resultsSummaryManager

averageBuildDuration

protected com.atlassian.util.concurrent.LazyReference<Long> averageBuildDuration
Constructor Detail

AbstractImmutablePlan

public AbstractImmutablePlan(@NotNull
                             ImmutablePlan plan,
                             BuildLoggerManager buildLoggerManager,
                             @NotNull
                             LabelManager labelManager,
                             VariableDefinitionManager variableDefinitionManager,
                             @NotNull
                             BuildDefinition buildDefinition,
                             ResultsSummaryManager resultsSummaryManager)
Method Detail

getId

public long getId()
Specified by:
getId in interface BambooIdProvider
Specified by:
getId in interface PlanIdentifier
Returns:
Database id of the plan

getDescription

public String getDescription()
Specified by:
getDescription in interface DescriptionProvider

getPlanKey

@NotNull
public PlanKey getPlanKey()
Description copied from interface: PlanIdentifier
Get the PlanKey identifier for this Plan

Specified by:
getPlanKey in interface PlanIdentifier
Specified by:
getPlanKey in interface PlanKeyProvider
Returns:
planKey

getKey

@NotNull
public String getKey()
Description copied from interface: ImmutablePlan
Obtain the plan's unique key (uppercase alphanumeric). This includes the project prefix e.g. BAM-MAIN. Prefer PlanIdentifier.getPlanKey()

Specified by:
getKey in interface ImmutablePlan
Returns:
The full key

getBuildKey

@NotNull
public String getBuildKey()
Description copied from interface: PlanIdentifier
This objects specific portion of the key. You probably want to use PlanIdentifier.getPlanKey().

Specified by:
getBuildKey in interface PlanIdentifier
Returns:
This objects specific portion of the key

getName

@NotNull
public String getName()
Description copied from interface: PlanIdentifier
Returns the full name for the build in the form of "project name - build name" e.g. "Confluence - HEAD"

Specified by:
getName in interface PlanIdentifier
Specified by:
getName in interface DescriptionProvider
Specified by:
getName in interface NameProvider
Returns:
String

getBuildName

@NotNull
public String getBuildName()
Specified by:
getBuildName in interface PlanIdentifier
Returns:
The plan specific portion of the name (without the project and/or parent's names). You probably want to use PlanIdentifier.getName()

getPlanType

@NotNull
public PlanType getPlanType()
Specified by:
getPlanType in interface PlanIdentifier
Returns:
the type of this plan

getType

@NotNull
public String getType()
Description copied from interface: ImmutablePlan
Returns the string representation of the type. See PlanType and used in Freemarker.

Specified by:
getType in interface ImmutablePlan
Returns:
the string representation of the type

isMarkedForDeletion

public boolean isMarkedForDeletion()
Description copied from interface: ImmutablePlan
Is the plan set to be deleted in the future

Specified by:
isMarkedForDeletion in interface ImmutablePlan
Returns:

hasMaster

public boolean hasMaster()
Specified by:
hasMaster in interface ImmutablePlan
Returns:
true if plan has a master plan

getVariables

@NotNull
public List<VariableDefinition> getVariables()
Description copied from interface: ImmutablePlan
Return list of VariableDefinitions bind to this Plan

Specified by:
getVariables in interface ImmutablePlan
Returns:
non-null list of VariableDefinition

getEffectiveVariables

@NotNull
public List<VariableDefinition> getEffectiveVariables()
Description copied from interface: ImmutablePlan
Return effective list of VariableDefinitions bind to this Plan. For master Plans this will return the same result as ImmutablePlan.getVariables(). Non-master plans will produce the sum of: - all master's variables which keys do not appear in result of ImmutablePlan.getVariables() - result of ImmutablePlan.getVariables()

Specified by:
getEffectiveVariables in interface ImmutablePlan
Returns:
non-null list of VariableDefinition

isSuspendedFromBuilding

public boolean isSuspendedFromBuilding()
Description copied from interface: PlanIdentifier
Checks if the build has been enabled / disabled.

Specified by:
isSuspendedFromBuilding in interface PlanIdentifier
Returns:
true if plan is disabled

getFirstBuildNumber

public int getFirstBuildNumber()
Description copied from interface: ImmutablePlan
What the number of the first build we have? It may not be 1 as some may have been removed!

Specified by:
getFirstBuildNumber in interface ImmutablePlan
Returns:
The number of the first build

getLastBuildNumber

public int getLastBuildNumber()
Description copied from interface: ImmutablePlan
What was the number of the latest build (may be being built)

Specified by:
getLastBuildNumber in interface ImmutablePlan
Returns:
the build number, zero if the build has not been built

getNextBuildNumber

public int getNextBuildNumber()
Description copied from interface: ImmutablePlan
The next build number represents the number of the next build result that's to be executed

Specified by:
getNextBuildNumber in interface ImmutablePlan
Returns:
a build number, starting with 1

getBuildDefinition

@NotNull
public BuildDefinition getBuildDefinition()
Description copied from interface: ImmutablePlan
Returns the BuildDefinition that backs this Plan

Specified by:
getBuildDefinition in interface ImmutablePlan
Returns:
BuildDefinition object.

getProject

@NotNull
public Project getProject()
Description copied from interface: ImmutablePlan
Returns the parent Project

Specified by:
getProject in interface ImmutablePlan
Specified by:
getProject in interface PlanIdentifier
Returns:
Project. Never null

getAverageBuildDuration

public long getAverageBuildDuration()
Description copied from interface: ImmutablePlan
Returns an average duration of the recent builds

Specified by:
getAverageBuildDuration in interface ImmutablePlan
Returns:
The duration in milliseconds

getMasterId

public long getMasterId()
Description copied from interface: PlanIdentifier
Database id of master of this ChainBranch

Specified by:
getMasterId in interface PlanIdentifier
Returns:

getLabellings

@NotNull
public List<Labelling> getLabellings()

getRelatedLabellings

@NotNull
public List<Labelling> getRelatedLabellings()

getLabelNames

@NotNull
public List<String> getLabelNames()
Description copied from interface: ImmutablePlan
Returns all the names of related labels with a namesapce of :label

Specified by:
getLabelNames in interface ImmutablePlan
Returns:

getCurrentStatus

@NotNull
public String getCurrentStatus()
Description copied from interface: ImmutablePlan
Retuns a string key as to what the status is. Can be "success", "failure", "current", "none" or "notRun". Mainly used for UI purposes.

Specified by:
getCurrentStatus in interface ImmutablePlan
Returns:

exceptionOnModification

protected void exceptionOnModification()

getBuildLogger

@NotNull
public BuildLogger getBuildLogger()
Description copied from interface: ImmutablePlan
Returns the helper object to deal with logging

Specified by:
getBuildLogger in interface ImmutablePlan
Returns:
A BuildLogger. @NotNull

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

compareTo

public int compareTo(ImmutablePlan plan)


Copyright © 2015 Atlassian Software Systems Pty Ltd. All rights reserved.