|
楼主 |
发表于 2017-6-28 11:53:23
|
显示全部楼层
本帖最后由 梦冷亦寒 于 2017-6-28 12:54 编辑
执行下一个子流程startMasterProcess发起主流程时:
public static void startMasterProcess(String masterProcess, String masterActivity) {
ActionContext context = ActionUtils.getRequestContext().getActionContext();
Map<String, Object> relas = (Map<String, Object>) context.getParameter(ProcessConstants.PI_RELATION_VALUE_PARAMETER);
//启动主流程
String sData1 = CommonUtils.createGUID();
String sData2 = null;
if(null!=relas) sData2 = (String)relas.get("sData1");//把当前的sData1存到主流程的sData2
ProcessControl control = ProcessUtils.startProcessQuery(masterProcess, null, null);
for(ProcessControlItem item : control.getFlowTos()){
if(!masterActivity.equals(item.getUnit()))
//删除指定的FlowTo
control.removeFlowTo(item);//清除多余流转
}
ProcessControlItem item = control.getFlowTo(masterActivity);
//设置当前流程控制信息单元是否为选中
item.setSelected(true);
//清空默认执行者
item.clearExecutors();
//添加执行者
item.addExecutor(new OrgUnit(ContextHelper.getPersonMember().getFID(), ContextHelper.getPersonMember().getFName()));
Map<String, Object> relations = new HashMap<String, Object>();
relations.put("sName", "主流程启动-"+masterActivity+"触发");
relations.put("sData1", sData1);
relations.put("sData2", sData2);
String executor = ContextHelper.getPersonMember().getFID();
List<Map<String, String>> doc = ProcessUtils.startProcess(masterProcess, relations, control, new ArrayList<String>(), null);
String task = doc.get(0).get("task");
//子流程写入主流程任务,用于唤醒
if(null!=relas){
relas.put("sData2", task);//记录主流程的任务id
}
//暂停主流程
System.out.println("暂停task " +task);
ProcessUtils.suspendProcess(task, control);
}
control.getFlowTos()这报:
2017-06-28 12:44:03 excute stream action, params:{"actions":[{"accept":"application/json","action":"externalAdvanceProcessAction","actionFlag":"__action_0__","activity":"order","contentType":"application/json","executeContext":"","executor":"/ORG01.ogn/PSN01@ORG01.psm","parameters":{"control":{"class":"com.justep.system.process.ProcessControl","object":{"@@tag":"process-control","customized-enabled":"false","dialog-enabled":"true","jump-enabled":"false","message":"","notice":[],"postscript":"","save-history":"true","status":"none","task-join":"false","task-join-mode":"tjmMultiple","to":[{"@activity-id":"2630DC1B36A14D34A4E328B9344C1A31","@id":"2630DC1B36A14D34A4E328B9344C1A31","@is-end":"false","@readonly":"false","@selected":"true","executor-kinds":" psm","executor-range":[{"@@tag":"org-unit","fid":"/ORG01.ogn/PSN01@ORG01.psm","fname":"/起步软件/system","responsible":"false"}],"executors":[{"@@tag":"org-unit","fid":"/ORG01.ogn/PSN01@ORG01.psm","fname":"/起步软件/system","responsible":false}],"process":"/TYWMS/TYWMS/process/master/masterProcess","task-relation-value":{"@@tag":"task-relation-value","SA_Task":"34AF8D5DDE98435BB67455CF4758842C","sActivity":"arr","sActivityInTemplate":"arr","sActivityName":"到货流程","sCURL":"/TYWMS/TYWMS/process/master/order.a","sEURL":"/TYWMS/TYWMS/process/master/arr.a","sExecuteMode":"temPreempt","sExecuteMode2":"","sLastModifyTime":"2017-06-28T12:42:10.029Z","sLock":"82D634DB9C9743C5BAD7ABFEC0DC80E7","sName":"到货流程:主流程启动-order触发","sPreemptMode":"tpmOpen","sProcess":"/TYWMS/TYWMS/process/master/masterProcess","sProcessName":"主流程","sProcessTemplateID2":"","sTypeName":"主流程"},"template":"","unit":"arr"}]}},"task":"189139B55F0B4C2DA2DB40362CB4798F"},"process":"/TYWMS/TYWMS/process/master/masterProcess"}]}
java.lang.reflect.InvocationTargetException
Caused by: java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
at java.util.ArrayList$Itr.next(ArrayList.java:851)
at com.hollyrise.process.ProcessUtil.startMasterProcess(ProcessUtil.java:64)
at ArrProcess.arrProcessBeforeStart(ArrProcess.java:13)
... 60 more
|
|