【问题标题】:Alfresco custom subtypes for cm:folder not workingcm:folder 的 Alfresco 自定义子类型不起作用
【发布时间】:2015-12-13 21:10:18
【问题描述】:

我尝试创建一个新的文件夹类型,它继承了 cm:folder 的所有内容,因此我在 tomcat/shared/classes/alfresco/extension/models 下为 myModel.xml 创建了一个 xml 文件,并将以下内容添加到它:

<?xml version="1.0" encoding="UTF-8"?>
<!-- xsi:schemaLocation="http://www.alfresco.org/model/dictionary/1.0      modelSchema.xsd" -->
<model name="my:custmodel" 
   xmlns="http://www.alfresco.org/model/dictionary/1.0" 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<description>custom folder test</description>
<author>Max Mustermann</author>
<published>2015-11-24</published>
<version>1.0</version>
<imports>
  <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
  <import uri="http://www.alfresco.org/model/system/1.0" prefix="sys"/>
</imports>

<namespaces>
  <namespace uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
  <namespace uri="http://www.alfresco.org/model/rendition/1.0" prefix="rn"/>
  <namespace uri="http://www.alfresco.org/model/exif/1.0" prefix="exif"/>
  <namespace uri="http://www.alfresco.org/model/audio/1.0" prefix="audio"/>
  <namespace uri="http://www.alfresco.org/model/webdav/1.0" prefix="webdav"/>
  <namespace uri="http://www.example.com/model/content/1.0" prefix="my" />
</namespaces>

<types>
<type name="my:folder1">
    <title>folder1</title>
    <parent>cm:folder</parent>
    <archive>true</archive>
 </type>
 <type name="my:folder2">
    <title>folder2</title>
    <parent>cm:folder</parent>
    <archive>true</archive>
 </type>
 </types>

然后我将以下行添加到 tomcat/shared/classes/alfresco/extension/custom-model-context.xml

<value>alfresco/extension/models/myModel.xml</value>

最后在 tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml:

<type name="cm:folder">
            <subtype name="my:folder1" />
            <subtype name="my:folder2" />
</type>

现在在 details->change Typ 下,出现了我的子类型,但是当我尝试应用它们时,我得到“无法更改文档类型...”

【问题讨论】:

    标签: alfresco models alfresco-share


    【解决方案1】:

    您在上下文文件中的模型文件名被提及为

    <value>alfresco/extension/models/custModel.xml</value>
    

    在您的描述中,您所说的名称为 "myModel.xml" 是错字吗?否则,您的文件条目看起来不错。希望您正确放置这些条目。

    此条目

    <namespace uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
    

    应该是&lt;imports&gt;标签的一部分而不是&lt;namespaces&gt;

    类似的东西

     <imports>
          <!-- Import Alfresco Dictionary Definitions -->
          <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
          <!-- Import Alfresco Content Domain Model Definitions -->
          <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
       </imports>
    

    【讨论】:

    • 我更改了这个stackoverflow帖子的真实模型名称,并且在打赏时确实犯了那个错误,xml标头也丢失了,我现在更正了......
    • 非常感谢! ,我是 alfresco 的新手,但在你的帮助下我成功了
    猜你喜欢
    • 2023-01-31
    • 1970-01-01
    • 2017-02-01
    • 2018-04-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-02
    相关资源
    最近更新 更多