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:
-
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
-
Method Summary
Modifier and TypeMethodDescription@NotNull BranchTriggeringOption
@Nullable TriggerDefinition
Default trigger for new branches.int
Returns a number of days the branch will be consider inactive (as per no commits activity in the repo) and therefore deleted.Returns the reg expression every vcs branch name needs to match for Bamboo to automatically create a plan branch for it.@NotNull PlanBranchWorkflow
Return the type of plan branching workflow.int
Returns a number of days the plan branch will be deleted once detected the vcs branch has been removed.boolean
Returns if Bamboo is configured to automatically clean up plan branches for branches that are considered inactive.boolean
Returns if Bamboo is configured to automatically create plan branches when detecting new branches in the repo.boolean
Returns if Bamboo will attempt to create remote issue links in JIRA when it finds an issue key in the branch name.boolean
Returns if Bamboo is configured to automatically clean up plan branches if the vcs branch is removed.boolean
isValid()
Is the object state valid after it has been initialised from properties.void
populateFromConfig
(@NotNull org.apache.commons.configuration.HierarchicalConfiguration config) Update the current object with data in theHierarchicalConfiguration
void
setBranchTriggeringOption
(@NotNull BranchTriggeringOption branchTriggeringOption) void
setDefaultBranchIntegrationConfiguration
(BranchIntegrationConfiguration defaultBranchIntegrationConfiguration) void
setDefaultBranchNotificationStrategy
(BranchNotificationStrategy defaultBranchNotificationStrategy) void
setDefaultTrigger
(@Nullable TriggerDefinition defaultTrigger) Set default trigger for new branches.void
setInactiveBranchCleanUpEnabled
(boolean enabled) Sets Bamboo to automatically cleanup plan branches if vcs branch is inactive.void
setInactiveBranchCleanUpPeriodInDays
(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.void
setMatchingPattern
(@NotNull String regularExpression) Sets the reg expression every vcs branch name will match for Bamboo to automatically create a plan branch for it.void
setPlanBranchCreationEnabled
(boolean isBranchCreationEnabled) Sets Bamboo to automatically create plan branches when detecting new branches in the repo.void
setPlanBranchWorkflow
(@NotNull PlanBranchWorkflow planBranchWorkflow) Sets the type of plan branching workflow.void
setRemoteJiraBranchLinkingEnabled
(boolean jiraBranchLinkingEnabled) Sets if Bamboo will attempt to create remote issue links in JIRA when it finds an issue key in the branch name.void
setRemovedBranchCleanUpEnabled
(boolean isAutomaticPlanBranchCleanUpEnabled) Sets Bamboo to automatically cleanup plan branches if vcs branch is deleted.void
setRemovedBranchCleanUpPeriodInDays
(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.HierarchicalConfiguration
Generate aHierarchicalConfiguration
from the current state of the object
-
Constructor Details
-
BranchMonitoringConfigurationImpl
public BranchMonitoringConfigurationImpl()
-
-
Method Details
-
getPlanBranchWorkflow
Description copied from interface:BranchMonitoringConfiguration
Return 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:
getPlanBranchWorkflow
in interfaceBranchMonitoringConfiguration
-
setPlanBranchWorkflow
Description copied from interface:BranchMonitoringConfiguration
Sets the type of plan branching workflow.- Specified by:
setPlanBranchWorkflow
in interfaceBranchMonitoringConfiguration
- See Also:
-
isPlanBranchCreationEnabled
public boolean isPlanBranchCreationEnabled()Description copied from interface:BranchMonitoringConfiguration
Returns if Bamboo is configured to automatically create plan branches when detecting new branches in the repo.- Specified by:
isPlanBranchCreationEnabled
in interfaceBranchMonitoringConfiguration
-
isRemovedBranchCleanUpEnabled
public boolean isRemovedBranchCleanUpEnabled()Description copied from interface:BranchMonitoringConfiguration
Returns 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:
isRemovedBranchCleanUpEnabled
in interfaceBranchMonitoringConfiguration
-
setPlanBranchCreationEnabled
public void setPlanBranchCreationEnabled(boolean isBranchCreationEnabled) Description copied from interface:BranchMonitoringConfiguration
Sets 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:
setPlanBranchCreationEnabled
in interfaceBranchMonitoringConfiguration
- Parameters:
isBranchCreationEnabled
- turns on / off this setting
-
setRemovedBranchCleanUpEnabled
public void setRemovedBranchCleanUpEnabled(boolean isAutomaticPlanBranchCleanUpEnabled) Description copied from interface:BranchMonitoringConfiguration
Sets Bamboo to automatically cleanup plan branches if vcs branch is deleted.- Specified by:
setRemovedBranchCleanUpEnabled
in interfaceBranchMonitoringConfiguration
- Parameters:
isAutomaticPlanBranchCleanUpEnabled
- turns on / off this setting
-
isInactiveBranchCleanUpEnabled
public boolean isInactiveBranchCleanUpEnabled()Description copied from interface:BranchMonitoringConfiguration
Returns 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:
isInactiveBranchCleanUpEnabled
in interfaceBranchMonitoringConfiguration
-
setInactiveBranchCleanUpEnabled
public void setInactiveBranchCleanUpEnabled(boolean enabled) Description copied from interface:BranchMonitoringConfiguration
Sets Bamboo to automatically cleanup plan branches if vcs branch is inactive.- Specified by:
setInactiveBranchCleanUpEnabled
in interfaceBranchMonitoringConfiguration
- Parameters:
enabled
- turns on / off this setting
-
getMatchingPattern
Description copied from interface:BranchMonitoringConfiguration
Returns 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:
getMatchingPattern
in interfaceBranchMonitoringConfiguration
- Returns:
- regular expression for matching vcs branches
-
setMatchingPattern
Description copied from interface:BranchMonitoringConfiguration
Sets 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:
setMatchingPattern
in interfaceBranchMonitoringConfiguration
- Parameters:
regularExpression
- regular expression for the vcs branch name to match
-
getInactiveBranchCleanUpPeriodInDays
public int getInactiveBranchCleanUpPeriodInDays()Description copied from interface:BranchMonitoringConfiguration
Returns a number of days the branch will be consider inactive (as per no commits activity in the repo) and therefore deleted.- Specified by:
getInactiveBranchCleanUpPeriodInDays
in interfaceBranchMonitoringConfiguration
- Returns:
- number of days a vcs branch is consider to be inactive
-
setInactiveBranchCleanUpPeriodInDays
public void setInactiveBranchCleanUpPeriodInDays(int inactiveBranchCleanUpPeriodInDays) Description copied from interface:BranchMonitoringConfiguration
Sets the number of days a plan branch will be consider inactive (as per no commits activity in the repo) and therefore deleted.- Specified by:
setInactiveBranchCleanUpPeriodInDays
in interfaceBranchMonitoringConfiguration
- Parameters:
inactiveBranchCleanUpPeriodInDays
- number of days a vcs branch is considered to be inactive
-
getRemovedBranchCleanUpPeriodInDays
public int getRemovedBranchCleanUpPeriodInDays()Description copied from interface:BranchMonitoringConfiguration
Returns a number of days the plan branch will be deleted once detected the vcs branch has been removed.- Specified by:
getRemovedBranchCleanUpPeriodInDays
in interfaceBranchMonitoringConfiguration
- Returns:
- number of days a plan branch is considered to be deleted after
-
setRemovedBranchCleanUpPeriodInDays
public void setRemovedBranchCleanUpPeriodInDays(int cleanUpPeriodInDays) Description copied from interface:BranchMonitoringConfiguration
Sets the number of days a plan branch will be deleted once detected the vcs branch is removed.- Specified by:
setRemovedBranchCleanUpPeriodInDays
in interfaceBranchMonitoringConfiguration
- Parameters:
cleanUpPeriodInDays
- number of days a plan branch is considered to be removed after
-
getDefaultBranchNotificationStrategy
- Specified by:
getDefaultBranchNotificationStrategy
in interfaceBranchMonitoringConfiguration
-
setDefaultBranchNotificationStrategy
public void setDefaultBranchNotificationStrategy(BranchNotificationStrategy defaultBranchNotificationStrategy) - Specified by:
setDefaultBranchNotificationStrategy
in interfaceBranchMonitoringConfiguration
-
getDefaultBranchIntegrationConfiguration
- Specified by:
getDefaultBranchIntegrationConfiguration
in interfaceBranchMonitoringConfiguration
-
setDefaultBranchIntegrationConfiguration
public void setDefaultBranchIntegrationConfiguration(BranchIntegrationConfiguration defaultBranchIntegrationConfiguration) - Specified by:
setDefaultBranchIntegrationConfiguration
in interfaceBranchMonitoringConfiguration
-
isRemoteJiraBranchLinkingEnabled
public boolean isRemoteJiraBranchLinkingEnabled()Description copied from interface:BranchMonitoringConfiguration
Returns 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:
isRemoteJiraBranchLinkingEnabled
in interfaceBranchMonitoringConfiguration
- Returns:
- true if Bamboo should try to create remote issue links in JIRA
-
setRemoteJiraBranchLinkingEnabled
public void setRemoteJiraBranchLinkingEnabled(boolean jiraBranchLinkingEnabled) Description copied from interface:BranchMonitoringConfiguration
Sets 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:
setRemoteJiraBranchLinkingEnabled
in interfaceBranchMonitoringConfiguration
- Parameters:
jiraBranchLinkingEnabled
- enables/disables this setting
-
populateFromConfig
public void populateFromConfig(@NotNull @NotNull org.apache.commons.configuration.HierarchicalConfiguration config) Description copied from interface:ConvertibleFromConfig
Update the current object with data in theHierarchicalConfiguration
- Specified by:
populateFromConfig
in interfaceConvertibleFromConfig
-
isValid
public boolean isValid()Description copied from interface:OptionallyConvertibleFromConfig
Is the object state valid after it has been initialised from properties.- Specified by:
isValid
in interfaceOptionallyConvertibleFromConfig
- Returns:
-
toConfiguration
@NotNull public @NotNull org.apache.commons.configuration.HierarchicalConfiguration toConfiguration()Description copied from interface:ConvertibleFromConfig
Generate aHierarchicalConfiguration
from the current state of the object- Specified by:
toConfiguration
in interfaceConvertibleFromConfig
- Returns:
- Always returns an
HierarchicalConfiguration
. Never null
-
getBranchTriggeringOption
- Specified by:
getBranchTriggeringOption
in interfaceBranchMonitoringConfiguration
-
setBranchTriggeringOption
public void setBranchTriggeringOption(@NotNull @NotNull BranchTriggeringOption branchTriggeringOption) - Specified by:
setBranchTriggeringOption
in interfaceBranchMonitoringConfiguration
-
getDefaultTrigger
Description copied from interface:BranchMonitoringConfiguration
Default trigger for new branches. Has an effect only if branch triggering options is set to 'custom'.- Specified by:
getDefaultTrigger
in interfaceBranchMonitoringConfiguration
-
setDefaultTrigger
Description copied from interface:BranchMonitoringConfiguration
Set default trigger for new branches. Has an effect only if branch triggering options is set to 'custom'.- Specified by:
setDefaultTrigger
in interfaceBranchMonitoringConfiguration
-