ALF-4865 - transfer service: transfer empty content property

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22682 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2010-09-24 09:51:50 +00:00
parent 0d42709dd2
commit f95cb3c51b
4 changed files with 599 additions and 242 deletions

View File

@@ -780,17 +780,26 @@ public class RepoPrimaryManifestProcessorImpl extends AbstractManifestProcessorB
{
ContentData contentData = (ContentData) contentEntry.getValue();
String contentUrl = contentData.getContentUrl();
String fileName = TransferCommons.URLToPartName(contentUrl);
File stagedFile = new File(stagingDir, fileName);
if (!stagedFile.exists())
if(contentUrl == null || contentUrl.isEmpty())
{
error(MSG_REFERENCED_CONTENT_FILE_MISSING);
log.debug("content data is null or empty:" + nodeToUpdate);
ContentData cd = new ContentData(null, null, 0, null);
nodeService.setProperty(nodeToUpdate, contentEntry.getKey(), cd);
}
else
{
String fileName = TransferCommons.URLToPartName(contentUrl);
File stagedFile = new File(stagingDir, fileName);
if (!stagedFile.exists())
{
error(MSG_REFERENCED_CONTENT_FILE_MISSING);
}
ContentWriter writer = contentService.getWriter(nodeToUpdate, contentEntry.getKey(), true);
writer.setEncoding(contentData.getEncoding());
writer.setMimetype(contentData.getMimetype());
writer.setLocale(contentData.getLocale());
writer.putContent(stagedFile);
}
ContentWriter writer = contentService.getWriter(nodeToUpdate, contentEntry.getKey(), true);
writer.setEncoding(contentData.getEncoding());
writer.setMimetype(contentData.getMimetype());
writer.setLocale(contentData.getLocale());
writer.putContent(stagedFile);
}
}