Need help with RTC Server side API to extract contributor of parent WI
Hello,
I am new to RTC and working on server side plugin wherein once parent WI is saved it triggers different child WI's. Child WI is initialized with most of the parent WI details like, Project Area, couple of custom Enumerator attributes.
There is a requirement wherein all the child WI contributor should be initialized with the contributor selected in parent WI. I see lots of examples for client side API to extract contributor which implements following code
if ((value instanceof IContributorHandle)) {
IContributor contributor = (IContributor) getTeamRepository()
.itemManager().fetchCompleteItem(
(IContributorHandle) value, IItemManager.DEFAULT,
getMonitor());
return contributor.getName();
}
I need something similar for server side to extract Contributor and also initialize child WI Contributor with the value selected in parent.
One answer
How to find the parent and work across parent child links can be found here:
https://rsjazz.wordpress.com/2012/11/27/resolve-parent-if-all-children-are-resolved-participant/
https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/
How to access the owner of a work item can be found here: https://rsjazz.wordpress.com/2014/05/26/only-owner-can-close-workitem-advisor/ .Any other IContributor attribute can be read using getValue(IAttribute). https://rsjazz.wordpress.com/2014/05/26/only-owner-can-close-workitem-advisor/ also shows how to get the currently logged in user.
If you haven IContributor (or an IContributorHandle) you can follow https://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ and use parentworkingcopy.setOwner(value) or parentworkingcopy.setValue(contributorIAttribute,value) to set the attribute.