Class KeepRulesManager
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.cleanup.v2019.settings.KeepRulesManager
-
- Direct Known Subclasses:
KeepRulesManagerWeb
public class KeepRulesManager extends Object
Manages clean-up keep rules and their storage via build configuration/project features.- Since:
- 2019.2
- See Also:
for base rules management
-
-
Field Summary
Fields Modifier and Type Field Description static String
RULES_FEATURE_TYPE
static String
RULES_FEATURES_DEFAULT_PREFIX
static String
USE_ONLY_OWN_BUILD_TYPE_RULES
-
Constructor Summary
Constructors Constructor Description KeepRulesManager(KeepRuleFactory keepRuleFactory, ProjectFeatureDescriptorFactory projectFeatureDescriptorFactory, BuildFeatureDescriptorFactory buildFeatureDescriptorFactory, AccessChecker accessChecker, ConfigActionFactory configActionFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
addRule(BuildTypeEx buildType, StorableRule rule)
Adds the new rule to the build configuration.void
addRule(BuildTypeEx buildType, StorableRule rule, String featureId)
Adds the rule with the provided id to the build configuration.String
addRule(BuildTypeTemplateEx template, StorableRule rule)
Adds the new rule to the template.void
addRule(BuildTypeTemplateEx template, StorableRule rule, String featureId)
Adds the rule with the provided id to the template.String
addRule(SProject project, StorableRule rule)
Adds the new rule to the project.void
addRule(SProject project, StorableRule rule, String featureId)
Adds the rule with the provided id to the project.ClashingCleanupRules
computeClashingCleanupRulesAfterMove(BuildTypeEx buildType, ProjectEx targetProject)
ClashingCleanupRules
computeClashingCleanupRulesAfterMove(ProjectEx project, ProjectEx targetProject)
void
deleteRule(BuildTypeEx buildType, String featureId)
void
deleteRule(BuildTypeTemplateEx template, String featureId)
void
deleteRule(ProjectEx project, String featureId)
Collection<KeepRule>
getEnabledRules(BuildTypeEx buildType)
Returns enabled effective rules from the whole build type hierarchy.Collection<KeepRule>
getEnabledRules(ProjectEx project)
Returns enabled effective rules from the whole project hierarchy.Map<String,KeepRule>
getFeatureId2EnabledRuleMap(BuildTypeEx buildType)
Returns map from feature ids to enabled effective rules from the whole build type hierarchy.Map<String,KeepRule>
getFeatureId2EnabledRuleMap(ProjectEx project)
Returns map from feature ids to enabled effective rules from the whole project hierarchy.Map<String,StorableRule>
getOwnRules(BuildTypeEx buildType)
Returns map from the build type own feature ids to keep rule wrappers.Map<String,StorableRule>
getOwnRules(BuildTypeTemplateEx template)
Returns map from the template own feature ids to keep rule wrappers.Map<String,StorableRule>
getOwnRules(SProject project)
Returns map from the project own feature ids to keep rule wrappers.static boolean
isKeepRule(SBuildFeatureDescriptor feature)
static boolean
isKeepRule(SProjectFeatureDescriptor feature)
void
resetRule(BuildTypeEx buildType, String featureId)
void
resetRule(BuildTypeTemplateEx template, String featureId)
void
resetRule(ProjectEx project, String featureId)
void
updateRule(BuildTypeEx buildType, StorableRule rule, String featureId)
void
updateRule(BuildTypeTemplateEx template, StorableRule rule, String featureId)
void
updateRule(ProjectEx project, StorableRule rule, String featureId)
protected void
walkBuildTypeRules(BuildTypeEx buildType, BuildTypeRulesHoldersVisitor visitor)
protected void
walkProjectRules(ProjectEx project, ProjectRulesHoldersVisitor visitor)
-
-
-
Field Detail
-
RULES_FEATURE_TYPE
public static final String RULES_FEATURE_TYPE
- See Also:
- Constant Field Values
-
RULES_FEATURES_DEFAULT_PREFIX
public static final String RULES_FEATURES_DEFAULT_PREFIX
- See Also:
- Constant Field Values
-
USE_ONLY_OWN_BUILD_TYPE_RULES
public static final String USE_ONLY_OWN_BUILD_TYPE_RULES
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
KeepRulesManager
public KeepRulesManager(@NotNull KeepRuleFactory keepRuleFactory, @NotNull ProjectFeatureDescriptorFactory projectFeatureDescriptorFactory, @NotNull BuildFeatureDescriptorFactory buildFeatureDescriptorFactory, @NotNull AccessChecker accessChecker, @NotNull ConfigActionFactory configActionFactory)
-
-
Method Detail
-
isKeepRule
public static boolean isKeepRule(@Nullable SBuildFeatureDescriptor feature)
-
isKeepRule
public static boolean isKeepRule(@Nullable SProjectFeatureDescriptor feature)
-
getOwnRules
@NotNull public Map<String,StorableRule> getOwnRules(@NotNull BuildTypeEx buildType)
Returns map from the build type own feature ids to keep rule wrappers.
-
getOwnRules
@NotNull public Map<String,StorableRule> getOwnRules(@NotNull BuildTypeTemplateEx template)
Returns map from the template own feature ids to keep rule wrappers.
-
getOwnRules
@NotNull public Map<String,StorableRule> getOwnRules(@NotNull SProject project)
Returns map from the project own feature ids to keep rule wrappers.
-
getEnabledRules
@NotNull public Collection<KeepRule> getEnabledRules(@NotNull BuildTypeEx buildType)
Returns enabled effective rules from the whole build type hierarchy.
-
getFeatureId2EnabledRuleMap
@NotNull public Map<String,KeepRule> getFeatureId2EnabledRuleMap(@NotNull BuildTypeEx buildType)
Returns map from feature ids to enabled effective rules from the whole build type hierarchy.
-
getEnabledRules
@NotNull public Collection<KeepRule> getEnabledRules(@NotNull ProjectEx project)
Returns enabled effective rules from the whole project hierarchy.
-
getFeatureId2EnabledRuleMap
@NotNull public Map<String,KeepRule> getFeatureId2EnabledRuleMap(@NotNull ProjectEx project)
Returns map from feature ids to enabled effective rules from the whole project hierarchy.
-
addRule
@NotNull public String addRule(@NotNull BuildTypeEx buildType, @NotNull StorableRule rule) throws DuplicateIdException
Adds the new rule to the build configuration. The corresponding feature id is created and returned.- Returns:
- newly created feature id of the rule
- Throws:
DuplicateIdException
-
addRule
public void addRule(@NotNull BuildTypeEx buildType, @NotNull StorableRule rule, @NotNull String featureId) throws DuplicateIdException
Adds the rule with the provided id to the build configuration. Main purpose: override existing rule by its id.- Throws:
DuplicateIdException
-
addRule
@NotNull public String addRule(@NotNull BuildTypeTemplateEx template, @NotNull StorableRule rule) throws DuplicateIdException
Adds the new rule to the template. The corresponding feature id is created and returned.- Returns:
- newly created feature id of the rule
- Throws:
DuplicateIdException
- See Also:
CleanupProperties.keepRulesInTemplatesSupported()
-
addRule
public void addRule(@NotNull BuildTypeTemplateEx template, @NotNull StorableRule rule, @NotNull String featureId) throws DuplicateIdException
Adds the rule with the provided id to the template. Main purpose: override existing rule by its id.- Throws:
DuplicateIdException
- See Also:
CleanupProperties.keepRulesInTemplatesSupported()
-
addRule
@NotNull public String addRule(@NotNull SProject project, @NotNull StorableRule rule) throws DuplicateIdException
Adds the new rule to the project. The corresponding feature id is created and returned.- Returns:
- newly created feature id of the rule
- Throws:
DuplicateIdException
-
addRule
public void addRule(@NotNull SProject project, @NotNull StorableRule rule, @NotNull String featureId) throws DuplicateIdException
Adds the rule with the provided id to the project. Main purpose: override existing rule by its id.- Throws:
DuplicateIdException
-
updateRule
public void updateRule(@NotNull BuildTypeEx buildType, @NotNull StorableRule rule, @NotNull String featureId) throws NoFeatureIdException
- Throws:
NoFeatureIdException
-
updateRule
public void updateRule(@NotNull BuildTypeTemplateEx template, @NotNull StorableRule rule, @NotNull String featureId) throws NoFeatureIdException
- Throws:
NoFeatureIdException
-
updateRule
public void updateRule(@NotNull ProjectEx project, @NotNull StorableRule rule, @NotNull String featureId) throws NoFeatureIdException
- Throws:
NoFeatureIdException
-
deleteRule
public void deleteRule(@NotNull BuildTypeEx buildType, @NotNull String featureId) throws NoFeatureIdException
- Throws:
NoFeatureIdException
-
deleteRule
public void deleteRule(@NotNull BuildTypeTemplateEx template, @NotNull String featureId) throws NoFeatureIdException
- Throws:
NoFeatureIdException
-
deleteRule
public void deleteRule(@NotNull ProjectEx project, @NotNull String featureId) throws NoFeatureIdException
- Throws:
NoFeatureIdException
-
resetRule
public void resetRule(@NotNull BuildTypeEx buildType, @NotNull String featureId) throws NoFeatureIdException
- Throws:
NoFeatureIdException
-
resetRule
public void resetRule(@NotNull BuildTypeTemplateEx template, @NotNull String featureId) throws NoFeatureIdException
- Throws:
NoFeatureIdException
-
resetRule
public void resetRule(@NotNull ProjectEx project, @NotNull String featureId) throws NoFeatureIdException
- Throws:
NoFeatureIdException
-
computeClashingCleanupRulesAfterMove
@NotNull public ClashingCleanupRules computeClashingCleanupRulesAfterMove(@NotNull BuildTypeEx buildType, @NotNull ProjectEx targetProject)
-
computeClashingCleanupRulesAfterMove
@NotNull public ClashingCleanupRules computeClashingCleanupRulesAfterMove(@NotNull ProjectEx project, @NotNull ProjectEx targetProject)
-
walkBuildTypeRules
protected void walkBuildTypeRules(@NotNull BuildTypeEx buildType, @NotNull BuildTypeRulesHoldersVisitor visitor)
-
walkProjectRules
protected void walkProjectRules(@NotNull ProjectEx project, @NotNull ProjectRulesHoldersVisitor visitor)
-
-