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:
I managed to get the iversionable, but don't know how to 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!
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 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.
So if all you have is a work item (and not a workspace, stream, or snapshot/baseline), you cannot compute a pathname.
Comments
showing 5 of 6
show 1 more comments