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);
}
Aggregations