本文整理汇总了Java中org.activiti.engine.RepositoryService类的典型用法代码示例。如果您正苦于以下问题:Java RepositoryService类的具体用法?Java RepositoryService怎么用?Java RepositoryService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RepositoryService类属于org.activiti.engine包,在下文中一共展示了RepositoryService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deploy
import org.activiti.engine.RepositoryService; //导入依赖的package包/类
/**
* 发布流程.
*/
@RequestMapping("console-deploy")
public String deploy(@RequestParam("xml") String xml) throws Exception {
RepositoryService repositoryService = processEngine
.getRepositoryService();
ByteArrayInputStream bais = new ByteArrayInputStream(
xml.getBytes("UTF-8"));
Deployment deployment = repositoryService.createDeployment()
.addInputStream("process.bpmn20.xml", bais).deploy();
List<ProcessDefinition> processDefinitions = repositoryService
.createProcessDefinitionQuery()
.deploymentId(deployment.getId()).list();
for (ProcessDefinition processDefinition : processDefinitions) {
processEngine.getManagementService().executeCommand(
new SyncProcessCmd(processDefinition.getId()));
}
return "redirect:/bpm/console-listProcessDefinitions.do";
}
示例2: viewXml
import org.activiti.engine.RepositoryService; //导入依赖的package包/类
/**
* 显示流程定义的xml.
*/
@RequestMapping("console-viewXml")
public void viewXml(
@RequestParam("processDefinitionId") String processDefinitionId,
HttpServletResponse response) throws Exception {
RepositoryService repositoryService = processEngine
.getRepositoryService();
ProcessDefinition processDefinition = repositoryService
.createProcessDefinitionQuery()
.processDefinitionId(processDefinitionId).singleResult();
String resourceName = processDefinition.getResourceName();
InputStream resourceAsStream = repositoryService.getResourceAsStream(
processDefinition.getDeploymentId(), resourceName);
response.setContentType("text/xml;charset=UTF-8");
IOUtils.copy(resourceAsStream, response.getOutputStream());
}
示例3: open
import org.activiti.engine.RepositoryService; //导入依赖的package包/类
@RequestMapping("modeler-open")
public String open(@RequestParam(value = "id", required = false) String id)
throws Exception {
RepositoryService repositoryService = processEngine
.getRepositoryService();
Model model = null;
if (!StringUtils.isEmpty(id)) {
model = repositoryService.getModel(id);
}
if (model == null) {
model = repositoryService.newModel();
repositoryService.saveModel(model);
id = model.getId();
}
// return "redirect:/cdn/modeler/editor.html?id=" + id;
//return "redirect:/widgets/modeler/modeler.html?modelId=" + id;
return "redirect:/cdn/modeler/modeler.html?modelId=" + id;
}
示例4: modelSave
import org.activiti.engine.RepositoryService; //导入依赖的package包/类
@RequestMapping("model/{modelId}/save")
@ResponseBody
public String modelSave(@PathVariable("modelId") String modelId,
@RequestParam("description") String description,
@RequestParam("json_xml") String jsonXml,
@RequestParam("name") String name,
@RequestParam("svg_xml") String svgXml) throws Exception {
RepositoryService repositoryService = processEngine
.getRepositoryService();
Model model = repositoryService.getModel(modelId);
model.setName(name);
// model.setMetaInfo(root.toString());
logger.info("jsonXml : {}", jsonXml);
repositoryService.saveModel(model);
repositoryService.addModelEditorSource(model.getId(),
jsonXml.getBytes("utf-8"));
return "{}";
}
示例5: getEngineServices
import org.activiti.engine.RepositoryService; //导入依赖的package包/类
@Override
public EngineServices getEngineServices() {
if (this.engineServicesMock != null) {
return this.engineServicesMock;
}
this.engineServicesMock = mock(EngineServices.class);
when(engineServicesMock.getFormService()).thenReturn(mock(FormService.class));
when(engineServicesMock.getHistoryService()).thenReturn(mock(HistoryService.class));
when(engineServicesMock.getIdentityService()).thenReturn(mock(IdentityService.class));
when(engineServicesMock.getManagementService()).thenReturn(mock(ManagementService.class));
when(engineServicesMock.getRepositoryService()).thenReturn(mock(RepositoryService.class));
when(engineServicesMock.getRuntimeService()).thenReturn(mock(RuntimeService.class));
when(engineServicesMock.getTaskService()).thenReturn(mock(TaskService.class));
return engineServicesMock;
}
示例6: getImage
import org.activiti.engine.RepositoryService; //导入依赖的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();
}
示例7: deployResources
import org.activiti.engine.RepositoryService; //导入依赖的package包/类
@Override
public void deployResources(final String deploymentNameHint, final Resource[] resources, final RepositoryService repositoryService) {
// Create a separate deployment for each resource using the resource
// name
for (final Resource resource : resources) {
final String resourceName = determineResourceName(resource);
final DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().enableDuplicateFiltering().name(resourceName);
try {
if (resourceName.endsWith(".bar") || resourceName.endsWith(".zip") || resourceName.endsWith(".jar")) {
deploymentBuilder.addZipInputStream(new ZipInputStream(resource.getInputStream()));
} else {
deploymentBuilder.addInputStream(resourceName, resource.getInputStream());
}
} catch (IOException e) {
throw new ActivitiException("couldn't auto deploy resource '" + resource + "': " + e.getMessage(), e);
}
deploymentBuilder.deploy();
}
}
示例8: deployResources
import org.activiti.engine.RepositoryService; //导入依赖的package包/类
@Override
public void deployResources(final String deploymentNameHint, final Resource[] resources, final RepositoryService repositoryService) {
// Create a single deployment for all resources using the name hint as
// the literal name
final DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().enableDuplicateFiltering().name(deploymentNameHint);
for (final Resource resource : resources) {
final String resourceName = determineResourceName(resource);
try {
if (resourceName.endsWith(".bar") || resourceName.endsWith(".zip") || resourceName.endsWith(".jar")) {
deploymentBuilder.addZipInputStream(new ZipInputStream(resource.getInputStream()));
} else {
deploymentBuilder.addInputStream(resourceName, resource.getInputStream());
}
} catch (IOException e) {
throw new ActivitiException("couldn't auto deploy resource '" + resource + "': " + e.getMessage(), e);
}
}
deploymentBuilder.deploy();
}
示例9: deployResources
import org.activiti.engine.RepositoryService; //导入依赖的package包/类
@Override
public void deployResources(final String deploymentNameHint, final Resource[] resources, final RepositoryService repositoryService) {
// Create a deployment for each distinct parent folder using the name
// hint
// as a prefix
final Map<String, Set<Resource>> resourcesMap = createMap(resources);
for (final Entry<String, Set<Resource>> group : resourcesMap.entrySet()) {
final String deploymentName = determineDeploymentName(deploymentNameHint, group.getKey());
final DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().enableDuplicateFiltering().name(deploymentName);
for (final Resource resource : group.getValue()) {
final String resourceName = determineResourceName(resource);
try {
if (resourceName.endsWith(".bar") || resourceName.endsWith(".zip") || resourceName.endsWith(".jar")) {
deploymentBuilder.addZipInputStream(new ZipInputStream(resource.getInputStream()));
} else {
deploymentBuilder.addInputStream(resourceName, resource.getInputStream());
}
} catch (IOException e) {
throw new ActivitiException("couldn't auto deploy resource '" + resource + "': " + e.getMessage(), e);
}
}
deploymentBuilder.deploy();
}
}
示例10: queryProcessDefinition
import org.activiti.engine.RepositoryService; //导入依赖的package包/类
@Test
public void queryProcessDefinition() throws Exception {
RepositoryService repositoryService = (RepositoryService) AppContext.getBean("repositoryService");
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
List<ProcessDefinition> processDefs = processDefinitionQuery
.processDefinitionKey("Employee360DegreeFeedbackProjectPublishProcess")
.orderByProcessDefinitionVersion()
.desc()
.list();
for (ProcessDefinition pd : processDefs) {
System.out.println( pd.getId() + " , " + pd.getName() + " , "
+ pd.getKey() + " , " + pd.getVersion() );
ProcessDefinitionImpl pdObj = (ProcessDefinitionImpl)repositoryService.getProcessDefinition(pd.getId());
System.out.println(pdObj.getActivities());
}
}
示例11: testStartProcess
import org.activiti.engine.RepositoryService; //导入依赖的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());
}
示例12: main
import org.activiti.engine.RepositoryService; //导入依赖的package包/类
public static void main(String[] args) {
AnnotationConfigApplicationContext ctx =
new AnnotationConfigApplicationContext();
ctx.register(SpringAnnotationConfiguration.class);
ctx.refresh();
assertNotNull(ctx.getBean(ProcessEngine.class));
assertNotNull(ctx.getBean(RuntimeService.class));
TaskService bean = ctx.getBean(TaskService.class);
assertNotNull(bean);
assertNotNull(ctx.getBean(HistoryService.class));
assertNotNull(ctx.getBean(RepositoryService.class));
assertNotNull(ctx.getBean(ManagementService.class));
assertNotNull(ctx.getBean(FormService.class));
Task task = bean.newTask();
task.setName("哈哈");
bean.saveTask(task);
}
示例13: testSpringMaster
import org.activiti.engine.RepositoryService; //导入依赖的package包/类
@Test
public void testSpringMaster() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("mule/spring-master/spring-master.xml");
MuleContext mc = (MuleContext) ctx.getBean("_muleContext");
mc.start();
RepositoryService repositoryService = (RepositoryService) ctx.getBean("repositoryService");
repositoryService.createDeployment().addClasspathResource("mule/leaveWithMule.bpmn").deploy();
RuntimeService runtimeService = (RuntimeService) ctx.getBean("runtimeService");
Map<String, Object> variableMap = new HashMap<String, Object>();
variableMap.put("days", 5);
runtimeService.startProcessInstanceByKey("leaveWithMule", variableMap);
TaskService taskService = (TaskService) ctx.getBean("taskService");
Task task = taskService.createTaskQuery().singleResult();
assertNotNull(task);
assertEquals("部门经理审批", task.getName());
mc.stop();
}
示例14: main
import org.activiti.engine.RepositoryService; //导入依赖的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
示例15: main
import org.activiti.engine.RepositoryService; //导入依赖的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());
}