Search in sources :

Example 1 with RuleFlowNodeContainerFactory

use of org.jbpm.ruleflow.core.RuleFlowNodeContainerFactory in project kogito-runtimes by kiegroup.

the class CompositeContextNodeHandler method getActionNode.

public MakeNodeResult getActionNode(RuleFlowNodeContainerFactory<?, ?> embeddedSubProcess, Action action, String collectVar, String... extraVariables) {
    ActionDataFilter actionFilter = action.getActionDataFilter();
    String fromExpr = null;
    String resultExpr = null;
    String toExpr = null;
    boolean useData = true;
    if (actionFilter != null) {
        fromExpr = actionFilter.getFromStateData();
        resultExpr = actionFilter.getResults();
        toExpr = actionFilter.getToStateData();
        useData = actionFilter.isUseResults();
    }
    if (action.getFunctionRef() != null) {
        return filterAndMergeNode(embeddedSubProcess, fromExpr, resultExpr, toExpr, useData, (factory, inputVar, outputVar) -> getActionNode(factory, action.getFunctionRef(), inputVar, outputVar, collectVar, extraVariables));
    } else if (action.getEventRef() != null) {
        return filterAndMergeNode(embeddedSubProcess, fromExpr, resultExpr, toExpr, useData, (factory, inputVar, outputVar) -> getActionNode(factory, action.getEventRef(), inputVar));
    } else if (action.getSubFlowRef() != null) {
        return filterAndMergeNode(embeddedSubProcess, fromExpr, resultExpr, toExpr, useData, (factory, inputVar, outputVar) -> getActionNode(factory, action.getSubFlowRef(), inputVar, outputVar));
    } else {
        throw new IllegalArgumentException("Action node " + action.getName() + " of state " + state.getName() + " does not have function or event defined");
    }
}
Also used : ServerlessWorkflowParser(org.kie.kogito.serverless.workflow.parser.ServerlessWorkflowParser) RestBodyBuilderSupplier(org.kie.kogito.serverless.workflow.suppliers.RestBodyBuilderSupplier) SysoutActionSupplier(org.kie.kogito.serverless.workflow.suppliers.SysoutActionSupplier) ObjectResolver(org.kie.kogito.serverless.workflow.ObjectResolver) Action(io.serverlessworkflow.api.actions.Action) HashMap(java.util.HashMap) NodeFactory(org.jbpm.ruleflow.core.factory.NodeFactory) ExpressionActionSupplier(org.kie.kogito.serverless.workflow.suppliers.ExpressionActionSupplier) Workflow(io.serverlessworkflow.api.Workflow) JsonNodeResolver(org.kie.kogito.serverless.workflow.JsonNodeResolver) JsonObjectUtils(org.kie.kogito.jackson.utils.JsonObjectUtils) OpenApiTaskDescriptor(org.jbpm.compiler.canonical.descriptors.OpenApiTaskDescriptor) WorkItemNodeFactory(org.jbpm.ruleflow.core.factory.WorkItemNodeFactory) FunctionDefinition(io.serverlessworkflow.api.functions.FunctionDefinition) Map(java.util.Map) CompositeContextNodeFactory(org.jbpm.ruleflow.core.factory.CompositeContextNodeFactory) JsonNode(com.fasterxml.jackson.databind.JsonNode) FunctionRef(io.serverlessworkflow.api.functions.FunctionRef) ParserContext(org.kie.kogito.serverless.workflow.parser.ParserContext) ExpressionWorkItemResolver(org.kie.kogito.process.expr.ExpressionWorkItemResolver) ActionDataFilter(io.serverlessworkflow.api.filters.ActionDataFilter) AbstractServiceTaskDescriptor(org.jbpm.compiler.canonical.descriptors.AbstractServiceTaskDescriptor) Iterator(java.util.Iterator) EventRef(io.serverlessworkflow.api.events.EventRef) RuleFlowNodeContainerFactory(org.jbpm.ruleflow.core.RuleFlowNodeContainerFactory) AbstractCompositeNodeFactory(org.jbpm.ruleflow.core.factory.AbstractCompositeNodeFactory) DataTypeResolver(org.jbpm.process.core.datatype.DataTypeResolver) JsonNodeVisitor(org.kie.kogito.jackson.utils.JsonNodeVisitor) ExpressionHandlerFactory(org.kie.kogito.process.expr.ExpressionHandlerFactory) List(java.util.List) State(io.serverlessworkflow.api.interfaces.State) RestWorkItemHandler(org.kogito.workitem.rest.RestWorkItemHandler) ExpressionHandlerUtils(org.kie.kogito.serverless.workflow.utils.ExpressionHandlerUtils) JavaDialect(org.drools.mvel.java.JavaDialect) Entry(java.util.Map.Entry) TaskDescriptor(org.jbpm.compiler.canonical.descriptors.TaskDescriptor) ServerlessWorkflowUtils(org.kie.kogito.serverless.workflow.utils.ServerlessWorkflowUtils) SubFlowRef(io.serverlessworkflow.api.functions.SubFlowRef) ActionDataFilter(io.serverlessworkflow.api.filters.ActionDataFilter)

Aggregations

JsonNode (com.fasterxml.jackson.databind.JsonNode)1 Workflow (io.serverlessworkflow.api.Workflow)1 Action (io.serverlessworkflow.api.actions.Action)1 EventRef (io.serverlessworkflow.api.events.EventRef)1 ActionDataFilter (io.serverlessworkflow.api.filters.ActionDataFilter)1 FunctionDefinition (io.serverlessworkflow.api.functions.FunctionDefinition)1 FunctionRef (io.serverlessworkflow.api.functions.FunctionRef)1 SubFlowRef (io.serverlessworkflow.api.functions.SubFlowRef)1 State (io.serverlessworkflow.api.interfaces.State)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 JavaDialect (org.drools.mvel.java.JavaDialect)1 AbstractServiceTaskDescriptor (org.jbpm.compiler.canonical.descriptors.AbstractServiceTaskDescriptor)1 OpenApiTaskDescriptor (org.jbpm.compiler.canonical.descriptors.OpenApiTaskDescriptor)1 TaskDescriptor (org.jbpm.compiler.canonical.descriptors.TaskDescriptor)1 DataTypeResolver (org.jbpm.process.core.datatype.DataTypeResolver)1 RuleFlowNodeContainerFactory (org.jbpm.ruleflow.core.RuleFlowNodeContainerFactory)1