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 java.lang.Object
implements ImmutablePlan


Field Summary
protected  com.atlassian.util.concurrent.LazyReference<java.lang.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, BuildDefinitionManager buildDefinitionManager, ResultsSummaryManager resultsSummaryManager)
          Deprecated. 
AbstractImmutablePlan(ImmutablePlan plan, BuildLoggerManager buildLoggerManager, LabelManager labelManager, VariableDefinitionManager variableDefinitionManager, BuildDefinition buildDefinition, ResultsSummaryManager resultsSummaryManager)
           
 
Method Summary
 int compareTo(ImmutablePlan plan)
           
 boolean equals(java.lang.Object o)
           
protected  void exceptionOnModification()
           
 long getAverageBuildDuration()
          Returns an average duration of the recent builds
 BuildDefinition getBuildDefinition()
          Returns the BuildDefinition that backs this Plan
 java.lang.String getBuildKey()
          This objects specific portion of the key.
 BuildLogger getBuildLogger()
          Returns the helper object to deal with logging
 java.lang.String getBuildName()
           
 java.lang.String getCurrentStatus()
          Retuns a string key as to what the status is.
 java.lang.String getDescription()
           
 java.util.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()
           
 java.lang.String getKey()
          Obtain the plan's unique key (uppercase alphanumeric).
 java.util.List<Labelling> getLabellings()
           
 java.util.List<java.lang.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
 java.lang.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
 java.util.List<Labelling> getRelatedLabellings()
           
 java.lang.String getType()
          Returns the string representation of the type.
 java.util.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<java.lang.Long> averageBuildDuration
Constructor Detail

AbstractImmutablePlan

@Deprecated
public AbstractImmutablePlan(@NotNull
                                        ImmutablePlan plan,
                                        BuildLoggerManager buildLoggerManager,
                                        @NotNull
                                        LabelManager labelManager,
                                        VariableDefinitionManager variableDefinitionManager,
                                        @NotNull
                                        BuildDefinitionManager buildDefinitionManager,
                                        ResultsSummaryManager resultsSummaryManager)
Deprecated. 


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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.util.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 java.util.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 java.util.List<Labelling> getLabellings()

getRelatedLabellings

@NotNull
public java.util.List<Labelling> getRelatedLabellings()

getLabelNames

@NotNull
public java.util.List<java.lang.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 java.lang.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 java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(ImmutablePlan plan)


Copyright © 2014 Atlassian Software Systems Pty Ltd. All Rights Reserved.