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 StringRULES_FEATURE_TYPEstatic StringRULES_FEATURES_DEFAULT_PREFIXstatic StringUSE_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 StringaddRule(BuildTypeEx buildType, StorableRule rule)Adds the new rule to the build configuration.voidaddRule(BuildTypeEx buildType, StorableRule rule, String featureId)Adds the rule with the provided id to the build configuration.StringaddRule(BuildTypeTemplateEx template, StorableRule rule)Adds the new rule to the template.voidaddRule(BuildTypeTemplateEx template, StorableRule rule, String featureId)Adds the rule with the provided id to the template.StringaddRule(SProject project, StorableRule rule)Adds the new rule to the project.voidaddRule(SProject project, StorableRule rule, String featureId)Adds the rule with the provided id to the project.ClashingCleanupRulescomputeClashingCleanupRulesAfterMove(BuildTypeEx buildType, ProjectEx targetProject)ClashingCleanupRulescomputeClashingCleanupRulesAfterMove(ProjectEx project, ProjectEx targetProject)voiddeleteRule(BuildTypeEx buildType, String featureId)voiddeleteRule(BuildTypeTemplateEx template, String featureId)voiddeleteRule(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 booleanisKeepRule(SBuildFeatureDescriptor feature)static booleanisKeepRule(SProjectFeatureDescriptor feature)voidresetRule(BuildTypeEx buildType, String featureId)voidresetRule(BuildTypeTemplateEx template, String featureId)voidresetRule(ProjectEx project, String featureId)voidupdateRule(BuildTypeEx buildType, StorableRule rule, String featureId)voidupdateRule(BuildTypeTemplateEx template, StorableRule rule, String featureId)voidupdateRule(ProjectEx project, StorableRule rule, String featureId)protected voidwalkBuildTypeRules(BuildTypeEx buildType, BuildTypeRulesHoldersVisitor visitor)protected voidwalkProjectRules(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 DuplicateIdExceptionAdds 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 DuplicateIdExceptionAdds 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 DuplicateIdExceptionAdds 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)
-
-