Class BeCPGMLPropertyInterceptor

java.lang.Object
fr.becpg.repo.multilingual.BeCPGMLPropertyInterceptor
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor

public class BeCPGMLPropertyInterceptor extends 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.

Version:
$Id: $Id
Author:
Derek Hulley, Philippe Dubois
See Also:
  • NodeService.getProperty(NodeRef, QName)
  • NodeService.getProperties(NodeRef)
  • NodeService.setProperty(NodeRef, QName, Serializable)
  • NodeService.setProperties(NodeRef, Map)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private org.alfresco.service.cmr.dictionary.DictionaryService
    Used to access property definitions
    private static org.apache.commons.logging.Log
     
    private org.alfresco.service.cmr.ml.MultilingualContentService
    Direct access to the MultilingualContentService
    private org.alfresco.service.namespace.NamespaceService
     
    private org.alfresco.service.cmr.repository.NodeService
    Direct access to the NodeService
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private Map<org.alfresco.service.namespace.QName,Serializable>
    convertInboundProperties(Map<org.alfresco.service.namespace.QName,Serializable> currentProperties, Map<org.alfresco.service.namespace.QName,Serializable> newProperties, org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.cmr.repository.NodeRef pivotNodeRef)
     
    private Serializable
    convertInboundProperty(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.cmr.repository.NodeRef pivotNodeRef, org.alfresco.service.namespace.QName propertyQName, Serializable inboundValue, Serializable currentValue)
     
    private Serializable
    convertOutboundProperty(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.cmr.repository.NodeRef pivotNodeRef, org.alfresco.service.namespace.QName propertyQName, Serializable outboundValue)
    Ensure that content is spoofed for empty translations.
    getClosestLocale.
    private Locale
    getLocale(org.alfresco.service.namespace.QName propertyQName)
     
    private org.alfresco.service.cmr.repository.NodeRef
    getPivotNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef)
     
    invoke(org.aopalliance.intercept.MethodInvocation invocation)
    private boolean
     
    static boolean
    isMLAware.
    void
    setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
    Setter for the field dictionaryService.
    void
    setMultilingualContentService(org.alfresco.service.cmr.ml.MultilingualContentService multilingualContentService)
    Setter for the field multilingualContentService.
    void
    setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
    Setter for the field namespaceService.
    void
    setNodeService(org.alfresco.service.cmr.repository.NodeService bean)
    Setter for the field nodeService.

    Methods inherited from class java.lang.Object

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

    • logger

      private static org.apache.commons.logging.Log logger
    • nodeService

      private org.alfresco.service.cmr.repository.NodeService nodeService
      Direct access to the NodeService
    • multilingualContentService

      private org.alfresco.service.cmr.ml.MultilingualContentService multilingualContentService
      Direct access to the MultilingualContentService
    • dictionaryService

      private org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService
      Used to access property definitions
    • namespaceService

      private org.alfresco.service.namespace.NamespaceService namespaceService
  • Constructor Details

    • BeCPGMLPropertyInterceptor

      public BeCPGMLPropertyInterceptor()
  • Method Details

    • setNamespaceService

      public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)

      Setter for the field namespaceService.

      Parameters:
      namespaceService - a NamespaceService object
    • isMLAware

      public static boolean isMLAware()

      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)

      Setter for the field nodeService.

      Parameters:
      bean - a NodeService object.
    • setMultilingualContentService

      public void setMultilingualContentService(org.alfresco.service.cmr.ml.MultilingualContentService multilingualContentService)

      Setter for the field multilingualContentService.

      Parameters:
      multilingualContentService - a MultilingualContentService object.
    • setDictionaryService

      public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)

      Setter for the field dictionaryService.

      Parameters:
      dictionaryService - a DictionaryService object.
    • invoke

      public Object invoke(@Nonnull org.aopalliance.intercept.MethodInvocation invocation) throws Throwable
      Specified by:
      invoke in interface org.aopalliance.intercept.MethodInterceptor
      Throws:
      Throwable
    • getPivotNodeRef

      private org.alfresco.service.cmr.repository.NodeRef getPivotNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef)
      Parameters:
      nodeRef - a potential empty translation
      Returns:
      the pivot translation node or null
    • convertOutboundProperty

      private Serializable convertOutboundProperty(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.cmr.repository.NodeRef pivotNodeRef, org.alfresco.service.namespace.QName propertyQName, Serializable outboundValue)
      Ensure that content is spoofed for empty translations.
    • getClosestLocale

      public Locale getClosestLocale(Collection<?> collection)

      getClosestLocale.

      Parameters:
      collection - a Collection object.
      Returns:
      a Locale object.
    • isCollectionOfMLText

      private boolean isCollectionOfMLText(Serializable outboundValue)
      Parameters:
      outboundValue - Serializable
      Returns:
      boolean
    • convertInboundProperties

      private Map<org.alfresco.service.namespace.QName,Serializable> convertInboundProperties(Map<org.alfresco.service.namespace.QName,Serializable> currentProperties, Map<org.alfresco.service.namespace.QName,Serializable> newProperties, org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.cmr.repository.NodeRef pivotNodeRef)
    • convertInboundProperty

      private Serializable convertInboundProperty(org.alfresco.service.cmr.repository.NodeRef nodeRef, org.alfresco.service.cmr.repository.NodeRef pivotNodeRef, org.alfresco.service.namespace.QName propertyQName, Serializable inboundValue, Serializable currentValue)
      Parameters:
      inboundValue - The value that must be set
      currentValue - The current value of the property or null if not known
      Returns:
      Returns a potentially converted property that conforms to the model
    • getLocale

      private Locale getLocale(org.alfresco.service.namespace.QName propertyQName)