Want to Read all ChangeSet's associated with a Work Item
Gagandeep Singh (1●2●2)
| asked Sep 25 '13, 1:33 a.m.
retagged Dec 03 '13, 5:00 p.m. by David Lafreniere (4.8k●7)
Say in my Project Area's "SSFS On Premise" and "WMS" , i want to get all changeSets associated to a single Work Item say "344521".
Following is the code...kindly help IWorkspaceManager iworkspaceManager = (IWorkspaceManager) repository.getClientLibrary(IWorkspaceManager.class); IWorkspaceSearchCriteria criteria1 = IWorkspaceSearchCriteria.FACTORY.newInstance(); criteria1.setKind( IWorkspaceSearchCriteria.WORKSPACES ); criteria1.setExactName( "SSFS On Premise" ); // criteria1.setExactOwnerName("SSFS On Premise"); List<IWorkspaceHandle> workspaceHandles = iworkspaceManager.findWorkspaces(criteria1, Integer.MAX_VALUE, monitor); IWorkspaceHandle wh = workspaceHandles.get( 0 ); IWorkspaceConnection workspaceConnection = iworkspaceManager.getWorkspaceConnection(wh, monitor); // IChangeSetSearchCriteria changeSetSearchCriteria = IChangeSetSearchCriteria.FACTORY.newInstance(); IContextHandle workspaceContexthandle = workspaceConnection.getContextHandle(); changeSetSearchCriteria.setContext(workspaceContexthandle); SimpleDateFormat format= new SimpleDateFormat("yyyyMMdd-hhmm");; changeSetSearchCriteria.setModifiedAfter(new Timestamp(format.parse("20130901").getTime())); List<IChangeSetHandle> changeSetHandles; try{ changeSetHandles = SCMPlatform.getWorkspaceManager(repository).findChangeSets(changeSetSearchCriteria, 1024,monitor); }catch ( TeamRepositoryException e){ throw new RuntimeException(e); } Also now how to read from changeSetHandlers ? |
2 answers
Ralph Schoon (63.5k●3●36●46)
| answered Sep 25 '13, 3:15 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Please have a look at http://thescmlounge.blogspot.de/2013/08/getting-your-stuff-using-rtc-sdk-to-zip.html and https://jazz.net/forum/questions/31044/how-to-get-workitemhandle-from-changesethandle and https://jazz.net/forum/questions/93392/change-set-how-to-retrive-the-information-of-changeset-programatically and https://jazz.net/forum/questions/3392/fetching-change-set-for-work-item
You can,for example use the IItemManager IChangeSet contribution = (IChangeSet) repo.itemManager().fetchCompleteItem(tempCs, IItemManager.DEFAULT, null); |
HI,
Why you are traveling through the workspace and then get the change set. as question suggested you need to get change sets only from work item. then probably you can first search work item and then change sets associated with it. Search the work item by IWorkItem task = workItemClient.findWorkItemById( Integer.parseInt("12345"), IWorkItem.FULL_PROFILE, null); IItemReference linkTarget = IReferenceFactory.INSTANCE .createReferenceToItem(task); // Get alist of all change sets ILinkQueryPage changeSets = linkManager.findLinksByTarget( WorkItemLinkTypes.CHANGE_SET, linkTarget, new NullProgressMonitor()); ILinkCollection linkCollection = changeSets.getLinks(); for (ILink iLink : linkCollection) { IChangeSetHandle changeSetHandle = (IChangeSetHandle) iLink .getSourceRef().resolve(); IChangeSet changeset = (IChangeSet) itemManager .fetchCompleteItem(changeSetHandle, IItemManager.DEFAULT, null); |
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.