It's all about the answers!

Ask a question

How do you accept change sets into the local (filesystem) workspace using the Java API?


0
1
William Weddendorf (1111) | asked Mar 20 '13, 11:24 a.m.
edited Jun 03 '16, 5:36 p.m. by David Lafreniere (4.8k7)
I'm using RTC 3.0.1 and the Java APIs. I've traversed them to the point that I can identify all incoming change sets (the basic flow, for others who are interested, is to search for a named workspace using workspace manager; then get the use the IFlowTable to get the current accept flow; then compare these two IWorkspaceConnection objects to produce an IChangeHistorySyncReport).

I can even accept these incoming change sets using IWorkspaceConnection.accept. However, I need to be able to update the local filesystem with these change sets as well. So I need to be able to take these incoming change sets and update the workspace on my computer's local filesystem with them.

Does anyone know how I can do so?

2 answers



permanent link
Tim Mok (6.6k38) | answered Mar 22 '13, 3:11 p.m.
JAZZ DEVELOPER
Is there a reason you want to implement this with the plan Java API? You could make a call to the CLI to have it change flow target and accept a change set in order to update what you have loaded. There's quite a bit of code in the clients that process the changes to a workspace that would affect your sandbox. It decides which items need to be updated and gets the new content.

You could do it yourself and I think IVersionedContentManager would be a starting point. You can look at the IUpdateReport from the accept and determine which files you'll need to update. Get the IFileItem for each file and get the IVersionedContent so you can use the IVersionedContentManager to retrieve the file.

Comments
William Weddendorf commented Mar 22 '13, 4:33 p.m.

I'm hoping to write an Ant task to automate the extraction of change sets to a build machine. I guess I could invoke the CLI from an exec runtime call, though there may be further limitations in that route. And, I don't actually know anything about the CLI.


Gidi Gal commented May 27 '18, 4:41 a.m.
Hi Tim,
I am writing integration with Rational Team Concert based on the Java API.
I am also looking for a Java API to perform accept.
Were there updates to simplify this operation through Java API or does it still require lots of code to emulate the behavior in pending changes view when accept operation is triggered ?

Thanks,
Gidi

permanent link
Stefano Antoniazzi (1701711) | answered Jun 03 '16, 10:04 a.m.
edited Jun 03 '16, 10:13 a.m.
I found this old post trying to understand what you must do after accepting change sets or baseline when you're working on a specific sandbox via java api and you want to refresh sandbox associated filesystem
I used 
com.ibm.team.filesystem.client.internal.operations.UpdateOperation.UpdateOperation(IWorkspaceConnection, List<IUpdateReport>, int, UpdateDilemmaHandler, IDownloadListener)
in this way
IFileSystemOperation fileSystemOperation = new UpdateOperation(
				workspaceConnection, 
				updateReports, 
				UpdateOperation.PROCESS_ALL_UPDATES, 
				WorkspaceUpdateDilemmaHandler.getDefault(), 
				downloadListener);
...
fileSystemOperation.run(progressMonitor);
but I don't get if this is similar of what has been suggested by Tim Mok. By the way it works for me....

Comments
Gidi Gal commented May 29 '18, 5:32 a.m. | edited May 29 '18, 5:32 a.m.

I think that the difference between the solution proposed by Tim and your solution is that Tim is referring to public API in RTC SDK while your solution is based on internal API (see the package path of UpdateOperation). While you can use this API, the dev team might not support this API in the future. According to Tim (if I understand correctly), there's a need to write allot of "public API" code in order to be aligned with the code triggered by the RTC client which deals with accept operation.

Your answer


Register or to post 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.