當前位置: 首頁>>代碼示例>>Java>>正文


Java RepositoryService類代碼示例

本文整理匯總了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";
}
 
開發者ID:zhaojunfei,項目名稱:lemon,代碼行數:23,代碼來源:ConsoleController.java

示例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());
}
 
開發者ID:zhaojunfei,項目名稱:lemon,代碼行數:19,代碼來源:ConsoleController.java

示例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;
}
 
開發者ID:zhaojunfei,項目名稱:lemon,代碼行數:22,代碼來源:ModelerController.java

示例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 "{}";
}
 
開發者ID:zhaojunfei,項目名稱:lemon,代碼行數:20,代碼來源:ModelerController.java

示例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;
}
 
開發者ID:SAP,項目名稱:cf-mta-deploy-service,代碼行數:18,代碼來源:MockDelegateExecution.java

示例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();
}
 
開發者ID:Lzw2016,項目名稱:study,代碼行數:21,代碼來源:Test01.java

示例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();
    }
}
 
開發者ID:flowable,項目名稱:flowable-engine,代碼行數:25,代碼來源:SingleResourceAutoDeploymentStrategy.java

示例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();

}
 
開發者ID:flowable,項目名稱:flowable-engine,代碼行數:25,代碼來源:DefaultAutoDeploymentStrategy.java

示例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();
    }

}
 
開發者ID:flowable,項目名稱:flowable-engine,代碼行數:32,代碼來源:ResourceParentFolderAutoDeploymentStrategy.java

示例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());
	}
	
}
 
開發者ID:billchen198318,項目名稱:bamboobsc,代碼行數:19,代碼來源:TestBPMN001.java

示例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());
}
 
開發者ID:shawn-gogh,項目名稱:myjavacode,代碼行數:27,代碼來源:VerySimpleLeaveProcessTest.java

示例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);
}
 
開發者ID:shawn-gogh,項目名稱:myjavacode,代碼行數:19,代碼來源:InitProcessEngineBySpringAnnotation.java

示例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();
}
 
開發者ID:shawn-gogh,項目名稱:myjavacode,代碼行數:24,代碼來源:ActivitiWithMuleTest.java

示例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());
}
 
開發者ID:yudar1024,項目名稱:spring4-springmvc4-mybatis3-activiti,代碼行數:27,代碼來源:SignalThrowingEvent.java


注:本文中的org.activiti.engine.RepositoryService類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。