Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

WorkItemWorkingCopy Save problem in RTC 2.0

I had a script which updates workitems. It worked fine in RTC 1.0.1.
After upgrading to RTC 2.0 and rebuilding against 2.0 libraries, In some cases the save fails.
I don't get any exception during the script running and it seems that the save succeeded, but looking at the WI in RTC later shows no modification.

Here is my code:

// get work item copy
IWorkItemHandle handle = (IWorkItemHandle) workItem.getItemHandle();
IWorkItemWorkingCopyManager wcm = workitemClient
.getWorkItemWorkingCopyManager();
wcm.connect(handle, IWorkItem.FULL_PROFILE, monitor);
WorkItemWorkingCopy wc;

wc = wcm.getWorkingCopy(handle);
IWorkItem copiedWorkItem = wc.getWorkItem();
// end get work item copy

// change status
IAttribute stateAttribute = workitemClient.findAttribute(
projectArea, IWorkItem.STATE_PROPERTY, null);

copiedWorkItem.setValue(stateAttribute, resolvedState
.getStringIdentifier());
// end change status
.
.
.

wc.save(monitor);

Thanks,
Moti

0 votes



4 answers

Permanent link
I had a script which updates workitems. It worked fine in RTC 1.0.1.
After upgrading to RTC 2.0 and rebuilding against 2.0 libraries, In
some cases the save fails.
I don't get any exception during the script running and it seems that
the save succeeded, but looking at the WI in RTC later shows no
modification.

The state of a work item should not be modified directly, but always via a
workflow action.

The work item server code validates the state of the work item on save:
The target state must be a valid transition from the previous state. In
the cases where you don't see an update, you are most likely setting the
work item state to a value that cannot be reached from the previous state
according to the workflow configuration.

--
Regards,
Patrick
Jazz Work Item Team

0 votes


Permanent link

The state of a work item should not be modified directly, but always via a
workflow action.

The work item server code validates the state of the work item on save:
The target state must be a valid transition from the previous state. In
the cases where you don't see an update, you are most likely setting the
work item state to a value that cannot be reached from the previous state
according to the workflow configuration.

--
Regards,
Patrick
Jazz Work Item Team


Thanks for the reply Patric,

I think this is not the case because my script is doing state transition which is allowed in the workflow (I can do the same in the UI).

Is there any other issue, or can I look at some point in the RTC source to debug it?

Thanks,
Moti

0 votes


Permanent link
Is there any other issue, or can I look at some point in the RTC
source to debug it?

To debug the issue, you could set a breakpoint in handleNotifySave(...) of
/com.ibm.team.workitem.service/src/com/ibm/team/workitem/service/internal/save/WorkflowTrigger.java

There is a call to
com.ibm.team.workitem.common.internal.WorkflowUtil.validState(IWorkflowInfo,
IWorkItem, String)

I assume that this call returns 'false' in your case.

--
Regards,
Patrick
Jazz Work Item Team

0 votes


Permanent link

To debug the issue, you could set a breakpoint in handleNotifySave(...) of
/com.ibm.team.workitem.service/src/com/ibm/team/workitem/service/internal/save/WorkflowTrigger.java

There is a call to
com.ibm.team.workitem.common.internal.WorkflowUtil.validState(IWorkflowInfo,
IWorkItem, String)

I assume that this call returns 'false' in your case.


Thanks you Patrick!

It was really the case.
(during the upgrade something was changing in the actions and states that I didn't notice)

Thanks,
Moti

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Aug 18 '09, 5:55 a.m.

Question was seen: 6,795 times

Last updated: Aug 18 '09, 5:55 a.m.

Confirmation Cancel Confirm