Skip to content

Commit

Permalink
added easier demo generation with improved synchronization
Browse files Browse the repository at this point in the history
  • Loading branch information
berndruecker committed Nov 23, 2015
1 parent 6d05962 commit 564972e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<camunda.version>7.3.0</camunda.version>
<camunda.version>7.4.0-alpha3</camunda.version>
</properties>

<dependencies>
<dependency>
<groupId>com.camunda.demo.environment</groupId>
<groupId>org.camunda.consulting.snippets</groupId>
<artifactId>camunda-demo-support</artifactId>
<version>0.1.0</version>
</dependency>
<version>0.3.2-SNAPSHOT</version>
</dependency>

<dependency>
<!-- process engine, needs to be provided -->
Expand Down Expand Up @@ -75,11 +75,11 @@

<!-- Add your own dependencies here, if in compile scope, they are added
to the war -->
<!-- <dependency> -->
<!-- <groupId>desmoj</groupId> -->
<!-- <artifactId>desmoj</artifactId> -->
<!-- <version>2.1.1</version> -->
<!-- </dependency> -->
<!-- <dependency> -->
<!-- <groupId>desmoj</groupId> -->
<!-- <artifactId>desmoj</artifactId> -->
<!-- <version>2.1.1</version> -->
<!-- </dependency> -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package com.camunda.demo.environment;

import java.util.logging.Logger;

import org.camunda.bpm.engine.ProcessEngine;

public class LicenseHelper {

private final static Logger LOGGER = Logger.getLogger(LicenseHelper.class.getName());

/**
* Set license from user home
*/
Expand All @@ -15,7 +19,8 @@ public static void setLicense(ProcessEngine processEngine) {
}

public static void setLicense(ProcessEngine processEngine, String licenseKey) {
processEngine.getManagementService().setProperty("camunda-license-key", licenseKey);
LOGGER.info("Set license to provided license key");

processEngine.getManagementService().setProperty("camunda-license-key", licenseKey);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.camunda.demo.environment;

import org.camunda.bpm.application.ProcessApplicationReference;
import org.camunda.bpm.engine.ProcessEngine;

public class ProcessApplicationDemoSetup {

public static void executeDefaultSetup(ProcessEngine engine, String processDefinitionKey) {
executeDefaultSetup(engine, processDefinitionKey, null);
}

public static void executeDefaultSetup(ProcessEngine engine, String processDefinitionKey, ProcessApplicationReference reference) {
synchronized (engine) {
LicenseHelper.setLicense(engine);
DemoDataGenerator.autoGenerateFor(engine, processDefinitionKey, 14, reference);
UserDataGenerator.createDefaultUsers(engine);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,16 @@
import org.camunda.bpm.engine.authorization.Resources;
import org.camunda.bpm.engine.identity.Group;
import org.camunda.bpm.engine.identity.User;
import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.camunda.bpm.engine.impl.persistence.entity.AuthorizationEntity;

public class UserDataGenerator {

private final static Logger LOGGER = Logger.getLogger(UserDataGenerator.class.getName());

public static void createDemoData(ProcessEngine engine) {

}


public static void createDefaultUsers(ProcessEngine engine) {
LOGGER.info("Generating default users for showroom");

// /////////////////////////////////////
// create user as otherwise the invoice exmaple will re-create users
// gets no authorizations - cannot do any harm :-)
Expand Down

0 comments on commit 564972e

Please sign in to comment.