Class UpdateViewHook

  • All Implemented Interfaces:
    GraphHook

    public class UpdateViewHook
    extends Object
    implements GraphHook
    This is a hook to update all operation views in a chain before it is executed. This hook can be configured to add additional view configurations such as extra filters and it can also be used to remove element groups out of a view. This hook will have no effect with operations that do not correctly implement OperationView therefore THIS HOOK SHOULD NOT BE USED TO ENFORCE ROLE BASED FILTERING OF ELEMENTS. Instead please make use of the visibility property (Schema.visibilityProperty).

    All fields are Optional:

    • withOpAuth = Apply this hook to Users with any of these operation authorisations
    • withoutOpAuth = Apply this hook to Users without any of these operation authorisations, overrides withOpAuth
    • withDataAuth = Apply this hook to Users with any of these data authorisations
    • withoutDataAuth = Apply this hook to Users without any of these data authorisations, overrides withDataAuth
    • whiteListElementGroups = When this hook is applied, only allow View Element Groups from this list, overrides viewToMerge
    • blackListElementGroups = When this hook is applied, remove all View Element Groups from this list, overrides whiteListElementGroups and viewToMerge
    • viewToMerge = the view to be merged into the current view.
    If the user matches the opAuth or dataAuth criteria the following is applied:
    • First the viewToMerge is merged into the user provided operation view.
    • Then the white list of element groups is applied.
    • Then the black list of element groups is applied.
    See Also:
    GraphHook, Schema.visibilityProperty
    • Field Detail

      • ADD_EXTRA_GROUPS_DEFAULT

        public static final boolean ADD_EXTRA_GROUPS_DEFAULT
        See Also:
        Constant Field Values
    • Constructor Detail

      • UpdateViewHook

        public UpdateViewHook()
    • Method Detail

      • preExecute

        public void preExecute​(OperationChain<?> opChain,
                               Context context)
        Description copied from interface: GraphHook
        Called from Graph before an OperationChain is executed.
        Specified by:
        preExecute in interface GraphHook
        Parameters:
        opChain - the OperationChain being executed. This can be modified/optimised in any GraphHook.
        context - the Context in which the operation chain was executed. The context also holds a reference to the original operation chain.
      • postExecute

        public <T> T postExecute​(T result,
                                 OperationChain<?> opChain,
                                 Context context)
        Description copied from interface: GraphHook
        Called from Graph after an OperationChain is executed.
        Specified by:
        postExecute in interface GraphHook
        Type Parameters:
        T - the result type
        Parameters:
        result - the result from the operation chain
        opChain - the OperationChain that was executed. This can be modified/optimised in any GraphHook.
        context - the Context in which the operation chain was executed. The context also holds a reference to the original operation chain.
        Returns:
        result object
      • onFailure

        public <T> T onFailure​(T result,
                               OperationChain<?> opChain,
                               Context context,
                               Exception e)
        Description copied from interface: GraphHook
        Called from Graph if an error occurs whilst executing the OperationChain.
        Specified by:
        onFailure in interface GraphHook
        Type Parameters:
        T - the result type
        Parameters:
        result - the result from the operation chain - likely to be null.
        opChain - the OperationChain that was executed. This can be modified/optimised in any GraphHook.
        context - the Context in which the operation chain was executed. The context also holds a reference to the original operation chain.
        e - the exception
        Returns:
        result object
      • getWithOpAuth

        public Set<String> getWithOpAuth()
      • getWithoutOpAuth

        public Set<String> getWithoutOpAuth()
      • getWithDataAuth

        public Set<String> getWithDataAuth()
      • getWithoutDataAuth

        public Set<String> getWithoutDataAuth()
      • getWhiteListElementGroups

        public Set<String> getWhiteListElementGroups()
      • setWhiteListElementGroups

        public UpdateViewHook setWhiteListElementGroups​(Set<String> whiteListElementGroups)
      • getBlackListElementGroups

        public Set<String> getBlackListElementGroups()
      • setBlackListElementGroups

        public UpdateViewHook setBlackListElementGroups​(Set<String> blackListElementGroups)
      • getViewToMerge

        public View getViewToMerge()
      • isAddExtraGroups

        public boolean isAddExtraGroups()
      • setAddExtraGroups

        public UpdateViewHook setAddExtraGroups​(boolean addExtraGroups)