|
@@ -1,5 +1,6 @@
|
|
|
package com.flow.flowable.cmd;
|
|
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.flowable.common.engine.impl.interceptor.Command;
|
|
|
import org.flowable.common.engine.impl.interceptor.CommandContext;
|
|
|
import org.flowable.engine.impl.util.CommandContextUtil;
|
|
@@ -12,12 +13,19 @@ import java.util.List;
|
|
|
public class CopyProcessInstanceCmd implements Command<Void> {
|
|
|
protected String processInstanceId;
|
|
|
protected String assignee;
|
|
|
+ protected String taskId;
|
|
|
|
|
|
public CopyProcessInstanceCmd(String processInstanceId, String assignee) {
|
|
|
this.processInstanceId = processInstanceId;
|
|
|
this.assignee = assignee;
|
|
|
}
|
|
|
|
|
|
+ public CopyProcessInstanceCmd(String processInstanceId, String taskId, String assignee) {
|
|
|
+ this.processInstanceId = processInstanceId;
|
|
|
+ this.taskId = taskId;
|
|
|
+ this.assignee = assignee;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public Void execute(CommandContext commandContext) {
|
|
|
HistoricIdentityLinkService historicIdentityLinkService = CommandContextUtil.getProcessEngineConfiguration(commandContext)
|
|
@@ -33,6 +41,9 @@ public class CopyProcessInstanceCmd implements Command<Void> {
|
|
|
historicIdentityLink.setUserId(assignee);
|
|
|
historicIdentityLink.setCreateTime(new Date());
|
|
|
historicIdentityLink.setProcessInstanceId(processInstanceId);
|
|
|
+ if (StringUtils.isNotBlank(taskId)) {
|
|
|
+ historicIdentityLink.setTaskId(taskId);
|
|
|
+ }
|
|
|
historicIdentityLinkService.insertHistoricIdentityLink(historicIdentityLink, false);
|
|
|
}
|
|
|
return null;
|