@ExperimentalSpi public abstract class BaseOperationCheck extends Object implements OperationCheck
OperationCheck
s.
Plugins implementing their own checks should extend this.Modifier | Constructor and Description |
---|---|
protected |
BaseOperationCheck(OperationKey operationKey,
TargetType expectedTargetType)
Construct a
BaseOperationCheck . |
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)
.@Nonnull public final OperationKey getOperationKey()
getOperationKey
in interface Operation
getOperationKey
in interface OperationCheck
OperationKey
passed to the constructor.@Nonnull public final ValidationResult canPerform(Person person, Target target)
canPerform(Person, java.lang.Iterable)
.canPerform
in interface OperationCheck
person
- the Person on which to perform a permission and validation checktarget
- the Target to check permission for@Nonnull public final ValidationResult canPerformAccordingToState(Person person, Target target)
canPerformAccordingToState(Person, java.lang.Iterable)
.canPerformAccordingToState
in interface OperationCheck
person
- the Person on which to perform a permission and validation checktarget
- the Target to check permission for@Nonnull public final Map<Target,ValidationResult> canPerform(Person person, Iterable<Target> targets)
TargetType
,
then delegates to canPerformImpl(Person, java.lang.Iterable)
.canPerform
in interface OperationCheck
person
- the Person on which to perform a permission and validation checktargets
- the Targets to check permission for;
must all be of the same TargetType
ValidationResult
for each of the supplied targets. Results for each target will
be as follows:
@Nonnull public final Map<Target,ValidationResult> canPerformAccordingToState(Person person, Iterable<Target> targets)
TargetType
,
then delegates to canPerformAccordingToStateImpl(Person, java.lang.Iterable)
.canPerformAccordingToState
in interface OperationCheck
person
- the Person on which to perform a permission and validation checktargets
- the Targets to check state for;
must all be of the same TargetType
ValidationResult
for each of the supplied targets. Results for each target will
be as follows:
@Nonnull protected abstract 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)BadRequestException
SimpleValidationResult.builder()
@Nonnull protected abstract 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)BadRequestException
SimpleValidationResult.builder()
Copyright © 2003–2018 Atlassian. All rights reserved.