gpt4 book ai didi

java - 设置 RTC 工作项的 "Discussion"属性

转载 作者:行者123 更新时间:2023-11-30 04:23:03 25 4
gpt4 key购买 nike

我正在尝试实用地设置工作项中“讨论”的值。

我设法设置了“描述”属性,但是当我尝试设置讨论时,我遇到了空指针异常:

  IWorkItemClient workItemClient= (IWorkItemClient)repository.getClientLibrary(IWorkItemClient.class);
IWorkItemWorkingCopyManager manager= workItemClient.getWorkItemWorkingCopyManager();
manager.connect(workItem, IWorkItem.SMALL_PROFILE, SysoutProgressMonitor.getMonitor());
WorkItemWorkingCopy wc= manager.getWorkingCopy(workItem);

IProgressMonitor monitor = SysoutProgressMonitor.getMonitor();
IWorkItemClient service = (IWorkItemClient) repository.getClientLibrary(IWorkItemClient.class);

IAttribute discussionAttribute = service.findAttribute(projectArea, "discussion", monitor);//Here I got a null "discussionAttribute"?

wc.getWorkItem().setValue(discussionAttribute, "New Value for Discussion");

任何想法!

最佳答案

//Here I got a null "discussionAttribute"?
Attribute discussionAttribute = service.findAttribute(projectArea, "discussion", monitor);

我怀疑“discussion”不是有效的 WorkItem 属性 ID。

尝试使用问题“Where can I find a list of IWorkItem attributes”来查询工作项的所有属性,以获得“discussion”的正确属性名称(可能是“comments”) >“?)

Use IItemManager.fetchCompleteItem to fetch the item for any handle.
The items carry the actual info; the handles are essentially just like pointers / URLs.

For example:

IContributorHandle contributorHandle = ...

IContributor contributor = (IContributor) teamRepository.itemManager.fetchCompleteItem(contributorHandle, IItemManager.DEFAULT, null); // should really provide a progress monitor in last arg for progress / cancelaton

String name = contributor.getName();

That's for client-side. For server-side, use IRepositoryItemService to fetch the item.

<小时/>

在项目区配置的属性中,我看到了

“评论”:ID“com.ibm.team.workitem.attribute.comments”,但没有“讨论”。

关于Jazz.net ,您会找到指向 this discussion 的链接并提到一个名为“internalComments”的 ID。

然后尝试:

Attribute discussionAttribute = 
service.findAttribute(projectArea, "internalComments", monitor);
<小时/>

不要忘记保存修改后的工作项,如“Modify a WorkItem

IDetailedStatus s = wc.save(null);
if (!s.isOK()) {
throw new TeamRepositoryException("Error saving work item",
s.getException());
}

关于java - 设置 RTC 工作项的 "Discussion"属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16522510/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com