所以我有2个型号。我有一个“medicalBillModel”,我想继承“clientDocument”。出于某种原因,当我这样做时,我得到的错误基本上是说已经定义了命名空间。当我有一个在露天中从另一个继承的模型时,他们需要有不同的命名空间,还是可以共享相同的命名空间?
我还尝试导入命名空间并删除命名空间声明,但这会导致此错误:
Caused by: org.alfresco.service.cmr.dictionary.DictionaryException: 06210000 Cannot define class ag:medicalBill as namespace http://www.company.com/model/content/1.0 is not defined by model ag:medicalBill
我目前正在使用Google搜索,但没有找到一个继承自另一个自定义模型的示例。
clientDocumentModel.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<model name="ag:clientDocument" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>General Client Document</description>
<author>James Pearson</author>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>
<namespaces>
<namespace uri="http://www.company.com/model/content/1.0" prefix="ag"/>
</namespaces>
<types>
<type name="ag:clientDocument">
<title>General Client Document</title>
<parent>cm:content</parent>
<properties>
<property name="ag:clientName">
<title>Client</title>
<type>d:text</type>
</property>
</properties>
</type>
</types>
</model>
medicalBillModel.xml
<?xml version="1.0" encoding="UTF-8"?>
<model name="ag:medicalBill" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<description>Medical Bill</description>
<author>James Pearson</author>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
<import uri="http://www.company.com/model/content/1.0" prefix="ag"/>
</imports>
<types>
<!-- Definition of new Content Type: Standard Operating Procedure -->
<type name="ag:medicalBill">
<title>Medical Bill</title>
<parent>ag:clientDocument</parent>
<properties>
<property name="ag:patientNameFirst">
<title>Patient First Name</title>
<type>d:text</type>
</property>
<property name="ag:patientNameLast">
<title>Patient Last Name</title>
<type>d:text</type>
</property>
<property name="ag:patientMiddleInitial">
<title>Patient Middle Initial</title>
<type>d:text</type>
</property>
<property name="ag:totalBillCharges">
<title>Total Bill Charges</title>
<type>d:double</type>
</property>
<property name="ag:dateAdmitted">
<title>Facility Name</title>
<type>d:date</type>
</property>
<property name="ag:dateDischarged">
<title>Facility Name</title>
<type>d:date</type>
</property>
<property name="ag:facility">
<title>Facility Name</title>
<type>d:text</type>
</property>
</properties>
</type>
</types>
<aspects>
</aspects>
</model>
答案 0 :(得分:4)
您好每个内容模型都可以有一个或多个唯一的命名空间,请查看Wiki
我知道它没有明确说明它必须是独一无二的。但确实如此。
我不明白你为什么要在不同的xml中使用相同的命名空间?
只需在一个内容模型中使用多种类型,即:
<model name="ag:clientDocument" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>General Client Document</description>
<author>James Pearson</author>
<version>1.0</version>
<imports>
<import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
<import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
</imports>
<namespaces>
<namespace uri="http://www.company.com/model/content/1.0" prefix="ag"/>
</namespaces>
<types>
<type name="ag:clientDocument">
<title>General Client Document</title>
<parent>cm:content</parent>
<properties>
<property name="ag:clientName">
<title>Client</title>
<type>d:text</type>
</property>
</properties>
</type>
<!-- Definition of new Content Type: Standard Operating Procedure -->
<type name="ag:medicalBill">
<title>Medical Bill</title>
<parent>ag:clientDocument</parent>
<properties>
<property name="ag:patientNameFirst">
<title>Patient First Name</title>
<type>d:text</type>
</property>
<property name="ag:patientNameLast">
<title>Patient Last Name</title>
<type>d:text</type>
</property>
<property name="ag:patientMiddleInitial">
<title>Patient Middle Initial</title>
<type>d:text</type>
</property>
<property name="ag:totalBillCharges">
<title>Total Bill Charges</title>
<type>d:double</type>
</property>
<property name="ag:dateAdmitted">
<title>Facility Name</title>
<type>d:date</type>
</property>
<property name="ag:dateDischarged">
<title>Facility Name</title>
<type>d:date</type>
</property>
<property name="ag:facility">
<title>Facility Name</title>
<type>d:text</type>
</property>
</properties>
</type>
</types>
</model>
通常我在一个内容模型中有很多类型。所以你不必担心。
如果您仍想分开它们,请使用不同的命名空间并导入其中一个。 BTW为什么要在MedicalBill中导入ClientModel?我没有看到任何用法?