IWorkSpaceHandle on a server side plugin
Hi guys
I was wondering, which is the way to retrieve an instance of this object in an OperationParticipant context of a work item save. |
Accepted answer
You need to get the direct IReference and query its extra information. That is a way to do it. However, keep in mind that this extra information may or may not be present in the link. This extra information also does not guarantee that this particular change set is in this workspace. Also of course note that a change set can be in multiple workspaces. There is no way of knowing that this workspace is the one "you want".
IReference workItemReference = linkServiceLibrary.referenceFactory().createReferenceToItem(workItemHandle); ILinkQueryPage page = linkService.findLinksByTarget(ILinkConstants.CHANGESET_WORKITEM_LINKTYPE_ID, workItemReference); for (ILink link : page.getLinks()) { Marco Gianfico selected this answer as the correct answer
Comments Thanks Remy for your answer.
Remy Suen
commented Sep 12 '14, 8:46 a.m.
Yes, it is an ILinkServiceLibrary.
Marco Gianfico
commented Sep 12 '14, 8:57 a.m.
Thanks Remy, it seems to work well, I got
|
One other answer
Ralph Schoon (63.1k●3●36●46)
| answered Sep 12 '14, 5:18 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
To resolve an item see https://rsjazz.wordpress.com/2013/03/20/understanding-and-using-the-rtc-java-client-api/ and other examples on the blog that use hadles and resolve the item (almost all examples have to).
(ITeamArea) teamRepository.itemManager() .fetchCompleteItem(handle, IItemManager.REFRESH, monitor); Comments for who is interested in I got the workItemCommon as service of the abstractService
Please read the blog(s) they explain these things.I did them to not have to answer everything over and over.
Use the Item profiles you think need. The profiles select more or less data.
Marco Gianfico
commented Sep 12 '14, 7:55 a.m.
Thanks Ralph. If you have suggestions also on how to reach the workspace handle would be great.
|
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.
Comments
I don't understand your question. What does an IWorkspaceHandle have anything to do with a work item? Please provide some sample code.
Pheraps my question was not crystal clear.
I'm doing a Server Side Operation Participant on a work item save.
So in the beginning I just have a SaveParameter that refers to the work item and the service that I can reach with AbstracScmService.getService().
The work item is linked with a change set so I can have the changeset component.
From this point going on, how I can have the workspacehandle of where this changeset is lying.
Thanks any suggestions.
Please attach the code that you have so far.
Also note that change sets do not have to reside in a workspace. They may have been suspended or discarded in which case they are not part of any workspace.
In this case i'm sure that the changeset reside in a workspace.
The code is really long so I just attach the way to retrieve the changeset
If needed I also have the ProjectAreaHandle retrieved from the workItem connected to that changeset, but i don't know ho to resolve the ProjectAreaHandle to a ProjectArea
IWorkItem workItem = (IWorkItem) saveParameter.getNewState();
IProjectAreaHandle projectAreaHandle = workItem.getProjectArea();