1
我有一個Alfresco工作流表單,其中有一個關聯字段,可以選擇多個用戶。字段UI定義是隱式的(模型定義了關聯)。Alfresco:如何爲cm:person關聯設置默認表單值
我想用當前登錄的用戶初始化該字段。
我試過使用表單過濾器,並使用FieldUtils.makeAssociationField()
使用NodeRef作爲值,然後form.addField()
,但這導致UnsupportedOperationException
。
雖然我使用相同的技術來無障礙地初始化屬性字段。
任何人都可以指出我的解決方法嗎?
private void initInitatorNodeRef(final Form form)
{
final String userName = AuthenticationUtil.getFullyAuthenticatedUser();
if (userName != null)
{
final NodeRef person = personService.getPerson(userName);
if (person != null)
{
final AssociationDefinition definition =
serviceRegistry.getDictionaryService().getAssociation(MywfModel.ASSOC_AUTHORS);
final Field field =
FieldUtils.makeAssociationField(
definition, person, null, serviceRegistry.getNamespaceService(),
serviceRegistry.getDictionaryService());
form.addField(field);
}
else
{
throw new RuntimeException("Person not found.");
}
}
else
{
throw new RuntimeException("UserName not found.");
}
}
你可以爲你的異常附上完整的跟蹤以及你的露天版! –
沒有堆棧跟蹤。 FormUIGet webscript似乎捕獲並掩蓋了異常。我目前正在測試Enterprise 5.0.2 –
原因可能是您已經在模型中定義了該關聯,並且您正在添加一個具有相同名稱的新關聯? –