如何在网页脚本中设置/更改露天文档的创建者

Dra*_*ško 2 alfresco

如何在上传文档的 Alfresco 中更改网页脚本中的“创建者”属性?

顺便说一句,我正在使用 Alfresco 4.2。

最好,D

Yon*_*tos 5

如果我没记错的话cm:creatorcm:modifiercm:createdcm: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)

祝你好运