Adwait Chitaley [http://community.jboss.org/people/achitaley] replied to the 
discussion

"Visualize workflow and it's current state"

To view the discussion, visit: http://community.jboss.org/message/558278#558278

--------------------------------------------------------------
To Eugene Dzhurinsky, HuiSheng Xu and other JBPM Users who desire to view the 
Current Status of a Process Instance in a Graphical Mode / PNG Image.

I have received a generous assistance of Roberto Harihar from Brazil, who has 
developed this code in viewing the Current Status of A Process Instance 
Graphically.

With the attached files and steps mentioned below, we can generate an Image of 
the Current Status of Process Instance. This can be integrated into our 
application as well.


1) Use the attached File (jbpm_image_sample.jar) and extract it. This JAR 
Contains the necessary code to generate PNG Image of Current Process Instance 
at Runtime. This also contains the required images to generate the PNG Image.

2) In addition to above, in the same package, create a Java Class File named 
*Render.java* and insert the following code in it:



import java.io.File;
import java.util.List;
import javax.imageio.ImageIO;
import org.jbpm.api.Configuration;
import org.jbpm.api.ProcessEngine;
import org.jbpm.api.model.OpenExecution;
import com.airsanchay.jbpm.JBPMUtilities;
import org.jbpm.api.ExecutionService;
import org.jbpm.api.HistoryService;
import org.jbpm.api.IdentityService;
import org.jbpm.api.ManagementService;
import org.jbpm.api.RepositoryService;
import org.jbpm.api.TaskService;

public class Render {
 
    /**
     * @param args
     */
    public static void main(String[] args) throws Exception {
        String processInstanceId = "AIRSanchayWorkflow.1870001";
        /** if you are running as a java application - outside a j2ee container 
*/
        ProcessEngine processEngine = new 
Configuration().setResource("jbpm.cfg.xml").buildProcessEngine();
        List historyActivities = 
processEngine.getHistoryService().createHistoryActivityInstanceQuery().processInstanceId(processInstanceId).list();
        RenderImage_JpdlModel jpdlModel = new 
RenderImage_JpdlModel(JBPMUtilities.class.getResourceAsStream("AIRSanchayWorkflow.jpdl.xml"),
 historyActivities);
        ImageIO.write(new RenderImage_JpdlModelDrawer().draw(jpdlModel), "png", 
new File("/root/Desktop/myprocess.png"));
    }
}

|
|  |

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

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

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

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to