*/
private static final long serialVersionUID = -4748534122977819475L;
public String excute() throws ExedoException {
WFEngine wfi = WFEngineFactory.getWFEngine();
if (service.getProcessTemplate() == null) {
this.setEchoValue(I18n.instance().get("服务未定义工作流模板"));
return null;
}
service.invokeUpdate();
ProcessTemplate pt = this.service.getProcessTemplate();
String wfUid = null;
wfUid = getWfUid(pt, wfUid);
if (wfUid == null) {
DOService findPI = DOService
.getService("do.wfi.processinstance.browse.findbyinstanceUid");
if (findPI != null) {
String curInstnaceUid = pt.getDoBO().getCorrInstance().getUid();
List list = findPI.invokeSelect(pt.getObjUid(), curInstnaceUid);
if (list != null && list.size() > 0) {
BOInstance boPI = (BOInstance) list.get(0);
wfUid = boPI.getUid();
}
}
}
// do.wfi.processinstance.browse.findbyinstanceUid
// if(wfuid==null && pt.getDoBO2()!=null && pt.getDo)
if (wfUid == null) {
try {
wfi.startProcess(pt);
} catch (WFException e) {
e.printStackTrace();
this.setEchoValue(e.getLocalizedMessage());
return NO_FORWARD;
}
} else {
ProcessInstance pi = null;
try {
pi = wfi.loadProcessInstance(wfUid);
NodeInstance ni = pi.getFirstActivityNode();
ni.perform();
} catch (WFException e) {
e.printStackTrace();
this.setEchoValue(e.getLocalizedMessage());