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

How to find deleted parent item in operation participant?

Since i'm new to RTC, I have one question and any help would be appreciated.
I've created IOperationParticipant that is updating some data in workitem.
I've need to find out what workitem was parent to saved workitem before save.

The code I have is:

Object data = operation.getOperationData();
if (!(data instanceof ISaveParameter))
return;

//this returns reference to new parent if added
//saveParameter.getNewReferences().getReferences(WorkItemEndPoints.PARENT_WORK_ITEM)    
//this returns empty array
//saveParameter.getNewReferences().getCreatedReferences(WorkItemEndPoints.PARENT_WORK_ITEM)
//this returns empty array
//saveParameter.getNewReferences().getDeletedReferences(WorkItemEndPoints.PARENT_WORK_ITEM)

I've tried using something like:

IAuditable oldStateAuditable = saveParameter.getOldState();
if(oldState!=null)
{
IAuditableCommon common = (IAuditableCommon)getService(IAuditableCommon.class);
IWorkItem oldItem = (IWorkItem)common.resolveAuditable(oldStateAuditable, IWorkItem.FULL_PROFILE, monitor);
oldReferences = workItemServer.resolveWorkItemReferences(oldItem, monitor);
}
but without success(it is also returning empty strings).

Based on this link: https://jazz.net/jazz/web/projects/Rational%20Team%20Concert#action=com.ibm.team.workitem.viewWorkItem&id=72536

my  approach should work.

Please, 
what am I missing?

0 votes



2 answers

Permanent link
 Hi,
 you can use the following to know the deleted parent.

List<IReference> references = saveParameter.getNewReferences().getDeletedReferences(WorkItemEndPoints.PARENT_WORK_ITEM);
 and then use the 

for (IReference reference : references)
            if (reference.isItemReference() && ((IItemReference)reference).getReferencedItem() instanceof IWorkItemHandle)
                return (IWorkItemHandle)((IItemReference)reference).getReferencedItem();


2 votes

Comments

great info.. thanks


Permanent link
 Hello Ivor,
Ralph's article - http://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/
may contain what you're looking for.
Check the code for findParentHandle method

Hope it helps,
Eric

0 votes

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,940

Question asked: Jan 27 '14, 10:01 a.m.

Question was seen: 5,214 times

Last updated: Nov 15 '14, 6:09 p.m.

Confirmation Cancel Confirm