Merged V2.0 to HEAD

5136: AR-918
   5137, 5138: AWC-1083
   5139: WCM-309, WCM-311


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5325 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-03-07 10:07:36 +00:00
parent 4a44e4d3a2
commit 6d5739e20f
3 changed files with 19 additions and 8 deletions

View File

@@ -204,7 +204,7 @@ public class TransformActionExecuter extends ActionExecuterAbstractBase
// Calculate the destination name
String originalName = (String)nodeService.getProperty(actionedUponNodeRef, ContentModel.PROP_NAME);
String newName = transformName(this.mimetypeService, originalName, mimeType);
String newName = transformName(this.mimetypeService, originalName, mimeType, true);
// Since we are overwriting we need to figure out whether the destination node exists
NodeRef copyNodeRef = null;
@@ -260,7 +260,7 @@ public class TransformActionExecuter extends ActionExecuterAbstractBase
String originalTitle = (String)nodeService.getProperty(actionedUponNodeRef, ContentModel.PROP_TITLE);
if (originalTitle != null && originalTitle.length() > 0)
{
String newTitle = transformName(this.mimetypeService, originalTitle, mimeType);
String newTitle = transformName(this.mimetypeService, originalTitle, mimeType, false);
nodeService.setProperty(copyNodeRef, ContentModel.PROP_TITLE, newTitle);
}
}
@@ -317,7 +317,7 @@ public class TransformActionExecuter extends ActionExecuterAbstractBase
*
* @return name with new extension as appropriate for the mimetype
*/
public static String transformName(MimetypeService mimetypeService, String original, String newMimetype)
public static String transformName(MimetypeService mimetypeService, String original, String newMimetype, boolean alwaysAdd)
{
// get the current extension
int dotIndex = original.lastIndexOf('.');
@@ -326,15 +326,23 @@ public class TransformActionExecuter extends ActionExecuterAbstractBase
{
// we found it
sb.append(original.substring(0, dotIndex));
// add the new extension
String newExtension = mimetypeService.getExtension(newMimetype);
sb.append('.').append(newExtension);
}
else
{
// no extension
// no extension so dont add a new one
sb.append(original);
if (alwaysAdd == true)
{
// add the new extension
String newExtension = mimetypeService.getExtension(newMimetype);
sb.append('.').append(newExtension);
}
}
// add the new extension
String newExtension = mimetypeService.getExtension(newMimetype);
sb.append('.').append(newExtension);
// done
return sb.toString();
}

View File

@@ -171,6 +171,9 @@ public class DbAccessControlListImpl extends LifecycleAdapter
// remove from the entry list
entry.delete();
}
// Fix issues with deleting and adding permissions
// See AR-918
this.getSession().flush();
// done
if (logger.isDebugEnabled())
{

View File

@@ -1390,7 +1390,7 @@ public class Node implements Serializable, Scopeable
{
// Copy the content node to a new node
String copyName = TransformActionExecuter.transformName(this.services.getMimetypeService(), getName(),
mimetype);
mimetype, true);
NodeRef copyNodeRef = this.services.getCopyService().copy(this.nodeRef, destination,
ContentModel.ASSOC_CONTAINS,
QName.createQName(ContentModel.PROP_CONTENT.getNamespaceURI(), QName.createValidLocalName(copyName)),