本文整理汇总了Java中org.activiti.engine.ProcessEngine.getRepositoryService方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessEngine.getRepositoryService方法的具体用法?Java ProcessEngine.getRepositoryService怎么用?Java ProcessEngine.getRepositoryService使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.ProcessEngine
的用法示例。
在下文中一共展示了ProcessEngine.getRepositoryService方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getImage
import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
@Test
public void getImage() throws IOException {
ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml").buildProcessEngine();
logger.info("### ============= 创建Activiti流程引擎实例, {}", processEngine);
RepositoryService repositoryService = processEngine.getRepositoryService();
//通过流程ID(XML上写的)找到流程
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
.processDefinitionId("请假流程:2:10004")
.singleResult();
String diagramResourceName = processDefinition.getDiagramResourceName();
logger.info(diagramResourceName);
InputStream imageStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), diagramResourceName);
FileUtils.writeByteArrayToFile(new File("F:\\123456.png"),IOUtils.toByteArray(imageStream));
imageStream.close();
processEngine.close();
}
示例2: testStartProcess
import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
@Test
public void testStartProcess() throws Exception {
// 创建流程引擎,使用内存数据库
ProcessEngine processEngine = ProcessEngineConfiguration
.createStandaloneInMemProcessEngineConfiguration()
.buildProcessEngine();
// 部署流程定义文件
RepositoryService repositoryService = processEngine.getRepositoryService();
String processFileName = "me/kafeitu/activiti/helloworld/sayhelloleave.bpmn";
repositoryService.createDeployment().addClasspathResource(processFileName)
.deploy();
// 验证已部署流程定义
ProcessDefinition processDefinition = repositoryService
.createProcessDefinitionQuery().singleResult();
assertEquals("leavesayhello", processDefinition.getKey());
// 启动流程并返回流程实例
RuntimeService runtimeService = processEngine.getRuntimeService();
ProcessInstance processInstance = runtimeService
.startProcessInstanceByKey("leavesayhello");
assertNotNull(processInstance);
System.out.println("pid=" + processInstance.getId() + ", pdid="
+ processInstance.getProcessDefinitionId());
}
示例3: main
import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) {
// 创建流程引擎
ProcessEngine engine = ProcessEngines
.getDefaultProcessEngine();
// 得到流程存储服务组件
RepositoryService repositoryService = engine.getRepositoryService();
// 得到运行时服务组件
RuntimeService runtimeService = engine.getRuntimeService();
// 部署流程文件
repositoryService.createDeployment()
.addClasspathResource("com/roger/activiti/workflow/CompensationBoundaryEvent.bpmn").deploy();
// 初始化参数
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("result", false);
runtimeService.startProcessInstanceByKey("cbProcess", vars);
}
开发者ID:yudar1024,项目名称:spring4-springmvc4-mybatis3-activiti,代码行数:17,代码来源:CompensationBoundaryEvent.java
示例4: main
import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) {
// 创建流程引擎
ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
// 得到流程存储服务组件
RepositoryService repositoryService = engine.getRepositoryService();
// 得到运行时服务组件
RuntimeService runtimeService = engine.getRuntimeService();
// 得到任务服务组件
TaskService taskService = engine.getTaskService();
// 得到管理服务组件
ManagementService managementService = engine.getManagementService();
// 部署流程文件
repositoryService.createDeployment()
.addClasspathResource("bpmn/SignalThrowingEvent.bpmn").deploy();
// 启动流程
runtimeService.startProcessInstanceByKey("stProcess");
// 完成选择商品任务
Task firstTask = taskService.createTaskQuery().singleResult();
taskService.complete(firstTask.getId());
// 完成用户支付任务
Task payTask = taskService.createTaskQuery().singleResult();
taskService.complete(payTask.getId());
// 由于使用了异步的中间Throwing事件,因此会产生2条工作数据
List<Job> jobs = managementService.createJobQuery().list();
System.out.println(jobs.size());
}
示例5: main
import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) {
// 创建流程引擎
ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
// 得到流程存储服务组件
RepositoryService repositoryService = engine.getRepositoryService();
// 得到运行时服务组件
RuntimeService runtimeService = engine.getRuntimeService();
TaskService taskService = engine.getTaskService();
// 部署流程文件
repositoryService.createDeployment()
.addClasspathResource("bpmn/MessageCatchingEvent.bpmn").deploy();
// 启动流程
ProcessInstance pi = runtimeService.startProcessInstanceByKey("mcProcess");
Execution exe = runtimeService.createExecutionQuery().activityId("messageintermediatecatchevent1").singleResult();
runtimeService.messageEventReceived("myMsg", exe.getId());
// 输出当前的任务
List<Task> tasks = taskService.createTaskQuery().list();
for (Task task : tasks) {
System.out.println(task.getName());
}
}
示例6: main
import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) {
// 创建流程引擎
ProcessEngine engine = ProcessEngines
.getDefaultProcessEngine();
// 得到流程存储服务组件
RepositoryService repositoryService = engine.getRepositoryService();
// 得到运行时服务组件
RuntimeService runtimeService = engine.getRuntimeService();
// 获取流程任务组件
TaskService taskService = engine.getTaskService();
// 部署流程文件
repositoryService.createDeployment()
.addClasspathResource("bpmn/ErrorBoundaryEvent.bpmn").deploy();
// 启动流程
runtimeService.startProcessInstanceByKey("ebProcess");
// 进行任务查询
Task task = taskService.createTaskQuery().singleResult();
System.out.println(task.getName());
}
示例7: main
import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) {
// 创建流程引擎
ProcessEngine engine = ProcessEngines.getDefaultProcessEngine();
// 得到流程存储服务组件
RepositoryService repositoryService = engine.getRepositoryService();
// 得到运行时服务组件
RuntimeService runtimeService = engine.getRuntimeService();
TaskService taskService = engine.getTaskService();
// 部署流程文件
repositoryService.createDeployment()
.addClasspathResource("bpmn/SignalCatchingEvent.bpmn").deploy();
// 启动流程
runtimeService.startProcessInstanceByKey("scProcess");
Task firstTask = taskService.createTaskQuery().singleResult();
taskService.complete(firstTask.getId());
// 此时会出现并行的两个流程分支,查找用户任务并完成
Task payTask = taskService.createTaskQuery().singleResult();
// 完成任务
taskService.complete(payTask.getId());
// 发送信号完成支付
runtimeService.signalEventReceived("finishPay");
Task finishTask = taskService.createTaskQuery().singleResult();
System.out.println("当前流程任务:" + finishTask.getName());
}
示例8: main
import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
// Build process enigne
ProcessEngine processEngine = new StandaloneInMemProcessEngineConfiguration()
// enable process definition info cache
.setEnableProcessDefinitionInfoCache(true)
.buildProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();
// deploy process definition
repositoryService.createDeployment()
.addClasspathResource("dynamic-service-task.bpmn20.xml")
.deploy();
// this will invoke OldServiceTask
ProcessInstance processInstance =
runtimeService.startProcessInstanceByKey("dynamic-service-task");
String processDefinitionId = processInstance.getProcessDefinitionId();
// change service task class name
System.out.println("==== changing service task class name ====");
DynamicBpmnService dynamicBpmnService = processEngine.getDynamicBpmnService();
ObjectNode infoNode = dynamicBpmnService
.changeServiceTaskClassName("dynamicServiceTask",
"org.activiti.examples.NewServiceTask");
dynamicBpmnService.saveProcessDefinitionInfo(processDefinitionId, infoNode);
// this will invoke NewServiceTask
processInstance = runtimeService.startProcessInstanceByKey("dynamic-service-task");
}
示例9: main
import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
// Build process enigne
ProcessEngine processEngine = new StandaloneInMemProcessEngineConfiguration()
// enable process definition info cache
.setEnableProcessDefinitionInfoCache(true)
.buildProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();
RuntimeService runtimeService = processEngine.getRuntimeService();
// deploy process definition
repositoryService.createDeployment()
.addClasspathResource("dynamic-script-task.bpmn20.xml")
.deploy();
String processDefinitionId = repositoryService.createProcessDefinitionQuery()
.singleResult().getId();
DynamicBpmnService dynamicBpmnService = processEngine.getDynamicBpmnService();
ObjectNode infoNode = dynamicBpmnService
.changeScriptTaskScript("scriptTask",
"java.lang.System.out.println(\"New output\");");
dynamicBpmnService.saveProcessDefinitionInfo(processDefinitionId, infoNode);
// start a process instance
runtimeService.startProcessInstanceByKey("dynamic-script-task");
}
示例10: ActivitiUtil
import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public ActivitiUtil(ProcessEngine engine, boolean deployWorkflowsInTenant)
{
this.repoService = engine.getRepositoryService();
this.runtimeService = engine.getRuntimeService();
this.taskService = engine.getTaskService();
this.historyService = engine.getHistoryService();
this.formService = engine.getFormService();
this.managementService = engine.getManagementService();
this.deployWorkflowsInTenant = deployWorkflowsInTenant;
}
示例11: testDeploy
import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
public void testDeploy() throws Exception
{
ProcessEngine engine = buildProcessEngine();
RepositoryService repoService = engine.getRepositoryService();
Deployment deployment = deployDefinition(repoService);
assertNotNull(deployment);
RuntimeService runtimeService = engine.getRuntimeService();
try
{
ProcessInstance instance = runtimeService.startProcessInstanceByKey("testTask");
assertNotNull(instance);
String instanceId = instance.getId();
ProcessInstance instanceInDb = findProcessInstance(runtimeService, instanceId);
assertNotNull(instanceInDb);
runtimeService.deleteProcessInstance(instanceId, "");
}
finally
{
// List<Deployment> deployments = repoService.createDeploymentQuery().list();
// for (Deployment deployment2 : deployments)
// {
// repoService.deleteDeployment(deployment2.getId());
// }
repoService.deleteDeployment(deployment.getId());
}
}
示例12: generateTestData
import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
@Override
public void generateTestData(ProcessEngine processEngine) {
RepositoryService repositoryService = processEngine.getRepositoryService();
repositoryService.createDeployment().addClasspathResource("expressionInJavaDelegateProcess.bpmn20.xml").deploy();
RuntimeService runtimeService = processEngine.getRuntimeService();
runtimeService.startProcessInstanceByKey("expressionInJavaDelegate");
}
示例13: generateTestData
import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
@Override
public void generateTestData(ProcessEngine processEngine) {
RepositoryService repositoryService = processEngine.getRepositoryService();
repositoryService.createDeployment().addClasspathResource("oneTaskProcess.bpmn20.xml").deploy();
RuntimeService runtimeService = processEngine.getRuntimeService();
runtimeService.startProcessInstanceByKey("oneTaskProcess", "activitiv5-one-task-process");
}
示例14: generateTestData
import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
@Override
public void generateTestData(ProcessEngine processEngine) {
RepositoryService repositoryService = processEngine.getRepositoryService();
repositoryService.createDeployment().addClasspathResource("parseHandlerProcess.bpmn20.xml").deploy();
RuntimeService runtimeService = processEngine.getRuntimeService();
runtimeService.startProcessInstanceByKey("parseHandlerTestProcess");
}
示例15: generateTestData
import org.activiti.engine.ProcessEngine; //导入方法依赖的package包/类
@Override
public void generateTestData(ProcessEngine processEngine) {
RepositoryService repositoryService = processEngine.getRepositoryService();
repositoryService.createDeployment().addClasspathResource("javaDelegateProcess.bpmn20.xml").deploy();
RuntimeService runtimeService = processEngine.getRuntimeService();
runtimeService.startProcessInstanceByKey("javaDelegateTestProcess");
}