本文整理汇总了Java中org.activiti.engine.RepositoryService.getDeploymentResourceNames方法的典型用法代码示例。如果您正苦于以下问题:Java RepositoryService.getDeploymentResourceNames方法的具体用法?Java RepositoryService.getDeploymentResourceNames怎么用?Java RepositoryService.getDeploymentResourceNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.RepositoryService
的用法示例。
在下文中一共展示了RepositoryService.getDeploymentResourceNames方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDeploymentResources
import org.activiti.engine.RepositoryService; //导入方法依赖的package包/类
@GET
@Path("/{deploymentId}/resources")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response getDeploymentResources(@PathParam("deploymentId") String deploymentId) {
RepositoryService repositoryService = BPMNOSGIService.getRepositoryService();
// 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);
DeploymentResourceResponseCollection deploymentResourceResponseCollection = new RestResponseFactory().createDeploymentResourceResponseList(deploymentId, resourceList, uriInfo.getBaseUri().toString());
return Response.ok().entity(deploymentResourceResponseCollection).build();
}
示例2: listDeploymentResourceNames
import org.activiti.engine.RepositoryService; //导入方法依赖的package包/类
/**
* 显示每个部署包里的资源.
*/
@RequestMapping("console-listDeploymentResourceNames")
public String listDeploymentResourceNames(
@RequestParam("deploymentId") String deploymentId, Model model) {
RepositoryService repositoryService = processEngine
.getRepositoryService();
List<String> deploymentResourceNames = repositoryService
.getDeploymentResourceNames(deploymentId);
model.addAttribute("deploymentResourceNames", deploymentResourceNames);
return "bpm/console-listDeploymentResourceNames";
}
示例3: queryFlowImage
import org.activiti.engine.RepositoryService; //导入方法依赖的package包/类
@Test
public void queryFlowImage() throws Exception {
String deploymentId = "10001";
RepositoryService repositoryService = (RepositoryService) AppContext.getBean("repositoryService");
List<String> names = repositoryService.getDeploymentResourceNames(deploymentId);
for (String name : names) {
System.out.println( name );
if (name.endsWith(".png") || name.endsWith(".bmp")) {
InputStream is = repositoryService.getResourceAsStream(deploymentId, name);
FileUtils.copyInputStreamToFile(is, new File("/tmp/" + name));
}
}
}
示例4: getDeploymentResourceData
import org.activiti.engine.RepositoryService; //导入方法依赖的package包/类
private byte[] getDeploymentResourceData(String deploymentId, String resourceId, RepositoryService
repositoryService) {
if (deploymentId == null) {
throw new ActivitiIllegalArgumentException("No deployment id provided");
}
if (resourceId == null) {
throw new ActivitiIllegalArgumentException("No resource id provided");
}
// 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);
if (resourceList.contains(resourceId)) {
final InputStream resourceStream = repositoryService.getResourceAsStream(deploymentId, resourceId);
try {
return IOUtils.toByteArray(resourceStream);
} catch (Exception e) {
throw new ActivitiException("Error converting resource stream", e);
}
} else {
// Resource not found in deployment
throw new ActivitiObjectNotFoundException("Could not find a resource with id '" + resourceId + "' in deployment '" + deploymentId + "'.", String.class);
}
}
示例5: getDeploymentResourceForDifferentUrl
import org.activiti.engine.RepositoryService; //导入方法依赖的package包/类
@GET
@Path("/{deploymentId}/resources/{resourcePath:.*}")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response getDeploymentResourceForDifferentUrl(@PathParam("deploymentId") String deploymentId, @PathParam("resourcePath") String resourcePath) {
if (log.isDebugEnabled()) {
log.debug("deploymentId:" + deploymentId + " resourcePath:" + resourcePath);
}
RepositoryService repositoryService = BPMNOSGIService.getRepositoryService();
// 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);
if (resourceList.contains(resourcePath)) {
// Build resource representation
DeploymentResourceResponse deploymentResourceResponse = new RestResponseFactory()
.createDeploymentResourceResponse(deploymentId, resourcePath,
Utils.resolveContentType(resourcePath), uriInfo.getBaseUri().toString());
return Response.ok().entity(deploymentResourceResponse).build();
} else {
// Resource not found in deployment
throw new ActivitiObjectNotFoundException("Could not find a resource with id '" + resourcePath
+ "' in deployment '" + deploymentId + "'.", Deployment.class);
}
}
示例6: getDeploymentResourceData
import org.activiti.engine.RepositoryService; //导入方法依赖的package包/类
private byte[] getDeploymentResourceData(String deploymentId, String resourceId) {
if (deploymentId == null) {
throw new ActivitiIllegalArgumentException("No deployment id provided");
}
if (resourceId == null) {
throw new ActivitiIllegalArgumentException("No resource id provided");
}
RepositoryService repositoryService = BPMNOSGIService.getRepositoryService();
// 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);
if (resourceList.contains(resourceId)) {
final InputStream resourceStream = repositoryService.getResourceAsStream(deploymentId, resourceId);
try {
return IOUtils.toByteArray(resourceStream);
} catch (Exception e) {
throw new ActivitiException("Error converting resource stream", e);
}
} else {
// Resource not found in deployment
throw new ActivitiObjectNotFoundException("Could not find a resource with id '" + resourceId + "' in deployment '" + deploymentId + "'.", String.class);
}
}