Aud*_*rey 2 upload android alfresco
我正在尝试在Alfresco上的存储库中上传文件.
我正在使用适用于Android的Alfresco Mobile SDK,它具有良好的文档记录且易于使用.
问题是我没有找到如何ContentFile
从文件(我要上传的文件)创建对象,以便使用该方法:
public Document createDocument(Folder folder, String nameFile,
Map<String,Serializable> properties, ContentFile contentFile)
Run Code Online (Sandbox Code Playgroud)
(这种方法效果很好,我可以创建一个没有内容的文件).
我很确定这不是什么大问题,但我环顾四周,并没有找到我需要的东西.在此先感谢您的帮助.
ServiceRegistry serviceRegistry = Login.session.getServiceRegistry();
DocumentFolderService documentFolderService =
serviceRegistry.getDocumentFolderService();
Folder folder = (Folder)
documentFolderService.getNodeByIdentifier(repository.getIdentifier());
Map<String,Serializable> properties = new HashMap<String,Serializable>();
// here I would like to take the content from the fileFrom:
ContentFile contentFile = null;
// fileFrom is a File object:
String nameFile = fileFrom.getName();
documentFolderService.createDocument(folder, nameFile, properties, contentFile);
Run Code Online (Sandbox Code Playgroud)
你应该使用这个ContentFileImpl
类:
//...
String location = "..."; // wherever you have to point to
ContentFile contentFile = new ContentFileImpl(new File(location));
//...
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
175 次 |
最近记录: |