Search in sources :

Example 1 with TaskDescriptor

use of org.jbpm.compiler.canonical.descriptors.TaskDescriptor in project kogito-runtimes by kiegroup.

the class WorkItemNodeVisitor method visitNode.

@Override
public void visitNode(String factoryField, T node, BlockStmt body, VariableScope variableScope, ProcessMetaData metadata) {
    Work work = node.getWork();
    String workName = node.getWork().getName();
    if (TaskDescriptorBuilder.isBuilderSupported(workName)) {
        final TaskDescriptor taskDescriptor = new TaskDescriptorBuilder(workName).withProcessMetadata(metadata).withWorkItemNode(node).withClassloader(contextClassLoader).build();
        workName = taskDescriptor.getName();
        metadata.getGeneratedHandlers().put(workName, taskDescriptor.generateHandlerClassForService());
    }
    body.addStatement(getAssignedFactoryMethod(factoryField, WorkItemNodeFactory.class, getNodeId(node), getNodeKey(), new LongLiteralExpr(node.getId()))).addStatement(getNameMethod(node, work.getName())).addStatement(getFactoryMethod(getNodeId(node), METHOD_WORK_NAME, new StringLiteralExpr(workName)));
    addWorkItemParameters(work, body, getNodeId(node));
    addNodeMappings(node, body, getNodeId(node));
    body.addStatement(getDoneMethod(getNodeId(node)));
    visitMetaData(node.getMetaData(), body, getNodeId(node));
    metadata.getWorkItems().add(workName);
}
Also used : AbstractServiceTaskDescriptor(org.jbpm.compiler.canonical.descriptors.AbstractServiceTaskDescriptor) TaskDescriptor(org.jbpm.compiler.canonical.descriptors.TaskDescriptor) WorkItemNodeFactory(org.jbpm.ruleflow.core.factory.WorkItemNodeFactory) TaskDescriptorBuilder(org.jbpm.compiler.canonical.descriptors.TaskDescriptorBuilder) Work(org.jbpm.process.core.Work) StringLiteralExpr(com.github.javaparser.ast.expr.StringLiteralExpr) LongLiteralExpr(com.github.javaparser.ast.expr.LongLiteralExpr)

Aggregations

LongLiteralExpr (com.github.javaparser.ast.expr.LongLiteralExpr)1 StringLiteralExpr (com.github.javaparser.ast.expr.StringLiteralExpr)1 AbstractServiceTaskDescriptor (org.jbpm.compiler.canonical.descriptors.AbstractServiceTaskDescriptor)1 TaskDescriptor (org.jbpm.compiler.canonical.descriptors.TaskDescriptor)1 TaskDescriptorBuilder (org.jbpm.compiler.canonical.descriptors.TaskDescriptorBuilder)1 Work (org.jbpm.process.core.Work)1 WorkItemNodeFactory (org.jbpm.ruleflow.core.factory.WorkItemNodeFactory)1