Skip to content

Commit

Permalink
java example app
Browse files Browse the repository at this point in the history
fixes #14
  • Loading branch information
jangalinski committed Jul 10, 2024
1 parent ce9acbc commit 5001567
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 2 deletions.
21 changes: 21 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,27 @@
</compilerPlugins>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<phase>process-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package io.holunda.camunda.platform.adminprocess.java._test;

import io.holunda.camunda.bpm.data.CamundaBpmData;
import io.holunda.camunda.platform.adminprocess.AdminProcess;
import io.holunda.camunda.platform.adminprocess.form.BooleanField;
import io.holunda.camunda.platform.adminprocess.form.DateField;
import io.holunda.camunda.platform.adminprocess.form.LongField;
import io.holunda.camunda.platform.adminprocess.form.StringField;
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import static io.holunda.camunda.platform.adminprocess.AdminProcess.builder;

@EnableProcessApplication
@SpringBootApplication
public class CamundaAdminProcessRegistryTestJavaApplication {

private static final Logger logger = LoggerFactory.getLogger(CamundaAdminProcessRegistryTestJavaApplication.class);

public static void main(String[] args) {
SpringApplication.run(CamundaAdminProcessRegistryTestJavaApplication.class, args);
}

@Bean
AdminProcess helloWorldAdminProcess() {

var stringField = new StringField("fooId", "Foo - enter your name");
var dateField = new DateField("dateId", "Date - select some magic");
var numberField = new LongField("longId", "A number");
var booleanField = new BooleanField("booleanId", "Yes or no?");

return builder("helloWorldJava")
.label("Hello World Java")
.addFormField(stringField)
.addFormField(dateField)
.addFormField(numberField)
.addFormField(booleanField)
.delegate(execution -> {
var reader = CamundaBpmData.reader(execution);

logger.info(" Hi, I am the process running with:");
logger.info("foo: {}", reader.get(stringField));
logger.info("date: {}", reader.get(dateField));
logger.info("number: {}", reader.get(numberField));
logger.info("yes: {}", reader.get(booleanField));
})
.build();
}
}
3 changes: 1 addition & 2 deletions src/test/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
spring:
application:
name: fiege-camunda-example
name: camunda-admin-process-example
datasource:
url: jdbc:h2:mem:example-simple;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
jpa:
Expand All @@ -9,7 +9,6 @@ spring:
server:
port: 12345


camunda:
bpm:
login:
Expand Down

0 comments on commit 5001567

Please sign in to comment.