public class DefaultAnonymizeUserService extends Object implements AnonymizeUserService
AnonymizeUserService.AnonymizeOperation, AnonymizeUserService.AnonymizePerformResult, AnonymizeUserService.AnonymizeProcessData, AnonymizeUserService.AnonymizeValidationResult, AnonymizeUserService.OperationsReport<T>, AnonymizeUserService.SingleOperationReport<T>
Constructor and Description |
---|
DefaultAnonymizeUserService(UserManager userManager,
I18nHelper.BeanFactory i18nBeanFactory,
GlobalPermissionManager globalPermissionManager,
UserKeyStore userKeyStore,
ExtendedUserDao extendedUserDao,
AnonymizeOperationSteps anonymizeOperationSteps,
com.atlassian.event.api.EventPublisher eventPublisher,
ReindexMessageManager reindexMessageManager) |
Modifier and Type | Method and Description |
---|---|
int |
getStepCount(AnonymizeUserService.AnonymizeValidationResult anonymizeValidationResult)
Gets amount of distinct operations performed in the process of anonymization.
|
AnonymizeUserService.AnonymizePerformResult |
perform(AnonymizeUserService.AnonymizeValidationResult validationResult,
Context asyncTaskContext)
We have
AnonymizeUserService.AnonymizeProcessData from validation phase which describes operations we would like to perform. |
AnonymizeUserService.AnonymizeValidationResult |
preValidateAnonymize(AnonymizationParameters request)
Pre-validates anonymization - fills all data that can be obtained from initial user key passed in the request:
if user name/key is anonymized, generates new anonymized user key/name if needed, gets list of affected entities etc.
|
AnonymizeUserService.AnonymizeValidationResult |
validateAnonymize(AnonymizationParameters request)
Validate the request and return a validation result.
|
public DefaultAnonymizeUserService(UserManager userManager, I18nHelper.BeanFactory i18nBeanFactory, GlobalPermissionManager globalPermissionManager, UserKeyStore userKeyStore, ExtendedUserDao extendedUserDao, AnonymizeOperationSteps anonymizeOperationSteps, com.atlassian.event.api.EventPublisher eventPublisher, ReindexMessageManager reindexMessageManager)
@Nonnull public AnonymizeUserService.AnonymizeValidationResult preValidateAnonymize(@Nonnull AnonymizationParameters request)
AnonymizeUserService
AnonymizationParameters
with AnonymizeUserService.AnonymizeProcessData
that can be used on UI.
Doesn't validate additional parameters required by handlers eg. new owner for entities.preValidateAnonymize
in interface AnonymizeUserService
request
- Anonymize request@Nonnull public AnonymizeUserService.AnonymizeValidationResult validateAnonymize(@Nonnull AnonymizationParameters request)
AnonymizeUserService
AnonymizationParameters.builder()
, like this:
AnonymizationParameters.builder()
.targetUser(activeUser.getKey())
.newOwner(admin)
.executor(admin)
.build());
You must always verify the validation result before proceeding:
AnonymizeValidationResult result = validateAnonymize(request);
if (result.isValid()) {
...perform the operation...
} else {
...handle the errors...
}
validateAnonymize
in interface AnonymizeUserService
@Nonnull public AnonymizeUserService.AnonymizePerformResult perform(@Nonnull AnonymizeUserService.AnonymizeValidationResult validationResult, @Nonnull Context asyncTaskContext)
AnonymizeUserService.AnonymizeProcessData
from validation phase which describes operations we would like to perform.
Validation is performed on each step so each step should have required data.
Process "blocking" steps are executed, if error is detected whole process is aborted.
Process "non blocking" steps are executed.
All results from steps are collected in report.perform
in interface AnonymizeUserService
validationResult
- Validation resultasyncTaskContext
- Task context to report the anonymization process progress topublic int getStepCount(@Nonnull AnonymizeUserService.AnonymizeValidationResult anonymizeValidationResult)
AnonymizeUserService
TaskContextAware.getContext()
passed in
AnonymizeUserService.perform(AnonymizeValidationResult, Context)
and AnonymizationHandler.update(Object)
.getStepCount
in interface AnonymizeUserService
Copyright © 2002-2022 Atlassian. All Rights Reserved.