From 63eae0f868e48b3f888fd67191082d72c7bc1e0f Mon Sep 17 00:00:00 2001 From: Paul Holmes-Higgin Date: Mon, 24 Jul 2006 15:41:20 +0000 Subject: [PATCH] ODF additions git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3391 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../alfresco/mimetype/openoffice-document-formats.xml | 4 ++-- .../repo/action/executer/TransformActionExecuter.java | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/config/alfresco/mimetype/openoffice-document-formats.xml b/config/alfresco/mimetype/openoffice-document-formats.xml index d29b92fc5a..62a0040d75 100644 --- a/config/alfresco/mimetype/openoffice-document-formats.xml +++ b/config/alfresco/mimetype/openoffice-document-formats.xml @@ -114,7 +114,7 @@ Microsoft Excel Spreadsheet - application/application/vnd.ms-excel + application/application/vnd.excel xls SpreadsheetMS Excel 97 @@ -144,7 +144,7 @@ Microsoft PowerPoint Presentation - application/vnd.ms-powerpoint + application/vnd.powerpoint ppt PresentationMS PowerPoint 97 diff --git a/source/java/org/alfresco/repo/action/executer/TransformActionExecuter.java b/source/java/org/alfresco/repo/action/executer/TransformActionExecuter.java index 3840764d24..4ddf81e03d 100644 --- a/source/java/org/alfresco/repo/action/executer/TransformActionExecuter.java +++ b/source/java/org/alfresco/repo/action/executer/TransformActionExecuter.java @@ -167,6 +167,10 @@ public class TransformActionExecuter extends ActionExecuterAbstractBase overwrite = overwriteValue.booleanValue(); } + // Calculate the destination name + String originalName = (String)nodeService.getProperty(actionedUponNodeRef, ContentModel.PROP_NAME); + String newName = transformName(originalName, mimeType); + // Since we are overwriting we need to figure out whether the destination node exists NodeRef copyNodeRef = null; if (overwrite == true) @@ -181,9 +185,10 @@ public class TransformActionExecuter extends ActionExecuterAbstractBase if (this.nodeService.hasAspect(copy, ContentModel.ASPECT_WORKING_COPY) == false) { // We can assume that we are looking for a node created by this action so the primary parent will - // match the destination folder + // match the destination folder and the name will be the same NodeRef parent = this.nodeService.getPrimaryParent(copy).getParentRef(); - if (parent.equals(destinationParent) == true) + String copyName = (String)this.nodeService.getProperty(copy, ContentModel.PROP_NAME); + if (parent.equals(destinationParent) == true && copyName.equals(newName) == true) { if (copyNodeRef == null) { @@ -216,8 +221,6 @@ public class TransformActionExecuter extends ActionExecuterAbstractBase if (newCopy == true) { // Adjust the name of the copy - String originalName = (String)nodeService.getProperty(actionedUponNodeRef, ContentModel.PROP_NAME); - String newName = transformName(originalName, mimeType); nodeService.setProperty(copyNodeRef, ContentModel.PROP_NAME, newName); String originalTitle = (String)nodeService.getProperty(actionedUponNodeRef, ContentModel.PROP_TITLE); if (originalTitle != null && originalTitle.length() > 0)