Class MLPropertyInterceptor

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

    public class MLPropertyInterceptor
    extends java.lang.Object
    implements org.aopalliance.intercept.MethodInterceptor
    Interceptor to filter out multilingual text properties from getter methods and transform to multilingual text for setter methods.

    This interceptor ensures that all multilingual (ML) text is transformed to the locale chosen for the request for getters and transformed to the default locale type for setters.

    Where ML text has been passed in, this will be allowed to pass.

    Author:
    Derek Hulley, Philippe Dubois
    See Also:
    NodeService.getProperty(NodeRef, QName), NodeService.getProperties(NodeRef), NodeService.setProperty(NodeRef, QName, Serializable), NodeService.setProperties(NodeRef, Map)
    • Constructor Detail

      • MLPropertyInterceptor

        public MLPropertyInterceptor()
    • Method Detail

      • setMLAware

        public static boolean setMLAware​(boolean mlAwareVal)
        Change the filtering behaviour of this interceptor on the curren thread. Use this to switch off the filtering and just pass out properties as handed out of the node service.
        Parameters:
        mlAwareVal - true if the current thread is able to handle d:mltext property types, otherwise false.
        Returns:
        true if the current transaction is ML aware
      • isMLAware

        public static boolean isMLAware()
        Returns:
        Returns true if the current thread has marked itself as being able to handle d:mltext types properly.
      • setNodeService

        public void setNodeService​(org.alfresco.service.cmr.repository.NodeService bean)
      • setMultilingualContentService

        public void setMultilingualContentService​(MultilingualContentService multilingualContentService)
      • setDictionaryService

        public void setDictionaryService​(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
      • 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
      • getClosestLocale

        public java.util.Locale getClosestLocale​(java.util.Collection<?> collection)