• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DeploymentBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.activiti.engine.repository.DeploymentBuilder的典型用法代码示例。如果您正苦于以下问题:Java DeploymentBuilder类的具体用法?Java DeploymentBuilder怎么用?Java DeploymentBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DeploymentBuilder类属于org.activiti.engine.repository包,在下文中一共展示了DeploymentBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: deployProcessDefinition

import org.activiti.engine.repository.DeploymentBuilder; //导入依赖的package包/类
protected String deployProcessDefinition(String... artifacts) {
    DeploymentBuilder deploymentBuilder = activitiProcessEngine.getRepositoryService().createDeployment();
    boolean firstArtifact = true;
    for (String artifact : artifacts)
    {
        InputStream bpmnInputStream = getClass().getClassLoader().getResourceAsStream(artifact);
        String name = artifact.substring(artifact.lastIndexOf("/") + 1);
        if (firstArtifact)
        {
            deploymentBuilder.name(name);
        }
        deploymentBuilder.addInputStream(name, bpmnInputStream);
    }
    String deploymentId = deploymentBuilder.deploy().getId();
    return deploymentId;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:17,代码来源:EnterpriseWorkflowTestApi.java


示例2: deploy

import org.activiti.engine.repository.DeploymentBuilder; //导入依赖的package包/类
/**
 * 部署流程资源
 * 加载ZIP文件中的流程
 */
@PostMapping(value = "/deploy")
public ResponseMessage<Object> deploy(@RequestParam(value = "file") MultipartFile file) throws IOException {
    // 获取上传的文件名
    String fileName = file.getOriginalFilename();

    // 得到输入流(字节流)对象
    InputStream fileInputStream = file.getInputStream();

    // 文件的扩展名
    String extension = FilenameUtils.getExtension(fileName);

    // zip或者bar类型的文件用ZipInputStream方式部署
    DeploymentBuilder deployment = repositoryService.createDeployment();
    if ("zip".equals(extension) || "bar".equals(extension)) {
        ZipInputStream zip = new ZipInputStream(fileInputStream);
        deployment.addZipInputStream(zip);
    } else {
        // 其他类型的文件直接部署
        deployment.addInputStream(fileName, fileInputStream);
    }
    deployment.deploy();

    return ResponseMessage.ok();
}
 
开发者ID:hs-web,项目名称:hsweb-framework,代码行数:29,代码来源:FlowableDeploymentController.java


示例3: deployResources

import org.activiti.engine.repository.DeploymentBuilder; //导入依赖的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


示例4: deployResources

import org.activiti.engine.repository.DeploymentBuilder; //导入依赖的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


示例5: deployResources

import org.activiti.engine.repository.DeploymentBuilder; //导入依赖的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


示例6: addZipInputStream

import org.activiti.engine.repository.DeploymentBuilder; //导入依赖的package包/类
@Override
public DeploymentBuilder addZipInputStream(ZipInputStream zipInputStream) {
    try {
        ZipEntry entry = zipInputStream.getNextEntry();
        while (entry != null) {
            if (!entry.isDirectory()) {
                String entryName = entry.getName();
                byte[] bytes = IoUtil.readInputStream(zipInputStream, entryName);
                ResourceEntity resource = new ResourceEntity();
                resource.setName(entryName);
                resource.setBytes(bytes);
                deployment.addResource(resource);
            }
            entry = zipInputStream.getNextEntry();
        }
    } catch (Exception e) {
        throw new ActivitiException("problem reading zip input stream", e);
    }
    return this;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:21,代码来源:DeploymentBuilderImpl.java


示例7: addZipInputStream

import org.activiti.engine.repository.DeploymentBuilder; //导入依赖的package包/类
public DeploymentBuilder addZipInputStream(ZipInputStream zipInputStream) {
  try {
    ZipEntry entry = zipInputStream.getNextEntry();
    while (entry != null) {
      if (!entry.isDirectory()) {
        String entryName = entry.getName();
        byte[] bytes = IoUtil.readInputStream(zipInputStream, entryName);
        ResourceEntity resource = new ResourceEntity();
        resource.setName(entryName);
        resource.setBytes(bytes);
        deployment.addResource(resource);
      }
      entry = zipInputStream.getNextEntry();
    }
  } catch (Exception e) {
    throw new ActivitiException("problem reading zip input stream", e);
  }
  return this;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:20,代码来源:DeploymentBuilderImpl.java


示例8: 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.");
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:ProcessDeployer.java


示例9: addInputStream

import org.activiti.engine.repository.DeploymentBuilder; //导入依赖的package包/类
@Override
public DeploymentBuilder addInputStream(String resourceName, InputStream inputStream) {
    if (inputStream == null) {
        throw new ActivitiIllegalArgumentException("inputStream for resource '" + resourceName + "' is null");
    }
    byte[] bytes = IoUtil.readInputStream(inputStream, resourceName);
    ResourceEntity resource = new ResourceEntity();
    resource.setName(resourceName);
    resource.setBytes(bytes);
    deployment.addResource(resource);
    return this;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:13,代码来源:DeploymentBuilderImpl.java


示例10: addClasspathResource

import org.activiti.engine.repository.DeploymentBuilder; //导入依赖的package包/类
@Override
public DeploymentBuilder addClasspathResource(String resource) {
    InputStream inputStream = ReflectUtil.getResourceAsStream(resource);
    if (inputStream == null) {
        throw new ActivitiIllegalArgumentException("resource '" + resource + "' not found");
    }
    return addInputStream(resource, inputStream);
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:9,代码来源:DeploymentBuilderImpl.java


示例11: addString

import org.activiti.engine.repository.DeploymentBuilder; //导入依赖的package包/类
@Override
public DeploymentBuilder addString(String resourceName, String text) {
    if (text == null) {
        throw new ActivitiIllegalArgumentException("text is null");
    }
    ResourceEntity resource = new ResourceEntity();
    resource.setName(resourceName);
    try {
        resource.setBytes(text.getBytes(DEFAULT_ENCODING));
    } catch (UnsupportedEncodingException e) {
        throw new ActivitiException("Unable to get process bytes.", e);
    }
    deployment.addResource(resource);
    return this;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:16,代码来源:DeploymentBuilderImpl.java


示例12: addBpmnModel

import org.activiti.engine.repository.DeploymentBuilder; //导入依赖的package包/类
@Override
public DeploymentBuilder addBpmnModel(String resourceName, BpmnModel bpmnModel) {
    BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
    try {
        String bpmn20Xml = new String(bpmnXMLConverter.convertToXML(bpmnModel), "UTF-8");
        addString(resourceName, bpmn20Xml);
    } catch (UnsupportedEncodingException e) {
        throw new ActivitiException("Error while transforming BPMN model to xml: not UTF-8 encoded", e);
    }
    return this;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:12,代码来源:DeploymentBuilderImpl.java


示例13: deploy

import org.activiti.engine.repository.DeploymentBuilder; //导入依赖的package包/类
/**
 * 部署流程资源
 */
@RequestMapping(value = "/deploy")
public String deploy(@RequestParam(value = "file", required = true) MultipartFile file) {

    // 获取上传的文件名
    String fileName = file.getOriginalFilename();

    try {
        // 得到输入流(字节流)对象
        InputStream fileInputStream = file.getInputStream();

        // 文件的扩展名
        String extension = FilenameUtils.getExtension(fileName);

        // zip或者bar类型的文件用ZipInputStream方式部署
        DeploymentBuilder deployment = repositoryService.createDeployment();
        if (extension.equals("zip") || extension.equals("bar")) {
            ZipInputStream zip = new ZipInputStream(fileInputStream);
            deployment.addZipInputStream(zip);
        } else {
            // 其他类型的文件直接部署
            deployment.addInputStream(fileName, fileInputStream);
        }
        deployment.deploy();
    } catch (Exception e) {
        logger.error("error on deploy process, because of file input stream");
    }

    return "redirect:process-list";
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:33,代码来源:DeploymentController.java


示例14: 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());
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:29,代码来源:ClasspathDeploymentTest.java


示例15: deploy

import org.activiti.engine.repository.DeploymentBuilder; //导入依赖的package包/类
/**
 * 部署流程资源
 */
@RequestMapping(value = "/deploy")
public String deploy(@RequestParam(value = "file", required = true) MultipartFile file) {

    // 获取上传的文件名
    String fileName = file.getOriginalFilename();

    try {
        // 得到输入流(字节流)对象
        InputStream fileInputStream = file.getInputStream();

        // 文件的扩展名
        String extension = FilenameUtils.getExtension(fileName);

        // zip或者bar类型的文件用ZipInputStream方式部署
        DeploymentBuilder deployment = repositoryService.createDeployment();
        if (extension.equals("zip") || extension.equals("bar")) {
            ZipInputStream zip = new ZipInputStream(fileInputStream);
            deployment.addZipInputStream(zip);
        } else {
            // 其他类型的文件直接部署
            deployment.addInputStream(fileName, fileInputStream);
        }
        deployment.deploy();
    } catch (Exception e) {
        logger.error("error on deploy process, because of file input stream");
    }

    return "redirect:processes";
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:33,代码来源:DeploymentController.java



注:本文中的org.activiti.engine.repository.DeploymentBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java NoOpCacheManager类代码示例发布时间:2022-05-21
下一篇:
Java SubscriberExceptionHandler类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap