It's all about the answers!

Ask a question

Facing Issue in calling the follow-up action plugin


Karthikeyan Elangovan (3644) | asked Jan 25 '12, 9:23 a.m.
Hi All,
I have created a simple follow-up action using operation participant extension in RTC 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!!

2 answers



permanent link
sam detweiler (12.5k6195201) | answered Jan 25 '12, 10:23 a.m.
is it the same workitem? same state?

Sam

permanent link
Francisco Rodriguez (561528) | answered Jun 12 '14, 2:58 p.m.
 I am facing a similar problem. My plugin is executing twice every time the save operation is performed. 

Comments
Francisco Rodriguez commented Jun 12 '14, 3:09 p.m.

My code is basically the same as the one from  Karthikeyan.


sam detweiler commented Jun 12 '14, 3:27 p.m. | edited Jun 12 '14, 3:30 p.m.

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"


Francisco Rodriguez commented Jun 12 '14, 3:46 p.m.

 Sam, you saved my day. It was as simple as having the participant installed twice. 

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.