How to: find state of the wi referenced by URI reference

Accepted answer
2 other answers

Comments

Hi Ralph,
I just wonder if there is some standard way in RTC SDK? I'm confused because this defect is in the same RTC project area and it's just RTC work item of different type.
I could find its UUID and stateid using
ILink link= wir.get(j).getLink();
UUID stateID = link.getStateId();
UUID itemID = link.getWorkingCopy().getItemId();
Is it any way to find the defect state having stateid and itemid?
-Thanks in advance

the stateID is a historical or current state of the work item and not the work item workflow state.
I looked deeper in the SDK and found something that works for me in a test environment. See http://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/ the last operation. It is marked with *Update*.
Comments

Sorry, Ralph. I failed to find Update. Are you talking about
public static void changeUserID(ITeamRepository teamRepository,
String originalID, String newID, Boolean doUpdate) method?
-thanks in advance

Sorry, wrong URL, not sure how that happened. Use http://rsjazz.wordpress.com/2012/09/19/the-rtc-workitem-link-api-linking-workitems-to-other-elements/ search for Update.

Thanks Ralph!
Should it work for server side extension?
-thanks in advance

That is client code. But when the client can do it, the server should too. Have you tried to use for references where the location is used as parameter in calls? Try to find the Service that is analog to the Client Library.

It looks it doesn't work for me cause
iReference.getLink().getOrigin()
returns null

Timur,
getOrigin() is used to get the teamRepository to get the client libraries in the client.
In a server extension you use getService() from AbstractService (that you extend) to get a service instead.