RTC Plain JAVA API To open an existing defect and update a field
Hi
I am trying to update an existing defect. What I want to do is search for a defect open it and update a field like summary. To search a defect I have the following code what I cant do is update the defect. public static IWorkItem getWorkItem() throws TeamRepositoryException, FileNotFoundException, ParseException { // Set the connection String repositoryURI = getHost(env); // Start the platform. TeamPlatform.startup(); ITeamRepository teamRepository = TeamPlatform.getTeamRepositoryService().getTeamRepository(repositoryURI); teamRepository.registerLoginHandler(new LoginHandler(userName, userPass)); teamRepository.login(null); IWorkItemClient workItemClient = (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class); IProgressMonitor progressMonitor = new NullProgressMonitor(); ItemProfile<IWorkItem> arg1 = IWorkItem.FULL_PROFILE; IWorkItem foundId = workItemClient.findWorkItemById(119049, arg1, progressMonitor); System.out.println("found me"+foundId.getId()); System.out.println("found me"+foundId.getHTMLSummary().getPlainText()); System.out.println("found me"+foundId.getHTMLDescription().getPlainText()); teamRepository.logout(); TeamPlatform.shutdown(); return foundId; } Any suggestion are welcome Thanks MrCoolK |
Accepted answer
RTC has two views of a workitem.. the readonly copy (given out be default) and the read/write version, called the workingcopy.
so, once you find the handle, you get the workitem (read only), IWorkItem foundId above then get the read/write version (getworkingcopy) IWorkItem foundid_rw = foundid.getworkingcopy(); you update the fields in the workingcopy, then Save the working copy. kishan adhi selected this answer as the correct answer
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.