All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.codingapi.springboot.flow.builder.FlowNodeFactory Maven / Gradle / Ivy
package com.codingapi.springboot.flow.builder;
import com.codingapi.springboot.flow.creator.DefaultTitleCreator;
import com.codingapi.springboot.flow.domain.FlowNode;
import com.codingapi.springboot.flow.em.FlowType;
import com.codingapi.springboot.flow.em.NodeType;
import com.codingapi.springboot.flow.matcher.IOperatorMatcher;
import com.codingapi.springboot.flow.operator.IFlowOperator;
import com.codingapi.springboot.flow.trigger.IErrTrigger;
import com.codingapi.springboot.flow.trigger.IOutTrigger;
import com.codingapi.springboot.flow.trigger.OverOutTrigger;
import lombok.AllArgsConstructor;
public class FlowNodeFactory {
@AllArgsConstructor
public static class Builder {
private IFlowOperator createUser;
public FlowNode startNode(String name, IOperatorMatcher operatorMatcher, IOutTrigger outTrigger) {
return startNode(name, FlowNode.VIEW_DEFAULT, operatorMatcher, outTrigger);
}
public FlowNode startNode(String name, String view, IOperatorMatcher operatorMatcher, IOutTrigger outTrigger) {
FlowNode flowNode = new FlowNode();
flowNode.setName(name);
flowNode.setType(NodeType.START);
flowNode.setCode(FlowNode.CODE_START);
flowNode.setView(view);
flowNode.setTitleCreator(new DefaultTitleCreator());
flowNode.setFlowType(FlowType.NOT_SIGN);
flowNode.setCreateTime(System.currentTimeMillis());
flowNode.setUpdateTime(System.currentTimeMillis());
flowNode.setCreateUser(createUser);
flowNode.setOutOperatorMatcher(operatorMatcher);
flowNode.setOutTrigger(outTrigger);
return flowNode;
}
public FlowNode overNode(String name) {
FlowNode flowNode = new FlowNode();
flowNode.setName(name);
flowNode.setType(NodeType.OVER);
flowNode.setCode(FlowNode.CODE_OVER);
flowNode.setView(FlowNode.VIEW_DEFAULT);
flowNode.setOutTrigger(new OverOutTrigger());
flowNode.setTitleCreator(new DefaultTitleCreator());
flowNode.setFlowType(FlowType.NOT_SIGN);
flowNode.setCreateTime(System.currentTimeMillis());
flowNode.setUpdateTime(System.currentTimeMillis());
flowNode.setCreateUser(createUser);
return flowNode;
}
public FlowNode node(String name,
String code,
String view,
FlowType flowType,
IOutTrigger outTrigger,
IOperatorMatcher outOperatorMatcher) {
return node(name, code, view, flowType, outTrigger, outOperatorMatcher, null, null);
}
public FlowNode node(String name,
String code,
FlowType flowType,
IOutTrigger outTrigger,
IOperatorMatcher outOperatorMatcher) {
return node(name, code, FlowNode.VIEW_DEFAULT, flowType, outTrigger, outOperatorMatcher, null, null);
}
public FlowNode node(String name,
String code,
String view,
FlowType flowType,
IOutTrigger outTrigger,
IOperatorMatcher outOperatorMatcher,
IErrTrigger errTrigger,
IOperatorMatcher errOperatorMatcher) {
FlowNode flowNode = new FlowNode();
flowNode.setName(name);
flowNode.setType(NodeType.APPROVAL);
flowNode.setCode(code);
flowNode.setView(view);
flowNode.setTitleCreator(new DefaultTitleCreator());
flowNode.setFlowType(flowType);
flowNode.setCreateTime(System.currentTimeMillis());
flowNode.setUpdateTime(System.currentTimeMillis());
flowNode.setCreateUser(createUser);
flowNode.setOutTrigger(outTrigger);
flowNode.setOutOperatorMatcher(outOperatorMatcher);
flowNode.setErrTrigger(errTrigger);
flowNode.setErrOperatorMatcher(errOperatorMatcher);
return flowNode;
}
}
public static Builder Builder(IFlowOperator createUser) {
return new Builder(createUser);
}
}