It's all about the answers!

Ask a question

How do I set the Change Set Owner using the Plain Java API?

Sudheer Rugbeer (11521832) | asked Oct 09 '17, 1:17 p.m.


I have written a Java app to import source code with version history using the Plain Java API.
I can set the file version date using the IFileItem.setFileTimestamp(date) but the Change Set owner and file modified by is being set to the logged in user.
Is it possible to set the Change Set's owner using the Plain Java API?

I found the internal method value)  but how do I convert my IChangeSet into a ChangeSet object?
I also assume that the file version's Modified By is just a reference to the Change Set's owner?

Thank you,

2 answers

permanent link
Shashikant Padur (4.2k27) | answered Oct 09 '17, 11:40 p.m.

You should not use internal methods and from the API or RTC clients you cannot change the change set owner. The change set owner is the one who has logged in to RTC and committed the changes or created the change set.

Sudheer Rugbeer commented Oct 10 '17, 3:21 a.m.

 Hi Shashikant,

Thank you for the response. I do understand why the change set owner should be the logged in user in a normal daily flow of work.

However, does this then mean that we cannot develop our own custom code version history import tool, because we will be unable to set previous version owners?

As a workaround, I will just add the owner as part of the check-in comment, but I am unsure if my client would accept this solution.

Thank you,

Sudheer Rugbeer commented Oct 10 '17, 8:34 a.m.

After discussions with my client, they are happy to go with the 'Check-in comment to include the owner' solution. We will also be associating the change sets with work items, so we could set the WI owner as the file version owner.

So, happy to accept this answer.

Thank you,

permanent link
Sudheer Rugbeer (11521832) | answered Oct 12 '17, 8:39 a.m.

After a bit more investigation with the Plain Java API, I came across this method:

            IComponentHandle componentHandle, String changeSetComment,
            Collection configOps, long creationTime,
            IContributorHandle contributor, IProgressMonitor monitor)
This is exactly what I was looking for, and works perfectly for importing my source code history into RTC.

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.