本文整理汇总了Java中org.activiti.engine.repository.ProcessDefinition.getResourceName方法的典型用法代码示例。如果您正苦于以下问题:Java ProcessDefinition.getResourceName方法的具体用法?Java ProcessDefinition.getResourceName怎么用?Java ProcessDefinition.getResourceName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.repository.ProcessDefinition
的用法示例。
在下文中一共展示了ProcessDefinition.getResourceName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: viewXml
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的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());
}
示例2: loadByDeployment
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
/**
* 读取资源,通过部署ID
*
* @param processDefinitionId 流程定义
* @param resourceType 资源类型(xml|image)
* @throws Exception
*/
@RequestMapping(value = "/resource/read")
public void loadByDeployment(@RequestParam("processDefinitionId") String processDefinitionId,
@RequestParam("resourceType") String resourceType,
HttpServletResponse response) throws Exception {
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
String resourceName = "";
if (resourceType.equals("image")) {
resourceName = processDefinition.getDiagramResourceName();
} else if (resourceType.equals("xml")) {
resourceName = processDefinition.getResourceName();
}
InputStream resourceAsStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), resourceName);
byte[] b = new byte[1024];
int len = -1;
while ((len = resourceAsStream.read(b, 0, 1024)) != -1) {
response.getOutputStream().write(b, 0, len);
}
}
示例3: loadByProcessInstance
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
/**
* 读取资源,通过流程ID
*
* @param resourceType 资源类型(xml|image)
* @param processInstanceId 流程实例ID
* @param response
* @throws Exception
*/
@RequestMapping(value = "/resource/process-instance")
public void loadByProcessInstance(@RequestParam("type") String resourceType, @RequestParam("pid") String processInstanceId, HttpServletResponse response)
throws Exception {
InputStream resourceAsStream = null;
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processInstance.getProcessDefinitionId())
.singleResult();
String resourceName = "";
if (resourceType.equals("image")) {
resourceName = processDefinition.getDiagramResourceName();
} else if (resourceType.equals("xml")) {
resourceName = processDefinition.getResourceName();
}
resourceAsStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), resourceName);
byte[] b = new byte[1024];
int len = -1;
while ((len = resourceAsStream.read(b, 0, 1024)) != -1) {
response.getOutputStream().write(b, 0, len);
}
}
示例4: SimpleProcessDefinition
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
public SimpleProcessDefinition(ProcessDefinition definition) {
id = definition.getId();
category = definition.getCategory();
name = definition.getName();
key = definition.getKey();
description = definition.getDescription();
version = definition.getVersion();
resourceName = definition.getResourceName();
deploymentId = definition.getDeploymentId();
diagramResourceName = definition.getResourceName();
suspended = definition.isSuspended();
hasGraphicalNotation = definition.hasGraphicalNotation();
hasStartFormKey = definition.hasStartFormKey();
tenantId = definition.getTenantId();
}
示例5: resourceRead
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
/**
* 读取资源,通过部署ID
* @param processDefinitionId 流程定义ID
* @param processInstanceId 流程实例ID
* @param resourceType 资源类型(xml|image)
*/
public InputStream resourceRead(String procDefId, String proInsId, String resType) throws Exception {
if (StringUtils.isBlank(procDefId)){
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(proInsId).singleResult();
procDefId = processInstance.getProcessDefinitionId();
}
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(procDefId).singleResult();
String resourceName = "";
if (resType.equals("image")) {
resourceName = processDefinition.getDiagramResourceName();
} else if (resType.equals("xml")) {
resourceName = processDefinition.getResourceName();
}
InputStream resourceAsStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), resourceName);
return resourceAsStream;
}
示例6: downloadFlow
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
@RequestMapping(value = "/processdef/export/{type}/{id}", method = RequestMethod.GET)
public void downloadFlow(@PathVariable("type") String type, @PathVariable("id") String id, HttpServletResponse response) {
try {
ProcessDefinition processDefinition = repositoryService.getProcessDefinition(id);
String resourceName = "";
if (type.equals("image")) {
resourceName = processDefinition.getDiagramResourceName();
} else if (type.equals("xml")) {
resourceName = processDefinition.getResourceName();
}
InputStream resourceAsStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), resourceName);
IOUtils.copy(resourceAsStream, response.getOutputStream());
response.setHeader("Content-Disposition", "attachment; filename=" + resourceName);
response.flushBuffer();
} catch (Exception e) {
LOGGER.error("导出流程定义的" + type + "文件失败:processDefId={}", id, e);
}
}
示例7: readXml
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
public String readXml(String processDefinitionId) throws Exception {
RepositoryService repositoryService = processEngine
.getRepositoryService();
ProcessDefinition processDefinition = repositoryService
.createProcessDefinitionQuery()
.processDefinitionId(processDefinitionId).singleResult();
String resourceName = processDefinition.getResourceName();
InputStream resourceAsStream = repositoryService.getResourceAsStream(
processDefinition.getDeploymentId(), resourceName);
return IOUtils.toString(resourceAsStream, "UTF-8");
}
示例8: processDefinitionQueryTest
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
@Test
public void processDefinitionQueryTest() {
List<ProcessDefinition> processDefinitionList = repositoryService.createProcessDefinitionQuery()
.list();
for (ProcessDefinition processDefinition : processDefinitionList) {
String tmp = "\r\n" +
"#=======================================================================================================================#\r\n" +
"# Spring MVC Context 容器初始化完成之后的处理:\r\n" +
"#\t getId " + processDefinition.getId() + "\r\n" +
"#\t getCategory " + processDefinition.getCategory() + "\r\n" +
"#\t getName " + processDefinition.getName() + "\r\n" +
"#\t getKey " + processDefinition.getKey() + "\r\n" +
"#\t getDescription " + processDefinition.getDescription() + "\r\n" +
"#\t getVersion " + processDefinition.getVersion() + "\r\n" +
"#\t getResourceName " + processDefinition.getResourceName() + "\r\n" +
"#\t getDeploymentId " + processDefinition.getDeploymentId() + "\r\n" +
"#\t getDiagramResourceName " + processDefinition.getDiagramResourceName() + "\r\n" +
"#\t hasStartFormKey " + processDefinition.hasStartFormKey() + "\r\n" +
"#\t hasGraphicalNotation " + processDefinition.hasGraphicalNotation() + "\r\n" +
"#\t isSuspended " + processDefinition.isSuspended() + "\r\n" +
"#\t getTenantId " + processDefinition.getTenantId() + "\r\n" +
"#=======================================================================================================================#\r\n";
logger.info(tmp);
}
// org.activiti.rest.service.application.ActivitiRestServicesApplication
// org.activiti.rest.service.api.RestActionRequest
}
示例9: BpmModelVo
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
public BpmModelVo(ProcessDefinition o) {
this.id = o.getId();
this.category = o.getCategory();
this.name = o.getName();
this.key = o.getKey();
this.description = o.getDescription();
this.version = o.getVersion();
this.deploymentId = o.getDeploymentId();
this.resourceName = o.getResourceName();
this.diagramResourceName = o.getDiagramResourceName();
}
示例10: ProcessDefinitionVo
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
public ProcessDefinitionVo(ProcessDefinition o) {
this.id = o.getId();
this.category = o.getCategory();
this.name = o.getName();
this.key = o.getKey();
this.description = o.getDescription();
this.version = o.getVersion();
this.resourceName = o.getResourceName();
this.deploymentId = o.getDeploymentId();
this.diagramResourceName = o.getDiagramResourceName();
this.hasStartFormKey = o.hasStartFormKey();
this.hasGraphicalNotation = o.hasGraphicalNotation();
this.suspended = o.isSuspended();
this.tenantId = o.getTenantId();
}
示例11: generateResource
import org.activiti.engine.repository.ProcessDefinition; //导入方法依赖的package包/类
/**
* 生成资源文件,并返回文件路径 给开发者看的
*/
@RequestMapping(value = "/processdef/generate/{type}/{pdId}", method = RequestMethod.POST)
@ResponseBody
public Result generateResource(@PathVariable("type") String type, @PathVariable("pdId") String pdId, HttpServletRequest request) {
try {
String dirPath = request.getRealPath("/");
ProcessDefinition processDefinition = repositoryService.getProcessDefinition(pdId);
String resourceName = "";
if (type.equals("image")) {
resourceName = processDefinition.getDiagramResourceName();
} else if (type.equals("xml")) {
resourceName = processDefinition.getResourceName();
}
InputStream resourceAsStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), resourceName);
String realPath = dirPath + File.separator + DIR_PATH + File.separator + resourceName;
realPath=realPath.replaceAll("\\\\", "/");
File file = new File(realPath);
if (file.exists()) {
file.delete();
}
FileUtil.copyInputStreamToFile(resourceAsStream, file);
String realName = (DIR_PATH + File.separator + resourceName).replaceAll("\\\\", "/");
return new Result(true, realName, "成功生成png");
} catch (Exception e) {
LOGGER.error("生成资源文件异常,pdId={}", pdId, e);
return new Result(false);
}
}