@ParametersAreNonnullByDefault @ReturnValuesAreNonnullByDefault public interface AnonymizationHandler<T>
OwnershipTransferHandler
,
UserAnonymizationHandler
,
UserKeyChangeHandler
,
UserNameChangeHandler
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_NUMBER_OF_TASKS |
Modifier and Type | Method and Description |
---|---|
Collection<AffectedEntity> |
getAffectedEntities(T parameter)
Used to collect a list of entities that will be affected by the anonymization process.
|
default int |
getNumberOfTasks(T userPropertyChangeParameter)
Returns the number of tasks/stages to be executed in
update(Object) . |
ServiceResult |
update(T parameter)
Performs the updates required by the user anonymization.
|
default ErrorCollection |
validateBusinessLogic(AnonymizationParameters anonymizationParameters)
Allows handlers to prevent the anonymization if it would break business logic constraints.
|
static final int DEFAULT_NUMBER_OF_TASKS
Collection<AffectedEntity> getAffectedEntities(T parameter)
Its goal is to inform the end-user about the expected changes before they trigger the process.
parameter
- Data relevant to the handled anonymization step, e.g. previous and new (anonymized) usernameServiceResult update(T parameter)
Implementations must be idempotent - multiple invocations of this method should lead to the same result. In particular, when the method fails we can call it again to finish the operation.
During the execution, implementations can update their the progress by calling Context.start(object);
on the context passed in parameter
, and subsequently call Context.Task.complete();
on the task
object to indicate task has finished.
Implementations can also call Context.setName("Name of current step")
to describe the task that is currently processed.
parameter
- Data relevant to the handled anonymization step, e.g. previous and new (anonymized) usernamedefault int getNumberOfTasks(T userPropertyChangeParameter)
update(Object)
. Used for diving the progress bar
between all of the handlers in proportions based on the returned numbers.
Implementations are responsible to execute the corresponding number of calls to Context.start(object);
and Context.Task.complete();
in update(Object)
.
DEFAULT_NUMBER_OF_TASKS
@ExperimentalSpi default ErrorCollection validateBusinessLogic(AnonymizationParameters anonymizationParameters)
As an example, ownership transfer handler can ensure that an entity can only be transferred to a user with a particular role, e.g. only to another admin.
The calculations done here should be as quick as possible not to degrade the user experience! Only business logic constraints should be checked here. You can assume that the passed in parameters are otherwise valid, e.g. the user to transfer the entity to exists and is not disabled.
ErrorCollection
, containing translated business logic validation errors if there were any, null otherwiseCopyright © 2002-2023 Atlassian. All Rights Reserved.