Class HiddenAspect


  • @AlfrescoPublicApi
    public class HiddenAspect
    extends java.lang.Object
    Functionality relating to hidden files and folders. Support for nodes marked as hidden but with visibility constraints for specific clients. A node can have the hidden aspect applied, which means that the node is hidden. However, for specific clients it can be defined whether the node is visible or will have its hidden attribute set in FileInfo.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Set<org.alfresco.service.namespace.QName> HIDDEN_PROPERTIES  
    • Constructor Summary

      Constructors 
      Constructor Description
      HiddenAspect()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean checkHidden​(FileInfo fileInfo, boolean both, boolean checkChildren)
      Checks whether the file should be hidden and applies the hidden and not indexed aspects if so.
      boolean checkHidden​(org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean both, boolean checkChildren)
      Checks whether the file should be hidden and applies the hidden and not indexed aspects to it and its children (if cascadeHidden == true).
      void checkHidden​(org.alfresco.service.cmr.repository.StoreRef storeRef)
      Searches for nodes in the given store that should be hidden (i.e.
      org.alfresco.util.FileFilterMode.Client[] getClients()  
      int getClientVisibilityMask​(org.alfresco.util.FileFilterMode.Client client, HiddenAspect.Visibility visibility)
      getClientVisibilityMap
      java.util.List<HiddenFileInfo> getPatterns()  
      HiddenAspect.Visibility getVisibility​(org.alfresco.util.FileFilterMode.Client client, org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Gets the visibility constraint for the given client on the given node.
      boolean hasHiddenAspect​(org.alfresco.service.cmr.repository.NodeRef nodeRef)  
      void hideNode​(FileInfoImpl fileInfo, int visibilityMask, boolean cascadeHiddenAspect, boolean cascadeIndexControlAspect, boolean clientControlled)
      Hides the node by applying the hidden and not indexed aspects.
      void hideNode​(org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean cascadeHiddenAspect, boolean cascadeIndexControlAspect, boolean clientControlled)
      Hides the node by applying the hidden and not indexed aspects.
      void hideNode​(org.alfresco.service.cmr.repository.NodeRef nodeRef, int clientVisibilityMask, boolean cascadeHiddenAspect, boolean cascadeIndexControlAspect, boolean clientControlled)
      Hides the node by applying the hidden and not indexed aspects.
      void hideNodeExplicit​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Mark this node as hidden regardless of any name/pattern/matching rules.
      void init()  
      boolean isClientControlled​(org.alfresco.service.cmr.repository.NodeRef nodeRef)  
      HiddenFileInfo onHiddenPath​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Checks whether the node is on a hidden path
      void removeHidden​(org.alfresco.service.cmr.repository.NodeRef nodeRef)  
      void removeHiddenAspect​(org.alfresco.service.cmr.repository.NodeRef nodeRef)  
      void setBehaviourFilter​(BehaviourFilter behaviourFilter)  
      void setFileFolderService​(FileFolderService fileFolderService)  
      void setNodeService​(org.alfresco.service.cmr.repository.NodeService nodeService)  
      void setPatterns​(java.util.List<HiddenFileFilter> filters)  
      void setPolicyComponent​(PolicyComponent policyComponent)  
      void setSearchService​(org.alfresco.service.cmr.search.SearchService searchService)  
      void showNode​(org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean cascade)
      Removes the hidden and index contol aspect.
      void unhideExplicit​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Remove the explicit hiding of a node.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • HIDDEN_PROPERTIES

        public static java.util.Set<org.alfresco.service.namespace.QName> HIDDEN_PROPERTIES
    • Constructor Detail

      • HiddenAspect

        public HiddenAspect()
    • Method Detail

      • setBehaviourFilter

        public void setBehaviourFilter​(BehaviourFilter behaviourFilter)
      • setPolicyComponent

        public void setPolicyComponent​(PolicyComponent policyComponent)
      • setNodeService

        public void setNodeService​(org.alfresco.service.cmr.repository.NodeService nodeService)
      • setFileFolderService

        public void setFileFolderService​(FileFolderService fileFolderService)
      • setSearchService

        public void setSearchService​(org.alfresco.service.cmr.search.SearchService searchService)
      • setPatterns

        public void setPatterns​(java.util.List<HiddenFileFilter> filters)
      • init

        public void init()
      • getClients

        public org.alfresco.util.FileFilterMode.Client[] getClients()
      • hideNodeExplicit

        public void hideNodeExplicit​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Mark this node as hidden regardless of any name/pattern/matching rules. Following this call the node will be hidden. If the node is already hidden will do nothing.
        Parameters:
        nodeRef - NodeRef
      • unhideExplicit

        public void unhideExplicit​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Remove the explicit hiding of a node. Following this call the node may or may not remain hidden based upon the other properties of the node.
        Parameters:
        nodeRef - NodeRef
      • removeHiddenAspect

        public void removeHiddenAspect​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      • hasHiddenAspect

        public boolean hasHiddenAspect​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      • removeHidden

        public void removeHidden​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      • getClientVisibilityMask

        public int getClientVisibilityMask​(org.alfresco.util.FileFilterMode.Client client,
                                           HiddenAspect.Visibility visibility)
        getClientVisibilityMap
        Parameters:
        client - Client
        visibility - Visibility
        Returns:
        the client visibilityMask
      • onHiddenPath

        public HiddenFileInfo onHiddenPath​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Checks whether the node is on a hidden path
        Parameters:
        nodeRef - NodeRef
        Returns:
        the matching filter, or null if no match
      • hideNode

        public void hideNode​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                             boolean cascadeHiddenAspect,
                             boolean cascadeIndexControlAspect,
                             boolean clientControlled)
        Hides the node by applying the hidden and not indexed aspects. The node will be hidden from all clients.
        Parameters:
        nodeRef - nodeRef
        cascadeHiddenAspect - boolean
        cascadeIndexControlAspect - boolean
        clientControlled - boolean
      • showNode

        public void showNode​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                             boolean cascade)
        Removes the hidden and index contol aspect. Reverses the effect of calling hideNode(NodeRef nodeRef)
        Parameters:
        nodeRef - the node to show
        cascade - true to cascade to all descendents of this node
      • hideNode

        public void hideNode​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                             int clientVisibilityMask,
                             boolean cascadeHiddenAspect,
                             boolean cascadeIndexControlAspect,
                             boolean clientControlled)
        Hides the node by applying the hidden and not indexed aspects. The node will be hidden from clients according to the visibility mask.
        Parameters:
        nodeRef - the node to hide
        clientVisibilityMask - int
        cascadeHiddenAspect - boolean
        cascadeIndexControlAspect - boolean
        clientControlled - boolean
      • checkHidden

        public void checkHidden​(org.alfresco.service.cmr.repository.StoreRef storeRef)
        Searches for nodes in the given store that should be hidden (i.e. match the hidden pattern) and hides them if they are not already hidden.
        Parameters:
        storeRef - StoreRef
      • checkHidden

        public boolean checkHidden​(FileInfo fileInfo,
                                   boolean both,
                                   boolean checkChildren)
        Checks whether the file should be hidden and applies the hidden and not indexed aspects if so.
        Parameters:
        fileInfo - FileInfo
        both - if true, will check if the node should not be hidden and remove hidden and index control aspects if they are present
        checkChildren - boolean
        Returns:
        boolean
      • hideNode

        public void hideNode​(FileInfoImpl fileInfo,
                             int visibilityMask,
                             boolean cascadeHiddenAspect,
                             boolean cascadeIndexControlAspect,
                             boolean clientControlled)
        Hides the node by applying the hidden and not indexed aspects. The node will be hidden from clients according to the visibility mask.
        Parameters:
        fileInfo - file to make hidden
        visibilityMask - int
        cascadeHiddenAspect - boolean
        cascadeIndexControlAspect - boolean
        clientControlled - boolean
      • isClientControlled

        public boolean isClientControlled​(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      • checkHidden

        public boolean checkHidden​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                   boolean both,
                                   boolean checkChildren)
        Checks whether the file should be hidden and applies the hidden and not indexed aspects to it and its children (if cascadeHidden == true). The visibility mask property will determine visibility for specific clients.

        Can optionally remove the hidden and index control aspects if the name of a node no longer matches the filter.

        Parameters:
        nodeRef - NodeRef
        both - if true, will check both if the node should not be hidden and remove hidden and index control aspects if they are present, and if the node should be hidden and add hidden and index control aspects if they are not present.
        checkChildren - boolean
        Returns:
        true if the node is hidden, irrespective of the clientVisibility property value.
      • getVisibility

        public HiddenAspect.Visibility getVisibility​(org.alfresco.util.FileFilterMode.Client client,
                                                     org.alfresco.service.cmr.repository.NodeRef nodeRef)
        Gets the visibility constraint for the given client on the given node.
        Parameters:
        client - Client
        nodeRef - NodeRef
        Returns:
        the visibility constraint for the given client and node