Alfresco 如何在露天扩展Person对象?
我已经尝试了一天左右的时间来扩展带有额外属性的person模型,但迄今为止,没有成功。我跟着,但没能让它工作。查看一下页面上的一些回复,就会发现有人尝试了4.1,但没有成功。我正在测试4.2。 如有任何见解,将不胜感激 编辑: 我有以下customContentModel.xml:Alfresco 如何在露天扩展Person对象?,alfresco,alfresco-share,Alfresco,Alfresco Share,我已经尝试了一天左右的时间来扩展带有额外属性的person模型,但迄今为止,没有成功。我跟着,但没能让它工作。查看一下页面上的一些回复,就会发现有人尝试了4.1,但没有成功。我正在测试4.2。 如有任何见解,将不胜感激 编辑: 我有以下customContentModel.xml: <model name="cm:contentModel" xmlns="http://www.alfresco.org/model/dictionary/1.0"> <!-- Option
<model name="cm:contentModel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
<!-- Optional meta-data about the model -->
<description>Professional Person Model</description>
<author></author>
<version>1.0</version>
<!-- Imports are required to allow references to definitions in other models -->
<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" />
<import uri="http://www.syn.fr/model/person/ext" prefix="ppm"/>
</imports>
<types>
<type name="cm:person">
<title>Person</title>
<parent>cm:authority</parent>
<properties>
<!-- The tokenisation set here is ignored - it is fixed for this type -->
<!-- This is so you can not break person lookup -->
<property name="cm:userName">
<type>d:text</type>
<mandatory>true</mandatory>
<constraints>
<constraint ref="cm:userNameConstraint" />
</constraints>
</property>
<property name="cm:homeFolder">
<type>d:noderef</type>
<mandatory>true</mandatory>
</property>
<property name="cm:firstName">
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="cm:lastName">
<type>d:text</type>
<mandatory>true</mandatory>
</property>
<property name="cm:middleName">
<type>d:text</type>
</property>
<property name="cm:email">
<type>d:text</type>
</property>
<property name="cm:organizationId">
<type>d:text</type>
</property>
<property name="cm:homeFolderProvider">
<type>d:text</type>
</property>
<property name="cm:defaultHomeFolderPath">
<type>d:text</type>
</property>
<property name="cm:presenceProvider">
<type>d:text</type>
</property>
<property name="cm:presenceUsername">
<type>d:text</type>
</property>
<property name="cm:organization">
<type>d:text</type>
</property>
<property name="cm:jobtitle">
<type>d:text</type>
</property>
<property name="cm:location">
<type>d:text</type>
</property>
<property name="cm:persondescription">
<type>d:content</type>
</property>
<property name="cm:telephone">
<type>d:text</type>
</property>
<property name="cm:mobile">
<type>d:text</type>
</property>
<property name="cm:companyaddress1">
<type>d:text</type>
</property>
<property name="cm:companyaddress2">
<type>d:text</type>
</property>
<property name="cm:companyaddress3">
<type>d:text</type>
</property>
<property name="cm:companypostcode">
<type>d:text</type>
</property>
<property name="cm:companytelephone">
<type>d:text</type>
</property>
<property name="cm:companyfax">
<type>d:text</type>
</property>
<property name="cm:companyemail">
<type>d:text</type>
</property>
<property name="cm:skype">
<type>d:text</type>
</property>
<property name="cm:instantmsg">
<type>d:text</type>
</property>
<property name="cm:userStatus">
<type>d:text</type>
</property>
<property name="cm:userStatusTime">
<type>d:datetime</type>
</property>
<property name="cm:googleusername">
<type>d:text</type>
</property>
<property name="cm:emailFeedDisabled">
<type>d:boolean</type>
</property>
<property name="cm:subscriptionsPrivate">
<type>d:boolean</type>
</property>
<!-- system maintained / protected values -->
<property name="cm:emailFeedId">
<type>d:long</type>
<protected>true</protected>
</property>
<property name="cm:sizeCurrent">
<type>d:long</type>
<protected>true</protected>
<mandatory enforced="true">true</mandatory>
</property>
<property name="cm:sizeQuota">
<type>d:long</type>
<protected>true</protected>
</property>
</properties>
<associations>
<association name="cm:avatar">
<source>
<role>cm:avatarOf</role>
<mandatory>false</mandatory>
<many>false</many>
</source>
<target>
<class>cm:content</class>
<role>cm:hasAvatar</role>
<mandatory>false</mandatory>
<many>false</many>
</target>
</association>
</associations>
</type>
<mandatory-aspects>
<aspect>ppm:attributes</aspect>
</mandatory-aspects>
</types>
</model>
专业人士模型
1
人
cm:管理局
d:文本
真的
d:诺德雷夫
真的
d:文本
真的
d:文本
真的
d:文本
d:文本
d:文本
d:文本
d:文本
d:文本
d:文本
d:文本
d:文本
d:文本
d:内容
d:文本
d:文本
d:文本
d:文本
d:文本
d:文本
d:文本
d:文本
d:文本
d:文本
d:文本
d:文本
d:日期时间
d:文本
d:布尔型
d:布尔型
d:很长
真的
d:很长
真的
真的
d:很长
真的
cm:avatarOf
假的
假的
cm:内容
cm:hasAvatar
假的
假的
ppm:属性
我得到一个关于cm:authority的错误,说找不到它。当然,所有的cm:*命名空间对象都会在可扩展对象之前加载,因此cm:authority本身也会可用?ECMA架构师指南示例成功了。我下载了代码示例,并根据我的情况对其进行了修改。非常简单,只需创建自己的扩展cm:person的类型并添加属性即可
<type name="ab:myperson">
<title>Person</title>
<parent>cm:person</parent>
<properties>
<!-- The tokenisation set here is ignored - it is fixed for this type -->
<!-- This is so you can not break person lookup -->
<property name="ab:customField">
<type>d:text</type>
<mandatory>true</mandatory>
</property>..
人
cm:人
d:文本
真的
..
问题是这个属性不会在新用户上设置,因为它们不是您想要的ab:myperson类型
您需要创建自定义行为,通过将cm:person的类型更改为ab:myperson来添加属性
最好的解决方案是创建方面而不是自定义类型,通过行为添加方面并设置属性
<type name="ab:myperson">
<title>Person</title>
<parent>cm:person</parent>
<properties>
<!-- The tokenisation set here is ignored - it is fixed for this type -->
<!-- This is so you can not break person lookup -->
<property name="ab:customField">
<type>d:text</type>
<mandatory>true</mandatory>
</property>..
关于创建自定义行为的伟大教程是
这就是如何扩展cm:person并使用它。您是否已经获得了它,以便在模型中定义额外的属性,并在repo/api中可读写?(在开始共享部分之前,这是要做的第一步!)仍然有问题。我更新了我的问题。我认为您的自定义内容模型必须具有唯一的名称。你能试着改变它,这样它就不会与任何内置的露天模型文件发生冲突吗?这篇文章中的第二位用户似乎没有这么做:此外,这难道不意味着会创建另一个人物类型的模型,而不仅仅是扩展已经存在的模型吗?你的类型会想要
cm:person
如果要覆盖内置的。这是我认为您需要使用唯一名称的总体模型名称(即非cm:contentModel
)