org.activiti.engine.RepositoryService.getDeploymentResourceNames()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中org.activiti.engine.RepositoryService.getDeploymentResourceNames方法的一些代码示例,展示了RepositoryService.getDeploymentResourceNames的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RepositoryService.getDeploymentResourceNames方法的具体详情如下:
包路径:org.activiti.engine.RepositoryService
类名称:RepositoryService
方法名:getDeploymentResourceNames

RepositoryService.getDeploymentResourceNames介绍

[英]Retrieves a list of deployment resources for the given deployment, ordered alphabetically.
[中]检索给定部署的部署资源列表,按字母顺序排列。

代码示例

代码示例来源:origin: org.activiti/activiti-rest

@ApiOperation(value = "List resources in a deployment", tags = {"Deployment"}, notes="The dataUrl property in the resulting JSON for a single resource contains the actual URL to use for retrieving the binary resource.")
 @ApiResponses(value = {
   @ApiResponse(code = 200, message = "Indicates the deployment was found and the resource list has been returned."),
   @ApiResponse(code = 404, message = "Indicates the requested deployment was not found.")
 })
 @RequestMapping(value = "/repository/deployments/{deploymentId}/resources", method = RequestMethod.GET, produces = "application/json")
 public List<DeploymentResourceResponse> getDeploymentResources(@ApiParam(name = "deploymentId", value = "The id of the deployment to get the resources for.") @PathVariable String deploymentId, HttpServletRequest request) {
  // Check if deployment exists
  Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
  if (deployment == null) {
   throw new ActivitiObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.", Deployment.class);
  }

  List<String> resourceList = repositoryService.getDeploymentResourceNames(deploymentId);

  return restResponseFactory.createDeploymentResourceResponseList(deploymentId, resourceList, contentTypeResolver);
 }
}

代码示例来源:origin: org.activiti/activiti-rest

@ApiOperation(value = "Get a deployment resource", tags = {"Deployment"}, notes="Replace ** by ResourceId")
 @ApiResponses(value = {
   @ApiResponse(code = 200, message = "Indicates both deployment and resource have been found and the resource has been returned."),
   @ApiResponse(code = 404, message = "Indicates the requested deployment was not found or there is no resource with the given id present in the deployment. The status-description contains additional information.")
 })

 @RequestMapping(value = "/repository/deployments/{deploymentId}/resources/**", method = RequestMethod.GET, produces = "application/json")
 public DeploymentResourceResponse getDeploymentResource(@ApiParam(name = "deploymentId", value = "The id of the deployment the requested resource is part of.") @PathVariable("deploymentId") String deploymentId, HttpServletRequest request) {

  Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
  if (deployment == null) {
   throw new ActivitiObjectNotFoundException("Could not find a deployment with id '" + deploymentId + "'.");
  }

  String pathInfo = request.getPathInfo();
  String resourceName = pathInfo.replace("/repository/deployments/" + deploymentId + "/resources/", "");

  List<String> resourceList = repositoryService.getDeploymentResourceNames(deploymentId);

  if (resourceList.contains(resourceName)) {
   // Build resource representation
   DeploymentResourceResponse response = restResponseFactory.createDeploymentResourceResponse(deploymentId, resourceName, contentTypeResolver.resolveContentType(resourceName));
   return response;

  } else {
   // Resource not found in deployment
   throw new ActivitiObjectNotFoundException("Could not find a resource with id '" + resourceName + "' in deployment '" + deploymentId + "'.");
  }
 }
}

代码示例来源:origin: FINRAOS/herd

private void deleteWorkflow(String deploymentId) throws Exception
  {
    repositoryService.deleteDeployment(deploymentId);
    List<String> deployResources = repositoryService.getDeploymentResourceNames(deploymentId);
    assertTrue(deployResources.isEmpty());
  }
}

代码示例来源:origin: stackoverflow.com

assertTrue(repositoryService.getDeploymentResourceNames(deployment.getId()).contains(bpmnName));

代码示例来源:origin: org.activiti/activiti-rest

List<String> resourceList = repositoryService.getDeploymentResourceNames(deploymentId);

代码示例来源:origin: org.activiti/activiti-explorer

protected void addResourceLinks() {
  List<String> resourceNames = repositoryService.getDeploymentResourceNames(deployment.getId());
  Collections.sort(resourceNames); // small nr of elements, so we can do it in-memory
  
  if (!resourceNames.isEmpty()) {
   Label resourceHeader = new Label(i18nManager.getMessage(Messages.DEPLOYMENT_HEADER_RESOURCES));
   resourceHeader.setWidth("95%");
   resourceHeader.addStyleName(ExplorerLayout.STYLE_H3);
   resourceHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
   addDetailComponent(resourceHeader);
   
   // resources
   VerticalLayout resourceLinksLayout = new VerticalLayout();
   resourceLinksLayout.setSpacing(true);
   resourceLinksLayout.setMargin(true, false, false, false);
   addDetailComponent(resourceLinksLayout);
   
   for (final String resourceName : resourceNames) {
    StreamResource.StreamSource streamSource = new StreamSource() {
     public InputStream getStream() {
      return repositoryService.getResourceAsStream(deployment.getId(), resourceName);
     }
    };
    Link resourceLink = new Link(resourceName, new StreamResource(streamSource, resourceName, ExplorerApp.get()));
    resourceLinksLayout.addComponent(resourceLink);
   }
  }
 }
}

相关文章

微信公众号

最新文章

更多