It's all about the answers!

Ask a question

Identify file paths of changes within IOperationParticipant


Dan Pollitt (322) | asked Mar 11 '14, 8:52 a.m.
Hi,

I am writing an IOperationParticipant for the com.ibm.team.scm.service.changehistory.modification Operation (Deliver (phase 2)). As part of the functionality I need to be able to determine the affected resources path during the following changes:
  1. File modification
  2. File addition
  3. File deletion
  4. File reparenting
1. and 3 (file modifications and deletions), are working fine using IScmService#configurationLocateAncestors for the IVersionableHandle retrieved from IChange#afterState() for a given change.

I am having trouble identifying how I can get the following information however (running in the Server as an IOperationParticipant):

2. File addition - how to find out what the path will be
4. File reparenting - how to find out what the path was (both the afterState and beforeState seem to yield the new path)

Any help much appreciated,

Dan

Accepted answer


permanent link
Tim Mok (6.6k38) | answered Mar 11 '14, 1:55 p.m.
JAZZ DEVELOPER
Ensure you are looking up the path in the context that you care about.
- Try using the source (ie. repository workspace) to look up the path in the case of the file addition.
- Try using the target (ie. stream) to look up the path in the case of reparenting.

You'll want to check your service configuration provider that you give to the the #configurationLocateAncestors call. Ensure you're using the provider for the correct context (source or target).
Dan Pollitt selected this answer as the correct answer

Comments
Tim Mok commented Mar 11 '14, 3:35 p.m.
JAZZ DEVELOPER
Thanks for that, so far I have just been using the target stream. How would I access the other contexts you mention?

You asked about getting the other contexts. I assume you're using the deliver operation data.

AdvisableOperation#getOperationData returns an object. For a deliver operation, it is DeliverOperationData that can give you the source and target. If you're not already using this, this is the way to get the source and target for the deliver operation as well as other data such as the change sets.


1
Dan Pollitt commented Mar 11 '14, 8:34 p.m.

Hi Tim,

Many thanks for this, and the pointer on obtaining the contexts - I am now able to access the path infomation I was looking for.

I did however notice that the object returned from AdvisableOperation#getOperationData was not an instancof DeliverOperationData but SCMDeltaSource so I used the source and target from the IChangeHistoryAddOperandDelta objects returned from IScmDeltaSource#getDeltas(IChangeHistoryAddOperandDelta.class) instead (version 4.0.0).

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.