It's all about the answers!

Ask a question

Changing workitem state programatically


Dashrath Kale (1542723) | asked Jan 17 '11, 12:45 a.m.
Hi

I want to change the state of the workitem using RTC JAVA API's.

Please let me know , if anyone has any information on this.

3 answers



permanent link
Patrick Streule (4.9k21) | answered Jan 18 '11, 6:08 a.m.
JAZZ DEVELOPER
I want to change the state of the workitem using RTC JAVA API's.

Please let me know , if anyone has any information on this.

On the client, you can use

com.ibm.team.workitem.client.WorkItemWorkingCopy.setWorkflowAction(String)

On the server, you pass the action ID on save:

com.ibm.team.workitem.service.IWorkItemServer.saveWorkItem2(IWorkItem,
IWorkItemReferences, String)


--
Regards,
Patrick
RTC Work Item Component Lead

permanent link
Dashrath Kale (1542723) | answered Jan 24 '11, 2:30 a.m.
Patrick

Thanks for your response , actually we are using the OperationParticipant for the below functionality:

1) Read the values of custom attributes from the work item.
2) Create the RTC project area with name as values of custom attibuites.
2) Populate the custom attribute with the value of other custom attibute values.ex: valueOf(attribute4)=valueOf(attibute1+attibute2+attibute3) but and to this we are using workItemCopy.save(null); from the client side but when we execute the save methos it again and again calls the Operation participant.

And as per your response ew need to call the save method after chaging the workflow action but that will also call the operation participant again

Note: we use Operation Particapnt just to call the client side code to create the Project area and populate the custom attributes.

permanent link
Ralph Schoon (63.6k33647) | answered Feb 07 '11, 9:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hi Dashrath,

I missed this one. Maybe you can do something in the Operation Participant that makes sure that subsequent calls can be filtered out?

Here is some code to begin with from the Extesibility Workshop on Jazz.net:


if (data instanceof ISaveParameter) {
saveParameter = (ISaveParameter) data;
/*
* If the state id has not changed, do not build.
*/
IWorkItem newState = (IWorkItem) saveParameter.getNewState();
Identifier<IState> newStateId = newState.getState2();
Identifier<IState> oldStateId = null;
IWorkItem oldState = (IWorkItem) saveParameter.getOldState();
if (oldState != null) // New work item check.
oldStateId = oldState.getState2();
if ((newStateId != null) && !(newStateId.equals(oldStateId))) {




Patrick

Thanks for your response , actually we are using the OperationParticipant for the below functionality:

1) Read the values of custom attributes from the work item.
2) Create the RTC project area with name as values of custom attibuites.
2) Populate the custom attribute with the value of other custom attibute values.ex: valueOf(attribute4)=valueOf(attibute1+attibute2+attibute3) but and to this we are using workItemCopy.save(null); from the client side but when we execute the save methos it again and again calls the Operation participant.

And as per your response ew need to call the save method after chaging the workflow action but that will also call the operation participant again

Note: we use Operation Particapnt just to call the client side code to create the Project area and populate the custom attributes.

Your answer


Register or to post 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.