mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-06-16 17:55:15 +00:00
Fix issue where imported content does not have associated binary content stream (i.e. fixes "ContentData does not have a content url" error).
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2232 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
parent
c81c8f59e8
commit
c131dd7dec
@ -590,18 +590,20 @@ public class ImporterComponent
|
|||||||
// bind import content data description
|
// bind import content data description
|
||||||
DataTypeDefinition dataTypeDef = dictionaryService.getDataType(DataTypeDefinition.CONTENT);
|
DataTypeDefinition dataTypeDef = dictionaryService.getDataType(DataTypeDefinition.CONTENT);
|
||||||
importContentData = bindPlaceHolder(importContentData, binding);
|
importContentData = bindPlaceHolder(importContentData, binding);
|
||||||
ContentData contentData = (ContentData)DefaultTypeConverter.INSTANCE.convert(dataTypeDef, importContentData);
|
if (importContentData != null && importContentData.length() > 0)
|
||||||
|
|
||||||
String contentUrl = contentData.getContentUrl();
|
|
||||||
if (contentUrl != null && contentUrl.length() > 0)
|
|
||||||
{
|
{
|
||||||
// import the content from the url
|
ContentData contentData = (ContentData)DefaultTypeConverter.INSTANCE.convert(dataTypeDef, importContentData);
|
||||||
InputStream contentStream = streamHandler.importStream(contentUrl);
|
String contentUrl = contentData.getContentUrl();
|
||||||
ContentWriter writer = contentService.getWriter(nodeRef, propertyName, true);
|
if (contentUrl != null && contentUrl.length() > 0)
|
||||||
writer.setEncoding(contentData.getEncoding());
|
{
|
||||||
writer.setMimetype(contentData.getMimetype());
|
// import the content from the url
|
||||||
writer.putContent(contentStream);
|
InputStream contentStream = streamHandler.importStream(contentUrl);
|
||||||
reportContentCreated(nodeRef, contentUrl);
|
ContentWriter writer = contentService.getWriter(nodeRef, propertyName, true);
|
||||||
|
writer.setEncoding(contentData.getEncoding());
|
||||||
|
writer.setMimetype(contentData.getMimetype());
|
||||||
|
writer.putContent(contentStream);
|
||||||
|
reportContentCreated(nodeRef, contentUrl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user