upload and update with same name to Alfresco

末鹿安然 提交于 2019-12-12 02:29:04

问题


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;  
     }     
}

回答1:


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



来源:https://stackoverflow.com/questions/9871249/upload-and-update-with-same-name-to-alfresco

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!