How to get the content of a change set, which is linked to a work item, exactly how it is visible in the RTC web client using Jazz SDK ver. 5.0.2.05
Environment: RTC 5.0.2 ifix05
How can I get the content of a change set (including the full file paths), which is linked to a work item, exactly how it is visible in the RTC web client using Jazz SDK?
I have searched for an answer in internet and found a lot of results.
Though, I was not able to get a satisfactory solution of this question.
In particular, I want to get the full path of a file (but not only its name), since a file with the same name may be present and changed in several folders.
I found that a change set doesn't contain the full file paths (https://jazz.net/forum/questions/135072/unknown-showing-up-on-workspace-in-rtc), because a given change set can be used by multiple configurations.
However the full file path is present in the RTC 5.0.2 web client by opening the linked change set through a given work item. Therefore I assume it has to be possible to get the same information using the Jazz SDK for RTC 5.0.2.05.
Can I get a reference to the related configuration to show same information present in RTC (including the full paths)?
I need that to update an RTC peer review plugin used by the development departments in the company I am working for.
Thank you for your support!
Best Regards.
Accepted answer
As I recall, when a change set is linked to a work item, if there is a "current" workspace at the time of linking, a reference to that workspace is added as a property on that link. Then if a pathname for a member of that change set is requested, some of the clients will check to see if there is a link from that change set to a work item, and if so, they will check to see if that link has that workspace property, and if it does, use that workspace to determine a pathname for that file.
Comments
2 other answers
Hello, Ralf.
It looks like the RTC desktop client picks the repository workspace which has been currently loaded, and displays the path of the files in that workspace (if the files exist in that workspace).
If no workspace is loaded then Eclipse asks us to specify a context (of a stream or repository workspace) as it is shown in the third screenshot in the above post of mine.
In the case of the RTC Web client, the context (in which the change set is created) is enclosed in the URI of the changeset as shown in the second screenshot.
If we assume that the above assumptions are correct, then using the Jazz SDK:
- Is there a way to get the currently loaded workpsace by the current user in the Eclipse client?
- Is there a way to get changeset URI and look for a workspace/stream name if there is such?
- In case that I have specified a context in the change explorer view of the Eclipse client as shown in the screenshots, then is there a way to get it from there?
- How can I traverse the changes in changeset linked to a given workitem, and generate a folder structure with the modified/deleted/added files and folders?
Are there any web tutorials?
Thanks a lot for your time and assistance!
Best Regards!
Comments
My Analysis showing why Team Advisor pops up with a PermissionDeniedException regardless I catch the exception:
1) my code tries to get a workspace connection (context) in order to get the full path of all changed files in a changeset: wsManager.getWorkspaceConnection(...)
2) com.ibm.team.scm.client.internal.WorkspaceManager.getWorkspaceConnection(...) calls getServerConfigurationService().refreshWorkspaces(...)
3) getServerConfigurationService().refreshWorkspaces(...) calls com.ibm.team.scm.client.internal.ScmServiceInterfaceProxy.invoke(...)
4) ScmServiceInterfaceProxy.invoke(...) calls ScmServiceInterfaceProxy.invokeCancelableService(...);
4.1. ScmServiceInterfaceProxy.invokeCancelableService(...) throws a PermissionDeniedException
4.2. ScmServiceInterfaceProxy.invoke(...) catches the exception
4.2.1. shows Team Advisor view using the notifyProcess(...) (see Step 4 in the code below)
4.2.2. and finally passes the exception to the caller IWorkspaceConnection getWorkspaceConnection(...) (see Step 5 in the code below)
5) IWorkspaceConnection getWorkspaceConnection(...) passes the exception to my code which is processed as well. (see Step 7 in the code below)
My plug-in code:
....
try {
if(wsHandle != null) {
// Step 1: IWorkspaceConnection getWorkspaceConnection(...) is executed
IWorkspaceConnection wsConn =
wsManager.getWorkspaceConnection(
(IWorkspaceHandle) wsHandle,
child.newChild(25));
...
}//if
...
}//try
catch(Throwable e) {
// Step 7: The exception PermissionDeniedException is processed here as well
System.out.println("Throwable: " + e.getMessage());
return result;
}
================================================
class: com.ibm.team.scm.client.internal.WorkspaceManager
public IWorkspaceConnection getWorkspaceConnection(
IWorkspaceHandle workspace,
IProgressMonitor monitor) throws TeamRepositoryException {
// Step 6: The exception is passed to the caller - my plug-in code
...
if (conn == null) {
// Step 2: getServerConfigurationService().refreshWorkspaces(...) is executed.
// It calls ScmServiceInterfaceProxy. invoke(...)
WorkspaceRefreshResult refreshed = getServerConfigurationService().refreshWorkspaces(
new WorkspaceRefreshParameter[]{createEmptyWorkspaceRefreshParameter(workspace)},
SCMClientUtil.monitorFor(monitor))[0];
...
}
========================================================
//Proxy helper which wraps all RPC service interface objects to common progress monitoring and
cancellation support
class: com.ibm.team.scm.client.internal.ScmServiceInterfaceProxy
public Object invoke(Object proxy, final Method method, final Object[] args)
throws Throwable {
try {
...
// Step 3: ScmServiceInterfaceProxy.invokeCancelableService(...) is executed.
// it throws PermissionDeniedException which is processed in ScmServiceInterfaceProxy. invoke(...)
returnVal = invokeCancelableService(method, args, monitor);
...
} catch (Throwable e) {
TeamRepositoryException tre = null;
...
tre = (TeamRepositoryException)e;
...
if (tre != null) {
// Step 4: The exception is caught and Team Advisor is shown here
// with the error message: Team Advisor Problem: Permission denied during
// "Source Control Operation". User '...' does not have permission to read workspace '...'
// The exception is still thrown so that clients can
// clean-up and react accordingly.
if(!calledByTeamAdvisorView &&
(tre instanceof TeamOperationCanceledException
|| tre instanceof PermissionDeniedException)) {
notifyProcess(tre, method); // shows TeamAdvisor view informing PermissionDeniedException error
}
// Step 5: The exception is passed to the caller
throw tre;
}//end of if (tre != null)
} //end of invoke method
1) my code tries to get a workspace connection (context) in order to get the full path of all changed files in a changeset: wsManager.getWorkspaceConnection(...)
2) com.ibm.team.scm.client.internal.WorkspaceManager.getWorkspaceConnection(...) calls getServerConfigurationService().refreshWorkspaces(...)
3) getServerConfigurationService().refreshWorkspaces(...) calls com.ibm.team.scm.client.internal.ScmServiceInterfaceProxy.invoke(...)
4) ScmServiceInterfaceProxy.invoke(...) calls ScmServiceInterfaceProxy.invokeCancelableService(...);
4.1. ScmServiceInterfaceProxy.invokeCancelableService(...) throws a PermissionDeniedException
4.2. ScmServiceInterfaceProxy.invoke(...) catches the exception
4.2.1. shows Team Advisor view using the notifyProcess(...) (see Step 4 in the code below)
4.2.2. and finally passes the exception to the caller IWorkspaceConnection getWorkspaceConnection(...) (see Step 5 in the code below)
5) IWorkspaceConnection getWorkspaceConnection(...) passes the exception to my code which is processed as well. (see Step 7 in the code below)
My plug-in code:
....
try {
if(wsHandle != null) {
// Step 1: IWorkspaceConnection getWorkspaceConnection(...) is executed
IWorkspaceConnection wsConn =
wsManager.getWorkspaceConnection(
(IWorkspaceHandle) wsHandle,
child.newChild(25));
...
}//if
...
}//try
catch(Throwable e) {
// Step 7: The exception PermissionDeniedException is processed here as well
System.out.println("Throwable: " + e.getMessage());
return result;
}
================================================
class: com.ibm.team.scm.client.internal.WorkspaceManager
public IWorkspaceConnection getWorkspaceConnection(
IWorkspaceHandle workspace,
IProgressMonitor monitor) throws TeamRepositoryException {
// Step 6: The exception is passed to the caller - my plug-in code
...
if (conn == null) {
// Step 2: getServerConfigurationService().refreshWorkspaces(...) is executed.
// It calls ScmServiceInterfaceProxy. invoke(...)
WorkspaceRefreshResult refreshed = getServerConfigurationService().refreshWorkspaces(
new WorkspaceRefreshParameter[]{createEmptyWorkspaceRefreshParameter(workspace)},
SCMClientUtil.monitorFor(monitor))[0];
...
}
========================================================
//Proxy helper which wraps all RPC service interface objects to common progress monitoring and
cancellation support
class: com.ibm.team.scm.client.internal.ScmServiceInterfaceProxy
public Object invoke(Object proxy, final Method method, final Object[] args)
throws Throwable {
try {
...
// Step 3: ScmServiceInterfaceProxy.invokeCancelableService(...) is executed.
// it throws PermissionDeniedException which is processed in ScmServiceInterfaceProxy. invoke(...)
returnVal = invokeCancelableService(method, args, monitor);
...
} catch (Throwable e) {
TeamRepositoryException tre = null;
...
tre = (TeamRepositoryException)e;
...
if (tre != null) {
// Step 4: The exception is caught and Team Advisor is shown here
// with the error message: Team Advisor Problem: Permission denied during
// "Source Control Operation". User '...' does not have permission to read workspace '...'
// The exception is still thrown so that clients can
// clean-up and react accordingly.
if(!calledByTeamAdvisorView &&
(tre instanceof TeamOperationCanceledException
|| tre instanceof PermissionDeniedException)) {
notifyProcess(tre, method); // shows TeamAdvisor view informing PermissionDeniedException error
}
// Step 5: The exception is passed to the caller
throw tre;
}//end of if (tre != null)
} //end of invoke method
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER May 10 '16, 5:20 a.m.Krasimir Malchev
May 10 '16, 5:42 a.m.Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER May 10 '16, 5:51 a.m.Krasimir Malchev
May 10 '16, 9:33 a.m.