如果我没记错的话cm:creator、cm:modifier、cm:created、cm:modified等都是 Alfresco 中的可审核属性,这意味着无法手动更新,因为它们是由 Alfresco 管理的。
我开发了一个java支持的网页脚本,并且添加了正常工作的代码(以更新创建者和修改器属性):
// Disable auditable aspect to allow change properties of cm:auditable aspect
policyBehaviourFilter.disableBehaviour(nodeRef, ContentModel.ASPECT_AUDITABLE);
// Update properties of cm:auditable aspect
nodeService.setProperty(nodeRef, ContentModel.PROP_CREATOR, "xxxxxx");
nodeService.setProperty(nodeRef, ContentModel.PROP_MODIFIER, "xxxxxx");
// Enable auditable aspect
policyBehaviourFilter.enableBehaviour(nodeRef, ContentModel.ASPECT_AUDITABLE);
Run Code Online (Sandbox Code Playgroud)
不要忘记在您声明 bean 的 context.xml 文件中添加:
<bean id="xxxxxxxx"
class="your class package"
parent="webscript">
<property name="nodeService" ref="NodeService" />
........
<property name="policyBehaviourFilter" ref="policyBehaviourFilter" />
</bean>
Run Code Online (Sandbox Code Playgroud)
祝你好运
| 归档时间: |
|
| 查看次数: |
4869 次 |
| 最近记录: |