10-05-2015 10:49 PM
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
if (processEngine == null) {
logger.error("Could not start the Activiti Engine");
return;
}
RepositoryService repositoryService = processEngine.getRepositoryService();
FormService formService = processEngine.getFormService();
TaskService taskService = processEngine.getTaskService();
IdentityService identityService = processEngine.getIdentityService();
// tried to create a new user using identity service, but still no impact
User kermit = identityService.newUser("kermit");
logger.info("Created kermit user:id=" + kermit.getId());
identityService.saveUser(kermit);
// tried setting authenticated user id as well, no impact
identityService.setAuthenticatedUserId("kermit");
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
try {
InputStream is = new FileInputStream(new File("C:/Users/Yee_Keat/Development/Adama/MyProcess.bpmn"));
deploymentBuilder.addInputStream("MyProcess", is);
Deployment deployment = deploymentBuilder.deploy();
logger.info("Deployed:id=" + deployment.getId() + ",name=" + deployment.getName());
is.close();
} catch (IOException e) {
logger.error("failed to deploy", e);
} catch (ActivitiException e) {
logger.error("failed to deploy", e);
}
List<ProcessDefinition> startableByKermit = repositoryService.createProcessDefinitionQuery().startableByUser(kermit.getId()).list();
// expecting to see some results from here, as my file have candidateStartUser=kermit configured
logger.info("processes that can be started by kermit = " + startableByKermit.size());
for (ProcessDefinition p : processDefinitions) {
logger.info("Process Definition:id=" + p.getId() + ",name=" + p.getName());
}
10-07-2015 02:45 AM
org.activiti.examples.bpmn.authorization.StartAuthorizationTest
in activiti source. There are an examples of the query.10-07-2015 02:48 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.