diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2014-04-21 17:06:56 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2014-04-21 17:06:56 +0200 |
commit | 76da6008dec491652f15f1148a4a68f30659b27b (patch) | |
tree | b4e1b21a5cf6e7338881191fcfcd404d9a5994f2 /calamus-engine | |
parent | fd681e2c6663652be02a31f7b40da4cd283ab37e (diff) | |
download | calamus-76da6008dec491652f15f1148a4a68f30659b27b.tar.gz calamus-76da6008dec491652f15f1148a4a68f30659b27b.tar.bz2 calamus-76da6008dec491652f15f1148a4a68f30659b27b.tar.xz calamus-76da6008dec491652f15f1148a4a68f30659b27b.zip |
Diffstat (limited to 'calamus-engine')
3 files changed, 35 insertions, 8 deletions
diff --git a/calamus-engine/src/main/java/io/trygvis/calamus/engine/CalamusJbpm.java b/calamus-engine/src/main/java/io/trygvis/calamus/engine/CalamusJbpm.java index af6f489..fd86b6e 100644 --- a/calamus-engine/src/main/java/io/trygvis/calamus/engine/CalamusJbpm.java +++ b/calamus-engine/src/main/java/io/trygvis/calamus/engine/CalamusJbpm.java @@ -58,8 +58,8 @@ public class CalamusJbpm { // session.addEventListener(AuditLoggerFactory.newJPAInstance(env)); // session.getWorkItemManager().registerWorkItemHandler("Service Task", new ServiceTaskHandler()); -// session.getWorkItemManager().registerWorkItemHandler("Upgrade App", new UpgradeAppWorkItemHandler()); -// session.getWorkItemManager().registerWorkItemHandler("Restart App", new RestartAppWorkItemHandler()); + session.getWorkItemManager().registerWorkItemHandler("Upgrade App", new UpgradeAppWorkItemHandler()); + session.getWorkItemManager().registerWorkItemHandler("Restart App", new RestartAppWorkItemHandler()); } public TransactionTemplate getTransactionTemplate() { diff --git a/calamus-engine/src/main/java/io/trygvis/calamus/engine/CalamusJbpmConfig.java b/calamus-engine/src/main/java/io/trygvis/calamus/engine/CalamusJbpmConfig.java index edfda28..3aaad13 100644 --- a/calamus-engine/src/main/java/io/trygvis/calamus/engine/CalamusJbpmConfig.java +++ b/calamus-engine/src/main/java/io/trygvis/calamus/engine/CalamusJbpmConfig.java @@ -1,8 +1,13 @@ package io.trygvis.calamus.engine; +import org.drools.core.marshalling.impl.ClassObjectMarshallingStrategyAcceptor; +import org.drools.core.marshalling.impl.SerializablePlaceholderResolverStrategy; +import org.drools.persistence.jpa.marshaller.JPAPlaceholderResolverStrategy; import org.jbpm.process.audit.JPAAuditLogService; import org.kie.api.io.Resource; import org.kie.api.io.ResourceType; +import org.kie.api.marshalling.ObjectMarshallingStrategy; +import org.kie.api.runtime.EnvironmentName; import org.kie.api.runtime.manager.RuntimeEnvironment; import org.kie.api.runtime.manager.RuntimeManager; import org.kie.internal.io.ResourceFactory; @@ -31,16 +36,15 @@ public class CalamusJbpmConfig { @Bean @Lazy public RuntimeEnvironmentFactoryBean runtimeEnvironment(DataSource dataSource, CalamusDbConfig.DbMigrations dbMigrations, EntityManagerFactory entityManagerFactory, PlatformTransactionManager platformTransactionManager) { - System.out.println("CalamusConfig.runtimeEnvironmentFactoryBean"); - System.out.println("dataSource = " + dataSource); - System.out.println("dbMigrations = " + dbMigrations); - System.out.println("entityManagerFactory = " + entityManagerFactory); - System.out.println("platformTransactionManager = " + platformTransactionManager); +// System.out.println("CalamusConfig.runtimeEnvironmentFactoryBean"); +// System.out.println("dataSource = " + dataSource); +// System.out.println("dbMigrations = " + dbMigrations); +// System.out.println("entityManagerFactory = " + entityManagerFactory); +// System.out.println("platformTransactionManager = " + platformTransactionManager); RuntimeEnvironmentFactoryBean x = new RuntimeEnvironmentFactoryBean(); x.setType("DEFAULT"); Map<Resource, ResourceType> assets = new HashMap<>(); - System.out.println("getClass().getClassLoader() = " + getClass().getClassLoader()); assets.put(ResourceFactory.newClassPathResource("Deploy.bpmn2", getClass()), ResourceType.BPMN2); x.setAssets(assets); // x.setClassLoader(getClass().getClassLoader()); @@ -48,6 +52,17 @@ public class CalamusJbpmConfig { x.setEntityManagerFactory(entityManagerFactory); x.setTransactionManager(platformTransactionManager); + ObjectMarshallingStrategy[] objectMarshallingStrategies = { + // set the entity manager factory for jpa strategy so it + // know how to store and read entities + new JPAPlaceholderResolverStrategy(entityManagerFactory), + // set the serialization based strategy as last one to + // deal with non entities classes + new SerializablePlaceholderResolverStrategy(ClassObjectMarshallingStrategyAcceptor.DEFAULT) + }; + x.setEnvironmentEntries(new HashMap<>()); + x.getEnvironmentEntries().put(EnvironmentName.OBJECT_MARSHALLING_STRATEGIES, objectMarshallingStrategies); + return x; } diff --git a/calamus-engine/src/main/resources/db/public/V001_001__data.sql b/calamus-engine/src/main/resources/db/public/V001_001__data.sql new file mode 100644 index 0000000..2a53212 --- /dev/null +++ b/calamus-engine/src/main/resources/db/public/V001_001__data.sql @@ -0,0 +1,12 @@ +INSERT INTO process (id, name, jbpm_process_id) +VALUES ((SELECT + nextval('calamus_seq')), 'Deploy', 'io.trygvis.calamus.Deploy'); + +INSERT INTO process_trigger (id, process, mvel) +VALUES ((SELECT + nextval('calamus_seq')), + (SELECT + id + FROM process + WHERE jbpm_process_id = 'io.trygvis.calamus.Deploy'), + 'artifact.groupId == "demo"'); |