10-29-2014 03:45 PM
package fluis;
import java.util.List;
import org.activiti.engine.HistoryService;
import org.activiti.engine.IdentityService;
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.FormService;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.history.HistoricProcessInstance;
import org.activiti.engine.identity.*;
import org.activiti.engine.task.Task;
public class adduser {
protected transient static ProcessEngine processEngine;
protected transient static IdentityService identityService;
protected transient static RepositoryService repositoryService;
protected transient static RuntimeService runtimeService;
protected transient static HistoryService historyService;
protected transient static FormService formService;
public static void initProcessEngineServices(){
processEngine = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration()
.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE)
.setJdbcDriver("org.h2.Driver")
.setJdbcUrl("jdbc:h2:tcp://localhost/activiti;DB_CLOSE_DELAY=1000")
.setJobExecutorActivate(true)
.buildProcessEngine();
repositoryService = processEngine.getRepositoryService();
runtimeService = processEngine.getRuntimeService();
historyService = processEngine.getHistoryService();
}
public static void initDeployments(){
repositoryService.createDeployment()
.addClasspathResource("processes/createTimersProcess.bpmn20.xml")
.addClasspathResource("processes/FinancialReportProcess.bpmn20.xml")
.deploy();
}
public static void newDeployment(String fileName){
processEngine.getRepositoryService().createDeployment().addClasspathResource("processes/" + fileName).deploy();
}
public static void createUser(String userId, String firstName, String lastName, String email){
if (identityService.createUserQuery().userId(userId).count() == 0) {
User user = identityService.newUser(userId);
user.setFirstName(firstName);
user.setLastName(lastName);
user.setPassword("");
user.setEmail(email);
identityService.saveUser(user);
}
}
public static void main(String[] args) {
initProcessEngineServices();
initDeployments();
newDeployment("oneTaskProcess.bpmn20.xml");
createUser("myid", "hermit", "stone", "kermit@kmail.com");
// User x = identityService.newUser("gty");
// System.out.println("asd");
}
}
10-30-2014 01:38 AM
10-30-2014 10:47 AM
10-30-2014 11:25 AM
11-02-2014 03:43 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.