Search in sources :

Example 1 with DataDefinition

use of org.jbpm.workflow.core.impl.DataDefinition in project kogito-runtimes by kiegroup.

the class ServerlessWorkflowParser method subprocessNode.

public static <T extends RuleFlowNodeContainerFactory<T, ?>> SubProcessNodeFactory<T> subprocessNode(SubProcessNodeFactory<T> nodeFactory, String inputVar, String outputVar) {
    Map<String, String> types = Collections.singletonMap(DEFAULT_WORKFLOW_VAR, JSON_NODE);
    DataAssociation inputDa = new DataAssociation(new DataDefinition(inputVar, inputVar, JSON_NODE), new DataDefinition(DEFAULT_WORKFLOW_VAR, DEFAULT_WORKFLOW_VAR, JSON_NODE), null, null);
    DataAssociation outputDa = new DataAssociation(new DataDefinition(DEFAULT_WORKFLOW_VAR, DEFAULT_WORKFLOW_VAR, JSON_NODE), new DataDefinition(outputVar, outputVar, JSON_NODE), null, null);
    VariableScope variableScope = new VariableScope();
    return nodeFactory.independent(true).metaData("BPMN.InputTypes", types).metaData("BPMN.OutputTypes", types).mapDataInputAssociation(inputDa).mapDataOutputAssociation(outputDa).context(variableScope).defaultContext(variableScope);
}
Also used : DataAssociation(org.jbpm.workflow.core.impl.DataAssociation) DataDefinition(org.jbpm.workflow.core.impl.DataDefinition) VariableScope(org.jbpm.process.core.context.variable.VariableScope)

Example 2 with DataDefinition

use of org.jbpm.workflow.core.impl.DataDefinition in project kogito-runtimes by kiegroup.

the class AbstractNodeHandler method writeDataAssociation.

protected void writeDataAssociation(DataAssociation input, StringBuilder xmlDump) {
    for (DataDefinition source : input.getSources()) {
        xmlDump.append("        <sourceRef>" + source.getId() + "</sourceRef>" + EOL);
    }
    if (input.getTarget() != null) {
        xmlDump.append("<targetRef>" + input.getTarget().getId() + "</targetRef>" + EOL);
    }
    if (!input.getAssignments().isEmpty()) {
        for (Assignment assignment : input.getAssignments()) {
            xmlDump.append("        <assignment>" + EOL);
            xmlDump.append("             <from xsi:type=\"tFormalExpression\">" + assignment.getFrom().getExpression() + "</from>");
            xmlDump.append("             <to xsi:type=\"tFormalExpression\">" + assignment.getTo().getExpression() + "</to>");
            xmlDump.append("        </assignment>" + EOL);
        }
    }
}
Also used : Assignment(org.jbpm.workflow.core.node.Assignment) DataDefinition(org.jbpm.workflow.core.impl.DataDefinition)

Example 3 with DataDefinition

use of org.jbpm.workflow.core.impl.DataDefinition in project kogito-runtimes by kiegroup.

the class AbstractNodeHandler method writeMultiInstance.

protected void writeMultiInstance(MultiInstanceSpecification ioSpecification, StringBuilder xmlDump) {
    if (!ioSpecification.hasLoopDataInputRef()) {
        return;
    }
    xmlDump.append("<multiInstanceLoopCharacteristics>" + EOL);
    if (ioSpecification.hasLoopDataInputRef()) {
        xmlDump.append("<loopDataInputRef>" + ioSpecification.getLoopDataInputRef() + "</loopDataInputRef>" + EOL);
    }
    if (ioSpecification.hasLoopDataOutputRef()) {
        xmlDump.append("<loopDataOutputRef>" + ioSpecification.getLoopDataOutputRef() + "</loopDataOutputRef>" + EOL);
    }
    DataDefinition input = ioSpecification.getInputDataItem();
    if (input != null) {
        xmlDump.append("<inputDataItem id=\"" + input.getId() + "\" name=\"" + input.getLabel() + "\" structureRef=\"" + input.getType() + "\" />");
    }
    DataDefinition output = ioSpecification.getOutputDataItem();
    if (output != null) {
        xmlDump.append("<outputDataItem id=\"" + output.getId() + "\" name=\"" + output.getLabel() + "\" structureRef=\"" + output.getType() + "\" />");
    }
    xmlDump.append("</multiInstanceLoopCharacteristics>" + EOL);
}
Also used : DataDefinition(org.jbpm.workflow.core.impl.DataDefinition)

Example 4 with DataDefinition

use of org.jbpm.workflow.core.impl.DataDefinition in project kogito-runtimes by kiegroup.

the class AbstractNodeHandler method writeCatchIO.

protected void writeCatchIO(IOSpecification ioSpecification, StringBuilder xmlDump) {
    for (DataDefinition output : ioSpecification.getDataOutput().values()) {
        xmlDump.append("        <dataOutput id=\"" + output.getId() + "\" name=\"" + output.getLabel() + "\" />" + EOL);
    }
    for (DataAssociation output : ioSpecification.getDataOutputAssociation()) {
        xmlDump.append("      <dataOutputAssociation>" + EOL);
        writeDataAssociation(output, xmlDump);
        xmlDump.append("      </dataOutputAssociation>" + EOL);
    }
}
Also used : DataAssociation(org.jbpm.workflow.core.impl.DataAssociation) DataDefinition(org.jbpm.workflow.core.impl.DataDefinition)

Example 5 with DataDefinition

use of org.jbpm.workflow.core.impl.DataDefinition in project kogito-runtimes by kiegroup.

the class AbstractNodeHandler method toDataExpression.

private DataDefinition toDataExpression(String expression) {
    DataDefinition dataSpec = new DataDefinition(UUID.randomUUID().toString(), "EXPRESSION (" + expression + ")", null);
    dataSpec.setExpression(expression);
    return dataSpec;
}
Also used : DataDefinition(org.jbpm.workflow.core.impl.DataDefinition)

Aggregations

DataDefinition (org.jbpm.workflow.core.impl.DataDefinition)25 DataAssociation (org.jbpm.workflow.core.impl.DataAssociation)9 ArrayList (java.util.ArrayList)7 Assignment (org.jbpm.workflow.core.node.Assignment)7 VariableScope (org.jbpm.process.core.context.variable.VariableScope)6 Element (org.w3c.dom.Element)4 StringLiteralExpr (com.github.javaparser.ast.expr.StringLiteralExpr)3 ClassOrInterfaceType (com.github.javaparser.ast.type.ClassOrInterfaceType)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Map (java.util.Map)3 ItemDefinition (org.jbpm.bpmn2.core.ItemDefinition)3 MultiInstanceSpecification (org.jbpm.workflow.core.impl.MultiInstanceSpecification)3 Transformation (org.jbpm.workflow.core.node.Transformation)3 Parameter (com.github.javaparser.ast.body.Parameter)2 AssignExpr (com.github.javaparser.ast.expr.AssignExpr)2 CastExpr (com.github.javaparser.ast.expr.CastExpr)2 Expression (com.github.javaparser.ast.expr.Expression)2 LambdaExpr (com.github.javaparser.ast.expr.LambdaExpr)2 MethodCallExpr (com.github.javaparser.ast.expr.MethodCallExpr)2