对于从露天的另一个模型继承的模型,它们是否需要具有不同的名称空间,或者它们可以共享相同的名称空间吗?
所以我有 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
我目前正在谷歌搜索,但没有找到从另一个继承的一个自定义模型的示例。
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>
So I have 2 models. I have a "medicalBillModel" that I would like to inherit from "clientDocument". For some reason when I do this I get errors basically saying that the namespace has already being defined. When I have a model that inherits from another in alfresco do they need to have distinct namespaces or can they share the same namespace?
I also tried to import the namespace and remove the namespace declaration but that causes this error:
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
I am currently in the process of googling but not finding an example of one custom model that inherits from another.
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您好,每个内容模型都可以有一个或多个唯一的命名空间,请查看 Wiki
I知道它没有明确说明它需要是唯一的。但确实如此。
我不明白为什么你想在不同的 xml 中使用相同的名称空间?
只需在一个内容模型中使用多种类型,如下所示:
通常我在一个内容模型中有很多类型。所以你不用担心。
如果您仍想将它们分开,请使用不同的命名空间并导入另一个。
顺便说一句,为什么要在 MedicalBill 中导入 ClientModel?我没看到有什么用处?
Hi Each content model can have one or multiple unique namespaces, take a look at the Wiki
I know it doesn't state clearly that it needs to be unique. But it is.
What I don't understand why do you want to use the same namespace in different xml's?
Just use multiple types in one content model aka the following:
Normally i have a lot of types in one content model. So you don't need to worry.
If you still want to seperate them, use different namespaces and import one and another.
BTW why do you want to import ClientModel in the MedicalBill? I don't see any usage of that?