我是露天新手。这是自定义模型。我需要获取文件夹内容(cm:文件夹)以及其他自定义类型(sparepart,metal)。以下方法用于获取类型,但不返回文件夹内容。需要在自定义模型xml文件(以及java类)中进行哪些更改才能使其正常工作?
例如Factory是父容器。在Factory,emp:metal,emp:asset和emp:sparepart是子容器。所以当我在Factory容器下添加这些子容器时,所有这些关联都会来。就像我需要的那样另一个名为folder association.i的关联也可以在Factory Container内创建文件夹和内容。现有模型工作正常。但是如何在工厂容器内添加emp:文件夹类型作为关联。当我点击查看节点浏览器时它不显示类型为“emp :文件夹“和目标关联。
List<AssociationRef> associationRefs = nodeService.getTargetAssocs(nodeRef,
EMPContentModel.EMP_NAMESPACE_URI_QNAME_PATTERN);
如果我在emp:fac下添加另一个关联,那么它也无法正常工作..
<association name="emp:containsFactoryFolder">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>cm:folder</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
custommodel.xml
<namespaces>
<namespace uri="http://www.emp.com/model/emp-cms-core/2.0" prefix="emp"/>
</namespaces>
<types>
<type name="emp:container">
<title>Container</title>
<parent>cm:folder</parent>
</type>
<type name="emp:fac">
<title>Factory</title>
<parent>emp:container</parent>
<associations>
<association name="emp:containsFactoryAsset">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>emp:asset</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
<association name="emp:containsFactorySparePart">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>emp:sparepart</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
<association name="emp:containsFactoryMetal">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>emp:metal</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</type>
<type name="emp:sparepart">
<title>Spare Part</title>
<parent>emp:container</parent>
<properties>
<property name="emp:sparePartNumber">
<title>Spare Part Number</title>
<type>d:text</type>
</property>
</properties>
<associations>
<association name="emp:containsSparePartAsset">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>emp:asset</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
<association name="emp:containsSparePartMetal">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>emp:metal</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
<association name="emp:derivesFromSparePart">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>emp:sparepart</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</type>
<type name="emp:metal">
<title>Metal</title>
<parent>emp:container</parent>
<associations>
<association name="emp:containsMetalAsset">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>emp:asset</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
<association name="emp:derivesFromMetal">
<source>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>emp:metal</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
<association name="emp:containsMetalMetal">
<source>
<mandatory>false</mandatory>
<many>true</many>
</source>
<target>
<class>emp:metal</class>
<mandatory>false</mandatory>
<many>true</many>
</target>
</association>
</associations>
</type>
<type name="emp:content">
<title>Content</title>
<parent>cm:content</parent>
</type>
<type name="emp:asset">
<title>Asset</title>
<parent>emp:content</parent>
</type>
</types>
</model>
提前致谢。
答案 0 :(得分:0)
您需要为 share-config-custom.xml 添加配置添加文档库配置,以便您在用户界面上查看自定义内容类型。
<types>
<type name="cm:content">
</type>
<type name="cm:folder">
<subtype name="emp:fac" />
<subtype name="emp:sparepart" />
</type>
<type name="trx:transferTarget">
<subtype name="trx:fileTransferTarget" />
</type>
</types>
一旦你看到那些可见的,你就可以创建普通文件夹,并将它的类型更改为你的自定义内容类型,即(emp:fac等...)。
要将这些文件夹与其他文件夹相关联,您需要再次在 share-config-custom.xml
中添加与文件夹属性相关的配置<config evaluator="model-type" condition="emp:fac">
<forms>
<form>
<field-visibility>
<show id="cm:name" />
<show id="emp:containsFactoryAsset" />
<show id="emp:containsFactorySparePart" />
<show id="cm:title" force="true" />
<show id="cm:description" force="true" />
</field-visibility>
</form>
</forms>
</config>
像这样。