本文整理汇总了Java中org.activiti.engine.repository.DeploymentBuilder.addClasspathResource方法的典型用法代码示例。如果您正苦于以下问题:Java DeploymentBuilder.addClasspathResource方法的具体用法?Java DeploymentBuilder.addClasspathResource怎么用?Java DeploymentBuilder.addClasspathResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.repository.DeploymentBuilder
的用法示例。
在下文中一共展示了DeploymentBuilder.addClasspathResource方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deployProcesses
import org.activiti.engine.repository.DeploymentBuilder; //导入方法依赖的package包/类
/**
* Deploys all processes listed in the {@link #PROCESSES_FILE_NAME}-file.
*/
public void deployProcesses() {
// build a single deployment containing all discovered processes
Set<String> resourceNames = getResourceNames();
if (resourceNames.size() == 0) {
logger.fine("Not creating a deployment");
return;
}
logger.fine("Start deploying processes.");
DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment();
for (String string : resourceNames) {
logger.info("Adding '" + string + "' to deployment.");
deploymentBuilder.addClasspathResource(string);
}
// deploy the processes
deploymentBuilder.deploy();
logger.fine("Done deploying processes.");
}
示例2: testClasspathDeployment111
import org.activiti.engine.repository.DeploymentBuilder; //导入方法依赖的package包/类
@Test
public void testClasspathDeployment111() throws Exception {
// 定义classpath
String bpmnClasspath = "chapter5/candidateUserInUserTask.bpmn";
// 创建部署构建器
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
// 添加资源
deploymentBuilder.addClasspathResource(bpmnClasspath);
// 执行部署
deploymentBuilder.deploy();
// 验证流程定义是否部署成功
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
long count = processDefinitionQuery.processDefinitionKey("candidateUserInUserTask").count();
assertEquals(1, count);
Map<String, Object> vars = new HashMap<String, Object>();
ArrayList<Date> objs = new ArrayList<Date>();
objs.add(new Date());
vars.put("list", objs);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("candidateUserInUserTask", vars);
Task task = taskService.createTaskQuery().includeProcessVariables().singleResult();
assertNotNull(task.getProcessVariables());
}
示例3: deployProcess
import org.activiti.engine.repository.DeploymentBuilder; //导入方法依赖的package包/类
/**
* Deploys a single process
*
* @return the processDefinitionId of the deployed process as returned by
* {@link ProcessDefinition#getId()}
*/
public String deployProcess(String resourceName) {
logger.fine("Start deploying single process.");
// deploy processes as one deployment
DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment();
deploymentBuilder.addClasspathResource(resourceName);
// deploy the processes
Deployment deployment = deploymentBuilder.deploy();
logger.fine("Process deployed");
// retreive the processDefinitionId for this process
return processEngine.getRepositoryService().createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult().getId();
}
示例4: testClasspathDeployment
import org.activiti.engine.repository.DeploymentBuilder; //导入方法依赖的package包/类
@Test
public void testClasspathDeployment() throws Exception {
// 定义classpath
String bpmnClasspath = "chapter5/candidateUserInUserTask.bpmn";
String pngClasspath = "chapter5/candidateUserInUserTask.png";
// 创建部署构建器
DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
// 添加资源
deploymentBuilder.addClasspathResource(bpmnClasspath);
deploymentBuilder.addClasspathResource(pngClasspath);
// 执行部署
deploymentBuilder.deploy();
// 验证流程定义是否部署成功
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
long count = processDefinitionQuery.processDefinitionKey("candidateUserInUserTask").count();
assertEquals(1, count);
// 读取图片文件
ProcessDefinition processDefinition = processDefinitionQuery.singleResult();
String diagramResourceName = processDefinition.getDiagramResourceName();
assertEquals(pngClasspath, diagramResourceName);
Map<String, Object> vars = new HashMap<String, Object>();
ArrayList<Date> objs = new ArrayList<Date>();
objs.add(new Date());
vars.put("list", objs);
// vars.put("aaa", "333");
runtimeService.startProcessInstanceByKey("candidateUserInUserTask", vars);
List<Task> list = taskService.createTaskQuery().includeProcessVariables().list();
System.out.println(list);
Task task = taskService.createTaskQuery().taskId(list.get(0).getId())
.includeProcessVariables().includeTaskLocalVariables().singleResult();
CommandContext commandContext = Context.getCommandContext();
System.out.println(task);
System.out.println(commandContext);
// ProcessEngineImpl defaultProcessEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();
// Context.setProcessEngineConfiguration(defaultProcessEngine.getProcessEngineConfiguration());
// Context.setCommandContext(defaultProcessEngine.getProcessEngineConfiguration().getCommandContextFactory().createCommandContext(null));
System.out.println(Context.getCommandContext());
System.out.println(task.getProcessVariables());
}