Interface OperationCheck

    • Method Detail

      • canPerform

        @NonNull ValidationResult canPerform​(Person person,
                                             Target target)
        Check whether the specified Person can perform this operation on the specified target.
        Parameters:
        person - the Person on which to perform a permission and validation check
        target - the Target to check permission for
        Returns:
        • an authorized and valid result if Person has permission to perform operation on this target in its current state
        • an unauthorized result if permissions prevent Person performing the operation on this target
        • a not-valid result for the following cases:
          • the operation is not currently valid for target due to its state
          • target doesn't exist
        Throws:
        NullPointerException - if person or targets is null
        IllegalArgumentException - if target is the wrong TargetType for this OperationCheck
        UnsupportedTargetException - if target points to the wrong kind of object for this operation check.
        BadRequestException
      • canPerformAccordingToState

        @NonNull ValidationResult canPerformAccordingToState​(Person person,
                                                             Target target)
        Check whether the specified Person can perform this operation on the specified target based on its state.

        This method must not check permissions, except when the state check depends on the result of a permission check.

        "Is this target in a state where this operation makes sense?"

        Parameters:
        person - the Person on which to perform a permission and validation check
        target - the Target to check permission for
        Returns:
        • an authorized and valid result if Person can perform operation on this target in its current state
        • an authorized and invalid result if the state of the target prevents Person performing the operation on this target
        Throws:
        NullPointerException - if person or targets is null
        IllegalArgumentException - if target is the wrong TargetType for this OperationCheck
        UnsupportedTargetException - if target points to the wrong kind of object for this operation check.
        BadRequestException
      • canPerform

        @NonNull Map<Target,​ValidationResult> canPerform​(Person person,
                                                               Iterable<Target> targets)
        Check whether the specified Person can perform this operation on ALL of the specified targets.
        Parameters:
        person - the Person on which to perform a permission and validation check
        targets - the Targets to check permission for; must all be of the same TargetType
        Returns:
        a Map providing a ValidationResult for each of the supplied targets. Results for each target will be as follows:
        • an authorized and valid result if Person can perform operation on this target in its current state
        • an unauthorized result if permissions prevent Person performing the operation on this target
        • a not-valid result for the following cases:
          • the operation is not currently valid for target due to its state
          • target doesn't exist
        Throws:
        NullPointerException - if person or targets is null, or any target is null
        IllegalArgumentException - if targets is empty, or if any target is the wrong TargetType for this OperationCheck
        UnsupportedTargetException - if any target points to the wrong kind of object for this operation check.
        BadRequestException
      • canPerformAccordingToState

        @NonNull Map<Target,​ValidationResult> canPerformAccordingToState​(Person person,
                                                                               Iterable<Target> targets)
        Check whether the specified Person can perform this operation on each of the specified targets based on their state.

        This method must not check permissions, except when the state check depends on the result of a permission check.

        Parameters:
        person - the Person on which to perform a permission and validation check
        targets - the Targets to check state for; must all be of the same TargetType
        Returns:
        a Map providing a ValidationResult for each of the supplied targets. Results for each target will be as follows:
        • an authorized and valid result if Person can perform operation on this target in its current state
        • an authorized and invalid result if the state of this target prevents Person performing the operation on this target
        Throws:
        NullPointerException - if person or targets is null, or any target is null
        IllegalArgumentException - if targets is empty, or if any target is the wrong TargetType for this OperationCheck
        UnsupportedTargetException - if any target points to the wrong kind of object for this operation check.
        BadRequestException