Interface ProjectSettingsRestrictionProcessor
ProjectSettingsRestriction
s.
Each processor is associated with a namespace
and feature key
, and
processes all restrictions with a settings key
with a matching namespace and feature key. The
component key
of a settings key is not considered when processing
restrictions, allowing multiple restrictions with differing component keys to be handled by the same processor.
Implementations must be stateless and thread-safe as a single instance will be used to process all restrictions for
the associated settings keys.
Processing is invoked after a restriction is
created
and the
restriction is unable to be deleted
until
processing is complete. Multiple processors can be associated with the same settings key. If a settings key does not
have any associated processors then created restrictions with that settings key will be automatically marked as
processed at creation.
Post processing can be used to perform additional actions that are required when implementing restriction functionality. For example consider a feature that includes both project-level and repository-level configuration where each repository in a project can choose to inherit settings from the project or have custom settings. A restriction created on a project for this feature could be used to force all repositories to use the project configuration. However it may also be desirable if the restriction is removed that all repositories are set to inheriting project configuration instead of reverting to custom repository-level configuration that existed before the restriction was created. In this case post processing could be used to delete all repository-level configuration for the feature for repositories in the restricted project.
A processor implementation must be registered as part of a
<project-settings-restriction-processor>
module in
the plugin descriptor.
- Since:
- 8.10
- See Also:
-
ProjectSettingsRestriction
ProjectSettingsRestrictionProcessorModuleDescriptor
-
Method Summary
Modifier and TypeMethodDescriptionThe feature key of theSettingsKey
that this processor is registered to.The namespace of theSettingsKey
that this processor is registered to.boolean
process
(RestrictionProcessingRequest processingRequest) Performs post-processing forProjectSettingsRestriction
s after they are created.
-
Method Details
-
getFeatureKey
The feature key of theSettingsKey
that this processor is registered to.- Returns:
- the feature key associated with this processor
-
getNamespace
The namespace of theSettingsKey
that this processor is registered to.- Returns:
- the namespace associated with this processor
-
process
Performs post-processing forProjectSettingsRestriction
s after they are created.Multiple processors can be associated with the
namespace
andfeature key
, differentiated bycomponent key
. If a processor fails to process it should returnfalse
. All processors will be invoked even if some indicate processing failure, but if any processor does returnfalse
then the restriction will not be marked as processed.A system background job will attempt to reprocess restrictions that one or more processors fail to process. The processing is performed on batches of provided repositories, so this method may be called multiple times with different repository ids over the course of a single restriction being processed.
Additionally, this method should be idempotent so when it is retried with the same request, the result should be the same.
- Parameters:
processingRequest
- the request object- Returns:
true
if the provided request was successfully processed, otherwisefalse
-