Class TagScopePropertyMethodInterceptor

  • All Implemented Interfaces:
    org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor

    public class TagScopePropertyMethodInterceptor
    extends java.lang.Object
    implements org.aopalliance.intercept.MethodInterceptor
    This class is an interceptor of the NodeService that converts the content of the tagScopeCache property into a pseudo, multi-value text property (cm:tagScopeSummary) with each value of the spoofed property taking the form "=". This interceptor can be enabled by calling its static setEnabled(Boolean) method. It is enabled by default. When enabled, a call to getProperties for a node that has a cm:tagScopeCache property will include the calculated cm:tagScopeSummary property. A call to getProperty specifying cm:tagScopeSummary as the property name will return the calculated property value or null if the node has no cm:tagScopeCache property value.
    Author:
    Brian Remmington
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Boolean getEnabled()  
      protected java.util.List<java.lang.String> getTagSummary​(org.alfresco.service.cmr.repository.NodeRef nodeRef, java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> allNodeProperties)
      Given a NodeRef and, optionally, the property map of that node, this operation establishes whether the node is a TagScope node, and returns the appropriate value of the cm:tagScopeSummary property.
      java.lang.Object invoke​(org.aopalliance.intercept.MethodInvocation invocation)  
      void setCache​(org.alfresco.repo.cache.SimpleCache<java.lang.String,​java.util.List<java.lang.String>> cache)  
      void setContentService​(ContentService contentService)  
      static java.lang.Boolean setEnabled​(java.lang.Boolean enable)
      Allows the functionality of this interceptor to be enabled and disabled on a thread-by-thread basis.
      void setNodeService​(org.alfresco.service.cmr.repository.NodeService nodeService)  
      • Methods inherited from class java.lang.Object

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

      • TagScopePropertyMethodInterceptor

        public TagScopePropertyMethodInterceptor()
    • Method Detail

      • setContentService

        public void setContentService​(ContentService contentService)
      • setNodeService

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

        public void setCache​(org.alfresco.repo.cache.SimpleCache<java.lang.String,​java.util.List<java.lang.String>> cache)
      • invoke

        public java.lang.Object invoke​(org.aopalliance.intercept.MethodInvocation invocation)
                                throws java.lang.Throwable
        Specified by:
        invoke in interface org.aopalliance.intercept.MethodInterceptor
        Throws:
        java.lang.Throwable
      • getTagSummary

        protected java.util.List<java.lang.String> getTagSummary​(org.alfresco.service.cmr.repository.NodeRef nodeRef,
                                                                 java.util.Map<org.alfresco.service.namespace.QName,​java.io.Serializable> allNodeProperties)
        Given a NodeRef and, optionally, the property map of that node, this operation establishes whether the node is a TagScope node, and returns the appropriate value of the cm:tagScopeSummary property.
        Parameters:
        nodeRef - NodeRef
        allNodeProperties - Optional. If the caller has a current property map for the node being queried then supplying it here saves a little time. This argument is allowed to be null.
      • getEnabled

        public static final java.lang.Boolean getEnabled()
      • setEnabled

        public static final java.lang.Boolean setEnabled​(java.lang.Boolean enable)
        Allows the functionality of this interceptor to be enabled and disabled on a thread-by-thread basis. The caller should ensure that the value is reset to its prior setting once it has finished using the thread of execution.
        Parameters:
        enable - Boolean
        Returns:
        The setting prior to invoking this operation.