Update a Work Item Attribute using its Operation Participant
Hi,
I am trying to update a custom attribute of string type from a save triggered operation participant using java. My code is as follows saveParameter = (ISaveParameter) data; IWorkItem newState = (IWorkItem) saveParameter.getNewState(); newState.setValue(attributeID, StringValue); It doesn't give an exception or anything. It just doesn't work. Where am i going wrong here. I am new at this and lost. Please Help. |
6 answers
The code below should edit a work item for you, you will need to change the id of the work item you are getting, change the identifier of the attribute you are getting and put a value in.
Hope this helps. ItemProfile<IWorkItem> profile = IWorkItem.DEFAULT_PROFILE; |
Hi,
Thank you for your reply. It was very useful. However could you please tell me how to get I am trying to get it using IWorkItemClient wiclient = (IWorkItemClient) repo.getClientLibrary(IWorkItemClient.class); If this is correct, how do i get the ITeamRepository Thanks Arun |
That is indeed correct for getting the work item client, the code to log in to the repository is
ITeamRepository teamRepository= TeamPlatform.getTeamRepositoryService().getTeamRepository(repositoryURI); Where repositoryURI is the address of your jazz repository, for example: https://jazz705.hursley.ibm.com:9443/ccm and then put your user name and password in, the login handler is an internal class private static class LoginHandler implements ILoginHandler, ILoginInfo { Then IWorkItemClient workItemClient= (IWorkItemClient) teamRepository.getClientLibrary(IWorkItemClient.class);will get the work item client for you. |
Hi Arun,
I think you have used com.ibm.team.workitem.client.IWorkItemClient API in your OperationParticipant plug-in. I am also trying to use client libraries in my OperationAdvisor but when I import client related libraries, the plug-in is not deployed on the server. Could you please let me know the solution? I did not find any solution for this since some weeks. I have to use com.ibm.team.repository.client.ITeamRepository as well in my current development Item. Thanks in Advance Regards, Radhika B |
the IWorkItem u have in the OperationAdvisor is a READ ONLY instance..
you must get the WorkingCopy to modify it.. in my OperationAdvisor , I assume something similar is done in a Participant.
you should always assume it is read only unless YOU just created the workitem. ---- edit.. you are in an OperationParticipant, and so shouldn't have a data overlay problem.. Sam |
Hi,
why do you use Client API on OperationAdvisor? I suggest you to use server side API. In order to save a work-item you can use IWorkItemServer instead of IWorkItemClient. Methods are quite similar. You are already logged in as you run Advisor, you don't need to re-login. Michele. Hi Arun,API in your OperationParticipant plug-in. I am also trying to use client libraries in my OperationAdvisor but when I import client related libraries, the plug-in is not deployed on the server. Could you please let me know the solution? I did not find any solution for this since some weeks. I have to use com.ibm.team.repository.client.ITeamRepository as well in my current development Item. Thanks in Advance Regards, Radhika B |
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.