本文介绍了如何在露天使用Java以编程方式获取相关(对等关联)节点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我目前有一个节点,即Campaigns,它具有一个字段/关联,该字段/关联引用了名为authorised_by的用户表。

So I currently have one node, campaigns, which has a field/association that references the user table called authorised_by.

在代码中,我可以这样设置关联:

In code I can set the association like this:

nodeService.createAssociation(mcdNodeRef, newAuthority, CustomContentModel.ASSOC_MCD_CAMP_AUTHORITY);

现在我需要对该流程进行反向工程,并从户外获取关联的价值DB,但没有getAssociation方法,似乎无法解决。

Now I need to basically reverse engineer this process and get the value of the association back out of the alfresco DB but there is no getAssociation method and can't seem to work it out.

谢谢

推荐答案

自己解决,这里是解决方案:

Solved it myself, here is solution:

    final NodeRef oldCampaignAuthority = NodeUtils.getTargetAssociatedNodeRef(mcdNodeRef, CustomContentModel.ASSOC_MCD_CAMP_AUTHORITY, nodeService);
    String oldAuthorityID = oldCampaignAuthority.getId();
    String oldAuthorityUsername = new Node(new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, oldAuthorityID)).getProperties().get(ContentModel.PROP_USERNAME).toString();

这篇关于如何在露天使用Java以编程方式获取相关(对等关联)节点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 04:49