11-22-2010 07:51 AM
public class ActivitiTestServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
RepositoryService repositoryService;
RuntimeService runtimeService;
FormService formService;
/**
* @see HttpServlet#HttpServlet()
*/
public ActivitiTestServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try{
buildProcessEngine();
response.setStatus(200);
PrintWriter writer = response.getWriter();
writer.println("<html>");
writer.println("<head><title>Hello World Servlet</title></head>");
writer.println("<body>");
writer.println(" <h1>Hello World from a Sevlet!</h1>");
writer.println("<body>");
writer.println("</html>");
writer.close();
}
catch (Exception e){
System.out.println("Fehler: " + e);
response.setStatus(404);
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
public void buildProcessEngine(){
ProcessEngine processEngine = new ProcessEngineBuilder()
.configureFromResource("activiti.cfg.xml")
.buildProcessEngine();
getServices(processEngine);
deploy();
}
public void deploy(){
String barFileName = "D:/workspace/ActivitiTestServlet/src/barFiles/bookorder.bar";
ZipInputStream inputStream = null;
try {
inputStream = new ZipInputStream(new FileInputStream(
barFileName));
} catch (FileNotFoundException e) {
System.out.println(e);
e.printStackTrace();
}
repositoryService.createDeployment().name(barFileName)
.addZipInputStream(inputStream).deploy();
runtimeService.startProcessInstanceByKey("bookorder");
}
public void getServices(ProcessEngine processEngine){
repositoryService = processEngine.getRepositoryService();
runtimeService = processEngine.getRuntimeService();
formService = processEngine.getFormService();
}
}
11-22-2010 08:06 AM
repositoryService.createProcessDefinitionQuery().processDefinitionKey("bookorder").singleResult();
11-22-2010 10:24 AM
11-22-2010 10:29 AM
11-22-2010 11:33 AM
List<Deployment> deployments = repositoryService.createDeploymentQuery().deploymentName("Book order").list();
for (int i = 0;i<deployments.size();++i){
Deployment deployment = deployments.get(i);
repositoryService.deleteDeployment(deployment.getId());
}
List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().processDefinitionKey(PROCESS_ID).list();
for (int i = 0;i<processDefinitions.size();i++){
repositoryService.deleteDeployment(processDefinitions.get(i).getDeploymentId());
}
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.