It's all about the answers!

Ask a question

Can not configure WorkItem State Change Event


Riddhi Shah (3721518) | asked Jul 27 '12, 2:40 a.m.
Hi,

I want to configure Work item state change event. It does not allow me to configure event. In Process configuration -> Team Configuration  -> Event Handling , it does not enable add button.



Can anyone please guide me on how to enable this ? Or what are steps to configure events ?

3 answers



permanent link
Daniel Pool (2644) | answered Aug 09 '12, 4:46 p.m.
JAZZ DEVELOPER
I suspect you need to have a follow-up action that is suitable for use with events defined in order for the add button to be enabled. The button should let you associate an existing follow-up action with a particular event.

You can search the forum for "follow-up action" to see some discussions about how you would do this.

Comments
Riddhi Shah commented Aug 10 '12, 12:13 a.m.

Thanks Daniel. I tried to configure "Followup Action" on WorkItemSave. What happens with that is , it gives control before saving the defect and not after it. So, say if my followup action will fail workitem will not be saved. I need some event which gets executed after save.

  • riddhi

permanent link
VK L (8177154159) | answered Aug 10 '12, 2:18 a.m.
Hi Eiddhi,

Followup action will get executed after the workitem save operation. The failure of a followup action occurs only in case of exceptions where your conditions are not met (or) the operation particpant contains erroneous code.

Thanks.

permanent link
Riddhi Shah (3721518) | answered Aug 10 '12, 2:27 a.m.
Hi Valli L,

Thanks for the reply.

My concern is if i run my plugin in debug mode , debugger ( control ) should come to my plugin after the save on defect is done. here, what i get is while saving only it gives control to debugger and if in case followup action fails it fails save operation as well. As the name suggest its followup action I expect save to be done regardless of followup action.

I also create one pre-condition plugin , and deployed both plugin in RTC. Now I edited one of my defect and clicked on save from RTC. In debugger , it comes before saving defect it comes to pre-condition plugin first and on success of that , it goes to followup action and after that it saves defect. So, in such case what is really difference between pre-condition and followup action ?

Following is my plugin.xml

<extension
         point="com.ibm.team.process.service.operationParticipants">
      <operationParticipant
            class="fridaytest.FridayTestClass"
            id="FridayTest.operationParticipant1"
            name="friday test"
            operationId="com.ibm.team.workitem.operation.workItemSave">
         <extensionService
               componentId="FridayTest.extensionService"
               implementationClass="fridaytest.FridayTestClass">
            <prerequisites>
               <requiredService
                     interface="com.ibm.team.workitem.service.IWorkItemServer">
               </requiredService>
               <requiredService
                     interface="com.ibm.team.workitem.common.IWorkItemCommon">
               </requiredService>
            </prerequisites>
         </extensionService>
      </operationParticipant>
   </extension>

Following is my code:

public class FridayTestClass extends AbstractService implements IOperationParticipant {

    private static final String SAVE_SUMMARY="summary";
    private IWorkItemServer workItemServer;
    private IWorkItemCommon wiCommon;
   
    public void run(AdvisableOperation operation,
            IProcessConfigurationElement participantConfig,
            IParticipantInfoCollector collector, IProgressMonitor monitor)
            throws TeamRepositoryException
    {
        // TODO Auto-generated method stub
        Object data = operation.getOperationData();
        if (data instanceof ISaveParameter)
        {
            ISaveParameter saveParameter = (ISaveParameter) data;
            IAuditable auditable = saveParameter.getNewState();
       
            if (auditable instanceof IWorkItem)
            {
                workItemServer = getService(IWorkItemServer.class);
                wiCommon = getService(IWorkItemCommon.class);
               
                IWorkItem workItem = (IWorkItem) auditable;
                           
                            IWorkItem workItemWC = (IWorkItem)workItem.getWorkingCopy();
                           
                            if (workItemWC == null) {
                   
                                System.out.println("Work Item not found.");
                   
                                return;
                   
                            }
                            try
                            {
                                IAttribute summaryAttribute = wiCommon.findAttribute(workItemWC.getProjectArea(),SAVE_SUMMARY, monitor);
                               
                           
                                workItemWC.setValue(summaryAttribute, "updated from plugin");
                                workItemServer.saveWorkItem2(workItemWC, null, null);
                               
                            }
                            catch (Exception e)
                            {
                                    e.printStackTrace();
                               
                            }
                                   
                           
            }
        }
    }

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.