|
@@ -20,6 +20,7 @@ import org.flowable.common.engine.api.delegate.event.FlowableEventType;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@EqualsAndHashCode(callSuper = true)
|
|
|
@Data
|
|
@@ -43,6 +44,8 @@ public class FlowModel extends BaseEntity {
|
|
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
|
|
private List<String> admin;
|
|
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
|
|
+ private List<Principal> starters;
|
|
|
+ @TableField(typeHandler = JacksonTypeHandler.class)
|
|
|
private Settings settings;
|
|
|
|
|
|
public BpmnModel toBpmnModel() {
|
|
@@ -77,6 +80,19 @@ public class FlowModel extends BaseEntity {
|
|
|
adminElement.setElementText(String.join(",", this.getAdmin()));
|
|
|
}
|
|
|
process.addExtensionElement(adminElement);
|
|
|
+ // 设置谁可以发起流程
|
|
|
+ if (CollectionUtils.isNotEmpty(this.starters)) {
|
|
|
+ List<String> candidateStarterUsers = this.starters.stream()
|
|
|
+ .filter(principal -> principal.getType() == PrincipalType.USER)
|
|
|
+ .map(Principal::getId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ process.setCandidateStarterUsers(candidateStarterUsers);
|
|
|
+ List<String> candidateStarterRoles = this.starters.stream()
|
|
|
+ .filter(principal -> principal.getType() == PrincipalType.ROLE)
|
|
|
+ .map(Principal::getId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ process.setCandidateStarterGroups(candidateStarterRoles);
|
|
|
+ }
|
|
|
// 设置流程
|
|
|
bpmnModel.addProcess(process);
|
|
|
// 自动布局
|