【问题标题】:Alfresco aspect secondaryType露天方面secondaryType
【发布时间】:2020-03-30 15:41:12
【问题描述】:

我在使用 Java 中的 Alfresco 时遇到了 openCmis 的问题。 我尝试在我的文档中添加一个secondaryType“abc:aspectCustom”,就像我们在这段代码中看到的那样:

props.put(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_DOCUMENT.value());
    props.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, Arrays.asList("P:abc:aspectCustom"));
    ContentStream contentStream = session.getObjectFactory().createContentStream(documentName, sizeFolder, typeFile, inputStream);
    Document document = targetFolder.createDocument(props, contentStream, VersioningState.CHECKEDOUT);

但我有这个错误:

java.lang.IllegalArgumentException: Secondary types property contains a type that is not a secondary type: P:abc:aspectCustom

所以我尝试调试,我发现我的问题来自这部分代码(ObjectFactoryImpl):

if (!(secondaryType instanceof SecondaryType)) {
                    throw new IllegalArgumentException(
                            "Secondary types property contains a type that is not a secondary type: " + secondaryTypeId);
                }

当我调试 secondaryType 对象时,我发现他是 PolicyType 的实例 而不是 SecondaryType。 所以我现在不知道问题在哪里!为什么我在模型中的方面被解释为 Policy 而不是 SecondaryType。

有关信息,在模型 Alfresco 中我有这个:

<aspect name="abc:aspectCustom">
            <title>ABCAspect</title>
</aspect> 

谢谢你:)

【问题讨论】:

    标签: java alfresco opencmis


    【解决方案1】:

    首先,确保您使用的是 CMIS 1.1 服务 URL,即 https://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom 用于 ATOMPub 绑定,https://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/browser 用于浏览器绑定。

    接下来,尝试添加一个开箱即用的方面,例如 P:cm:geographic,而不是您的自定义方面,以确保它有效。这将排除您的自定义内容模型的任何问题。

    【讨论】:

    • 你好杰夫,谢谢你的回答。现在可以了:)
    • 问题是您使用了错误的 CMIS 服务 URL 吗?
    • 是的,我在我的 pom 中使用了正确的依赖项,但是错误的 url :/
    猜你喜欢
    • 2011-05-03
    • 1970-01-01
    • 1970-01-01
    • 2018-04-22
    • 1970-01-01
    • 1970-01-01
    • 2018-09-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多