Package com.atlassian.bamboo.plan
Class AbstractPlan
- java.lang.Object
-
- com.atlassian.core.bean.EntityObject
-
- com.atlassian.bamboo.core.BambooEntityObject
-
- com.atlassian.bamboo.core.BambooEntityWithOid
-
- com.atlassian.bamboo.hibernate.HibernateBambooEntityWithOid
-
- com.atlassian.bamboo.plan.AbstractPlan
-
- All Implemented Interfaces:
BambooIdProvider
,BambooObject
,BambooObjectWithOid
,EntityWithOid
,ImmutableEntityWithOid
,Deletable
,Describable
,ImmutableDeletable
,ImmutablePlan
,Plan
,PlanIdentifier
,PlanKeyProvider
,DescriptionProvider
,NameProvider
,Versionable
,Cloneable
,Comparable<Plan>
- Direct Known Subclasses:
AbstractChain
,DefaultJob
@MappedSuperclass public abstract class AbstractPlan extends HibernateBambooEntityWithOid implements ImmutablePlan, Plan, Comparable<Plan>
This plan is only partially migrated to annotation-based Hibernate model, to allow creating queries using the new query mechanism. "Plan.hbm.xml" is still the source of truth for this entity.
-
-
Field Summary
Fields Modifier and Type Field Description 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 Constructor Description AbstractPlan()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Plan plan)
boolean
equals(Object o)
@NotNull BuildDefinition
getBuildDefinition()
Returns theBuildDefinition
that backs thisPlan
@Nullable BuildDefinitionForBuild
getBuildDefinitionXml()
@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 Optional<Long>
getDatabaseId()
String
getDescription()
String
getDiscriminator()
@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!@NotNull String
getKey()
Obtain the plan's unique key (uppercase alphanumeric).@NotNull List<Labelling>
getLabellings()
Used only for Hibernate mapping purposes.@NotNull List<String>
getLabelNames()
int
getLastBuildNumber()
What was the number of the latest build (may be being built)@Nullable ResultsSummary
getLatestResultsSummary()
Get the latest finished resultlong
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.@NotNull PlanKey
getPlanKey()
@NotNull Project
getProject()
Returns the parentProject
@NotNull List<Labelling>
getRelatedLabellings()
Returns labellings that are applicable for the plan level@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
isBusy()
Is thePlan
"busy".boolean
isMarkedForDeletion()
Is the plan set to be deleted in the futureboolean
isSuspendedFromBuilding()
Checks if the build has been enabled / disabled.void
setBuildDefinitionManager(BuildDefinitionManager buildDefinitionManager)
void
setBuildDefinitionXml(@Nullable BuildDefinitionForBuild buildDefinitionXml)
void
setBuildKey(String buildKey)
Define the build's unique key (uppercase alphanumeric)void
setBuildLoggerManager(BuildLoggerManager buildLoggerManager)
void
setBuildName(String buildName)
void
setDescription(@Nullable String description)
void
setDiscriminator(String discriminator)
void
setKey(String fullKey)
void
setLabellings(List<Labelling> labellings)
void
setLabelManager(LabelManager labelManager)
void
setMarkedForDeletion(boolean markedForDeletion)
void
setName(@NotNull String name)
void
setPlanExecutionManager(PlanExecutionManager planExecutionManager)
void
setPlanKey(@NotNull PlanKey planKey)
void
setProject(Project project)
void
setResultsSummaryManager(ResultsSummaryManager resultsSummaryManager)
void
setSuspendedFromBuilding(boolean suspendedFromBuilding)
Sets the build to suspend temporarilyvoid
setVariableDefinitionManager(VariableDefinitionManager variableDefinitionManager)
void
setVersion(@NotNull Long version)
-
Methods inherited from class com.atlassian.bamboo.hibernate.HibernateBambooEntityWithOid
getId, getOid, setId, setOid
-
Methods inherited from class com.atlassian.core.bean.EntityObject
clone, getCreationDate, getCurrentDate, getLastModificationDate, setClock, setCreationDate, setLastModificationDate
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.atlassian.bamboo.core.BambooObject
setId
-
Methods inherited from interface com.atlassian.bamboo.core.EntityWithOid
setOid
-
Methods inherited from interface com.atlassian.bamboo.core.ImmutableEntityWithOid
getEntityType, getOid
-
Methods inherited from interface com.atlassian.bamboo.plan.cache.ImmutablePlan
getAverageBuildDuration, getCurrentStatus, getMaster, isActive, isExecuting
-
Methods inherited from interface com.atlassian.bamboo.plan.PlanIdentifier
getId, getPlanType
-
-
-
-
Field Detail
-
resultsSummaryManager
protected ResultsSummaryManager resultsSummaryManager
-
-
Method Detail
-
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.
-
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
-
setPlanKey
public void setPlanKey(@NotNull @NotNull PlanKey planKey)
- Specified by:
setPlanKey
in interfacePlan
-
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
-
setBuildKey
public void setBuildKey(String buildKey)
Description copied from interface:Plan
Define the build's unique key (uppercase alphanumeric)- Specified by:
setBuildKey
in interfacePlan
- Parameters:
buildKey
- The value 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
-
setName
public void setName(@NotNull @NotNull String name)
- Specified by:
setName
in interfaceDescribable
-
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()
-
setBuildName
public void setBuildName(String buildName)
- Specified by:
setBuildName
in interfacePlan
-
getDescription
public String getDescription()
- Specified by:
getDescription
in interfaceDescriptionProvider
-
setDescription
public void setDescription(@Nullable @Nullable String description)
- Specified by:
setDescription
in interfaceDescribable
-
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
-
hasMaster
public boolean hasMaster()
- Specified by:
hasMaster
in interfaceImmutablePlan
- Returns:
- true if plan has a master plan
-
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
-
setMarkedForDeletion
public void setMarkedForDeletion(boolean markedForDeletion)
- Specified by:
setMarkedForDeletion
in interfaceDeletable
-
setSuspendedFromBuilding
public void setSuspendedFromBuilding(boolean suspendedFromBuilding)
Description copied from interface:Plan
Sets the build to suspend temporarily- Specified by:
setSuspendedFromBuilding
in interfacePlan
-
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
-
isBusy
public boolean isBusy()
Description copied from interface:ImmutablePlan
Is thePlan
"busy". Busy is defined by the plan having a lock held on it. This is done during change detection, dependency listner and the like- Specified by:
isBusy
in interfaceImmutablePlan
- Returns:
- busy
-
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
.
-
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
-
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
-
getLatestResultsSummary
@Nullable public @Nullable ResultsSummary getLatestResultsSummary()
Description copied from interface:ImmutablePlan
Get the latest finished result- Specified by:
getLatestResultsSummary
in interfaceImmutablePlan
- Specified by:
getLatestResultsSummary
in interfacePlan
- Returns:
- The summary info for the last completed build. Returns null if there are no build results for this 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
-
setProject
public void setProject(Project project)
- Specified by:
setProject
in interfacePlan
-
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
-
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.
-
getBuildDefinitionXml
@Nullable public @Nullable BuildDefinitionForBuild getBuildDefinitionXml()
- Specified by:
getBuildDefinitionXml
in interfacePlan
-
setBuildDefinitionXml
public void setBuildDefinitionXml(@Nullable @Nullable BuildDefinitionForBuild buildDefinitionXml)
- Specified by:
setBuildDefinitionXml
in interfacePlan
-
getLabellings
@NotNull public @NotNull List<Labelling> getLabellings()
Description copied from interface:Plan
Used only for Hibernate mapping purposes. Deprecated for removal from the interface- Specified by:
getLabellings
in interfacePlan
- Returns:
-
getRelatedLabellings
@NotNull public @NotNull List<Labelling> getRelatedLabellings()
Description copied from interface:Plan
Returns labellings that are applicable for the plan level- Specified by:
getRelatedLabellings
in interfacePlan
- Returns:
- Empty list if no labels
-
getLabelNames
@NotNull public @NotNull List<String> getLabelNames()
- Specified by:
getLabelNames
in interfaceImmutablePlan
- Returns:
- all the names of related labels with a namespace of :label
-
setLabellings
public void setLabellings(List<Labelling> labellings)
- Specified by:
setLabellings
in interfacePlan
-
setPlanExecutionManager
public void setPlanExecutionManager(PlanExecutionManager planExecutionManager)
-
setBuildDefinitionManager
public void setBuildDefinitionManager(BuildDefinitionManager buildDefinitionManager)
-
setBuildLoggerManager
public void setBuildLoggerManager(BuildLoggerManager buildLoggerManager)
-
setResultsSummaryManager
public void setResultsSummaryManager(ResultsSummaryManager resultsSummaryManager)
-
setVariableDefinitionManager
public void setVariableDefinitionManager(VariableDefinitionManager variableDefinitionManager)
-
setLabelManager
public void setLabelManager(LabelManager labelManager)
-
getDiscriminator
public String getDiscriminator()
-
setDiscriminator
public void setDiscriminator(String discriminator)
-
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
-
setVersion
public void setVersion(@NotNull @NotNull Long version)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classcom.atlassian.core.bean.EntityObject
-
equals
public boolean equals(Object o)
- Overrides:
equals
in classcom.atlassian.core.bean.EntityObject
-
compareTo
public int compareTo(Plan plan)
- Specified by:
compareTo
in interfaceComparable<Plan>
-
-