jbpmconsole流程图采用的是jBPM自定义的标签,我没有研究过如何部署,因为我添加了几次没成功就放弃了,自定义标签的方法也许引用简单,但是部署麻烦,而且不够灵活,所以最好是自己从jBPM的附件表中调出图片,并自己绘制出当前节点和已经过节点.甚至可以在节点上提示审批意见,点击当前节点打开审批窗口等.
先说说jBPM的附件表,默认发布时包含了流程定义和坐标两个xml文件和一个流程截图的jpg图片,流程图显示就是构建一个action,在action中读取jpg图片并输出,然后客户端用一个img指向改action就可以了,当前节点和历史节点可以自行读取并利用div或者vml叠加到图片上.
//读取附件的内容
public byte[] getFile(String processName,int version, String fileName) throws Exception{
byte[] bytes = null;
JbpmContext jbpmContext = this.getContext();
try {
GraphSession graphSession = jbpmContext.getGraphSession();
ProcessDefinition pd = getDefinition(processName, version);
if(pd==null) throw new Exception("Process not found!");
FileDefinition fileDef = pd.getFileDefinition();
if(fileDef==null) throw new Exception("Process filedefinition not found!");
bytes = fileDef.getBytes(fileName);
} finally {
closeContext();
}
return bytes;
}
//获取图片的action
public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
request.setCharacterEncoding("UTF-8");
String name = request.getParameter("name");
int version = 0;
try {
version = Integer.valueOf(request.getParameter("version"));
} catch(Exception e) { }
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Charset", "UTF-8"); //default is UTF-8
log.info("get process:" + name+"/"+version);
Service jbpmSvr = new Service();
byte[] bytes = jbpmSvr.getFile(name, version, name+".xml");
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
OutputStream out = response.getOutputStream();
IoUtil.transfer(bais,out);
out.flush();
out.close();
return null;
}
在图片上叠加当前节点的图层需要先获取节点的坐标和大小
public int[] GetTaskinstanceBox(Long piID) throws DocumentException, UnsupportedEncodingException {
JbpmContext jbpmContext=this.getContext();
Session session = getSession(jbpmContext);
try {
List<String> aryToken = getProcessToken(session, piID);
int[] ret = new int[aryToken.size()*4+2];
ProcessInstance pi = jbpmContext.getProcessInstance(piID);
FileDefinition fd = pi.getProcessDefinition().getFileDefinition();
byte[] gpdBytes = fd.getBytes("gpd.xml");
String s = new String(gpdBytes,"UTF-8");
Document document = DocumentHelper.parseText(s);
document.setXMLEncoding("UTF-8");
Element root = document.getRootElement();
ret[0] = Integer.valueOf(root.attribute("width").getValue()).intValue();
ret[1] = Integer.valueOf(root.attribute("height").getValue()).intValue();
for(int i=0;i<aryToken.size();i++){
String nodeName = aryToken.get(i);
XPath xPath = new DefaultXPath("//node[@name='" + nodeName + "']");
Element node = (Element) xPath.selectSingleNode(root);
ret[i*4+2] = Integer.valueOf(node.attribute("x").getValue()).intValue();
ret[i*4+3] = Integer.valueOf(node.attribute("y").getValue()).intValue();
ret[i*4+4] = Integer.valueOf(node.attribute("width").getValue()).intValue();
ret[i*4+5] = Integer.valueOf(node.attribute("height").getValue()).intValue();
}
return ret;
} finally {
jbpmContext.close();
}
}
可以看到用XPath xPath = new DefaultXPath("//node[@name='" + nodeName + "']");在xml中查找节点,所以jBPM的节点名称不能重名,一个有意思的现象,如果你手动修改流程定义的xml文件,让其中两个节点重名,打开流程图后发现同名其中一个节点连接都跑到另外一个节点上了,这说明jBPM是按节点名称查找xml中的第一个节点,要解决这个问题就只能自定义流程样式,用自己顶一个的属性来显示节点名称,并且自己编写流程设计器和流程图显示.
分享到:
相关推荐
需要加载jbpm的包,数据库驱动,jaxen.jar
jbpm image tag lib and web.xml 博文链接:https://fengshujuan.iteye.com/blog/97291
JBoss jBPM 实例说明 struts1.1+spring1.2+hibernate3.0+jbpm3.1.4可以tomcat下运行,可通过图形模式发布工程,配置了在网页显示jbpm流程图的标签文件。
本工程基于以下框架实现工作流的实例. struts+spring+hibernate3.0+jbpm3.1.4,可以tomcat下运行,可通过图形模式发布工程,配置了在网页显示jbpm流程图的标签文件。
本工程为struts1.1+spring1.2+hibernate3.0+jbpm3.1.4 可以tomcat下运行,可通过图形模式发布工程,配置了在网页显示jbpm流程图的标签文件。 由于不能上传10M以上的包,本工程分为3个部分上传
本工程为struts1.1+spring1.2+hibernate3.0+jbpm3.1.4 可以tomcat下运行,可通过图形模式发布工程,配置了在网页显示jbpm流程图的标签文件。 由于不能上传10M以上的包,本工程分为3个部分上传
4.6 JBPM在MyEclipse画流程图时出现乱码: 14 5 核心API 14 5.1ProcessEngine 14 5.2RepositoryService 15 5.3ExecutionService 16 5.4TaskService 16 5.5ProcessDefinition 16 5.6ProcessInstance 16 5.7Execution ...
jbpm+ssh+spring security+ext+dwr+tomcat6.0+mysql+myeclipse8.0 完整实例 包括权限 邮件发送 流程图节点高亮显示
.........................................7 1.3 jBPM版helloworld.....................................10 1.3.1 创建helloworld流程......................13 1.3.2 设计流程图 ..................................
这是显示BPMN流程的图像: OpenShift环境安装 先决条件 您需要3.11版的OpenShift集群才能运行该应用程序。 您还可以使用minishift或oc集群。 您需要计算机上的OpenShift CLI(oc命令)才能使用launch.sh脚本。 您...
新手,近段时间正在自学...会签分配任务时,我用的是:task assignment handler,可在页面上显示流程图。开发环境为:jdk1.6.0_18+mysql5.1.48+jbpm4.4+struts2+spring3+hibernate3+ eclipse-jee-galileo-SR2-win32。
.........................................7 1.3 jBPM版helloworld.....................................10 1.3.1 创建helloworld流程......................13 1.3.2 设计流程图 ..................................
============ 为了在下一个页面 可以显示流程图, 根据实例id 查询 发布id @Override public String findDeploymentIdByProcessInstanceId(String pid) { ProcessInstance processInstance = processEngine....
【图八】在线流程设计 6.报表管理 系统的报表管理是基于模板来进行设置管理的,目前支持FineReport及Jasper Report两种报表引擎,前者是商业报表,其功能非常强大,可以实现多样式数据呈现方式,支持HTML、PDF、...
在实现流程管理和公文管理中,考虑到以后的扩展性,结合JBPM技术,用Myeclipse中的Joss Jbpm插件对流程图进行设计,采用Hibernate对流程中的流转进行控制,采用FreeMarker模版引擎对表单进行动态的显示。
一个是我们将编辑好的bpmn20.xml文件通过我们之前一分钟入门的示例activiti-explorer应用导入进去,查看它的流程图,并完整执行一遍流程。 在编写这个Demo之前,至少要了解Activiti与Spring如何集成、XxxService各自...
它以基于流行的JEE开源技术整合,以JBPM4.4流程引擎为基础,采用了WebService、XML、J2EE、Spring组件的灵活配置,并且与Microsoft Office实现了有机整合。完善了用户管理和安全的权限管理,支持POP3/POP3,SMTP/...