Package fr.becpg.repo.multilingual
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
FieldsModifier and TypeFieldDescriptionprivate org.alfresco.service.cmr.dictionary.DictionaryServiceUsed to access property definitionsprivate static org.apache.commons.logging.Logprivate org.alfresco.service.cmr.ml.MultilingualContentServiceDirect access to the MultilingualContentServiceprivate org.alfresco.service.namespace.NamespaceServiceprivate org.alfresco.service.cmr.repository.NodeServiceDirect access to the NodeService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate 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 SerializableconvertInboundProperty(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 SerializableconvertOutboundProperty(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(Collection<?> collection) getClosestLocale.private LocalegetLocale(org.alfresco.service.namespace.QName propertyQName) private org.alfresco.service.cmr.repository.NodeRefgetPivotNodeRef(org.alfresco.service.cmr.repository.NodeRef nodeRef) invoke(org.aopalliance.intercept.MethodInvocation invocation) private booleanisCollectionOfMLText(Serializable outboundValue) static booleanisMLAware.voidsetDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService) Setter for the fielddictionaryService.voidsetMultilingualContentService(org.alfresco.service.cmr.ml.MultilingualContentService multilingualContentService) Setter for the fieldmultilingualContentService.voidsetNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService) Setter for the fieldnamespaceService.voidsetNodeService(org.alfresco.service.cmr.repository.NodeService bean) Setter for the fieldnodeService.
-
Field Details
-
logger
private static org.apache.commons.logging.Log logger -
nodeService
private org.alfresco.service.cmr.repository.NodeService nodeServiceDirect access to the NodeService -
multilingualContentService
private org.alfresco.service.cmr.ml.MultilingualContentService multilingualContentServiceDirect access to the MultilingualContentService -
dictionaryService
private org.alfresco.service.cmr.dictionary.DictionaryService dictionaryServiceUsed 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- aNamespaceServiceobject
-
isMLAware
public static boolean isMLAware()isMLAware.
- Returns:
- Returns true if the current thread has marked itself
as being able to handle
d:mltexttypes properly.
-
setNodeService
public void setNodeService(org.alfresco.service.cmr.repository.NodeService bean) Setter for the field
nodeService.- Parameters:
bean- aNodeServiceobject.
-
setMultilingualContentService
public void setMultilingualContentService(org.alfresco.service.cmr.ml.MultilingualContentService multilingualContentService) Setter for the field
multilingualContentService.- Parameters:
multilingualContentService- aMultilingualContentServiceobject.
-
setDictionaryService
public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService) Setter for the field
dictionaryService.- Parameters:
dictionaryService- aDictionaryServiceobject.
-
invoke
public Object invoke(@Nonnull org.aopalliance.intercept.MethodInvocation invocation) throws Throwable - Specified by:
invokein interfaceorg.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
getClosestLocale.
- Parameters:
collection- aCollectionobject.- Returns:
- a
Localeobject.
-
isCollectionOfMLText
- 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 setcurrentValue- The current value of the property or null if not known- Returns:
- Returns a potentially converted property that conforms to the model
-
getLocale
-