Search in sources :

Example 1 with TriggerMetaData

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

the class ProcessGenerator method classDeclaration.

public ClassOrInterfaceDeclaration classDeclaration() {
    ClassOrInterfaceDeclaration cls = new ClassOrInterfaceDeclaration().setName(targetTypeName).setModifiers(Modifier.Keyword.PUBLIC);
    ProcessMetaData processMetaData = processExecutable.generate();
    ConstructorDeclaration constructor = getConstructorDeclaration().addParameter(appCanonicalName, APPLICATION);
    MethodCallExpr handlersCollection = new MethodCallExpr(new NameExpr("java.util.Arrays"), "asList");
    MethodCallExpr superMethod = new MethodCallExpr(null, "super").addArgument(new NameExpr(APPLICATION)).addArgument(handlersCollection);
    if (context.getAddonsConfig().usePersistence()) {
        constructor.addParameter(ProcessInstancesFactory.class.getCanonicalName(), FACTORY);
        superMethod.addArgument(new NameExpr(FACTORY));
    }
    constructor.setBody(new BlockStmt().addStatement(superMethod).addStatement(new MethodCallExpr("activate")));
    if (context.hasDI()) {
        context.getDependencyInjectionAnnotator().withNamedApplicationComponent(cls, process.getId());
        context.getDependencyInjectionAnnotator().withEagerStartup(cls);
        context.getDependencyInjectionAnnotator().withInjection(constructor);
    }
    Map<String, CompilationUnit> handlers = processMetaData.getGeneratedHandlers();
    if (!handlers.isEmpty()) {
        MethodCallExpr initMethodCall = new MethodCallExpr(null, "this").addArgument(new NameExpr(APPLICATION));
        ConstructorDeclaration decl = getConstructorDeclaration().addParameter(appCanonicalName, APPLICATION).setBody(new BlockStmt().addStatement(initMethodCall));
        if (context.getAddonsConfig().usePersistence()) {
            initMethodCall.addArgument(new NameExpr(FACTORY));
            decl.addParameter(ProcessInstancesFactory.class.getCanonicalName(), FACTORY);
        }
        cls.addMember(decl);
        for (Entry<String, CompilationUnit> handler : handlers.entrySet()) {
            String varName = handler.getKey().substring(handler.getKey().lastIndexOf('.') + 1);
            varName = Character.toLowerCase(varName.charAt(0)) + varName.substring(1);
            ClassOrInterfaceDeclaration handlerClazz = handler.getValue().findFirst(ClassOrInterfaceDeclaration.class).orElseThrow(() -> new NoSuchElementException("Compilation unit doesn't contain a method declaration!"));
            String clazzName = handler.getValue().getPackageDeclaration().map(pd -> pd.getName().toString() + '.' + handlerClazz.getName()).orElse(handlerClazz.getName().asString());
            ClassOrInterfaceType clazzNameType = parseClassOrInterfaceType(clazzName);
            Parameter parameter = new Parameter(clazzNameType, varName);
            if (context.hasDI()) {
                context.getDependencyInjectionAnnotator().withApplicationComponent(handlerClazz);
                context.getDependencyInjectionAnnotator().withOptionalInjection(handlerClazz.getConstructors().stream().filter(c -> !c.getParameters().isEmpty()).findFirst().orElseThrow(() -> new IllegalStateException("Cannot find a non empty constructor to annotate in handler class " + handlerClazz)));
            }
            initMethodCall.addArgument(new ObjectCreationExpr(null, clazzNameType, NodeList.nodeList()));
            constructor.addParameter(parameter);
            handlersCollection.addArgument(new NameExpr(varName));
            additionalClasses.add(handler.getValue());
        }
    }
    String processInstanceFQCN = ProcessInstanceGenerator.qualifiedName(packageName, typeName);
    cls.addExtendedType(abstractProcessType(modelTypeName)).addMember(constructor).addMember(getConstructorDeclaration()).addMember(createInstanceMethod(processInstanceFQCN)).addMember(createInstanceWithBusinessKeyMethod(processInstanceFQCN)).addMember(new MethodDeclaration().addModifier(Keyword.PUBLIC).setName(CREATE_MODEL).setType(modelTypeName).addAnnotation(Override.class).setBody(new BlockStmt().addStatement(new ReturnStmt(new ObjectCreationExpr(null, new ClassOrInterfaceType(null, modelTypeName), NodeList.nodeList()))))).addMember(createInstanceGenericMethod(processInstanceFQCN)).addMember(createInstanceGenericWithBusinessKeyMethod(processInstanceFQCN)).addMember(createInstanceGenericWithWorkflowInstanceMethod(processInstanceFQCN)).addMember(createReadOnlyInstanceGenericWithWorkflowInstanceMethod(processInstanceFQCN)).addMember(process(processMetaData));
    internalConfigure(processMetaData).ifPresent(cls::addMember);
    internalRegisterListeners(processMetaData).ifPresent(cls::addMember);
    if (!processMetaData.getSubProcesses().isEmpty()) {
        for (Entry<String, String> subProcess : processMetaData.getSubProcesses().entrySet()) {
            FieldDeclaration subprocessFieldDeclaration = new FieldDeclaration();
            String fieldName = "process" + subProcess.getKey();
            ClassOrInterfaceType modelType = new ClassOrInterfaceType(null, new SimpleName(org.kie.kogito.process.Process.class.getCanonicalName()), NodeList.nodeList(new ClassOrInterfaceType(null, StringUtils.ucFirst(subProcess.getKey() + "Model"))));
            if (context.hasDI()) {
                subprocessFieldDeclaration.addVariable(new VariableDeclarator(modelType, fieldName));
                context.getDependencyInjectionAnnotator().withInjection(subprocessFieldDeclaration);
            } else {
                // app.get(org.kie.kogito.process.Processes.class).processById()
                MethodCallExpr initSubProcessField = new MethodCallExpr(new MethodCallExpr(new NameExpr(APPLICATION), "get").addArgument(new ClassExpr().setType(Processes.class.getCanonicalName())), "processById").addArgument(new StringLiteralExpr(subProcess.getKey()));
                subprocessFieldDeclaration.addVariable(new VariableDeclarator(modelType, fieldName));
                constructor.getBody().addStatement(new AssignExpr(new FieldAccessExpr(new ThisExpr(), fieldName), new CastExpr(modelType, initSubProcessField), Operator.ASSIGN));
            }
            cls.addMember(subprocessFieldDeclaration);
        }
    }
    if (!processMetaData.getTriggers().isEmpty()) {
        for (TriggerMetaData trigger : processMetaData.getTriggers()) {
            // add message produces as field
            if (trigger.getType().equals(TriggerMetaData.TriggerType.ProduceMessage)) {
                String producerFieldType = packageName + "." + typeName + "MessageProducer_" + trigger.getOwnerId();
                String producerFieldName = "producer_" + trigger.getOwnerId();
                FieldDeclaration producerFieldDeclaration = new FieldDeclaration().addVariable(new VariableDeclarator(new ClassOrInterfaceType(null, producerFieldType), producerFieldName));
                cls.addMember(producerFieldDeclaration);
                if (context.hasDI()) {
                    context.getDependencyInjectionAnnotator().withInjection(producerFieldDeclaration);
                } else {
                    AssignExpr assignExpr = new AssignExpr(new FieldAccessExpr(new ThisExpr(), producerFieldName), new ObjectCreationExpr().setType(producerFieldType), AssignExpr.Operator.ASSIGN);
                    cls.getConstructors().forEach(c -> c.getBody().addStatement(assignExpr));
                }
            }
        }
    }
    cls.getMembers().sort(new BodyDeclarationComparator());
    return cls;
}
Also used : StaticJavaParser.parseClassOrInterfaceType(com.github.javaparser.StaticJavaParser.parseClassOrInterfaceType) ClassExpr(com.github.javaparser.ast.expr.ClassExpr) ClassOrInterfaceType(com.github.javaparser.ast.type.ClassOrInterfaceType) TriggerMetaData(org.jbpm.compiler.canonical.TriggerMetaData) AbstractProcess(org.kie.kogito.process.impl.AbstractProcess) ReturnStmt(com.github.javaparser.ast.stmt.ReturnStmt) MemoryFileSystem(org.drools.compiler.compiler.io.memory.MemoryFileSystem) Parameter(com.github.javaparser.ast.body.Parameter) BodyDeclarationComparator(org.kie.kogito.codegen.core.BodyDeclarationComparator) CastExpr(com.github.javaparser.ast.expr.CastExpr) ThisExpr(com.github.javaparser.ast.expr.ThisExpr) ArrayList(java.util.ArrayList) VariableDeclarator(com.github.javaparser.ast.body.VariableDeclarator) ConstructorDeclaration(com.github.javaparser.ast.body.ConstructorDeclaration) ObjectCreationExpr(com.github.javaparser.ast.expr.ObjectCreationExpr) Map(java.util.Map) SuperExpr(com.github.javaparser.ast.expr.SuperExpr) CompilationUnit(com.github.javaparser.ast.CompilationUnit) NoSuchElementException(java.util.NoSuchElementException) WorkflowProcessInstance(org.kie.api.runtime.process.WorkflowProcessInstance) Keyword(com.github.javaparser.ast.Modifier.Keyword) NodeList(com.github.javaparser.ast.NodeList) SimpleName(com.github.javaparser.ast.expr.SimpleName) KogitoBuildContext(org.kie.kogito.codegen.api.context.KogitoBuildContext) Process(org.kie.api.definition.process.Process) MethodCallExpr(com.github.javaparser.ast.expr.MethodCallExpr) AssignExpr(com.github.javaparser.ast.expr.AssignExpr) NameExpr(com.github.javaparser.ast.expr.NameExpr) StringLiteralExpr(com.github.javaparser.ast.expr.StringLiteralExpr) StandardCharsets(java.nio.charset.StandardCharsets) ProcessMetaData(org.jbpm.compiler.canonical.ProcessMetaData) Modifier(com.github.javaparser.ast.Modifier) SourceVersion(javax.lang.model.SourceVersion) List(java.util.List) Model(org.kie.kogito.Model) FieldDeclaration(com.github.javaparser.ast.body.FieldDeclaration) MethodDeclaration(com.github.javaparser.ast.body.MethodDeclaration) Entry(java.util.Map.Entry) Operator(com.github.javaparser.ast.expr.AssignExpr.Operator) Optional(java.util.Optional) KogitoWorkflowProcess(org.kie.kogito.internal.process.runtime.KogitoWorkflowProcess) BlockStmt(com.github.javaparser.ast.stmt.BlockStmt) Processes(org.kie.kogito.process.Processes) FieldAccessExpr(com.github.javaparser.ast.expr.FieldAccessExpr) ProcessInstancesFactory(org.kie.kogito.process.ProcessInstancesFactory) ClassOrInterfaceDeclaration(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration) StringUtils(org.drools.core.util.StringUtils) ObjectCreationExpr(com.github.javaparser.ast.expr.ObjectCreationExpr) ClassOrInterfaceDeclaration(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration) SimpleName(com.github.javaparser.ast.expr.SimpleName) NameExpr(com.github.javaparser.ast.expr.NameExpr) StringLiteralExpr(com.github.javaparser.ast.expr.StringLiteralExpr) StaticJavaParser.parseClassOrInterfaceType(com.github.javaparser.StaticJavaParser.parseClassOrInterfaceType) ClassOrInterfaceType(com.github.javaparser.ast.type.ClassOrInterfaceType) FieldDeclaration(com.github.javaparser.ast.body.FieldDeclaration) VariableDeclarator(com.github.javaparser.ast.body.VariableDeclarator) AssignExpr(com.github.javaparser.ast.expr.AssignExpr) ConstructorDeclaration(com.github.javaparser.ast.body.ConstructorDeclaration) CastExpr(com.github.javaparser.ast.expr.CastExpr) BodyDeclarationComparator(org.kie.kogito.codegen.core.BodyDeclarationComparator) FieldAccessExpr(com.github.javaparser.ast.expr.FieldAccessExpr) ThisExpr(com.github.javaparser.ast.expr.ThisExpr) CompilationUnit(com.github.javaparser.ast.CompilationUnit) MethodDeclaration(com.github.javaparser.ast.body.MethodDeclaration) BlockStmt(com.github.javaparser.ast.stmt.BlockStmt) TriggerMetaData(org.jbpm.compiler.canonical.TriggerMetaData) ProcessInstancesFactory(org.kie.kogito.process.ProcessInstancesFactory) ProcessMetaData(org.jbpm.compiler.canonical.ProcessMetaData) Parameter(com.github.javaparser.ast.body.Parameter) ClassExpr(com.github.javaparser.ast.expr.ClassExpr) ReturnStmt(com.github.javaparser.ast.stmt.ReturnStmt) NoSuchElementException(java.util.NoSuchElementException) MethodCallExpr(com.github.javaparser.ast.expr.MethodCallExpr)

Example 2 with TriggerMetaData

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

the class ProcessCodegen method internalGenerate.

@Override
protected Collection<GeneratedFile> internalGenerate() {
    List<ProcessGenerator> ps = new ArrayList<>();
    List<ProcessInstanceGenerator> pis = new ArrayList<>();
    List<ProcessExecutableModelGenerator> processExecutableModelGenerators = new ArrayList<>();
    // REST resources
    List<ProcessResourceGenerator> rgs = new ArrayList<>();
    // message endpoints/consumers
    List<MessageConsumerGenerator> megs = new ArrayList<>();
    // message producers
    List<MessageProducerGenerator> mpgs = new ArrayList<>();
    Map<String, ModelClassGenerator> processIdToModelGenerator = new HashMap<>();
    Map<String, InputModelClassGenerator> processIdToInputModelGenerator = new HashMap<>();
    Map<String, OutputModelClassGenerator> processIdToOutputModelGenerator = new HashMap<>();
    Map<String, List<UserTaskModelMetaData>> processIdToUserTaskModel = new HashMap<>();
    Map<String, ProcessMetaData> processIdToMetadata = new HashMap<>();
    OpenApiClientWorkItemIntrospector introspector = new OpenApiClientWorkItemIntrospector(this.context());
    // first we generate all the data classes from variable declarations
    for (WorkflowProcess workFlowProcess : processes.values()) {
        ModelClassGenerator mcg = new ModelClassGenerator(context(), workFlowProcess);
        processIdToModelGenerator.put(workFlowProcess.getId(), mcg);
        InputModelClassGenerator imcg = new InputModelClassGenerator(context(), workFlowProcess);
        processIdToInputModelGenerator.put(workFlowProcess.getId(), imcg);
        OutputModelClassGenerator omcg = new OutputModelClassGenerator(context(), workFlowProcess);
        processIdToOutputModelGenerator.put(workFlowProcess.getId(), omcg);
    }
    // then we generate user task inputs and outputs if any
    for (WorkflowProcess workFlowProcess : processes.values()) {
        UserTasksModelClassGenerator utcg = new UserTasksModelClassGenerator(workFlowProcess);
        processIdToUserTaskModel.put(workFlowProcess.getId(), utcg.generate());
    }
    // then we can instantiate the exec model generator
    // with the data classes that we have already resolved
    ProcessToExecModelGenerator execModelGenerator = new ProcessToExecModelGenerator(context().getClassLoader());
    // collect all process descriptors (exec model)
    for (KogitoWorkflowProcess workFlowProcess : processes.values()) {
        introspector.introspect(workFlowProcess);
        ProcessExecutableModelGenerator execModelGen = new ProcessExecutableModelGenerator(workFlowProcess, execModelGenerator);
        String packageName = workFlowProcess.getPackageName();
        String id = workFlowProcess.getId();
        try {
            ProcessMetaData generate = execModelGen.generate();
            processIdToMetadata.put(id, generate);
            processExecutableModelGenerators.add(execModelGen);
        } catch (RuntimeException e) {
            throw new ProcessCodegenException(id, packageName, e);
        }
    }
    // generate Process, ProcessInstance classes and the REST resource
    for (ProcessExecutableModelGenerator execModelGen : processExecutableModelGenerators) {
        String classPrefix = StringUtils.ucFirst(execModelGen.extractedProcessId());
        KogitoWorkflowProcess workFlowProcess = execModelGen.process();
        ModelClassGenerator modelClassGenerator = processIdToModelGenerator.get(execModelGen.getProcessId());
        ProcessGenerator p = new ProcessGenerator(context(), workFlowProcess, execModelGen, classPrefix, modelClassGenerator.className(), applicationCanonicalName());
        ProcessInstanceGenerator pi = new ProcessInstanceGenerator(workFlowProcess.getPackageName(), classPrefix, modelClassGenerator.generate());
        ProcessMetaData metaData = processIdToMetadata.get(workFlowProcess.getId());
        // Creating and adding the ResourceGenerator
        ProcessResourceGenerator processResourceGenerator = new ProcessResourceGenerator(context(), workFlowProcess, modelClassGenerator.className(), execModelGen.className(), applicationCanonicalName());
        processResourceGenerator.withUserTasks(processIdToUserTaskModel.get(workFlowProcess.getId())).withSignals(metaData.getSignals()).withTriggers(metaData.isStartable(), metaData.isDynamic());
        rgs.add(processResourceGenerator);
        if (metaData.getTriggers() != null) {
            for (TriggerMetaData trigger : metaData.getTriggers()) {
                // generate message consumers for processes with message start events
                if (trigger.getType().equals(TriggerMetaData.TriggerType.ConsumeMessage)) {
                    MessageConsumerGenerator messageConsumerGenerator = new MessageConsumerGenerator(context(), workFlowProcess, modelClassGenerator.className(), execModelGen.className(), applicationCanonicalName(), trigger);
                    megs.add(messageConsumerGenerator);
                    metaData.getConsumers().put(trigger.getName(), messageConsumerGenerator.compilationUnit());
                } else if (trigger.getType().equals(TriggerMetaData.TriggerType.ProduceMessage)) {
                    MessageProducerGenerator messageProducerGenerator = new MessageProducerGenerator(context(), workFlowProcess, trigger);
                    mpgs.add(messageProducerGenerator);
                    metaData.getProducers().put(trigger.getName(), messageProducerGenerator.compilationUnit());
                }
            }
        }
        processGenerators.add(p);
        ps.add(p);
        pis.add(pi);
    }
    for (ModelClassGenerator modelClassGenerator : processIdToModelGenerator.values()) {
        ModelMetaData mmd = modelClassGenerator.generate();
        storeFile(MODEL_TYPE, modelClassGenerator.generatedFilePath(), mmd.generate());
    }
    for (ModelClassGenerator modelClassGenerator : processIdToModelGenerator.values()) {
        ModelMetaData mmd = modelClassGenerator.generate();
        storeFile(MODEL_TYPE, modelClassGenerator.generatedFilePath(), mmd.generate());
    }
    for (InputModelClassGenerator modelClassGenerator : processIdToInputModelGenerator.values()) {
        ModelMetaData mmd = modelClassGenerator.generate();
        storeFile(MODEL_TYPE, modelClassGenerator.generatedFilePath(), mmd.generate());
    }
    for (OutputModelClassGenerator modelClassGenerator : processIdToOutputModelGenerator.values()) {
        ModelMetaData mmd = modelClassGenerator.generate();
        storeFile(MODEL_TYPE, modelClassGenerator.generatedFilePath(), mmd.generate());
    }
    for (List<UserTaskModelMetaData> utmd : processIdToUserTaskModel.values()) {
        for (UserTaskModelMetaData ut : utmd) {
            storeFile(MODEL_TYPE, UserTasksModelClassGenerator.generatedFilePath(ut.getInputModelClassName()), ut.generateInput());
            storeFile(MODEL_TYPE, UserTasksModelClassGenerator.generatedFilePath(ut.getOutputModelClassName()), ut.generateOutput());
            storeFile(MODEL_TYPE, UserTasksModelClassGenerator.generatedFilePath(ut.getTaskModelClassName()), ut.generateModel());
        }
    }
    if (context().hasRESTForGenerator(this)) {
        for (ProcessResourceGenerator resourceGenerator : rgs) {
            storeFile(REST_TYPE, resourceGenerator.generatedFilePath(), resourceGenerator.generate());
            storeFile(MODEL_TYPE, UserTasksModelClassGenerator.generatedFilePath(resourceGenerator.getTaskModelFactoryClassName()), resourceGenerator.getTaskModelFactory());
        }
        // Generating the Producer classes for Dependency Injection
        StaticDependencyInjectionProducerGenerator.of(context()).generate().entrySet().forEach(entry -> storeFile(PRODUCER_TYPE, entry.getKey(), entry.getValue()));
    }
    for (MessageConsumerGenerator messageConsumerGenerator : megs) {
        storeFile(MESSAGE_CONSUMER_TYPE, messageConsumerGenerator.generatedFilePath(), messageConsumerGenerator.generate());
    }
    for (MessageProducerGenerator messageProducerGenerator : mpgs) {
        storeFile(MESSAGE_PRODUCER_TYPE, messageProducerGenerator.generatedFilePath(), messageProducerGenerator.generate());
    }
    for (ProcessGenerator p : ps) {
        storeFile(PROCESS_TYPE, p.generatedFilePath(), p.generate());
        p.getAdditionalClasses().forEach(cp -> {
            String packageName = cp.getPackageDeclaration().map(pd -> pd.getName().toString()).orElse("");
            String clazzName = cp.findFirst(ClassOrInterfaceDeclaration.class).map(cls -> cls.getName().toString()).get();
            String path = (packageName + "." + clazzName).replace('.', '/') + ".java";
            storeFile(GeneratedFileType.SOURCE, path, cp.toString());
        });
    }
    if ((context().getAddonsConfig().useProcessSVG())) {
        Map<String, String> svgs = context().getContextAttribute(ContextAttributesConstants.PROCESS_AUTO_SVG_MAPPING, Map.class);
        svgs.keySet().stream().forEach(key -> storeFile(GeneratedFileType.INTERNAL_RESOURCE, "META-INF/processSVG/" + key + ".svg", svgs.get(key)));
    }
    if (context().hasRESTForGenerator(this)) {
        final ProcessCloudEventMetaFactoryGenerator topicsGenerator = new ProcessCloudEventMetaFactoryGenerator(context(), processExecutableModelGenerators);
        storeFile(REST_TYPE, topicsGenerator.generatedFilePath(), topicsGenerator.generate());
    }
    for (ProcessInstanceGenerator pi : pis) {
        storeFile(PROCESS_INSTANCE_TYPE, pi.generatedFilePath(), pi.generate());
    }
    // generate Grafana dashboards
    if (context().getAddonsConfig().usePrometheusMonitoring()) {
        Optional<String> globalDbJson = generateOperationalDashboard(GLOBAL_OPERATIONAL_DASHBOARD_TEMPLATE, "Global", context().getPropertiesMap(), "Global", context().getGAV().orElse(KogitoGAV.EMPTY_GAV), false);
        String globalDbName = buildDashboardName(context().getGAV(), "Global");
        globalDbJson.ifPresent(dashboard -> generatedFiles.addAll(DashboardGeneratedFileUtils.operational(dashboard, globalDbName + ".json")));
        for (KogitoWorkflowProcess process : processes.values()) {
            String dbName = buildDashboardName(context().getGAV(), process.getId());
            Optional<String> dbJson = generateOperationalDashboard(PROCESS_OPERATIONAL_DASHBOARD_TEMPLATE, process.getId(), context().getPropertiesMap(), process.getId(), context().getGAV().orElse(KogitoGAV.EMPTY_GAV), false);
            dbJson.ifPresent(dashboard -> generatedFiles.addAll(DashboardGeneratedFileUtils.operational(dashboard, dbName + ".json")));
        }
    }
    return generatedFiles;
}
Also used : Arrays(java.util.Arrays) ServerlessWorkflowParser(org.kie.kogito.serverless.workflow.parser.ServerlessWorkflowParser) ProcessToExecModelGenerator(org.jbpm.compiler.canonical.ProcessToExecModelGenerator) XmlProcessReader(org.jbpm.compiler.xml.XmlProcessReader) LoggerFactory(org.slf4j.LoggerFactory) ProcessCloudEventMetaFactoryGenerator(org.kie.kogito.codegen.process.events.ProcessCloudEventMetaFactoryGenerator) FileSystemResource(org.drools.core.io.impl.FileSystemResource) BPMNSemanticModule(org.jbpm.bpmn2.xml.BPMNSemanticModule) CollectedResource(org.kie.kogito.codegen.api.io.CollectedResource) Map(java.util.Map) SemanticModules(org.drools.core.xml.SemanticModules) ModelMetaData(org.jbpm.compiler.canonical.ModelMetaData) KogitoBuildContext(org.kie.kogito.codegen.api.context.KogitoBuildContext) GeneratedFileType(org.kie.kogito.codegen.api.GeneratedFileType) ValidationLogDecorator(org.kie.kogito.process.validation.ValidationLogDecorator) Collection(java.util.Collection) Process(org.kie.api.definition.process.Process) Set(java.util.Set) ApplicationSection(org.kie.kogito.codegen.api.ApplicationSection) Reader(java.io.Reader) BPMNDISemanticModule(org.jbpm.bpmn2.xml.BPMNDISemanticModule) String.format(java.lang.String.format) Resource(org.kie.api.io.Resource) BPMNExtensionsSemanticModule(org.jbpm.bpmn2.xml.BPMNExtensionsSemanticModule) List(java.util.List) Stream(java.util.stream.Stream) ProcessConfigGenerator(org.kie.kogito.codegen.process.config.ProcessConfigGenerator) SAXException(org.xml.sax.SAXException) Optional(java.util.Optional) GeneratedFile(org.kie.kogito.codegen.api.GeneratedFile) ValidationException(org.kie.kogito.process.validation.ValidationException) ClassOrInterfaceDeclaration(com.github.javaparser.ast.body.ClassOrInterfaceDeclaration) StringUtils(org.drools.core.util.StringUtils) TriggerMetaData(org.jbpm.compiler.canonical.TriggerMetaData) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) ProcessValidatorRegistry(org.jbpm.process.core.validation.ProcessValidatorRegistry) WorkflowProcess(org.kie.api.definition.process.WorkflowProcess) ContextAttributesConstants(org.kie.kogito.codegen.api.context.ContextAttributesConstants) ValidationContext(org.kie.kogito.process.validation.ValidationContext) GrafanaConfigurationWriter.generateOperationalDashboard(org.kie.kogito.grafana.GrafanaConfigurationWriter.generateOperationalDashboard) UserTaskModelMetaData(org.jbpm.compiler.canonical.UserTaskModelMetaData) AbstractGenerator(org.kie.kogito.codegen.core.AbstractGenerator) GrafanaConfigurationWriter.buildDashboardName(org.kie.kogito.grafana.GrafanaConfigurationWriter.buildDashboardName) OpenApiClientWorkItemIntrospector(org.kie.kogito.codegen.process.openapi.OpenApiClientWorkItemIntrospector) Logger(org.slf4j.Logger) Files(java.nio.file.Files) IOException(java.io.IOException) File(java.io.File) GeneratedInfo(org.kie.kogito.codegen.api.GeneratedInfo) ProcessMetaData(org.jbpm.compiler.canonical.ProcessMetaData) Collectors.toList(java.util.stream.Collectors.toList) KogitoGAV(org.kie.kogito.KogitoGAV) Paths(java.nio.file.Paths) DashboardGeneratedFileUtils(org.kie.kogito.codegen.core.DashboardGeneratedFileUtils) KogitoWorkflowProcess(org.kie.kogito.internal.process.runtime.KogitoWorkflowProcess) Collections(java.util.Collections) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList) Collectors.toList(java.util.stream.Collectors.toList) WorkflowProcess(org.kie.api.definition.process.WorkflowProcess) KogitoWorkflowProcess(org.kie.kogito.internal.process.runtime.KogitoWorkflowProcess) OpenApiClientWorkItemIntrospector(org.kie.kogito.codegen.process.openapi.OpenApiClientWorkItemIntrospector) UserTaskModelMetaData(org.jbpm.compiler.canonical.UserTaskModelMetaData) ProcessToExecModelGenerator(org.jbpm.compiler.canonical.ProcessToExecModelGenerator) KogitoWorkflowProcess(org.kie.kogito.internal.process.runtime.KogitoWorkflowProcess) ProcessCloudEventMetaFactoryGenerator(org.kie.kogito.codegen.process.events.ProcessCloudEventMetaFactoryGenerator) TriggerMetaData(org.jbpm.compiler.canonical.TriggerMetaData) ModelMetaData(org.jbpm.compiler.canonical.ModelMetaData) UserTaskModelMetaData(org.jbpm.compiler.canonical.UserTaskModelMetaData) ProcessMetaData(org.jbpm.compiler.canonical.ProcessMetaData)

Aggregations

ClassOrInterfaceDeclaration (com.github.javaparser.ast.body.ClassOrInterfaceDeclaration)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Map (java.util.Map)2 Optional (java.util.Optional)2 StringUtils (org.drools.core.util.StringUtils)2 ProcessMetaData (org.jbpm.compiler.canonical.ProcessMetaData)2 TriggerMetaData (org.jbpm.compiler.canonical.TriggerMetaData)2 Process (org.kie.api.definition.process.Process)2 StaticJavaParser.parseClassOrInterfaceType (com.github.javaparser.StaticJavaParser.parseClassOrInterfaceType)1 CompilationUnit (com.github.javaparser.ast.CompilationUnit)1 Modifier (com.github.javaparser.ast.Modifier)1 Keyword (com.github.javaparser.ast.Modifier.Keyword)1 NodeList (com.github.javaparser.ast.NodeList)1 ConstructorDeclaration (com.github.javaparser.ast.body.ConstructorDeclaration)1 FieldDeclaration (com.github.javaparser.ast.body.FieldDeclaration)1 MethodDeclaration (com.github.javaparser.ast.body.MethodDeclaration)1 Parameter (com.github.javaparser.ast.body.Parameter)1 VariableDeclarator (com.github.javaparser.ast.body.VariableDeclarator)1 AssignExpr (com.github.javaparser.ast.expr.AssignExpr)1