It's all about the answers!

Ask a question

Which handle do i disconnect??


Green Elk (136) | asked Feb 01 '17, 11:04 a.m.

 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 = ....
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);
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

regards
john

One answer



permanent link
Ralph Schoon (61.1k33643) | answered Feb 01 '17, 11:48 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

 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.

Your answer


Register or to post your answer.