@ExperimentalSpi public abstract class BaseOperationCheck extends Object implements OperationCheck
OperationChecks.
Plugins implementing their own checks should extend this.| Modifier | Constructor and Description |
|---|---|
protected |
BaseOperationCheck(OperationKey operationKey,
TargetType expectedTargetType)
Construct a
BaseOperationCheck. |
| Modifier and Type | Method and Description |
|---|---|
@NonNull Map<Target,ValidationResult> |
canPerform(Person person,
Iterable<Target> targets)
Validates targets are the correct
TargetType,
then delegates to canPerformImpl(Person, java.lang.Iterable). |
@NonNull ValidationResult |
canPerform(Person person,
Target target)
Delegates to
canPerform(Person, java.lang.Iterable). |
@NonNull Map<Target,ValidationResult> |
canPerformAccordingToState(Person person,
Iterable<Target> targets)
Validates targets are the correct
TargetType,
then delegates to canPerformAccordingToStateImpl(Person, java.lang.Iterable). |
@NonNull ValidationResult |
canPerformAccordingToState(Person person,
Target target)
Delegates to
canPerformAccordingToState(Person, java.lang.Iterable). |
protected abstract @NonNull Map<Target,ValidationResult> |
canPerformAccordingToStateImpl(@NonNull Person person,
@NonNull Iterable<Target> targets)
Subclass implements this to perform canPerformAccordingToState checks on a collection of targets.
|
protected abstract @NonNull Map<Target,ValidationResult> |
canPerformImpl(@NonNull Person person,
@NonNull Iterable<Target> targets)
Subclass implements this to perform canPerform checks on a collection of targets.
|
@NonNull OperationKey |
getOperationKey() |
protected BaseOperationCheck(OperationKey operationKey, TargetType expectedTargetType)
BaseOperationCheck.operationKey - the operation for getOperationKey().expectedTargetType - the single TargetType supported by this check. This base class will check
targets match this before calling canPerformImpl(Person, java.lang.Iterable) or canPerformAccordingToStateImpl(Person, java.lang.Iterable).public final @NonNull OperationKey getOperationKey()
getOperationKey in interface OperationgetOperationKey in interface OperationCheckOperationKey passed to the constructor.public final @NonNull ValidationResult canPerform(Person person, Target target)
canPerform(Person, java.lang.Iterable).canPerform in interface OperationCheckperson - the Person on which to perform a permission and validation checktarget - the Target to check permission forpublic final @NonNull ValidationResult canPerformAccordingToState(Person person, Target target)
canPerformAccordingToState(Person, java.lang.Iterable).canPerformAccordingToState in interface OperationCheckperson - the Person on which to perform a permission and validation checktarget - the Target to check permission forpublic final @NonNull Map<Target,ValidationResult> canPerform(Person person, Iterable<Target> targets)
TargetType,
then delegates to canPerformImpl(Person, java.lang.Iterable).canPerform in interface OperationCheckperson - the Person on which to perform a permission and validation checktargets - the Targets to check permission for;
must all be of the same TargetTypeValidationResult for each of the supplied targets. Results for each target will
be as follows:
public final @NonNull Map<Target,ValidationResult> canPerformAccordingToState(Person person, Iterable<Target> targets)
TargetType,
then delegates to canPerformAccordingToStateImpl(Person, java.lang.Iterable).canPerformAccordingToState in interface OperationCheckperson - the Person on which to perform a permission and validation checktargets - the Targets to check state for;
must all be of the same TargetTypeValidationResult for each of the supplied targets. Results for each target will
be as follows:
protected abstract @NonNull Map<Target,ValidationResult> canPerformImpl(@NonNull Person person, @NonNull Iterable<Target> targets)
person - non-null Persontargets - non-null non-empty collection of Targets, each already validated as being non-null
and having the correct TargetType for this operation checkOperationCheck.canPerform(com.atlassian.confluence.api.model.people.Person, java.lang.Iterable)UnsupportedTargetException - if target points to the wrong kind of object for this operation check
(e.g. container target vs. specific object target)BadRequestExceptionSimpleValidationResult.builder()protected abstract @NonNull Map<Target,ValidationResult> canPerformAccordingToStateImpl(@NonNull Person person, @NonNull Iterable<Target> targets)
person - non-null Persontargets - non-null non-empty collection of Targets, each already validated as being non-null
and having the correct TargetType for this operation checkOperationCheck.canPerformAccordingToState(com.atlassian.confluence.api.model.people.Person, java.lang.Iterable)UnsupportedTargetException - if target points to the wrong kind of object for this operation check
(e.g. container target vs. specific object target)BadRequestExceptionSimpleValidationResult.builder()Copyright © 2003–2021 Atlassian. All rights reserved.