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 ResultsSummaryManagerresultsSummaryManager-
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 intcompareTo(Plan plan)booleanequals(Object o)@NotNull BuildDefinitiongetBuildDefinition()Returns theBuildDefinitionthat backs thisPlan@Nullable BuildDefinitionForBuildgetBuildDefinitionXml()@NotNull StringgetBuildKey()This objects specific portion of the key.@NotNull BuildLoggergetBuildLogger()Returns the helper object to deal with logging@NotNull StringgetBuildName()@NotNull Optional<Long>getDatabaseId()StringgetDescription()StringgetDiscriminator()@NotNull List<VariableDefinition>getEffectiveVariables()Return effective list ofVariableDefinitions bind to this Plan.intgetFirstBuildNumber()What the number of the first build we have?@NotNull StringgetKey()Obtain the plan's unique key (uppercase alphanumeric).@NotNull List<Labelling>getLabellings()Used only for Hibernate mapping purposes.@NotNull List<String>getLabelNames()intgetLastBuildNumber()What was the number of the latest build (may be being built)@Nullable ResultsSummarygetLatestResultsSummary()Get the latest finished resultlonggetMasterId()@NotNull Optional<Long>getMasterIdIfExists()@NotNull StringgetName()Returns the full name for the build in the form of "project name - build name" e.g.@NotNull PlanKeygetPlanKey()@NotNull ProjectgetProject()Returns the parentProject@NotNull List<Labelling>getRelatedLabellings()Returns labellings that are applicable for the plan level@NotNull StringgetType()Returns the string representation of the type.@NotNull List<VariableDefinition>getVariables()Return list ofVariableDefinitions bind to this Plan@NotNull LonggetVersion()Returns the version number of this object.inthashCode()booleanhasMaster()booleanisBusy()Is thePlan"busy".booleanisMarkedForDeletion()Is the plan set to be deleted in the futurebooleanisSuspendedFromBuilding()Checks if the build has been enabled / disabled.voidsetBuildDefinitionManager(BuildDefinitionManager buildDefinitionManager)voidsetBuildDefinitionXml(@Nullable BuildDefinitionForBuild buildDefinitionXml)voidsetBuildKey(String buildKey)Define the build's unique key (uppercase alphanumeric)voidsetBuildLoggerManager(BuildLoggerManager buildLoggerManager)voidsetBuildName(String buildName)voidsetDescription(@Nullable String description)voidsetDiscriminator(String discriminator)voidsetKey(String fullKey)voidsetLabellings(List<Labelling> labellings)voidsetLabelManager(LabelManager labelManager)voidsetMarkedForDeletion(boolean markedForDeletion)voidsetName(@NotNull String name)voidsetPlanExecutionManager(PlanExecutionManager planExecutionManager)voidsetPlanKey(@NotNull PlanKey planKey)voidsetProject(Project project)voidsetResultsSummaryManager(ResultsSummaryManager resultsSummaryManager)voidsetSuspendedFromBuilding(boolean suspendedFromBuilding)Sets the build to suspend temporarilyvoidsetVariableDefinitionManager(VariableDefinitionManager variableDefinitionManager)voidsetVersion(@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:
getDatabaseIdin 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:
getPlanKeyin interfacePlanIdentifier- Specified by:
getPlanKeyin interfacePlanKeyProvider- Returns:
- planKey
-
getKey
@NotNull public @NotNull String 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
-
setPlanKey
public void setPlanKey(@NotNull @NotNull PlanKey planKey)- Specified by:
setPlanKeyin interfacePlan
-
getBuildKey
@NotNull public @NotNull String 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
-
setBuildKey
public void setBuildKey(String buildKey)
Description copied from interface:PlanDefine the build's unique key (uppercase alphanumeric)- Specified by:
setBuildKeyin interfacePlan- Parameters:
buildKey- The value of the key
-
getName
@NotNull public @NotNull String 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
-
setName
public void setName(@NotNull @NotNull String name)- Specified by:
setNamein interfaceDescribable
-
getBuildName
@NotNull public @NotNull 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()
-
setBuildName
public void setBuildName(String buildName)
- Specified by:
setBuildNamein interfacePlan
-
getDescription
public String getDescription()
- Specified by:
getDescriptionin interfaceDescriptionProvider
-
setDescription
public void setDescription(@Nullable @Nullable String description)- Specified by:
setDescriptionin interfaceDescribable
-
getType
@NotNull public @NotNull String 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
-
hasMaster
public boolean hasMaster()
- Specified by:
hasMasterin interfaceImmutablePlan- Returns:
- true if plan has a master plan
-
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
-
setMarkedForDeletion
public void setMarkedForDeletion(boolean markedForDeletion)
- Specified by:
setMarkedForDeletionin interfaceDeletable
-
setSuspendedFromBuilding
public void setSuspendedFromBuilding(boolean suspendedFromBuilding)
Description copied from interface:PlanSets the build to suspend temporarily- Specified by:
setSuspendedFromBuildingin interfacePlan
-
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
-
isBusy
public boolean isBusy()
Description copied from interface:ImmutablePlanIs 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:
isBusyin interfaceImmutablePlan- Returns:
- busy
-
getBuildLogger
@NotNull public @NotNull BuildLogger getBuildLogger()
Description copied from interface:ImmutablePlanReturns the helper object to deal with logging- Specified by:
getBuildLoggerin interfaceImmutablePlan- Returns:
- A
BuildLogger.
-
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
-
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
-
getLatestResultsSummary
@Nullable public @Nullable ResultsSummary getLatestResultsSummary()
Description copied from interface:ImmutablePlanGet the latest finished result- Specified by:
getLatestResultsSummaryin interfaceImmutablePlan- Specified by:
getLatestResultsSummaryin 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:ImmutablePlanReturn list ofVariableDefinitions bind to this Plan- Specified by:
getVariablesin interfaceImmutablePlan- Returns:
- non-null list of
VariableDefinition
-
getEffectiveVariables
@NotNull public @NotNull List<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
-
setProject
public void setProject(Project project)
- Specified by:
setProjectin interfacePlan
-
getBuildDefinition
@NotNull public @NotNull BuildDefinition getBuildDefinition()
Description copied from interface:ImmutablePlanReturns theBuildDefinitionthat backs thisPlan- Specified by:
getBuildDefinitionin interfaceImmutablePlan- Returns:
BuildDefinitionobject.
-
getProject
@NotNull public @NotNull Project getProject()
Description copied from interface:ImmutablePlanReturns the parentProject- Specified by:
getProjectin interfaceImmutablePlan- Specified by:
getProjectin interfacePlanIdentifier- Returns:
Project. Never null
-
getMasterId
public long getMasterId()
- Specified by:
getMasterIdin interfacePlanIdentifier- Returns:
- database id of master of this Plan or -1 if none.
-
getMasterIdIfExists
@NotNull public @NotNull Optional<Long> getMasterIdIfExists()
- Specified by:
getMasterIdIfExistsin interfacePlanIdentifier- Returns:
- database id of master of this Plan or empty if none.
-
getBuildDefinitionXml
@Nullable public @Nullable BuildDefinitionForBuild getBuildDefinitionXml()
- Specified by:
getBuildDefinitionXmlin interfacePlan
-
setBuildDefinitionXml
public void setBuildDefinitionXml(@Nullable @Nullable BuildDefinitionForBuild buildDefinitionXml)- Specified by:
setBuildDefinitionXmlin interfacePlan
-
getLabellings
@NotNull public @NotNull List<Labelling> getLabellings()
Description copied from interface:PlanUsed only for Hibernate mapping purposes. Deprecated for removal from the interface- Specified by:
getLabellingsin interfacePlan- Returns:
-
getRelatedLabellings
@NotNull public @NotNull List<Labelling> getRelatedLabellings()
Description copied from interface:PlanReturns labellings that are applicable for the plan level- Specified by:
getRelatedLabellingsin interfacePlan- Returns:
- Empty list if no labels
-
getLabelNames
@NotNull public @NotNull List<String> getLabelNames()
- Specified by:
getLabelNamesin interfaceImmutablePlan- Returns:
- all the names of related labels with a namespace of :label
-
setLabellings
public void setLabellings(List<Labelling> labellings)
- Specified by:
setLabellingsin 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:VersionableReturns the version number of this object.- Specified by:
getVersionin interfaceVersionable- Returns:
- the version number
-
setVersion
public void setVersion(@NotNull @NotNull Long version)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classcom.atlassian.core.bean.EntityObject
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classcom.atlassian.core.bean.EntityObject
-
compareTo
public int compareTo(Plan plan)
- Specified by:
compareToin interfaceComparable<Plan>
-
-