您好,我一直在尝试使用 projectArea 获取流名称。我有以下参数: Repository IFileItem WorkItem and its ChangeSets
有没有可能得到它。
提前致谢。
请不要给我一个顾问示例的链接,因为我已经阅读了它,但我无法做到。
在这篇文章中,提到了以下内容: https ://jazz.net/forum/questions/49910/how-to-get-an-iconfiguration-from-ichangeset
有一个提示通常很有用(但不一定总是正确),隐藏在 ILink 中,它用作 IChangeSetHandle(源)和 IWorkItemHandle(目标)之间的绑定。源端的 IItemReference 有一个 String extraInfo 字段,可以通过 IItemReference#getExtraInfo() 检索该字段。此字符串的格式为 IWorkspace=,它指示原始工作空间。您可以使用 IWorkspace.ITEM_TYPE.createItemHandle(suppliedUUID, null) 创建 IWorkspace 的句柄。
public void testWorkspaceConnection(ITeamRepository repository, IWorkItem workItem) throws TeamRepositoryException, IOException{
List<ILink> changeSetLinks = (List<ILink>)linkCollection.getLinksById("com.ibm.team.filesystem.workitems.change_set");
List<IReference> changeSetReferences = new ArrayList<IReference>();
for (ILink link : changeSetLinks) {
changeSetReferences.add(link.getSourceRef());
}
List<IItemHandle> itemHandles = new ArrayList<IItemHandle>();
for (IReference reference : changeSetReferences) {
itemHandles.add((IItemHandle)reference.resolve());
}
if(itemHandles.isEmpty()){
return;
}
IItemHandle itemHandle = itemHandles.get(itemHandles.size() - 1);
IChangeSet changeSet = (IChangeSet)repository.itemManager().fetchCompleteItem(itemHandle, 0, monitor);
List changes = changeSet.changes();
IFileItem fileItem = getLogidiagFile(changeSet, repository);
// TILL HERE THAT WAS AN EXISTING CODE THAT WAS ALREADY THERE AND IT FETCHES THE REQUIRED FILE.
//NEXT IS WHAT |'VE ADDED TO BE ABLE TO DETERMINE THE FULL PATH
String uuid=changeSetReferences.get(changeSetReferences.size()-1).getExtraInfo(); //Here I need to get workspace uuid to be abble to create a connection over as the post said
IWorkspaceHandle workspaceHandle = (IWorkspaceHandle)IWorkspace.ITEM_TYPE.createItemHandle(UUID.valueOf(uuid), null);
IWorkspaceManager workspaceManager = SCMPlatform.getWorkspaceManager(repository);
IWorkspaceConnection workspaceConnection = workspaceManager.getWorkspaceConnection(workspaceHandle,monitor);
我得到的异常如下:
线程“主”java.lang.IllegalArgumentException 中的异常:com.ibm.team.repository.common.UUID.valueOf(UUID.java:76) 处的 UUID [Workspace=_iibA0GlNEeKd76sMjPDLRA] 无效
那么我是走在正确的路线上还是有更好的路线可以指导我!