我尝试使用Alfresco NodeService来使一个内容节点(QName cm:content)成为另一个内容节点的主父级。NodeService提供了一个
public ChildAssociationRef moveNode(
NodeRef nodeToMoveRef,
NodeRef newParentRef,
QName assocTypeQName,
QName assocQName)
throws InvalidNodeRefException;假设节点theNodeToMove的当前主父节点是文件夹,文件夹中节点的主父目录引用是primaryAssocRef。让theTargetContentNode成为目标content节点。
调用上述消息,如下所示
nodeService.moveNode(theNodeToMove,
theTargetContentNode,
primaryAssocRef.getTypeQName(),
primaryAssocRef.getQName());失败了。据报道一次完整性违规事件
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是否有可能使内容节点成为现有内容节点的主父?
发布于 2019-09-12 18:31:01
是也不是。是的,因为内容节点可以有子节点,而不是,因为您不能使用“包含”关联。
基本上,当您创建一个“父-子”关系时,您需要声明它的关联类型。例如,rm:rendition是这些类型中的一种。
在文件夹下创建文档时使用的“主”关联类型是cm:contains,其设置方式不允许内容节点有子节点。这是通过模型定义完成的,如下所示:
<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>https://stackoverflow.com/questions/57909289
复制相似问题