[jboss-user] [jBPM] - Re: [Jbpm5]how to get the image showing the current status of a workflow in the web application

xiaoxiao long do-not-reply at jboss.com
Mon Oct 8 03:55:54 EDT 2012


xiaoxiao long [https://community.jboss.org/people/mimi_2012] created the discussion

"Re: [Jbpm5]how to get the image showing the current status of  a workflow in the web application"

To view the discussion, visit: https://community.jboss.org/message/763643#763643

--------------------------------------------------------------
thank you,but I use the bpmn file ,in JBPM4.4 it is simple to achieve this function:

<%@page import="org.jbpm.api.*,java.io.*"%>
<%
 ProcessEngine processEngine = Configuration.getProcessEngine();
 RepositoryService repositoryService = processEngine
   .getRepositoryService();
 ExecutionService executionService = processEngine
   .getExecutionService();
 String id = request.getParameter("id");
 ProcessInstance processInstance = executionService
   .findProcessInstanceById(id);
 String processDefinitionId = processInstance
   .getProcessDefinitionId();
 ProcessDefinition processDefinition = repositoryService
   .createProcessDefinitionQuery().processDefinitionId(
     processDefinitionId).uniqueResult();
 InputStream inputStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(),"loan.png");
 byte[] b = new byte[1024];
 int len = -1;
 while ((len = inputStream.read(b, 0, 1024)) != -1) {
  response.getOutputStream().write(b, 0, len);
 }
%>

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="org.jbpm.api.*,java.util.*,org.jbpm.api.model.*" %>
<%
 String id = request.getParameter("id");
 ProcessEngine processEngine = Configuration.getProcessEngine();
 RepositoryService repositoryService = processEngine.getRepositoryService();
 ExecutionService executionService = processEngine.getExecutionService();
 ProcessInstance processInstance = executionService.findProcessInstanceById(id);
 Set<String> activityNames = processInstance.findActiveActivityNames();
 
 ActivityCoordinates ac = repositoryService.getActivityCoordinates(processInstance.getProcessDefinitionId(),activityNames.iterator().next());
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " http://www.w3.org/TR/html4/loose.dtd http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<img src="loan.png" style="position:absolute;left:0px;top:0px;">
*<div style="position:absolute;border:1px solid red;left:<%=ac.getX()%>px;top:<%=ac.getY()%>px;width:<%=ac.getWidth()%>px;height:<%=ac.getHeight()%>px;"></div>*
</body>
</html>

--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/763643#763643]

Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121008/f545bf3a/attachment-0001.html 


More information about the jboss-user mailing list