如何在alfresco WebScript中添加子关联
我发现很难找到关于这方面的有用文档。基本上,我在alfresco内容模型中定义了两种自定义类型“概念”和“概念方案”。概念方案与许多子概念有关联。像这样:如何在alfresco WebScript中添加子关联,alfresco,alfresco-webscripts,content-model,Alfresco,Alfresco Webscripts,Content Model,我发现很难找到关于这方面的有用文档。基本上,我在alfresco内容模型中定义了两种自定义类型“概念”和“概念方案”。概念方案与许多子概念有关联。像这样: <type name="ancoat:conceptScheme"> <title>Concept Scheme</title> <parent>ancoat:ddiObject</parent>
<type name="ancoat:conceptScheme">
<title>Concept Scheme</title>
<parent>ancoat:ddiObject</parent>
<associations>
<child-association name="ancoat:categories">
<source>
<mandatory>true</mandatory>
<many>false</many>
</source>
<target>
<class>ancoat:concept</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
<duplicate>false</duplicate>
<propagateTimestamps>true</propagateTimestamps>
</child-association>
</associations>
<mandatory-aspects>
<aspect>ancoat:describedObject</aspect>
</mandatory-aspects>
</type>
概念方案
ancoat:对象
真的
假的
安科特:概念
假的
真的
假的
真的
ancoat:描述对象
我有两个WebScript,一个用于创建概念节点,另一个用于概念方案。现在我想创建一个webscript,它引用这些对象中的每一个,并在它们之间创建一个关联
我该怎么做?我找到了Node.createAssociation函数,但找不到任何使用它的示例。我会用java的方式回答您 假设名称空间是
http://ancoat.com/model/content/1.0
对于ancoat
前缀,具有以下关联:
public static final QName ANCOAT_CATEGORIES_ASSOC = QName.createQName("http://ancoat.com/model/content/1.0",
categories);
然后,您可以将一个节点与其他节点与节点服务关联:
getNodeService().setAssociations(pNode, ANCOAT_CATEGORIES_ASSOC, targets);
其中,pNode
是一个节点,targets
是要与之关联的节点列表
现在,使用子关联,使用addChild
方法可能是更好的方法:
getNodeService().addChild(parentRefs, childRef, assocTypeQName, qname)
你想要java后端webscript还是javascript?我个人不介意。我在想,我只是要为像这样更轻量级的任务编写javascript,为更复杂的任务编写java。但在这一点上,我使用的后端非常简单。