09-06-2011 02:23 PM
public class WithdrawCommand implements Command<Void> {
private String mstrPid;
private String mstrWithdrawName;
private String mstrExecutionId;
private String mstrActiveTaskId;
@Resource(name = "processEngine")
private ProcessEngine mobjProcessEngine;
@Resource(name = "runtimeService")
private RuntimeService mobjRuntimeService;
@Resource(name = "repositoryService")
private RepositoryService mobjRepositoryService;
@Resource(name = "taskService")
private TaskService mobjTaskService;
@Resource(name = "historyService")
private HistoryService mobjHistoryService;
public WithdrawCommand(String pstrPid, String pstrName,String pstrExecutionId,String pstrActiveTaskId) {
this.mstrPid = pstrPid;
this.mstrWithdrawName = pstrName;
this.mstrExecutionId = pstrExecutionId;
this.mstrActiveTaskId = pstrActiveTaskId;
}
@Override
public Void execute(CommandContext commandContext) {
ActivityImpl activityImpl =commandContext.getExecutionManager().findExecutionById(mstrExecutionId).getActivity();
TransitionImpl transition = (TransitionImpl)activityImpl.getOutgoingTransitions().get(0);
ActivityImpl from = transition.getDestination();
ActivityImpl to = transition.getSource();
TransitionImpl withdraw = from.createOutgoingTransition();
withdraw.setDestination(to);
withdraw.setProperty("name", "withdraw");
mobjTaskService.complete(mstrActiveTaskId);
return null;
}
public void setMstrPid(String mstrPid) {
this.mstrPid = mstrPid;
}
public void setMstrWithdrawName(String mstrWithdrawName) {
this.mstrWithdrawName = mstrWithdrawName;
}
public void setMobjProcessEngine(ProcessEngine mobjProcessEngine) {
this.mobjProcessEngine = mobjProcessEngine;
}
public void setMobjRuntimeService(RuntimeService mobjRuntimeService) {
this.mobjRuntimeService = mobjRuntimeService;
}
public void
setMobjRepositoryService(RepositoryService mobjRepositoryService) {
this.mobjRepositoryService = mobjRepositoryService;
}
public void setMobjTaskService(TaskService mobjTaskService) {
this.mobjTaskService = mobjTaskService;
}
public void setMobjHistoryService(HistoryService mobjHistoryService) {
this.mobjHistoryService = mobjHistoryService;
}
}
09-08-2011 02:34 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.