Package com.atlassian.bamboo.plan.cache
Class AbstractImmutablePlan
- java.lang.Object
-
- com.atlassian.bamboo.plan.cache.AbstractImmutablePlan
-
- All Implemented Interfaces:
BambooIdProvider
,ImmutableEntityWithOid
,ImmutableDeletable
,ImmutablePlan
,PlanIdentifier
,PlanKeyProvider
,DescriptionProvider
,NameProvider
,Versionable
,Comparable<ImmutablePlan>
- Direct Known Subclasses:
AbstractImmutableChain
,ImmutableJobImpl
public abstract class AbstractImmutablePlan extends Object implements ImmutablePlan, Comparable<ImmutablePlan>
-
-
Field Summary
Fields Modifier and Type Field Description protected io.atlassian.util.concurrent.ResettableLazyReference<Long>
averageBuildDuration
protected BuildDefinition
buildDefinition
protected ResultsSummaryManager
resultsSummaryManager
-
Fields inherited from interface com.atlassian.bamboo.plan.cache.ImmutablePlan
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
NAME_DELIMITER
-
Fields inherited from interface com.atlassian.bamboo.plan.PlanKeyProvider
getPlanKey
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractImmutablePlan(@Nullable Long databaseId, @NotNull ImmutablePlan plan, @NotNull PlanKey planKey, @NotNull String name, BuildLoggerManager buildLoggerManager, @NotNull LabelManager labelManager, VariableDefinitionManager variableDefinitionManager, @NotNull BuildDefinition buildDefinition, ResultsSummaryManager resultsSummaryManager)
AbstractImmutablePlan(@Nullable Long databaseId, @NotNull ImmutablePlan plan, BuildLoggerManager buildLoggerManager, @NotNull LabelManager labelManager, VariableDefinitionManager variableDefinitionManager, @NotNull BuildDefinition buildDefinition, ResultsSummaryManager resultsSummaryManager)
protected
AbstractImmutablePlan(Long id, EnrichedPlanDto dto, PlanKey planKey, String name, BuildLoggerManager buildLoggerManager, VariableDefinitionManager variableDefinitionManager, ResultsSummaryManager resultsSummaryManager)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
compareTo(ImmutablePlan plan)
boolean
equals(Object o)
protected void
exceptionOnModification()
long
getAverageBuildDuration()
Returns an average duration of the recent builds@NotNull BuildDefinition
getBuildDefinition()
Returns theBuildDefinition
that backs thisPlan
@NotNull String
getBuildKey()
This objects specific portion of the key.@NotNull BuildLogger
getBuildLogger()
Returns the helper object to deal with logging@NotNull String
getBuildName()
@NotNull String
getCurrentStatus()
@NotNull Optional<Long>
getDatabaseId()
String
getDescription()
@NotNull List<VariableDefinition>
getEffectiveVariables()
Return effective list ofVariableDefinition
s 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()
Returns database id of the plan.@NotNull String
getKey()
Obtain the plan's unique key (uppercase alphanumeric).@NotNull List<Labelling>
getLabellings()
@NotNull List<String>
getLabelNames()
int
getLastBuildNumber()
What was the number of the latest build (may be being built)long
getMasterId()
@NotNull Optional<Long>
getMasterIdIfExists()
@NotNull String
getName()
Returns the full name for the build in the form of "project name - build name" e.g.BambooEntityOid
getOid()
OID assigned to this object.@NotNull PlanKey
getPlanKey()
@NotNull PlanType
getPlanType()
@NotNull Project
getProject()
Returns the parentProject
@NotNull List<Labelling>
getRelatedLabellings()
@NotNull String
getType()
Returns the string representation of the type.@NotNull List<VariableDefinition>
getVariables()
Return list ofVariableDefinition
s bind to this Plan@NotNull Long
getVersion()
Returns the version number of this object.int
hashCode()
boolean
hasMaster()
boolean
isMarkedForDeletion()
Is the plan set to be deleted in the futureboolean
isSuspendedFromBuilding()
Checks if the build has been enabled / disabled.abstract void
resetLatestResultsSummary(int latestKnownBuildNumber, boolean resetAverageBuildDuration)
protected void
resetLatestResultsSummary(io.atlassian.util.concurrent.ResettableLazyReference<? extends ImmutableResultsSummary> latestResultsSummary, int latestKnownBuildNumber, boolean resetAverageBuildDuration)
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.bamboo.core.ImmutableEntityWithOid
getEntityType
-
Methods inherited from interface com.atlassian.bamboo.plan.cache.ImmutablePlan
getLatestResultsSummary, getMaster, isActive, isBusy, isExecuting
-
-
-
-
Field Detail
-
buildDefinition
protected BuildDefinition buildDefinition
-
resultsSummaryManager
protected final ResultsSummaryManager resultsSummaryManager
-
averageBuildDuration
protected io.atlassian.util.concurrent.ResettableLazyReference<Long> averageBuildDuration
-
-
Constructor Detail
-
AbstractImmutablePlan
public AbstractImmutablePlan(@Nullable @Nullable Long databaseId, @NotNull @NotNull ImmutablePlan plan, BuildLoggerManager buildLoggerManager, @NotNull @NotNull LabelManager labelManager, VariableDefinitionManager variableDefinitionManager, @NotNull @NotNull BuildDefinition buildDefinition, ResultsSummaryManager resultsSummaryManager)
-
AbstractImmutablePlan
protected AbstractImmutablePlan(@Nullable @Nullable Long databaseId, @NotNull @NotNull ImmutablePlan plan, @NotNull @NotNull PlanKey planKey, @NotNull @NotNull String name, BuildLoggerManager buildLoggerManager, @NotNull @NotNull LabelManager labelManager, VariableDefinitionManager variableDefinitionManager, @NotNull @NotNull BuildDefinition buildDefinition, ResultsSummaryManager resultsSummaryManager)
-
AbstractImmutablePlan
protected AbstractImmutablePlan(Long id, EnrichedPlanDto dto, PlanKey planKey, String name, BuildLoggerManager buildLoggerManager, VariableDefinitionManager variableDefinitionManager, ResultsSummaryManager resultsSummaryManager)
-
-
Method Detail
-
getId
public long getId()
Description copied from interface:PlanIdentifier
Returns database id of the plan. Use ofPlanIdentifier.getDatabaseId()
should be preferred.- Specified by:
getId
in interfaceBambooIdProvider
- Specified by:
getId
in interfacePlanIdentifier
-
getDatabaseId
@NotNull public @NotNull Optional<Long> getDatabaseId()
- Specified by:
getDatabaseId
in interfacePlanIdentifier
- Returns:
- database id of the plan or empty if this plan is not a DB object.
-
getDescription
public String getDescription()
- Specified by:
getDescription
in interfaceDescriptionProvider
-
getPlanKey
@NotNull public @NotNull PlanKey getPlanKey()
Description copied from interface:PlanIdentifier
- Specified by:
getPlanKey
in interfacePlanIdentifier
- Specified by:
getPlanKey
in interfacePlanKeyProvider
- Returns:
- planKey
-
getKey
@NotNull public @NotNull String getKey()
Description copied from interface:ImmutablePlan
Obtain the plan's unique key (uppercase alphanumeric). This includes the project prefix e.g. BAM-MAIN. PreferPlanIdentifier.getPlanKey()
- Specified by:
getKey
in interfaceImmutablePlan
- Returns:
- The full key
-
getBuildKey
@NotNull public @NotNull String getBuildKey()
Description copied from interface:PlanIdentifier
This objects specific portion of the key. You probably want to usePlanIdentifier.getPlanKey()
.- Specified by:
getBuildKey
in interfacePlanIdentifier
- Returns:
- This objects specific portion of the key
-
getName
@NotNull public @NotNull 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 interfaceDescriptionProvider
- Specified by:
getName
in interfaceNameProvider
- Specified by:
getName
in interfacePlanIdentifier
- Returns:
- String
-
getBuildName
@NotNull public @NotNull String getBuildName()
- Specified by:
getBuildName
in interfacePlanIdentifier
- 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 @NotNull PlanType getPlanType()
- Specified by:
getPlanType
in interfacePlanIdentifier
- Returns:
- the type of this plan
-
getType
@NotNull public @NotNull String getType()
Description copied from interface:ImmutablePlan
Returns the string representation of the type. SeePlanType
and used in Freemarker.- Specified by:
getType
in interfaceImmutablePlan
- 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 interfaceImmutableDeletable
- Specified by:
isMarkedForDeletion
in interfaceImmutablePlan
- Returns:
- Whether or not the Object has been marked for deletion
-
hasMaster
public boolean hasMaster()
- Specified by:
hasMaster
in interfaceImmutablePlan
- Returns:
- true if plan has a master plan
-
getVariables
@NotNull public @NotNull List<VariableDefinition> getVariables()
Description copied from interface:ImmutablePlan
Return list ofVariableDefinition
s bind to this Plan- Specified by:
getVariables
in interfaceImmutablePlan
- Returns:
- non-null list of
VariableDefinition
-
getEffectiveVariables
@NotNull public @NotNull List<VariableDefinition> getEffectiveVariables()
Description copied from interface:ImmutablePlan
Return effective list ofVariableDefinition
s bind to this Plan. For master Plans this will return the same result asImmutablePlan.getVariables()
. Non-master plans will produce the sum of: - all master's variables which keys do not appear in result ofImmutablePlan.getVariables()
- result ofImmutablePlan.getVariables()
- Specified by:
getEffectiveVariables
in interfaceImmutablePlan
- 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 interfacePlanIdentifier
- 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 interfaceImmutablePlan
- 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 interfaceImmutablePlan
- Returns:
- the build number, zero if the build has not been built
-
getBuildDefinition
@NotNull public @NotNull BuildDefinition getBuildDefinition()
Description copied from interface:ImmutablePlan
Returns theBuildDefinition
that backs thisPlan
- Specified by:
getBuildDefinition
in interfaceImmutablePlan
- Returns:
BuildDefinition
object.
-
getProject
@NotNull public @NotNull Project getProject()
Description copied from interface:ImmutablePlan
Returns the parentProject
- Specified by:
getProject
in interfaceImmutablePlan
- Specified by:
getProject
in interfacePlanIdentifier
- 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 interfaceImmutablePlan
- Returns:
- The duration in milliseconds
-
getMasterId
public long getMasterId()
- Specified by:
getMasterId
in interfacePlanIdentifier
- Returns:
- database id of master of this Plan or -1 if none.
-
getMasterIdIfExists
@NotNull public @NotNull Optional<Long> getMasterIdIfExists()
- Specified by:
getMasterIdIfExists
in interfacePlanIdentifier
- Returns:
- database id of master of this Plan or empty if none.
-
getLabelNames
@NotNull public @NotNull List<String> getLabelNames()
- Specified by:
getLabelNames
in interfaceImmutablePlan
- Returns:
- all the names of related labels with a namespace of :label
-
getCurrentStatus
@NotNull public @NotNull String getCurrentStatus()
- Specified by:
getCurrentStatus
in interfaceImmutablePlan
- Returns:
- a string key as to what the status is. Can be "success", "failure", "current", "none" or "notRun". Mainly used for UI purposes.
-
getOid
public BambooEntityOid getOid()
Description copied from interface:ImmutableEntityWithOid
OID assigned to this object. TheBambooEntityOid.getEntityType()
should be the same as this object'sImmutableEntityWithOid.getEntityType()
.- Specified by:
getOid
in interfaceImmutableEntityWithOid
-
getVersion
@NotNull public @NotNull Long getVersion()
Description copied from interface:Versionable
Returns the version number of this object.- Specified by:
getVersion
in interfaceVersionable
- Returns:
- the version number
-
resetLatestResultsSummary
@Internal public abstract void resetLatestResultsSummary(int latestKnownBuildNumber, boolean resetAverageBuildDuration)
-
exceptionOnModification
protected void exceptionOnModification()
-
getBuildLogger
@NotNull public @NotNull BuildLogger getBuildLogger()
Description copied from interface:ImmutablePlan
Returns the helper object to deal with logging- Specified by:
getBuildLogger
in interfaceImmutablePlan
- Returns:
- A
BuildLogger
.
-
compareTo
public int compareTo(ImmutablePlan plan)
- Specified by:
compareTo
in interfaceComparable<ImmutablePlan>
-
resetLatestResultsSummary
protected void resetLatestResultsSummary(io.atlassian.util.concurrent.ResettableLazyReference<? extends ImmutableResultsSummary> latestResultsSummary, int latestKnownBuildNumber, boolean resetAverageBuildDuration)
-
-