Facing Issue in calling the follow-up action plugin
Hi All,
I have created a simple follow-up action using operation participant extension inRTC 2.0.0.2 .
Function of follow-up action: When save operation is performed in my custom workitem(here Enhancement request), the plugin will be triggered and prints "Web Services can be called for the Request".
Issue: My code is called twice whenever save operation is performed in custom workitem(Enhancement request) and prints
"Web Services can be called for the Request
Web Services can be called for the Request"
like this.
So please someone help me to resolve this issue asap.
My Code:
package wicreation;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import com.ibm.team.process.common.IProcessConfigurationElement;
import com.ibm.team.process.common.IProjectAreaHandle;
import com.ibm.team.process.common.advice.AdvisableOperation;
import com.ibm.team.process.common.advice.IReportInfo;
import com.ibm.team.process.common.advice.runtime.IOperationParticipant;
import com.ibm.team.process.common.advice.runtime.IParticipantInfoCollector;
import com.ibm.team.repository.common.IAuditable;
import com.ibm.team.repository.common.TeamRepositoryException;
import com.ibm.team.repository.service.AbstractService;
import com.ibm.team.workitem.common.ISaveParameter;
import com.ibm.team.workitem.common.IWorkItemCommon;
import com.ibm.team.workitem.common.model.IAttribute;
import com.ibm.team.workitem.common.model.IWorkItem;
import com.ibm.team.workitem.common.model.IState;
import com.ibm.team.workitem.common.model.IWorkItemReferences;
import com.ibm.team.workitem.common.model.IWorkItemType;
import com.ibm.team.workitem.common.model.Identifier;
import com.ibm.team.workitem.common.model.WorkItemEndPoints;
import com.ibm.team.workitem.common.model.WorkItemLinkTypes;
import com.ibm.team.workitem.common.workflow.IWorkflowInfo;
import com.ibm.team.workitem.service.IWorkItemServer;
public class WIChildStory extends AbstractService implements IOperationParticipant {
public void run(AdvisableOperation operation,
IProcessConfigurationElement participantConfig,
IParticipantInfoCollector collector, IProgressMonitor monitor)
throws TeamRepositoryException {
// TODO Auto-generated method stub
//To get Operation data
Object data = operation.getOperationData();
//To check whether it is save operation
if (data instanceof ISaveParameter) {
ISaveParameter param = (ISaveParameter) data;
IAuditable auditable = param.getNewState();
//To check whether save operation is performed in WorkItem
if (auditable instanceof IWorkItem) {
IWorkItem sourceworkItem = (IWorkItem) auditable;
//IWorkItemServer workItemServer = this.getService(IWorkItemServer.class);
//To get WI type, previous and current state of source workitem
String currentWItype = sourceworkItem.getWorkItemType();
String targetWItype = "enhancementrequest";
if(currentWItype.equalsIgnoreCase(targetWItype)){
System.out.println("Web Services can be called for the Request");
}
}
}
}
}
Thanks in Advance!!
I have created a simple follow-up action using operation participant extension in
"Web Services can be called for the Request
Web Services can be called for the Request"
like this.
So please someone help me to resolve this issue asap.
My Code:
package wicreation;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import com.ibm.team.process.common.IProcessConfigurationElement;
import com.ibm.team.process.common.IProjectAreaHandle;
import com.ibm.team.process.common.advice.AdvisableOperation;
import com.ibm.team.process.common.advice.IReportInfo;
import com.ibm.team.process.common.advice.runtime.IOperationParticipant;
import com.ibm.team.process.common.advice.runtime.IParticipantInfoCollector;
import com.ibm.team.repository.common.IAuditable;
import com.ibm.team.repository.common.TeamRepositoryException;
import com.ibm.team.repository.service.AbstractService;
import com.ibm.team.workitem.common.ISaveParameter;
import com.ibm.team.workitem.common.IWorkItemCommon;
import com.ibm.team.workitem.common.model.IAttribute;
import com.ibm.team.workitem.common.model.IWorkItem;
import com.ibm.team.workitem.common.model.IState;
import com.ibm.team.workitem.common.model.IWorkItemReferences;
import com.ibm.team.workitem.common.model.IWorkItemType;
import com.ibm.team.workitem.common.model.Identifier;
import com.ibm.team.workitem.common.model.WorkItemEndPoints;
import com.ibm.team.workitem.common.model.WorkItemLinkTypes;
import com.ibm.team.workitem.common.workflow.IWorkflowInfo;
import com.ibm.team.workitem.service.IWorkItemServer;
public class WIChildStory extends AbstractService implements IOperationParticipant {
public void run(AdvisableOperation operation,
IProcessConfigurationElement participantConfig,
IParticipantInfoCollector collector, IProgressMonitor monitor)
throws TeamRepositoryException {
// TODO Auto-generated method stub
//To get Operation data
Object data = operation.getOperationData();
//To check whether it is save operation
if (data instanceof ISaveParameter) {
ISaveParameter param = (ISaveParameter) data;
IAuditable auditable = param.getNewState();
//To check whether save operation is performed in WorkItem
if (auditable instanceof IWorkItem) {
IWorkItem sourceworkItem = (IWorkItem) auditable;
//IWorkItemServer workItemServer = this.getService(IWorkItemServer.class);
//To get WI type, previous and current state of source workitem
String currentWItype = sourceworkItem.getWorkItemType();
String targetWItype = "enhancementrequest";
if(currentWItype.equalsIgnoreCase(targetWItype)){
System.out.println("Web Services can be called for the Request");
}
}
}
}
}
Thanks in Advance!!
2 answers
I am facing a similar problem. My plugin is executing twice every time the save operation is performed.
Comments
My code is basically the same as the one from Karthikeyan.
what rtc version are u using?
I don't see this in any of my participants.
can u check the process config source xml and search for the participant.(followup-action) to see if it might be installed twice?
<followup-actions>
somewhere after the followup-actions element
<followup-action xmlns="http://com.ibm.team.process/setUpProject" description="Initializes a project area with the pieces necessary to start work on a project." id="com.ibm.team.process.server.setUpProject" name="Setup Project"
Sam, you saved my day. It was as simple as having the participant installed twice.