Can not configure WorkItem State Change Event
3 answers
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>
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();
}
}
}
}