[英]Custom Alfresco Model with UUID default value
I want to add a new property to the alfresco model which will have the node-uuid as default value.我想向露天 model 添加一个新属性,它将 node-uuid 作为默认值。
<type name="nemo:Pdossier">
<title>Dossier Nemo</title>
<parent>cm:folder</parent>
<properties>
<property name="nemo:etatDossier">
<type>d:text</type>
</property>
<!-- Nouveau UUID qui sera utilisé lors de la migration d'alfresco -->
<property name="client:uuidClientFolder">
<type>d:text</type>
<default>????</default>
</property>
</properties>
</type>
how can I access the value of node-uuid
?如何访问
node-uuid
的值?
As Gagravarr mentioned, use a behavior.正如 Gagravarr 提到的,使用一种行为。 The code in the behavior would look something like:
行为中的代码如下所示:
@Override
public void onUpdateNode(NodeRef nodeRef) {
String uuid = (String) nodeService.getProperty(nodeRef, PROP_UNIQUE_ID);
final QName PROP_UUID_CLIENT_FOLDER = QName.createQName("http://www.your.namespace.uri/model/1.0","uuidClientFolder");
nodeService.setProperty(nodeRef, PROP_UUID_CLIENT_FOLDER, uuid);
}
If you've never implemented a behavior before, take a look at my tutorial for an example.如果您以前从未实现过行为,请查看我的教程以获取示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.