It's all about the answers!

Ask a question

When does the .getModifiedBy() value change for an IChangeSet?


Jazzuser user (68749) | asked Oct 24 '18, 8:23 a.m.
edited Oct 24 '18, 10:32 a.m. by David Lafreniere (4.8k7)
Hello All,

I have a scenario wherein i need to get all the Workspaces of a CS Owner.

So I use : Changeset.getAuthor().

However I found another API CS.getModifiedBy()...From the API Docs i came to know, that if there are changes in the CS then we get the Modifier else it remains null.

I wanted to know, in which all cases/scenarios we get this Modifier value.

Please assist on this.
Thank you.

One answer



permanent link
David Lafreniere (4.8k7) | answered Oct 24 '18, 10:31 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
edited Oct 24 '18, 10:35 a.m.
The .getAuthor() method exists on IChangeSet and the .getModifiedBy() method exists on IItem (Note: IChangeSet extends IItem so it picks this up.).

.getAuthor() has semantic meaning by SCM and is meant to represent the person who is responsible for the changes in the change set, .getModifiedBy() has semantic meaning more at the foundation/database layer, and is really meant to represent the person who is responsible for the 'new state of that item in the database'.

For your use case I would only use .getAuthor() and just forget about the method provided by IItem.

To be specific though:
-change sets first get created, in which case the .getAuthor() and .getModifiedBy() would be the same person:
(Note: Since IItem is 'generic' in a way, the Javadoc suggests that the .getModified() might be null for newly-created items [ex: it might be programmatically possible to create an item without assigning a modifier]. I don't think this is the case for change sets though.)

-check-ins (commits) create a new state of the change set. In this case the .getAuthor() and .getModifiedBy() would be the same person.

-completing/closing a change set creates a new state of the change set. In this case the .getAuthor() and .getModifiedBy() would be the same person.

-Note there is a rare case where the .getAuthor() of a change set can change. If a repository workspace has an active change set, and if an admin changes the owner of that workspace to himself, then he can now check-in and complete the change set, which would change the .getAuthor() to him.

-Modifying a change set comment also creates a new state of the change set. In this case however, it's possible for someone else to modify the change set comment after it has been closed. In which case the .getAuthor() does not change (it still represents the person who did the file changes in the change set), but the .getModifiedBy() method would return the person that just changed the comment.

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.