Search in sources :

Example 6 with WorkflowProcess

use of org.jbpm.workflow.core.WorkflowProcess in project jbpm by kiegroup.

the class RuleSetNodeBuilder method build.

@Override
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) {
    super.build(process, processDescr, context, node);
    WorkflowProcess wfProcess = (WorkflowProcess) process;
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("imports", wfProcess.getImports());
    parameters.put("classloader", context.getConfiguration().getClassLoader());
    for (DataAssociation dataAssociation : ((RuleSetNode) node).getInAssociations()) {
        Transformation transformation = dataAssociation.getTransformation();
        if (transformation != null) {
            DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage());
            transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters));
        }
    }
    for (DataAssociation dataAssociation : ((RuleSetNode) node).getOutAssociations()) {
        Transformation transformation = dataAssociation.getTransformation();
        if (transformation != null) {
            DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage());
            transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters));
        }
    }
}
Also used : Transformation(org.jbpm.workflow.core.node.Transformation) DataTransformer(org.kie.api.runtime.process.DataTransformer) HashMap(java.util.HashMap) DataAssociation(org.jbpm.workflow.core.node.DataAssociation) RuleSetNode(org.jbpm.workflow.core.node.RuleSetNode) WorkflowProcess(org.jbpm.workflow.core.WorkflowProcess)

Example 7 with WorkflowProcess

use of org.jbpm.workflow.core.WorkflowProcess in project jbpm by kiegroup.

the class StartNodeBuilder method build.

@Override
public void build(Process process, ProcessDescr processDescr, ProcessBuildContext context, Node node) {
    super.build(process, processDescr, context, node);
    Transformation transformation = (Transformation) node.getMetaData().get("Transformation");
    if (transformation != null) {
        WorkflowProcess wfProcess = (WorkflowProcess) process;
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("imports", wfProcess.getImports());
        parameters.put("classloader", context.getConfiguration().getClassLoader());
        DataTransformer transformer = DataTransformerRegistry.get().find(transformation.getLanguage());
        transformation.setCompiledExpression(transformer.compile(transformation.getExpression(), parameters));
    }
}
Also used : Transformation(org.jbpm.workflow.core.node.Transformation) DataTransformer(org.kie.api.runtime.process.DataTransformer) HashMap(java.util.HashMap) WorkflowProcess(org.jbpm.workflow.core.WorkflowProcess)

Aggregations

HashMap (java.util.HashMap)7 WorkflowProcess (org.jbpm.workflow.core.WorkflowProcess)7 Transformation (org.jbpm.workflow.core.node.Transformation)6 DataTransformer (org.kie.api.runtime.process.DataTransformer)6 DataAssociation (org.jbpm.workflow.core.node.DataAssociation)3 ProcessDialect (org.jbpm.process.builder.dialect.ProcessDialect)2 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Predicate (java.util.function.Predicate)1 Collectors (java.util.stream.Collectors)1 Collectors.toList (java.util.stream.Collectors.toList)1 Collectors.toMap (java.util.stream.Collectors.toMap)1 ActionDescr (org.drools.compiler.lang.descr.ActionDescr)1 CaseNotFoundException (org.jbpm.casemgmt.api.CaseNotFoundException)1