首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使内容节点成为节点的主父节点

使内容节点成为节点的主父节点
EN

Stack Overflow用户
提问于 2019-09-12 14:48:51
回答 1查看 103关注 0票数 1

我尝试使用Alfresco NodeService来使一个内容节点(QName cm:content)成为另一个内容节点的主父级NodeService提供了一个

代码语言:javascript
复制
public ChildAssociationRef moveNode(
        NodeRef nodeToMoveRef,
        NodeRef newParentRef,
        QName assocTypeQName,
        QName assocQName)
        throws InvalidNodeRefException;

假设节点theNodeToMove的当前主父节点是文件夹,文件夹中节点的主父目录引用是primaryAssocRef。让theTargetContentNode成为目标content节点。

调用上述消息,如下所示

代码语言:javascript
复制
nodeService.moveNode(theNodeToMove,
                     theTargetContentNode,
                     primaryAssocRef.getTypeQName(),
                     primaryAssocRef.getQName());

失败了。据报道一次完整性违规事件

代码语言:javascript
复制
The association source type is incorrect:
   Source Node: workspace://SpacesStore/27a97736-222c-4bac-8610-f15ce312b074 
   Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}folder], name={http://www.alfresco.org/model/content/1.0}contains, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null]
   Required Source Type: {http://www.alfresco.org/model/content/1.0}folder
   Actual Source Type: {http://www.alfresco.org/model/content/1.0}content

是否有可能使内容节点成为现有内容节点的主父

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-09-12 18:31:01

是也不是。是的,因为内容节点可以有子节点,而不是,因为您不能使用“包含”关联。

基本上,当您创建一个“父-子”关系时,您需要声明它的关联类型。例如,rm:rendition是这些类型中的一种。

在文件夹下创建文档时使用的“主”关联类型是cm:contains,其设置方式不允许内容节点有子节点。这是通过模型定义完成的,如下所示:

代码语言:javascript
复制
<type name="cm:folder">
     <title>Folder</title>
     <parent>cm:cmobject</parent>
     <archive>true</archive>
     <associations>
        <child-association name="cm:contains">
           <source>
              <mandatory>false</mandatory>
              <many>true</many>
           </source>
           <target>
              <class>sys:base</class>
              <mandatory>false</mandatory>
              <many>true</many>
           </target>
           <duplicate>false</duplicate>
           <propagateTimestamps>true</propagateTimestamps>
        </child-association>
     </associations>
</type>
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57909289

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档