It's all about the answers!

Ask a question

Multiple operation on a file in a changeset


Vinod Kumar (9612010) | asked Jun 08 '10, 9:25 a.m.
JAZZ DEVELOPER
I'm trying to rename and modify a file in RTC in a single change set using API.
I'm using the code like this.

fileItem.setName("new_name");

fileItem.setContent(content);

List<IConfigurationOp> itemsToCommit = new ArrayList<IConfigurationOp>();

itemsToCommit.add(IWorkspaceConnection.configurationOpFactory().save(fileItem));

itemsToCommit.add(IWorkspaceConnection.configurationOpFactory().save(fileItem1));
itemsToCommit.add(IWorkspaceConnection.configurationOpFactory().save(fileItem2));
itemsToCommit.add(IWorkspaceConnection.configurationOpFactory().save(fileItem3));
...
IWorkspaceConnection.commit(changeSet, itemsToCommit, monitor);


But then I realize that if there are more than one operations involved as in case of fileItem (setName and setContent) then latest operation is committed. In this case file 'fileItem' is modified but it is not renamed to the new name. If I try to add it to itemsToCommit twice (i.e after each operation) then I get an exception. How can I handle this?

Be the first one to answer this question!


Register or to post your answer.