RTC - IOperationParticipant - operation.workItemSave - Resolve IVersionable path
Hello,
I'm trying to read the full path from the files associated via changeset to a workitem. In this case it will trigger as a participant on an operation.workItemSave operation. After getting the path it will do some modifications on the work item attributes. Right now I can get the list changesets and its changes. But I don't know how to resolve the path. The code I have: run(){ IWorkItem workitem = (IWorkItem) ((ISaveParameter) data).getNewState();<-OK List<IChange> changes = getIChangeSets(workitem);<-OK List<IVersionable> versionables = getIVersionables();<-OK resolvePath();<-? }; I managed to get the iversionable, but don't know how to resolve IFolderHandle private String resolvePath(IVersionable versionable){ IFolderHandle folderHandle = versionable.getParent(); //How do i resolve ifolderHandle? } After getting the IFolder i would climb the tree and build the path. From the examples I found in the forum. There is a "IScmService.configurationResolvePath" method to resolve the path, but it needs a ServiceConfigurationProvider which in turn is provided by a IWorkspace. If this was a DeliverOperationData I could get the configuration, but this "data" is a IWorkItem. Is it possible to get the full path of a file associated to a workitem? Any help is welcome. Thanks! |
2 answers
The IVersionableItemHandle could be either a IFolderHandle or a IFileItemHandle so you can just cast it after an "if instanceof" check.
|
Geoffrey Clemm (30.1k●3●30●35)
| answered Jan 21 '16, 12:42 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
The only way to compute a pathname from an IVersionableHandle is to provide a Workspace (or Stream or Snapshot/Baseline) context, because the pathname for a file depends on what folder versions are selected for the parent folders (a file version only knows the UUID of its immediate parent folder, and it's name relative to that parent folder ... the additional folders and relative names for the rest of the pathname can only be determined if you know what version to use of those parent folders.
So if all you have is a work item (and not a workspace, stream, or snapshot/baseline), you cannot compute a pathname. Comments
Rogério Moreira
commented Jan 21 '16, 1:19 p.m.
Hello Geoffrey and thank you for providing feedback.
Geoffrey Clemm
commented Jan 21 '16, 2:20 p.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
I know there must be a way to find a stream by name on the server, but we'll need one of the API experts to provide a pointer. Note that stream names are not guaranteed to be unique, so it might return multiple streams.
sam detweiler
commented Jan 21 '16, 4:47 p.m.
but remember, streams are not located anywhere in the file system, so the path i useless there too.
@gmclemm
Michele Pegoraro
commented Jan 22 '16, 7:01 a.m.
Streams (and workspace) could be searched using IScmQueryService.findWorkspaces method. You need a IWorkspaceSearchCriteria that you can get using its factory. In this object you can set which type of workspace (stream or not) you are searching and the name of the searched object.
Rogério Moreira
commented Jan 25 '16, 6:12 a.m.
@mikyjpeg
showing 5 of 6
show 1 more comments
|
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.