当前位置: 首页>>代码示例>>Java>>正文


Java DeploymentBuilder.addZipInputStream方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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:barudisshu,项目名称:activiti-in-action-codes,代码行数:33,代码来源:DeploymentController.java

示例6: 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

示例7: uploadDeployment

import org.activiti.engine.repository.DeploymentBuilder; //导入方法依赖的package包/类
@Post
public void uploadDeployment(Representation entity) {
  try {
    if(authenticate(SecuredResource.ADMIN) == false) return;
    
    RestletFileUpload upload = new RestletFileUpload(new DiskFileItemFactory());
    List<FileItem> items = upload.parseRepresentation(entity);
    
    FileItem uploadItem = null;
    String successMethod = null;
    for (FileItem fileItem : items) {
      if(fileItem.getName() != null) {
        uploadItem = fileItem;
      } else if(fileItem.getFieldName().equals("success")){
        successMethod = fileItem.getString();
      }
    }
    
    DeploymentBuilder deploymentBuilder = ActivitiUtil.getRepositoryService().createDeployment();
    String fileName = uploadItem.getName();
    if (fileName.endsWith(".bpmn20.xml")) {
      deploymentBuilder.addInputStream(fileName, uploadItem.getInputStream());
    } else if (fileName.endsWith(".bar") || fileName.endsWith(".zip")) {
      deploymentBuilder.addZipInputStream(new ZipInputStream(uploadItem.getInputStream()));
    } else {
      throw new ActivitiException("File must be of type .bpmn20.xml, .bar or .zip");
    }
    deploymentBuilder.name(fileName);
    deploymentBuilder.deploy();
    StringBuilder html = new StringBuilder();
    html.append("<html>\n");
    html.append("  <script type=\"text/javascript\">\n");
    html.append("    " + successMethod + "()\n");
    html.append("   </script>\n");
    html.append("</html>\n");
    getResponse().setEntity(html.toString(), MediaType.TEXT_HTML);
    
  } catch (Exception e) {
    throw new ActivitiException(e.getMessage(), e);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:42,代码来源:DeploymentUploadResource.java


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