本文介绍了同名上传并更新到Alfresco的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将文件更新到Alfresco.我上传了它,当我想更新(具有相同的名称)时,出现重复的子名称"错误.我想在Alfresco上保留两个相同名称的文件,并且只更改文件版本"(Alfresco的名称将是一个,但文件版本为1.0,1.1,1.2).以下是我遇到问题的Java代码.

i want to update files to Alfresco. i upload it and when i want to update (with same name) i have errors "duplicate child name". i want to keep both of files with the same name on Alfresco and to change only the "file versions" (the name to Alfresco will be one but have file versions 1.0 , 1.1, 1.2).Below is my java code that i have the problem.

protected void executeFunction(AlfrescoRestClient alfrescoClient, AlfrescoSOAPClient alfrescoSOAPClient) throws Exception {
    String lastFileId = "";  
    for (int i=0; i < files.size(); i++) {          
        String filename = files.get(i).substring(files.get(i).lastIndexOf("name=")+5);
        String contentType = files.get(i).substring(0, files.get(i).indexOf(";"));

        lastFileId = alfrescoSOAPClient.uploadFileWithProperties(this.sourcePath + filename, filename, 
                 this.destinationFolder, contentType, "utf8", false, null, null, null, null, null, false, null, 
                 null, null, null, null, false, null, null, null);                

        AlfrescoResponse resp = alfrescoClient.updateCheckedOutFile(this.sourcePath + filename, this.description, contentType, checkOutId);

        Document<Element> doc = resp.getDocument();
        Entry responseEntry = (Entry)doc.getRoot();
        LOGGER.severe("ID: " + responseEntry.getId().toString());
        lastFileId = responseEntry.getId().toString();
        this.fileId = lastFileId;  
     }     
}

推荐答案

您无法在露天场所更新具有相同名称的文档,但可以更改内容并更新文档的版本.

You can not Update the document with same name in alfresco but you can change the content and update the version of Document.

这篇关于同名上传并更新到Alfresco的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 03:25