首页 > 解决方案 > 使用 CMIS API 上传重复文件

问题描述

我想将具有相同名称的两个文件上传到 Alfresco Repository 中(我可以将其上传到 Documentum 中)但我遇到了异常有人可以告诉我如何实现它,因为它是我的用户的业务用例可以上传同名文件吗?请注意,这在 Documentum 中的工作方式与预期相同。

[2/12/20 16:43:03:554 IST] 00000040 SystemErr     R org.apache.chemistry.opencmis.commons.exceptions.CmisContentAlreadyExistsException: An object with this name already exists: 01120277 File or folder Book_295_12.xlsx already exists
[2/12/20 16:43:03:555 IST] 00000040 SystemErr     R     at org.apache.chemistry.opencmis.client.bindings.spi.atompub.AbstractAtomPubService.convertStatusCode(AbstractAtomPubService.java:506)

标签: alfresco

解决方案


为此,您应该覆盖您的 contentModel.xml:

<type name="cm:folder">
    <title>Folder</title>
    <parent>cm:cmobject</parent>
    <archive>true</archive>
    <properties/>
    <associations>
        <child-association name="cm:contains">
            <source>
                <mandatory>false</mandatory>
                <many>true</many>
            </source>
            <target>
                <class>sys:base</class>
                <mandatory enforced="false">false</mandatory>
                <many>true</many>
            </target>
            <duplicate>false</duplicate>
            <propagateTimestamps>true</propagateTimestamps>
        </child-association>
    </associations>
    <overrides/>
    <mandatory-aspects/>
</type>

如您所见,子关联中有重复的参数,值为“false”。你应该把它改成“真”


推荐阅读