Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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?

1

0 votes



2 answers

Permanent link
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.

1 vote

Comments

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.

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
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....

0 votes

Comments

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 log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,935
× 1,202
× 19

Question asked: Mar 20 '13, 11:24 a.m.

Question was seen: 7,152 times

Last updated: May 29 '18, 5:32 a.m.

Confirmation Cancel Confirm