Package com.atlassian.bamboo.plan.branch
Class BranchMonitoringConfigurationImpl
- java.lang.Object
-
- com.atlassian.bamboo.plan.branch.BranchMonitoringConfigurationImpl
-
- All Implemented Interfaces:
ConvertibleFromConfig,OptionallyConvertibleFromConfig,BranchMonitoringConfiguration,Serializable
public class BranchMonitoringConfigurationImpl extends Object implements BranchMonitoringConfiguration
Keeps build plan specific plan branch monitoring settings.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface com.atlassian.bamboo.plan.branch.BranchMonitoringConfiguration
BRANCH_CREATION_CONFIG_KEY, BRANCH_TRIGGERING_CFG_KEY, BRANCHES_CUSTOM_CONFIG_KEY, BRANCHES_INACTIVITY_CLEAN_UP_PERIOD, BRANCHES_MATCHING_PATTERN_CONFIG_KEY, BRANCHES_NOTIFICATION_STRATEGY_CONFIG_KEY, DEFAULT_BRANCH_MATCH_NAME_PATTERN, DEFAULT_REMOVED_BRANCH_CLEAN_UP_PERIOD, DEFAULT_TIME_OF_INACTIVITY_DAYS, INACTIVE_BRANCH_CLEANUP_CONFIG_KEY, JIRA_BRANCH_LINKING_CONFIG_KEY, MINIMUM_INACTIVE_BRANCH_CLEAN_UP_PERIOD, MINIMUM_REMOVED_BRANCH_CLEAN_UP_PERIOD, PLAN_BRANCH_WORKFLOW_CFG_KEY, PLAN_BRANCHES_MONITORING_ENABLED, REMOVED_BRANCH_CLEANUP_CONFIG_KEY, REMOVED_BRANCH_CLEANUP_PERIOD_CONFIG_KEY, REMOVED_BRANCH_DAILY_CLEAN_UP_PERIOD
-
-
Constructor Summary
Constructors Constructor Description BranchMonitoringConfigurationImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull BranchTriggeringOptiongetBranchTriggeringOption()BranchIntegrationConfigurationgetDefaultBranchIntegrationConfiguration()BranchNotificationStrategygetDefaultBranchNotificationStrategy()@Nullable TriggerDefinitiongetDefaultTrigger()Default trigger for new branches.intgetInactiveBranchCleanUpPeriodInDays()Returns a number of days the branch will be consider inactive (as per no commits activity in the repo) and therefore deleted.StringgetMatchingPattern()Returns the reg expression every vcs branch name needs to match for Bamboo to automatically create a plan branch for it.@NotNull PlanBranchWorkflowgetPlanBranchWorkflow()Return the type of plan branching workflow.intgetRemovedBranchCleanUpPeriodInDays()Returns a number of days the plan branch will be deleted once detected the vcs branch has been removed.booleanisInactiveBranchCleanUpEnabled()Returns if Bamboo is configured to automatically clean up plan branches for branches that are considered inactive.booleanisPlanBranchCreationEnabled()Returns if Bamboo is configured to automatically create plan branches when detecting new branches in the repo.booleanisRemoteJiraBranchLinkingEnabled()Returns if Bamboo will attempt to create remote issue links in JIRA when it finds an issue key in the branch name.booleanisRemovedBranchCleanUpEnabled()Returns if Bamboo is configured to automatically clean up plan branches if the vcs branch is removed.booleanisValid()Is the object state valid after it has been initialised from properties.voidpopulateFromConfig(@NotNull org.apache.commons.configuration.HierarchicalConfiguration config)Update the current object with data in theHierarchicalConfigurationvoidsetBranchTriggeringOption(@NotNull BranchTriggeringOption branchTriggeringOption)voidsetDefaultBranchIntegrationConfiguration(BranchIntegrationConfiguration defaultBranchIntegrationConfiguration)voidsetDefaultBranchNotificationStrategy(BranchNotificationStrategy defaultBranchNotificationStrategy)voidsetDefaultTrigger(@Nullable TriggerDefinition defaultTrigger)Set default trigger for new branches.voidsetInactiveBranchCleanUpEnabled(boolean enabled)Sets Bamboo to automatically cleanup plan branches if vcs branch is inactive.voidsetInactiveBranchCleanUpPeriodInDays(int inactiveBranchCleanUpPeriodInDays)Sets the number of days a plan branch will be consider inactive (as per no commits activity in the repo) and therefore deleted.voidsetMatchingPattern(@NotNull String regularExpression)Sets the reg expression every vcs branch name will match for Bamboo to automatically create a plan branch for it.voidsetPlanBranchCreationEnabled(boolean isBranchCreationEnabled)Sets Bamboo to automatically create plan branches when detecting new branches in the repo.voidsetPlanBranchWorkflow(@NotNull PlanBranchWorkflow planBranchWorkflow)Sets the type of plan branching workflow.voidsetRemoteJiraBranchLinkingEnabled(boolean jiraBranchLinkingEnabled)Sets if Bamboo will attempt to create remote issue links in JIRA when it finds an issue key in the branch name.voidsetRemovedBranchCleanUpEnabled(boolean isAutomaticPlanBranchCleanUpEnabled)Sets Bamboo to automatically cleanup plan branches if vcs branch is deleted.voidsetRemovedBranchCleanUpPeriodInDays(int cleanUpPeriodInDays)Sets the number of days a plan branch will be deleted once detected the vcs branch is removed.@NotNull org.apache.commons.configuration.HierarchicalConfigurationtoConfiguration()Generate aHierarchicalConfigurationfrom the current state of the object
-
-
-
Method Detail
-
getPlanBranchWorkflow
@NotNull public @NotNull PlanBranchWorkflow getPlanBranchWorkflow()
Description copied from interface:BranchMonitoringConfigurationReturn the type of plan branching workflow. The workflow indicates on what changes will Bamboo react when managing plan branches (e.g. VCS branch creation/deletion, pull request creation/deletion).- Specified by:
getPlanBranchWorkflowin interfaceBranchMonitoringConfiguration
-
setPlanBranchWorkflow
public void setPlanBranchWorkflow(@NotNull @NotNull PlanBranchWorkflow planBranchWorkflow)Description copied from interface:BranchMonitoringConfigurationSets the type of plan branching workflow.- Specified by:
setPlanBranchWorkflowin interfaceBranchMonitoringConfiguration- See Also:
BranchMonitoringConfiguration.getPlanBranchWorkflow()
-
isPlanBranchCreationEnabled
public boolean isPlanBranchCreationEnabled()
Description copied from interface:BranchMonitoringConfigurationReturns if Bamboo is configured to automatically create plan branches when detecting new branches in the repo.- Specified by:
isPlanBranchCreationEnabledin interfaceBranchMonitoringConfiguration
-
isRemovedBranchCleanUpEnabled
public boolean isRemovedBranchCleanUpEnabled()
Description copied from interface:BranchMonitoringConfigurationReturns if Bamboo is configured to automatically clean up plan branches if the vcs branch is removed. This will happen X days after the vcs branch been deleted, where X is an user configurable value that can be set inBranchMonitoringConfiguration.setRemovedBranchCleanUpPeriodInDays(int).- Specified by:
isRemovedBranchCleanUpEnabledin interfaceBranchMonitoringConfiguration
-
setPlanBranchCreationEnabled
public void setPlanBranchCreationEnabled(boolean isBranchCreationEnabled)
Description copied from interface:BranchMonitoringConfigurationSets Bamboo to automatically create plan branches when detecting new branches in the repo. Existing branches in the repo won't have a build, just the recently created ones.- Specified by:
setPlanBranchCreationEnabledin interfaceBranchMonitoringConfiguration- Parameters:
isBranchCreationEnabled- turns on / off this setting
-
setRemovedBranchCleanUpEnabled
public void setRemovedBranchCleanUpEnabled(boolean isAutomaticPlanBranchCleanUpEnabled)
Description copied from interface:BranchMonitoringConfigurationSets Bamboo to automatically cleanup plan branches if vcs branch is deleted.- Specified by:
setRemovedBranchCleanUpEnabledin interfaceBranchMonitoringConfiguration- Parameters:
isAutomaticPlanBranchCleanUpEnabled- turns on / off this setting
-
isInactiveBranchCleanUpEnabled
public boolean isInactiveBranchCleanUpEnabled()
Description copied from interface:BranchMonitoringConfigurationReturns if Bamboo is configured to automatically clean up plan branches for branches that are considered inactive. This will happen if the vcs branch does not have commits for X days, where X is an user configurable value that can be set throughBranchMonitoringConfiguration.setInactiveBranchCleanUpPeriodInDays(int).- Specified by:
isInactiveBranchCleanUpEnabledin interfaceBranchMonitoringConfiguration
-
setInactiveBranchCleanUpEnabled
public void setInactiveBranchCleanUpEnabled(boolean enabled)
Description copied from interface:BranchMonitoringConfigurationSets Bamboo to automatically cleanup plan branches if vcs branch is inactive.- Specified by:
setInactiveBranchCleanUpEnabledin interfaceBranchMonitoringConfiguration- Parameters:
enabled- turns on / off this setting
-
getMatchingPattern
public String getMatchingPattern()
Description copied from interface:BranchMonitoringConfigurationReturns the reg expression every vcs branch name needs to match for Bamboo to automatically create a plan branch for it. This will happen only if branch workflow is enabled, which can be evaluated throughBranchMonitoringConfiguration.getPlanBranchWorkflow().- Specified by:
getMatchingPatternin interfaceBranchMonitoringConfiguration- Returns:
- regular expression for matching vcs branches
-
setMatchingPattern
public void setMatchingPattern(@NotNull @NotNull String regularExpression)Description copied from interface:BranchMonitoringConfigurationSets the reg expression every vcs branch name will match for Bamboo to automatically create a plan branch for it. Setting this value won't turn automatic branch creation on, for this useBranchMonitoringConfiguration.setPlanBranchWorkflow(PlanBranchWorkflow).- Specified by:
setMatchingPatternin interfaceBranchMonitoringConfiguration- Parameters:
regularExpression- regular expression for the vcs branch name to match
-
getInactiveBranchCleanUpPeriodInDays
public int getInactiveBranchCleanUpPeriodInDays()
Description copied from interface:BranchMonitoringConfigurationReturns a number of days the branch will be consider inactive (as per no commits activity in the repo) and therefore deleted.- Specified by:
getInactiveBranchCleanUpPeriodInDaysin interfaceBranchMonitoringConfiguration- Returns:
- number of days a vcs branch is consider to be inactive
-
setInactiveBranchCleanUpPeriodInDays
public void setInactiveBranchCleanUpPeriodInDays(int inactiveBranchCleanUpPeriodInDays)
Description copied from interface:BranchMonitoringConfigurationSets the number of days a plan branch will be consider inactive (as per no commits activity in the repo) and therefore deleted.- Specified by:
setInactiveBranchCleanUpPeriodInDaysin interfaceBranchMonitoringConfiguration- Parameters:
inactiveBranchCleanUpPeriodInDays- number of days a vcs branch is considered to be inactive
-
getRemovedBranchCleanUpPeriodInDays
public int getRemovedBranchCleanUpPeriodInDays()
Description copied from interface:BranchMonitoringConfigurationReturns a number of days the plan branch will be deleted once detected the vcs branch has been removed.- Specified by:
getRemovedBranchCleanUpPeriodInDaysin interfaceBranchMonitoringConfiguration- Returns:
- number of days a plan branch is considered to be deleted after
-
setRemovedBranchCleanUpPeriodInDays
public void setRemovedBranchCleanUpPeriodInDays(int cleanUpPeriodInDays)
Description copied from interface:BranchMonitoringConfigurationSets the number of days a plan branch will be deleted once detected the vcs branch is removed.- Specified by:
setRemovedBranchCleanUpPeriodInDaysin interfaceBranchMonitoringConfiguration- Parameters:
cleanUpPeriodInDays- number of days a plan branch is considered to be removed after
-
getDefaultBranchNotificationStrategy
public BranchNotificationStrategy getDefaultBranchNotificationStrategy()
- Specified by:
getDefaultBranchNotificationStrategyin interfaceBranchMonitoringConfiguration
-
setDefaultBranchNotificationStrategy
public void setDefaultBranchNotificationStrategy(BranchNotificationStrategy defaultBranchNotificationStrategy)
- Specified by:
setDefaultBranchNotificationStrategyin interfaceBranchMonitoringConfiguration
-
getDefaultBranchIntegrationConfiguration
public BranchIntegrationConfiguration getDefaultBranchIntegrationConfiguration()
- Specified by:
getDefaultBranchIntegrationConfigurationin interfaceBranchMonitoringConfiguration
-
setDefaultBranchIntegrationConfiguration
public void setDefaultBranchIntegrationConfiguration(BranchIntegrationConfiguration defaultBranchIntegrationConfiguration)
- Specified by:
setDefaultBranchIntegrationConfigurationin interfaceBranchMonitoringConfiguration
-
isRemoteJiraBranchLinkingEnabled
public boolean isRemoteJiraBranchLinkingEnabled()
Description copied from interface:BranchMonitoringConfigurationReturns if Bamboo will attempt to create remote issue links in JIRA when it finds an issue key in the branch name. Bamboo will always create the link from Bamboo to JIRA regardless of this setting.- Specified by:
isRemoteJiraBranchLinkingEnabledin interfaceBranchMonitoringConfiguration- Returns:
- true if Bamboo should try to create remote issue links in JIRA
-
setRemoteJiraBranchLinkingEnabled
public void setRemoteJiraBranchLinkingEnabled(boolean jiraBranchLinkingEnabled)
Description copied from interface:BranchMonitoringConfigurationSets if Bamboo will attempt to create remote issue links in JIRA when it finds an issue key in the branch name. Bamboo will always create the link from Bamboo to JIRA regardless of this setting.- Specified by:
setRemoteJiraBranchLinkingEnabledin interfaceBranchMonitoringConfiguration- Parameters:
jiraBranchLinkingEnabled- enables/disables this setting
-
populateFromConfig
public void populateFromConfig(@NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration config)Description copied from interface:ConvertibleFromConfigUpdate the current object with data in theHierarchicalConfiguration- Specified by:
populateFromConfigin interfaceConvertibleFromConfig
-
isValid
public boolean isValid()
Description copied from interface:OptionallyConvertibleFromConfigIs the object state valid after it has been initialised from properties.- Specified by:
isValidin interfaceOptionallyConvertibleFromConfig- Returns:
-
toConfiguration
@NotNull public @NotNull org.apache.commons.configuration.HierarchicalConfiguration toConfiguration()
Description copied from interface:ConvertibleFromConfigGenerate aHierarchicalConfigurationfrom the current state of the object- Specified by:
toConfigurationin interfaceConvertibleFromConfig- Returns:
- Always returns an
HierarchicalConfiguration. Never null
-
getBranchTriggeringOption
@NotNull public @NotNull BranchTriggeringOption getBranchTriggeringOption()
- Specified by:
getBranchTriggeringOptionin interfaceBranchMonitoringConfiguration
-
setBranchTriggeringOption
public void setBranchTriggeringOption(@NotNull @NotNull BranchTriggeringOption branchTriggeringOption)- Specified by:
setBranchTriggeringOptionin interfaceBranchMonitoringConfiguration
-
getDefaultTrigger
@Nullable public @Nullable TriggerDefinition getDefaultTrigger()
Description copied from interface:BranchMonitoringConfigurationDefault trigger for new branches. Has an effect only if branch triggering options is set to 'custom'.- Specified by:
getDefaultTriggerin interfaceBranchMonitoringConfiguration
-
setDefaultTrigger
public void setDefaultTrigger(@Nullable @Nullable TriggerDefinition defaultTrigger)Description copied from interface:BranchMonitoringConfigurationSet default trigger for new branches. Has an effect only if branch triggering options is set to 'custom'.- Specified by:
setDefaultTriggerin interfaceBranchMonitoringConfiguration
-
-