diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/AbstractCompositeNodeVisitor.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/AbstractCompositeNodeVisitor.java index 96b9d205f59..b9143a9d762 100644 --- a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/AbstractCompositeNodeVisitor.java +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/AbstractCompositeNodeVisitor.java @@ -18,8 +18,7 @@ */ package org.jbpm.compiler.canonical; -import java.util.Map; - +import org.jbpm.compiler.canonical.node.NodeVisitorBuilderService; import org.jbpm.process.core.context.variable.VariableScope; import org.jbpm.workflow.core.node.CompositeContextNode; import org.kie.api.definition.process.Node; @@ -28,15 +27,15 @@ public abstract class AbstractCompositeNodeVisitor extends AbstractNodeVisitor { - protected Map, AbstractNodeVisitor> nodesVisitors; + protected NodeVisitorBuilderService nodevisitorService; - public AbstractCompositeNodeVisitor(Map, AbstractNodeVisitor> nodesVisitors) { - this.nodesVisitors = nodesVisitors; + public AbstractCompositeNodeVisitor(NodeVisitorBuilderService nodevisitorService) { + this.nodevisitorService = nodevisitorService; } protected void visitNodes(String factoryField, U[] nodes, BlockStmt body, VariableScope variableScope, ProcessMetaData metadata) { for (U node : nodes) { - AbstractNodeVisitor visitor = (AbstractNodeVisitor) nodesVisitors.get(node.getClass()); + AbstractNodeVisitor visitor = (AbstractNodeVisitor) nodevisitorService.findNodeVisitor(node.getClass()); if (visitor == null) { continue; } diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/CompositeContextNodeVisitor.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/CompositeContextNodeVisitor.java index 12d7946aefb..7bb9c149d88 100644 --- a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/CompositeContextNodeVisitor.java +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/CompositeContextNodeVisitor.java @@ -19,13 +19,12 @@ package org.jbpm.compiler.canonical; import java.util.HashSet; -import java.util.Map; import java.util.stream.Stream; +import org.jbpm.compiler.canonical.node.NodeVisitorBuilderService; import org.jbpm.process.core.context.variable.VariableScope; import org.jbpm.ruleflow.core.factory.CompositeContextNodeFactory; import org.jbpm.workflow.core.node.CompositeContextNode; -import org.kie.api.definition.process.Node; import com.github.javaparser.ast.expr.BooleanLiteralExpr; import com.github.javaparser.ast.expr.MethodCallExpr; @@ -34,8 +33,8 @@ public class CompositeContextNodeVisitor extends AbstractCompositeNodeVisitor { - public CompositeContextNodeVisitor(Map, AbstractNodeVisitor> nodesVisitors) { - super(nodesVisitors); + public CompositeContextNodeVisitor(NodeVisitorBuilderService nodeVisitorService) { + super(nodeVisitorService); } @Override diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/DynamicNodeVisitor.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/DynamicNodeVisitor.java index 26c802d4948..6535aa5466f 100644 --- a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/DynamicNodeVisitor.java +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/DynamicNodeVisitor.java @@ -20,13 +20,12 @@ import java.util.ArrayList; import java.util.Collection; -import java.util.Map; import java.util.stream.Stream; +import org.jbpm.compiler.canonical.node.NodeVisitorBuilderService; import org.jbpm.process.core.context.variable.VariableScope; import org.jbpm.ruleflow.core.factory.DynamicNodeFactory; import org.jbpm.workflow.core.node.DynamicNode; -import org.kie.api.definition.process.Node; import com.github.javaparser.ast.expr.MethodCallExpr; @@ -36,8 +35,8 @@ public class DynamicNodeVisitor extends CompositeContextNodeVisitor { - public DynamicNodeVisitor(Map, AbstractNodeVisitor> nodesVisitors) { - super(nodesVisitors); + public DynamicNodeVisitor(NodeVisitorBuilderService nodeVisitorService) { + super(nodeVisitorService); } @Override diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/EventSubProcessNodeVisitor.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/EventSubProcessNodeVisitor.java index 815f637039d..ef9c441e44f 100644 --- a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/EventSubProcessNodeVisitor.java +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/EventSubProcessNodeVisitor.java @@ -20,13 +20,12 @@ import java.util.ArrayList; import java.util.Collection; -import java.util.Map; import java.util.stream.Stream; +import org.jbpm.compiler.canonical.node.NodeVisitorBuilderService; import org.jbpm.process.core.context.variable.VariableScope; import org.jbpm.ruleflow.core.factory.EventSubProcessNodeFactory; import org.jbpm.workflow.core.node.EventSubProcessNode; -import org.kie.api.definition.process.Node; import com.github.javaparser.ast.expr.BooleanLiteralExpr; import com.github.javaparser.ast.expr.MethodCallExpr; @@ -37,8 +36,8 @@ public class EventSubProcessNodeVisitor extends CompositeContextNodeVisitor { - public EventSubProcessNodeVisitor(Map, AbstractNodeVisitor> nodesVisitors) { - super(nodesVisitors); + public EventSubProcessNodeVisitor(NodeVisitorBuilderService nodeVisitorService) { + super(nodeVisitorService); } @Override diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/ForEachNodeVisitor.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/ForEachNodeVisitor.java index bb9bf76a415..45e4ffdaa63 100644 --- a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/ForEachNodeVisitor.java +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/ForEachNodeVisitor.java @@ -21,8 +21,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import java.util.Map; +import org.jbpm.compiler.canonical.node.NodeVisitorBuilderService; import org.jbpm.process.core.context.variable.VariableScope; import org.jbpm.ruleflow.core.factory.ForEachNodeFactory; import org.jbpm.workflow.core.Node; @@ -45,8 +45,8 @@ public class ForEachNodeVisitor extends AbstractCompositeNodeVisitor { - public ForEachNodeVisitor(Map, AbstractNodeVisitor> nodesVisitors) { - super(nodesVisitors); + public ForEachNodeVisitor(NodeVisitorBuilderService nodeVisitorService) { + super(nodeVisitorService); } @Override diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/ProcessVisitor.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/ProcessVisitor.java index 355ab77aa45..f694ecad61e 100644 --- a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/ProcessVisitor.java +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/ProcessVisitor.java @@ -19,7 +19,6 @@ package org.jbpm.compiler.canonical; import java.util.ArrayList; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -28,6 +27,7 @@ import java.util.stream.Stream; import org.jbpm.compiler.canonical.descriptors.ExpressionUtils; +import org.jbpm.compiler.canonical.node.NodeVisitorBuilderService; import org.jbpm.process.core.Context; import org.jbpm.process.core.ContextContainer; import org.jbpm.process.core.Work; @@ -40,27 +40,7 @@ import org.jbpm.workflow.core.Node; import org.jbpm.workflow.core.NodeContainer; import org.jbpm.workflow.core.impl.ConnectionImpl; -import org.jbpm.workflow.core.node.ActionNode; -import org.jbpm.workflow.core.node.BoundaryEventNode; -import org.jbpm.workflow.core.node.CatchLinkNode; -import org.jbpm.workflow.core.node.CompositeContextNode; import org.jbpm.workflow.core.node.CompositeNode; -import org.jbpm.workflow.core.node.DynamicNode; -import org.jbpm.workflow.core.node.EndNode; -import org.jbpm.workflow.core.node.EventNode; -import org.jbpm.workflow.core.node.EventSubProcessNode; -import org.jbpm.workflow.core.node.FaultNode; -import org.jbpm.workflow.core.node.ForEachNode; -import org.jbpm.workflow.core.node.HumanTaskNode; -import org.jbpm.workflow.core.node.Join; -import org.jbpm.workflow.core.node.MilestoneNode; -import org.jbpm.workflow.core.node.RuleSetNode; -import org.jbpm.workflow.core.node.Split; -import org.jbpm.workflow.core.node.StartNode; -import org.jbpm.workflow.core.node.StateNode; -import org.jbpm.workflow.core.node.SubProcessNode; -import org.jbpm.workflow.core.node.ThrowLinkNode; -import org.jbpm.workflow.core.node.TimerNode; import org.jbpm.workflow.core.node.WorkItemNode; import org.kie.api.definition.process.Connection; import org.kie.api.definition.process.Process; @@ -98,30 +78,10 @@ public class ProcessVisitor extends AbstractVisitor { public static final String DEFAULT_VERSION = "1.0"; - private Map, AbstractNodeVisitor> nodesVisitors = new HashMap<>(); + private NodeVisitorBuilderService nodeVisitorService; public ProcessVisitor(ClassLoader contextClassLoader) { - this.nodesVisitors.put(StartNode.class, new StartNodeVisitor()); - this.nodesVisitors.put(ActionNode.class, new ActionNodeVisitor()); - this.nodesVisitors.put(EndNode.class, new EndNodeVisitor()); - this.nodesVisitors.put(HumanTaskNode.class, new HumanTaskNodeVisitor()); - this.nodesVisitors.put(WorkItemNode.class, new WorkItemNodeVisitor<>(contextClassLoader)); - this.nodesVisitors.put(SubProcessNode.class, new LambdaSubProcessNodeVisitor()); - this.nodesVisitors.put(Split.class, new SplitNodeVisitor()); - this.nodesVisitors.put(Join.class, new JoinNodeVisitor()); - this.nodesVisitors.put(FaultNode.class, new FaultNodeVisitor()); - this.nodesVisitors.put(RuleSetNode.class, new RuleSetNodeVisitor(contextClassLoader)); - this.nodesVisitors.put(BoundaryEventNode.class, new BoundaryEventNodeVisitor()); - this.nodesVisitors.put(EventNode.class, new EventNodeVisitor()); - this.nodesVisitors.put(ForEachNode.class, new ForEachNodeVisitor(nodesVisitors)); - this.nodesVisitors.put(CompositeContextNode.class, new CompositeContextNodeVisitor<>(nodesVisitors)); - this.nodesVisitors.put(EventSubProcessNode.class, new EventSubProcessNodeVisitor(nodesVisitors)); - this.nodesVisitors.put(TimerNode.class, new TimerNodeVisitor()); - this.nodesVisitors.put(MilestoneNode.class, new MilestoneNodeVisitor()); - this.nodesVisitors.put(DynamicNode.class, new DynamicNodeVisitor(nodesVisitors)); - this.nodesVisitors.put(StateNode.class, new StateNodeVisitor(nodesVisitors)); - this.nodesVisitors.put(CatchLinkNode.class, new CatchLinkNodeVisitor()); - this.nodesVisitors.put(ThrowLinkNode.class, new ThrowLinkNodeVisitor()); + nodeVisitorService = new NodeVisitorBuilderService(); } public void visitProcess(WorkflowProcess process, MethodDeclaration processMethod, ProcessMetaData metadata) { @@ -221,7 +181,8 @@ private void visitHeader(WorkflowProcess process, BlockStmt body) { private void visitNodes(List nodes, BlockStmt body, VariableScope variableScope, ProcessMetaData metadata) { for (U node : nodes) { - AbstractNodeVisitor visitor = (AbstractNodeVisitor) nodesVisitors.get(node.getClass()); + @SuppressWarnings("unchecked") + AbstractNodeVisitor visitor = (AbstractNodeVisitor) this.nodeVisitorService.findNodeVisitor(node.getClass()); if (visitor == null) { throw new IllegalStateException("No visitor found for node " + node.getClass().getName()); } @@ -229,6 +190,15 @@ private void visitNodes(List } } + @SuppressWarnings("unchecked") + private String getFieldName(ContextContainer contextContainer) { + AbstractNodeVisitor visitor = null; + if (contextContainer instanceof CompositeNode) { + visitor = this.nodeVisitorService.findNodeVisitor(contextContainer.getClass()); + } + return visitor != null ? visitor.getNodeId(((Node) contextContainer)) : FACTORY_FIELD_NAME; + } + private void visitConnections(org.kie.api.definition.process.Node[] nodes, BlockStmt body) { List connections = new ArrayList<>(); @@ -302,14 +272,6 @@ faultVariable. map(StringLiteralExpr::new) } } - private String getFieldName(ContextContainer contextContainer) { - AbstractNodeVisitor visitor = null; - if (contextContainer instanceof CompositeNode) { - visitor = this.nodesVisitors.get(contextContainer.getClass()); - } - return visitor != null ? visitor.getNodeId(((Node) contextContainer)) : FACTORY_FIELD_NAME; - } - private void visitSubExceptionScope(org.kie.api.definition.process.Node[] nodes, BlockStmt body) { Stream.of(nodes) .peek(node -> { diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/StateNodeVisitor.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/StateNodeVisitor.java index 8c4d95aa9fb..c800c3d65fc 100644 --- a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/StateNodeVisitor.java +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/StateNodeVisitor.java @@ -23,12 +23,12 @@ import java.util.Map; import java.util.stream.Stream; +import org.jbpm.compiler.canonical.node.NodeVisitorBuilderService; import org.jbpm.process.core.context.variable.VariableScope; import org.jbpm.ruleflow.core.factory.StateNodeFactory; import org.jbpm.workflow.core.Constraint; import org.jbpm.workflow.core.impl.ConnectionRef; import org.jbpm.workflow.core.node.StateNode; -import org.kie.api.definition.process.Node; import com.github.javaparser.ast.expr.IntegerLiteralExpr; import com.github.javaparser.ast.expr.MethodCallExpr; @@ -39,8 +39,8 @@ public class StateNodeVisitor extends CompositeContextNodeVisitor { - public StateNodeVisitor(Map, AbstractNodeVisitor> nodesVisitors) { - super(nodesVisitors); + public StateNodeVisitor(NodeVisitorBuilderService nodeVisitorService) { + super(nodeVisitorService); } @Override diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/ActionNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/ActionNodeVisitorBuilder.java new file mode 100644 index 00000000000..559aa4b23ef --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/ActionNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.ActionNodeVisitor; +import org.jbpm.workflow.core.node.ActionNode; +import org.kie.api.definition.process.Node; + +public class ActionNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return ActionNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new ActionNodeVisitor(); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/BoundaryEventNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/BoundaryEventNodeVisitorBuilder.java new file mode 100644 index 00000000000..ad47008b990 --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/BoundaryEventNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.BoundaryEventNodeVisitor; +import org.jbpm.workflow.core.node.BoundaryEventNode; +import org.kie.api.definition.process.Node; + +public class BoundaryEventNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return BoundaryEventNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new BoundaryEventNodeVisitor(); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/CatchLinkNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/CatchLinkNodeVisitorBuilder.java new file mode 100644 index 00000000000..7fc2c24bb08 --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/CatchLinkNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.CatchLinkNodeVisitor; +import org.jbpm.workflow.core.node.CatchLinkNode; +import org.kie.api.definition.process.Node; + +public class CatchLinkNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return CatchLinkNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new CatchLinkNodeVisitor(); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/CompositeContextNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/CompositeContextNodeVisitorBuilder.java new file mode 100644 index 00000000000..d59ce5949b3 --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/CompositeContextNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.CompositeContextNodeVisitor; +import org.jbpm.workflow.core.node.CompositeContextNode; +import org.kie.api.definition.process.Node; + +public class CompositeContextNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return CompositeContextNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new CompositeContextNodeVisitor(nodeVisitorService); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/DynamicNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/DynamicNodeVisitorBuilder.java new file mode 100644 index 00000000000..85c45eaecfb --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/DynamicNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.DynamicNodeVisitor; +import org.jbpm.workflow.core.node.DynamicNode; +import org.kie.api.definition.process.Node; + +public class DynamicNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return DynamicNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new DynamicNodeVisitor(nodeVisitorService); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/EndNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/EndNodeVisitorBuilder.java new file mode 100644 index 00000000000..0d67cfef924 --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/EndNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.EndNodeVisitor; +import org.jbpm.workflow.core.node.EndNode; +import org.kie.api.definition.process.Node; + +public class EndNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return EndNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new EndNodeVisitor(); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/EventNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/EventNodeVisitorBuilder.java new file mode 100644 index 00000000000..e1b244e9e5d --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/EventNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.EventNodeVisitor; +import org.jbpm.workflow.core.node.EventNode; +import org.kie.api.definition.process.Node; + +public class EventNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return EventNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new EventNodeVisitor(); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/EventSubProcessNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/EventSubProcessNodeVisitorBuilder.java new file mode 100644 index 00000000000..10d0504f9f1 --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/EventSubProcessNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.EventSubProcessNodeVisitor; +import org.jbpm.workflow.core.node.EventSubProcessNode; +import org.kie.api.definition.process.Node; + +public class EventSubProcessNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return EventSubProcessNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new EventSubProcessNodeVisitor(nodeVisitorService); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/FaultNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/FaultNodeVisitorBuilder.java new file mode 100644 index 00000000000..b142911daf0 --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/FaultNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.FaultNodeVisitor; +import org.jbpm.workflow.core.node.FaultNode; +import org.kie.api.definition.process.Node; + +public class FaultNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return FaultNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new FaultNodeVisitor(); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/ForEachNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/ForEachNodeVisitorBuilder.java new file mode 100644 index 00000000000..2ba0c2df48d --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/ForEachNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.ForEachNodeVisitor; +import org.jbpm.workflow.core.node.ForEachNode; +import org.kie.api.definition.process.Node; + +public class ForEachNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return ForEachNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new ForEachNodeVisitor(nodeVisitorService); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/HumanTaskNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/HumanTaskNodeVisitorBuilder.java new file mode 100644 index 00000000000..c2fcda95eba --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/HumanTaskNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.HumanTaskNodeVisitor; +import org.jbpm.workflow.core.node.HumanTaskNode; +import org.kie.api.definition.process.Node; + +public class HumanTaskNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return HumanTaskNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new HumanTaskNodeVisitor(); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/JoinNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/JoinNodeVisitorBuilder.java new file mode 100644 index 00000000000..5512e190fda --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/JoinNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.JoinNodeVisitor; +import org.jbpm.workflow.core.node.Join; +import org.kie.api.definition.process.Node; + +public class JoinNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return Join.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new JoinNodeVisitor(); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/MilestoneNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/MilestoneNodeVisitorBuilder.java new file mode 100644 index 00000000000..a770f651fb6 --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/MilestoneNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.MilestoneNodeVisitor; +import org.jbpm.workflow.core.node.MilestoneNode; +import org.kie.api.definition.process.Node; + +public class MilestoneNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return MilestoneNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new MilestoneNodeVisitor(); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/NodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/NodeVisitorBuilder.java new file mode 100644 index 00000000000..ac1bc555ffe --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/NodeVisitorBuilder.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; + +public interface NodeVisitorBuilder { + + Class type(); + + AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService); +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/NodeVisitorBuilderService.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/NodeVisitorBuilderService.java new file mode 100644 index 00000000000..660618e1138 --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/NodeVisitorBuilderService.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import java.util.Map; +import java.util.ServiceLoader; +import java.util.function.Function; +import java.util.stream.Collectors; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; + +public class NodeVisitorBuilderService { + + private Map, NodeVisitorBuilder> nodesVisitors; + + public NodeVisitorBuilderService() { + nodesVisitors = ServiceLoader.load(NodeVisitorBuilder.class).stream().map(ServiceLoader.Provider::get).collect(Collectors.toMap(NodeVisitorBuilder::type, Function.identity())); + } + + public AbstractNodeVisitor findNodeVisitor(Class clazz) { + NodeVisitorBuilder nodeVisitor = nodesVisitors.get(clazz); + if (nodeVisitor != null) { + return nodeVisitor.visitor(this); + } + throw new IllegalArgumentException(clazz + " visitor not supported"); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/RuleSetNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/RuleSetNodeVisitorBuilder.java new file mode 100644 index 00000000000..e70098f6893 --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/RuleSetNodeVisitorBuilder.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.RuleSetNodeVisitor; +import org.jbpm.util.JbpmClassLoaderUtil; +import org.jbpm.workflow.core.node.RuleSetNode; +import org.kie.api.definition.process.Node; + +public class RuleSetNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return RuleSetNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new RuleSetNodeVisitor(JbpmClassLoaderUtil.findClassLoader()); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/SplitNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/SplitNodeVisitorBuilder.java new file mode 100644 index 00000000000..897734d474e --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/SplitNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.SplitNodeVisitor; +import org.jbpm.workflow.core.node.Split; +import org.kie.api.definition.process.Node; + +public class SplitNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return Split.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new SplitNodeVisitor(); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/StartNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/StartNodeVisitorBuilder.java new file mode 100644 index 00000000000..e614d9f7d81 --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/StartNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.StartNodeVisitor; +import org.jbpm.workflow.core.node.StartNode; +import org.kie.api.definition.process.Node; + +public class StartNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return StartNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new StartNodeVisitor(); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/StateNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/StateNodeVisitorBuilder.java new file mode 100644 index 00000000000..64639640bcf --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/StateNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.StateNodeVisitor; +import org.jbpm.workflow.core.node.StateNode; +import org.kie.api.definition.process.Node; + +public class StateNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return StateNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new StateNodeVisitor(nodeVisitorService); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/SubProcessNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/SubProcessNodeVisitorBuilder.java new file mode 100644 index 00000000000..4e57a26f147 --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/SubProcessNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.LambdaSubProcessNodeVisitor; +import org.jbpm.workflow.core.node.SubProcessNode; +import org.kie.api.definition.process.Node; + +public class SubProcessNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return SubProcessNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new LambdaSubProcessNodeVisitor(); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/ThrowLinkNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/ThrowLinkNodeVisitorBuilder.java new file mode 100644 index 00000000000..7b2770f1a62 --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/ThrowLinkNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.ThrowLinkNodeVisitor; +import org.jbpm.workflow.core.node.ThrowLinkNode; +import org.kie.api.definition.process.Node; + +public class ThrowLinkNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return ThrowLinkNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new ThrowLinkNodeVisitor(); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/TimerNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/TimerNodeVisitorBuilder.java new file mode 100644 index 00000000000..54a17ca53f6 --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/TimerNodeVisitorBuilder.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.TimerNodeVisitor; +import org.jbpm.workflow.core.node.TimerNode; +import org.kie.api.definition.process.Node; + +public class TimerNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return TimerNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new TimerNodeVisitor(); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/WorkItemNodeVisitorBuilder.java b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/WorkItemNodeVisitorBuilder.java new file mode 100644 index 00000000000..6ed300ae35b --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/java/org/jbpm/compiler/canonical/node/WorkItemNodeVisitorBuilder.java @@ -0,0 +1,39 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jbpm.compiler.canonical.node; + +import org.jbpm.compiler.canonical.AbstractNodeVisitor; +import org.jbpm.compiler.canonical.WorkItemNodeVisitor; +import org.jbpm.util.JbpmClassLoaderUtil; +import org.jbpm.workflow.core.node.WorkItemNode; +import org.kie.api.definition.process.Node; + +public class WorkItemNodeVisitorBuilder implements NodeVisitorBuilder { + + @Override + public Class type() { + return WorkItemNode.class; + } + + @Override + public AbstractNodeVisitor visitor(NodeVisitorBuilderService nodeVisitorService) { + return new WorkItemNodeVisitor(JbpmClassLoaderUtil.findClassLoader()); + } + +} diff --git a/jbpm/jbpm-flow-builder/src/main/resources/META-INF/services/org.jbpm.compiler.canonical.node.NodeVisitorBuilder b/jbpm/jbpm-flow-builder/src/main/resources/META-INF/services/org.jbpm.compiler.canonical.node.NodeVisitorBuilder new file mode 100644 index 00000000000..1cd11599480 --- /dev/null +++ b/jbpm/jbpm-flow-builder/src/main/resources/META-INF/services/org.jbpm.compiler.canonical.node.NodeVisitorBuilder @@ -0,0 +1,21 @@ +org.jbpm.compiler.canonical.node.ActionNodeVisitorBuilder +org.jbpm.compiler.canonical.node.BoundaryEventNodeVisitorBuilder +org.jbpm.compiler.canonical.node.CatchLinkNodeVisitorBuilder +org.jbpm.compiler.canonical.node.CompositeContextNodeVisitorBuilder +org.jbpm.compiler.canonical.node.DynamicNodeVisitorBuilder +org.jbpm.compiler.canonical.node.EndNodeVisitorBuilder +org.jbpm.compiler.canonical.node.EventNodeVisitorBuilder +org.jbpm.compiler.canonical.node.EventSubProcessNodeVisitorBuilder +org.jbpm.compiler.canonical.node.FaultNodeVisitorBuilder +org.jbpm.compiler.canonical.node.ForEachNodeVisitorBuilder +org.jbpm.compiler.canonical.node.HumanTaskNodeVisitorBuilder +org.jbpm.compiler.canonical.node.JoinNodeVisitorBuilder +org.jbpm.compiler.canonical.node.MilestoneNodeVisitorBuilder +org.jbpm.compiler.canonical.node.RuleSetNodeVisitorBuilder +org.jbpm.compiler.canonical.node.SplitNodeVisitorBuilder +org.jbpm.compiler.canonical.node.StartNodeVisitorBuilder +org.jbpm.compiler.canonical.node.StateNodeVisitorBuilder +org.jbpm.compiler.canonical.node.SubProcessNodeVisitorBuilder +org.jbpm.compiler.canonical.node.ThrowLinkNodeVisitorBuilder +org.jbpm.compiler.canonical.node.TimerNodeVisitorBuilder +org.jbpm.compiler.canonical.node.WorkItemNodeVisitorBuilder \ No newline at end of file