public 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.
ProjectSettingsRestriction
,
ProjectSettingsRestrictionProcessorModuleDescriptor
Modifier and Type | Method and Description |
---|---|
String |
getFeatureKey()
The feature key of the
SettingsKey that this processor is registered to. |
String |
getNamespace()
The namespace of the
SettingsKey that this processor is registered to. |
boolean |
process(RestrictionProcessingRequest processingRequest)
Performs post-processing for
ProjectSettingsRestriction s after they are created. |
@Nonnull String getFeatureKey()
SettingsKey
that this processor is registered to.@Nonnull String getNamespace()
SettingsKey
that this processor is registered to.boolean process(@Nonnull RestrictionProcessingRequest processingRequest)
ProjectSettingsRestriction
s after they are created.
Multiple processors can be associated with the namespace
and
feature key
, differentiated by
component key
. If a processor fails to process it should return
false
. All processors will be invoked even if some indicate processing failure, but if any processor
does return false
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.
processingRequest
- the request objecttrue
if the provided request was successfully processed, otherwise false
Copyright © 2024 Atlassian. All rights reserved.