gitgabrio commented on code in PR #3850:
URL: 
https://github.com/apache/incubator-kie-kogito-runtimes/pull/3850#discussion_r1969955675


##########
kogito-codegen-modules/kogito-codegen-processes/src/main/java/org/kie/kogito/codegen/process/ProcessCodegen.java:
##########
@@ -582,4 +591,44 @@ public Optional<ApplicationSection> section() {
     public int priority() {
         return 10;
     }
+
+    private void processProducerTemplate(String statement) {
+        TemplatedGenerator generator = TemplatedGenerator.builder()
+                .withTemplateBasePath("/class-templates/producer/")
+                .withFallbackContext(JavaKogitoBuildContext.CONTEXT_NAME)
+                .withTargetTypeName(BUSINESS_CALENDAR_PRODUCER_TEMPLATE)
+                .build(context(), BUSINESS_CALENDAR_PRODUCER_TEMPLATE);
+        CompilationUnit compilationUnit = generator.compilationUnitOrThrow();
+        if (Objects.nonNull(statement)) {
+            String constructorBody = String.format("{ this.businessCalendar =  
%s; }", statement);
+            NodeList<com.github.javaparser.ast.stmt.Statement> statements = 
StaticJavaParser.parseBlock(constructorBody).getStatements();
+            
compilationUnit.findFirst(ClassOrInterfaceDeclaration.class).flatMap(NodeWithMembers::getDefaultConstructor)
+                    .ifPresent(a -> a.setBody(new BlockStmt(statements)));
+        }
+        storeFile(PRODUCER_TYPE, generator.generatedFilePath(), 
compilationUnit.toString());
+    }
+
+    private String deriveBusinessCalendarDeclarationStatement(String 
businessCalendarClassName) {

Review Comment:
   @Abhitocode 
   Please replace the returned object to `Optional<Expression>`
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to