Which handle do i disconnect??
Here is some simple client which i'm uusing to create Workitems
IWorkItemClient wiClient = .... IWorkItemType workItemType = wiClient.findWorkItemType(oProject, "com.abd.type1", null); IWorkItemWorkingCopyManager wiwcmgr = ....It's not clear to me what I have to free up (disconnect) at the end. I was expecting that i would disconnect workItemHandle, as that is what i was given when i did the connect, however an examples i've seen disconnects using wiWorkingCopy. Can someone explain the subtleties please ? The code may need to create hundreds of items so i'm trying to avoid handle leakage in the client and the server
IWorkItemHandle workItemHandle = wiwcmgr.connectNew(workItemType, null);
WorkItemWorkingCopy workingCopy = wiwcmgr.getWorkingCopy(workItemHandle);
IWorkItem wiWorkingCopy = workingCopy.getWorkItem(); wiWorkingCopy.setHTMLSummary(XMLString.createFromPlainText("title1")); workingCopy.save(null);
wiwcmgr.disconnect(wiWorkingCopy);
regards
john
One answer
I would suggest to not use that API and to follow https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ and use an workItemOperation as described in section Alternative to Create and Modify WorkItems
Other than that workItemHandle and workingCopy and wiWorkingCopy represent pretty much the same object just with different interfaces.