It's all about the answers!

Ask a question

How to find deleted parent item in operation participant?


Ivor Mirošević (122) | asked Jan 27 '14, 10:01 a.m.
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?

2 answers



permanent link
Surender Biyyala (402048) | answered Nov 15 '14, 3:38 p.m.
 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();



Comments
sam detweiler commented Nov 15 '14, 6:09 p.m.

great info.. thanks


permanent link
Eric Jodet (6.3k5109120) | answered Jan 29 '14, 10:04 a.m.
JAZZ DEVELOPER
 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

Your answer


Register or to post your answer.