Error when I attach a file in a workitem by plugin Participant
Hi all,
I have working fine the Participant plugin (Create approvers: http://rsjazz.wordpress.com/2012/11/30/a-create-approval-work-item-save-participant/) but when I try to attach a file in a workitem (after creation) an alert say "Failed save workitem".
The ccm.log error:
2013-05-22 11:32:08,951 [ WebContainer : 3] ERROR com.ibm.team.process.common - com.ibm.team.workitem.common.internal.model.impl.AttachmentImpl incompatible with com.ibm.team.workitem.common.model.IWorkItem
java.lang.ClassCastException: com.ibm.team.workitem.common.internal.model.impl.AttachmentImpl incompatible with com.ibm.team.workitem.common.model.IWorkItem
at ev.createapproval.CreateApproval.run(CreateApproval.java:101)
My first lines of run code:
//Get Data
Object data = operation.getOperationData();
ISaveParameter saveParameter = null;
if (data instanceof ISaveParameter)
{
saveParameter = (ISaveParameter) data;
IWorkItem newState = (IWorkItem) saveParameter.getNewState(); //line 101 error
Identifier<IState> newStateId = newState.getState2();
Identifier<IState> oldStateId = null;
IWorkItem oldState = (IWorkItem) saveParameter.getOldState();
String tipo = newState.getWorkItemType().toString();
//avoid recursive with loop
if (saveParameter.getAdditionalSaveParameters().contains("Loop") || !(tipo.equals("proyecto")))
{
return;
}
//Not new wi
if (oldState != null )
{
IApprovals HasApprovals = oldState.getApprovals();
List<IApproval> hasAppr = HasApprovals.getContents();
...
Anybody know what is wrong with my participant plugin?
Thanks
|
2 answers
Ralph Schoon (63.6k●3●36●47)
| answered May 22 '13, 7:05 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Marcos, if you look into the code of the participant: http://rsjazz.wordpress.com/2012/07/31/rtc-update-parent-duration-estimation-and-effort-participant/ and the other one, where you commented, you can see that you have to make sure your follow up action is actually triggered by a work item save. The code mentioned is:
if (!(data instanceof ISaveParameter)) return; // Check that this was a save operation on a work item ISaveParameter saveParameter= (ISaveParameter) data; if (!(saveParameter.getNewState() instanceof IWorkItem)) return;The instanceof IWorkItem is actually important, so you don't cast something completely different than a IWorkItem and get the error you see. Comments
Girish Chandra P
commented Oct 03 '16, 7:23 a.m.
Thanks This Worked for me ..Refer also : https://jazz.net/forum/questions/109930/urgent-problem-attaching-a-file-in-a-workitem-web-page
|
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.