Interface BehaviourFilter

  • All Known Implementing Classes:
    BehaviourFilterImpl

    @AlfrescoPublicApi
    public interface BehaviourFilter
    Contract disabling and enabling policy behaviours.

    Since 4.0, the behaviour enabling/disabling is recorded using reference counting, meaning that the outermost disable call in a stack has an effective veto. Use proper try-finally patterns to ensure behaviour is released after it is no longer needed.

    
     behaviourFilter.disableBehaviour(abc);
     try
     {
        behaviourFilter.disableBehaviour(abc);
        try
        {
           // Do something that might have triggered 'abc' but will not
        }
        finally
        {
            behaviourFilter.enableBehaviour(abc);
        }
        // Do something that might have triggered 'abc' but will not despite the last enable call
     }
     finally
     {
         behaviourFilter.enableBehaviour(abc);
     }
     
    Author:
    Derek Hulley
    See Also:
    PolicyComponent
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      void disableAllBehaviours()
      Deprecated.
      void disableBehaviour()
      Disable behaviour for all types
      void disableBehaviour​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Disable all behaviours for a given node
      void disableBehaviour​(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName className)
      Disable behaviour for specific node and class
      void disableBehaviour​(org.alfresco.service.namespace.QName className)
      Disable behaviour for a type or aspect for all nodes.
      void disableBehaviour​(org.alfresco.service.namespace.QName className, boolean includeSubClasses)
      Disable behaviour for a type or aspect for all nodes.
      void enableAllBehaviours()
      Deprecated.
      Since 4.0 use disableBehaviour()
      void enableBehaviour()
      Enable behaviours for all classes.
      void enableBehaviour​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Enable behaviour for a specific node
      void enableBehaviour​(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName className)
      Enable behaviour for specific node
      void enableBehaviour​(org.alfresco.service.namespace.QName className)
      Enable behaviour for all nodes
      This is also applied to the to the disabled behaviours with disableBehaviour(QName, boolean)
      void enableBehaviours​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Deprecated.
      boolean isActivated()
      Determine if any behaviours have been disabled or altered.
      boolean isEnabled()
      Determine if behaviour is globally enabled.
      boolean isEnabled​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Determine if behaviour is enabled for a specific node.
      boolean isEnabled​(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.namespace.QName className)
      Determine if behaviour is enabled for specific node and class.
      boolean isEnabled​(org.alfresco.service.namespace.QName className)
      Determine if behaviour is enabled for a class.
    • Method Detail

      • enableBehaviours

        void enableBehaviours​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Deprecated.
      • enableAllBehaviours

        void enableAllBehaviours()
        Deprecated.
        Since 4.0 use disableBehaviour()
      • disableBehaviour

        void disableBehaviour()
        Disable behaviour for all types

        The change applies ONLY to the current transaction.

      • disableBehaviour

        void disableBehaviour​(org.alfresco.service.namespace.QName className)
        Disable behaviour for a type or aspect for all nodes.
        Given a direct instance of className (ie. not a subclass) all behaviour is disabled (including superclass behaviour).

        The same as calling disableBehaviour(QName, boolean) with false

        The change applies ONLY to the current transaction.

        Parameters:
        className - the type/aspect behaviour to disable
      • disableBehaviour

        void disableBehaviour​(org.alfresco.service.namespace.QName className,
                              boolean includeSubClasses)
        Disable behaviour for a type or aspect for all nodes.
        Given an instance of className (including instances that are subclasses of className, if includeSubClasses is true) all behaviour is disabled (including superclass behaviour).

        Successive calls (within the current transaction) will overwrite the filter for this class.
        The change applies ONLY to the current transaction.
        Parameters:
        className - the type/aspect behaviour to disable
        includeSubClasses - set to true to disable the behaviours of subclasses
        Since:
        5.1
      • disableBehaviour

        void disableBehaviour​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                              org.alfresco.service.namespace.QName className)
        Disable behaviour for specific node and class

        The change applies ONLY to the current transaction.

        Parameters:
        nodeRef - the node to disable for
        className - the type/aspect behaviour to disable
      • disableBehaviour

        void disableBehaviour​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Disable all behaviours for a given node
        Parameters:
        nodeRef - the node to disable for
      • enableBehaviour

        void enableBehaviour()
        Enable behaviours for all classes.

        The change applies ONLY to the current transaction.

      • enableBehaviour

        void enableBehaviour​(org.alfresco.service.namespace.QName className)
        Enable behaviour for all nodes
        This is also applied to the to the disabled behaviours with disableBehaviour(QName, boolean)

        The change applies ONLY to the current transaction.

        Parameters:
        className - the type/aspect behaviour to enable
      • enableBehaviour

        void enableBehaviour​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                             org.alfresco.service.namespace.QName className)
        Enable behaviour for specific node

        The change applies ONLY to the current transaction.

        Parameters:
        nodeRef - the node to enable for
        className - the type/aspect behaviour to enable or null for all classes
      • enableBehaviour

        void enableBehaviour​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Enable behaviour for a specific node

        The change applies ONLY to the current transaction.

        Parameters:
        nodeRef - the node to enable for
        Since:
        4.0
      • isEnabled

        boolean isEnabled()
        Determine if behaviour is globally enabled.

        The change applies ONLY to the current transaction.

        Returns:
        true => behaviour is enabled
        Since:
        4.0
      • isEnabled

        boolean isEnabled​(org.alfresco.service.namespace.QName className)
        Determine if behaviour is enabled for a class.

        The change applies ONLY to the current transaction.

        Parameters:
        className - the behaviour to test for
        Returns:
        true => behaviour is enabled
      • isEnabled

        boolean isEnabled​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                          org.alfresco.service.namespace.QName className)
        Determine if behaviour is enabled for specific node and class.

        Note: A node behaviour is enabled only when: a) the behaviour is not disabled across all nodes b) the behaviour is not disabled specifically for the provided node

        The change applies ONLY to the current transaction.

        Parameters:
        nodeRef - the node to test for
        className - the behaviour to test for
        Returns:
        true => behaviour is enabled
      • isEnabled

        boolean isEnabled​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Determine if behaviour is enabled for a specific node.

        The change applies ONLY to the current transaction.

        Parameters:
        nodeRef - the node to test for
        Returns:
        true => behaviour is enabled
      • isActivated

        boolean isActivated()
        Determine if any behaviours have been disabled or altered.

        The change applies ONLY to the current transaction.

        Returns:
        true => behaviours have been altered