org.kie.kogito.examples.Application Maven / Gradle / Ivy
package org.kie.kogito.examples;
import org.kie.kogito.Config;
import org.kie.kogito.process.Processes;
import org.kie.kogito.uow.UnitOfWorkManager;
@javax.inject.Singleton()
public class Application implements org.kie.kogito.Application {
@javax.inject.Inject()
javax.enterprise.inject.Instance eventPublishers;
@org.eclipse.microprofile.config.inject.ConfigProperty(name = "kogito.service.url")
java.util.Optional kogitoService;
@javax.inject.Inject()
org.kie.kogito.Config config;
Processes processes = new Processes();
public Config config() {
return config;
}
public UnitOfWorkManager unitOfWorkManager() {
return config().process().unitOfWorkManager();
}
@javax.annotation.PostConstruct()
public void setup() {
if (config().process() != null) {
if (eventPublishers != null) {
eventPublishers.forEach(publisher -> unitOfWorkManager().eventManager().addPublisher(publisher));
}
unitOfWorkManager().eventManager().setService(kogitoService.orElse(""));
unitOfWorkManager().eventManager().setAddons(config().addons());
}
}
public Processes processes() {
return processes;
}
public class Processes implements org.kie.kogito.process.Processes {
public org.kie.kogito.process.Process extends org.kie.kogito.Model> processById(String processId) {
if ("onboarding.onboarding".equals(processId))
return new org.kie.kogito.examples.onboarding.OnboardingProcess(Application.this).configure();
if ("onboarding.setupHR".equals(processId))
return new org.kie.kogito.examples.onboarding.SetupHRProcess(Application.this).configure();
if ("onboarding.setupPayroll".equals(processId))
return new org.kie.kogito.examples.onboarding.SetupPayrollProcess(Application.this).configure();
return null;
}
public java.util.Collection processIds() {
return java.util.Arrays.asList("onboarding.onboarding", "onboarding.setupHR", "onboarding.setupPayroll");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy