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
FieldsModifier and TypeFieldDescriptionprotected io.atlassian.util.concurrent.ResettableLazyReference<Long>protected BuildDefinitionprotected final InternalResultsSummaryAccessorFields 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_SUCCESSFields inherited from interface com.atlassian.bamboo.plan.PlanIdentifier
NAME_DELIMITERFields inherited from interface com.atlassian.bamboo.plan.PlanKeyProvider
getPlanKey -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractImmutablePlan(@Nullable Long databaseId, @NotNull ImmutablePlan plan, @NotNull PlanKey planKey, @NotNull String name, BuildLoggerManager buildLoggerManager, @NotNull LabelDao labelDao, VariableDefinitionManager variableDefinitionManager, @NotNull BuildDefinition buildDefinition, InternalResultsSummaryAccessor immutableResultsSummaryAccessor) AbstractImmutablePlan(@Nullable Long databaseId, @NotNull ImmutablePlan plan, BuildLoggerManager buildLoggerManager, @NotNull LabelDao labelDao, VariableDefinitionManager variableDefinitionManager, @NotNull BuildDefinition buildDefinition, InternalResultsSummaryAccessor immutableResultsSummaryAccessor) protectedAbstractImmutablePlan(Long id, EnrichedPlanDto dto, PlanKey planKey, String name, BuildLoggerManager buildLoggerManager, VariableDefinitionManager variableDefinitionManager, InternalResultsSummaryAccessor immutableResultsSummaryAccessor) -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(ImmutablePlan plan) booleanprotected voidlongReturns an average duration of the recent builds@NotNull BuildDefinitionReturns theBuildDefinitionthat backs thisPlan@NotNull StringThis objects specific portion of the key.@NotNull BuildLoggerReturns the helper object to deal with logging@NotNull String@NotNull String@NotNull List<VariableDefinition>Return effective list ofVariableDefinitions bind to this Plan.intWhat the number of the first build we have?longgetId()Returns database id of the plan.@NotNull StringgetKey()Obtain the plan's unique key (uppercase alphanumeric).intWhat was the number of the latest build (may be being built)long@NotNull StringgetName()Returns the full name for the build in the form of "project name - build name" e.g.getOid()OID assigned to this object.@NotNull PlanKey@NotNull PlanType@NotNull ProjectReturns the parentProject@NotNull StringgetType()Returns the string representation of the type.@NotNull List<VariableDefinition>Return list ofVariableDefinitions bind to this Plan@NotNull LongReturns the version number of this object.inthashCode()booleanbooleanIs the plan set to be deleted in the futurebooleanChecks if the build has been enabled / disabled.abstract voidresetLatestResultsSummary(int latestKnownBuildNumber, boolean resetAverageBuildDuration) protected voidresetLatestResultsSummary(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, waitMethods inherited from interface com.atlassian.bamboo.core.ImmutableEntityWithOid
getEntityTypeMethods inherited from interface com.atlassian.bamboo.plan.cache.ImmutablePlan
getLatestResultsSummary, getMaster, isActive, isBusy, isExecuting
-
Field Details
-
buildDefinition
-
immutableResultsSummaryAccessor
-
averageBuildDuration
-
-
Constructor Details
-
AbstractImmutablePlan
public AbstractImmutablePlan(@Nullable @Nullable Long databaseId, @NotNull @NotNull ImmutablePlan plan, BuildLoggerManager buildLoggerManager, @NotNull @NotNull LabelDao labelDao, VariableDefinitionManager variableDefinitionManager, @NotNull @NotNull BuildDefinition buildDefinition, InternalResultsSummaryAccessor immutableResultsSummaryAccessor) -
AbstractImmutablePlan
protected AbstractImmutablePlan(@Nullable @Nullable Long databaseId, @NotNull @NotNull ImmutablePlan plan, @NotNull @NotNull PlanKey planKey, @NotNull @NotNull String name, BuildLoggerManager buildLoggerManager, @NotNull @NotNull LabelDao labelDao, VariableDefinitionManager variableDefinitionManager, @NotNull @NotNull BuildDefinition buildDefinition, InternalResultsSummaryAccessor immutableResultsSummaryAccessor) -
AbstractImmutablePlan
protected AbstractImmutablePlan(Long id, EnrichedPlanDto dto, PlanKey planKey, String name, BuildLoggerManager buildLoggerManager, VariableDefinitionManager variableDefinitionManager, InternalResultsSummaryAccessor immutableResultsSummaryAccessor)
-
-
Method Details
-
getId
public long getId()Description copied from interface:PlanIdentifierReturns database id of the plan. Use ofPlanIdentifier.getDatabaseId()should be preferred.- Specified by:
getIdin interfaceBambooIdProvider- Specified by:
getIdin interfacePlanIdentifier
-
getDatabaseId
- Specified by:
getDatabaseIdin interfacePlanIdentifier- Returns:
- database id of the plan or empty if this plan is not a DB object.
-
getDescription
- Specified by:
getDescriptionin interfaceDescriptionProvider
-
getPlanKey
Description copied from interface:PlanIdentifier- Specified by:
getPlanKeyin interfacePlanIdentifier- Specified by:
getPlanKeyin interfacePlanKeyProvider- Returns:
- planKey
-
getKey
Description copied from interface:ImmutablePlanObtain the plan's unique key (uppercase alphanumeric). This includes the project prefix e.g. BAM-MAIN. PreferPlanIdentifier.getPlanKey()- Specified by:
getKeyin interfaceImmutablePlan- Returns:
- The full key
-
getBuildKey
Description copied from interface:PlanIdentifierThis objects specific portion of the key. You probably want to usePlanIdentifier.getPlanKey().- Specified by:
getBuildKeyin interfacePlanIdentifier- Returns:
- This objects specific portion of the key
-
getName
Description copied from interface:PlanIdentifierReturns the full name for the build in the form of "project name - build name" e.g. "Confluence - HEAD"- Specified by:
getNamein interfaceDescriptionProvider- Specified by:
getNamein interfaceNameProvider- Specified by:
getNamein interfacePlanIdentifier- Returns:
- String
-
getBuildName
- Specified by:
getBuildNamein 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
- Specified by:
getPlanTypein interfacePlanIdentifier- Returns:
- the type of this plan
-
getType
Description copied from interface:ImmutablePlanReturns the string representation of the type. SeePlanTypeand used in Freemarker.- Specified by:
getTypein interfaceImmutablePlan- Returns:
- the string representation of the type
-
isMarkedForDeletion
public boolean isMarkedForDeletion()Description copied from interface:ImmutablePlanIs the plan set to be deleted in the future- Specified by:
isMarkedForDeletionin interfaceImmutableDeletable- Specified by:
isMarkedForDeletionin interfaceImmutablePlan- Returns:
- Whether or not the Object has been marked for deletion
-
hasMaster
public boolean hasMaster()- Specified by:
hasMasterin interfaceImmutablePlan- Returns:
- true if plan has a master plan, meaning it is a plan branch or a job present on a plan branch
-
getVariables
Description copied from interface:ImmutablePlanReturn list ofVariableDefinitions bind to this Plan- Specified by:
getVariablesin interfaceImmutablePlan- Returns:
- non-null list of
VariableDefinition
-
getEffectiveVariables
Description copied from interface:ImmutablePlanReturn effective list ofVariableDefinitions 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:
getEffectiveVariablesin interfaceImmutablePlan- Returns:
- non-null list of
VariableDefinition
-
isSuspendedFromBuilding
public boolean isSuspendedFromBuilding()Description copied from interface:PlanIdentifierChecks if the build has been enabled / disabled.- Specified by:
isSuspendedFromBuildingin interfacePlanIdentifier- Returns:
- true if plan is disabled
-
getFirstBuildNumber
public int getFirstBuildNumber()Description copied from interface:ImmutablePlanWhat the number of the first build we have? It may not be 1 as some may have been removed!- Specified by:
getFirstBuildNumberin interfaceImmutablePlan- Returns:
- The number of the first build
-
getLastBuildNumber
public int getLastBuildNumber()Description copied from interface:ImmutablePlanWhat was the number of the latest build (may be being built)- Specified by:
getLastBuildNumberin interfaceImmutablePlan- Returns:
- the build number, zero if the build has not been built
-
getBuildDefinition
Description copied from interface:ImmutablePlanReturns theBuildDefinitionthat backs thisPlan- Specified by:
getBuildDefinitionin interfaceImmutablePlan- Returns:
BuildDefinitionobject.
-
getProject
Description copied from interface:ImmutablePlanReturns the parentProject- Specified by:
getProjectin interfaceImmutablePlan- Specified by:
getProjectin interfacePlanIdentifier- Returns:
Project. Never null
-
getAverageBuildDuration
public long getAverageBuildDuration()Description copied from interface:ImmutablePlanReturns an average duration of the recent builds- Specified by:
getAverageBuildDurationin interfaceImmutablePlan- Returns:
- The duration in milliseconds
-
getMasterId
public long getMasterId()- Specified by:
getMasterIdin interfacePlanIdentifier- Returns:
- database id of master of this Plan or -1 if none.
-
getMasterIdIfExists
- Specified by:
getMasterIdIfExistsin interfacePlanIdentifier- Returns:
- database id of master of this Plan or empty if none.
-
getLabellings
-
getRelatedLabellings
-
getLabelNames
- Specified by:
getLabelNamesin interfaceImmutablePlan- Returns:
- all the names of related labels with a namespace of :label
-
getCurrentStatus
- Specified by:
getCurrentStatusin 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
Description copied from interface:ImmutableEntityWithOidOID assigned to this object. TheBambooEntityOid.getEntityType()should be the same as this object'sImmutableEntityWithOid.getEntityType().- Specified by:
getOidin interfaceImmutableEntityWithOid
-
getVersion
Description copied from interface:VersionableReturns the version number of this object.- Specified by:
getVersionin interfaceVersionable- Returns:
- the version number
-
resetLatestResultsSummary
@Internal public abstract void resetLatestResultsSummary(int latestKnownBuildNumber, boolean resetAverageBuildDuration) -
exceptionOnModification
protected void exceptionOnModification() -
getBuildLogger
Description copied from interface:ImmutablePlanReturns the helper object to deal with logging- Specified by:
getBuildLoggerin interfaceImmutablePlan- Returns:
- A
BuildLogger.
-
hashCode
public int hashCode() -
equals
-
compareTo
- Specified by:
compareToin interfaceComparable<ImmutablePlan>
-
resetLatestResultsSummary
protected void resetLatestResultsSummary(io.atlassian.util.concurrent.ResettableLazyReference<? extends ImmutableResultsSummary> latestResultsSummary, int latestKnownBuildNumber, boolean resetAverageBuildDuration)
-