From a85bc773c30e35c388f8e29370a1ae2b43a58383 Mon Sep 17 00:00:00 2001 From: Derek Hulley Date: Wed, 25 Apr 2007 02:13:55 +0000 Subject: [PATCH] Merged V2.0 to HEAD 5497: cwd variable and forminstancedata 5512: AR-1303 MLPropertyInterceptor 5527: CIFS invalid characters git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5543 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/model/wcmAppModel.xml | 6 +++ .../smb/server/CoreProtocolHandler.java | 4 +- .../java/org/alfresco/model/WCMAppModel.java | 1 + .../repo/node/BaseNodeServiceTest.java | 54 +++++++++++++++++++ .../repo/node/MLPropertyInterceptor.java | 17 +++--- 5 files changed, 71 insertions(+), 11 deletions(-) diff --git a/config/alfresco/model/wcmAppModel.xml b/config/alfresco/model/wcmAppModel.xml index bce82da2df..4c8c0c3d55 100644 --- a/config/alfresco/model/wcmAppModel.xml +++ b/config/alfresco/model/wcmAppModel.xml @@ -352,6 +352,12 @@ d:text true + + The original parent path when this form instance data was created - used for regenerating accurately. + d:text + false + + Renditions of this form instance data d:text diff --git a/source/java/org/alfresco/filesys/smb/server/CoreProtocolHandler.java b/source/java/org/alfresco/filesys/smb/server/CoreProtocolHandler.java index 86f88c0ed4..2705cfa50a 100644 --- a/source/java/org/alfresco/filesys/smb/server/CoreProtocolHandler.java +++ b/source/java/org/alfresco/filesys/smb/server/CoreProtocolHandler.java @@ -87,8 +87,8 @@ class CoreProtocolHandler extends ProtocolHandler // Invalid file name characters - private static final String InvalidFileNameChars = "\"/[]:+|<>=;,*?"; - private static final String InvalidFileNameCharsSearch = "\"/[]:+|<>=;,"; + private static final String InvalidFileNameChars = "\"/:|<>*?"; + private static final String InvalidFileNameCharsSearch = "\"/:|<>"; // SMB packet class diff --git a/source/java/org/alfresco/model/WCMAppModel.java b/source/java/org/alfresco/model/WCMAppModel.java index db72577fd4..c8aa70151c 100644 --- a/source/java/org/alfresco/model/WCMAppModel.java +++ b/source/java/org/alfresco/model/WCMAppModel.java @@ -104,6 +104,7 @@ public interface WCMAppModel static final QName ASPECT_FORM_INSTANCE_DATA = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "forminstancedata"); static final QName PROP_PARENT_FORM_NAME = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "parentformname"); static final QName PROP_RENDITIONS = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "renditions"); + static final QName PROP_ORIGINAL_PARENT_PATH = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "orginalparentpath"); static final QName ASPECT_RENDITION = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "rendition"); static final QName PROP_PARENT_RENDERING_ENGINE_TEMPLATE = QName.createQName(NamespaceService.WCMAPP_MODEL_1_0_URI, "parentrenderingenginetemplate"); diff --git a/source/java/org/alfresco/repo/node/BaseNodeServiceTest.java b/source/java/org/alfresco/repo/node/BaseNodeServiceTest.java index 4eabd8ddc9..aa61c85b01 100644 --- a/source/java/org/alfresco/repo/node/BaseNodeServiceTest.java +++ b/source/java/org/alfresco/repo/node/BaseNodeServiceTest.java @@ -1751,4 +1751,58 @@ public abstract class BaseNodeServiceTest extends BaseSpringTest setComplete(); endTransaction(); } + + public static boolean behaviourExecuted = false; + + public void testAR1303() throws Exception + { + Map props = new HashMap(1); + props.put(ContentModel.PROP_NAME, "test.txt"); + + NodeRef nodeRef = this.nodeService.createNode( + this.rootNodeRef, + ContentModel.ASSOC_CHILDREN, + ContentModel.ASSOC_CHILDREN, + ContentModel.TYPE_CONTENT, + props).getChildRef(); + + this.nodeService.addAspect(nodeRef, ContentModel.ASPECT_TITLED, null); + + this.nodeService.setProperty(nodeRef, ContentModel.PROP_DESCRIPTION, "my description"); + this.nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, "my title"); + + JavaBehaviour behaviour = new JavaBehaviour(this, "onUpdateProperties"); + PolicyComponent policyComponent = (PolicyComponent)this.applicationContext.getBean("policyComponent"); + policyComponent.bindClassBehaviour( + QName.createQName(NamespaceService.ALFRESCO_URI, "onUpdateProperties"), + ContentModel.ASPECT_TITLED, + behaviour); + + behaviourExecuted = false; + + // Update the title property and check that the behaviour has been fired + this.nodeService.setProperty(nodeRef, ContentModel.PROP_TITLE, "changed title"); + assertTrue("The onUpdateProperties behaviour has not been fired.", behaviourExecuted); + } + + public void onUpdateProperties( + NodeRef nodeRef, + Map before, + Map after) + { + behaviourExecuted = true; + assertFalse(before.get(ContentModel.PROP_TITLE).toString().equals(after.get(ContentModel.PROP_TITLE).toString())); + + System.out.print("Before values: "); + for (Map.Entry entry : before.entrySet()) + { + System.out.println(entry.getKey().toString() + " : " + entry.getValue().toString()); + } + System.out.print("\nAfter values: "); + for (Map.Entry entry : after.entrySet()) + { + System.out.println(entry.getKey().toString() + " : " + entry.getValue().toString()); + } + } + } diff --git a/source/java/org/alfresco/repo/node/MLPropertyInterceptor.java b/source/java/org/alfresco/repo/node/MLPropertyInterceptor.java index efb4f97da8..9c12c8eee9 100644 --- a/source/java/org/alfresco/repo/node/MLPropertyInterceptor.java +++ b/source/java/org/alfresco/repo/node/MLPropertyInterceptor.java @@ -216,8 +216,10 @@ public class MLPropertyInterceptor implements MethodInterceptor NodeRef nodeRef = (NodeRef) args[0]; QName propertyQName = (QName) args[1]; Serializable inboundValue = (Serializable) args[2]; + // Convert the property inboundValue = convertInboundProperty(contentLocale, nodeRef, propertyQName, inboundValue, null); + // Pass this through to the node service directNodeService.setProperty(nodeRef, propertyQName, inboundValue); // Done @@ -261,21 +263,18 @@ public class MLPropertyInterceptor implements MethodInterceptor { currentValue = directNodeService.getProperty(nodeRef, propertyQName); } - MLText currentMLValue = null; - if (currentValue == null) + MLText returnMLValue = new MLText(); + if (currentValue != null) { - currentMLValue = new MLText(); - } - else - { - currentMLValue = DefaultTypeConverter.INSTANCE.convert(MLText.class, currentValue); + MLText currentMLValue = DefaultTypeConverter.INSTANCE.convert(MLText.class, currentValue); + returnMLValue.putAll(currentMLValue); } // Force the inbound value to be a String (it isn't MLText) String inboundValueStr = DefaultTypeConverter.INSTANCE.convert(String.class, inboundValue); // Add it to the current MLValue - currentMLValue.put(contentLocale, inboundValueStr); + returnMLValue.put(contentLocale, inboundValueStr); // Done - ret = currentMLValue; + ret = returnMLValue; } } else // It is not defined as d:mltext in the dictionary