jbpm---example
。。
:
deployProcessDefinition.jsp
JbpmContext jbpmContext = JbpmConfiguration.getInstance().createJbpmContext();
DiskFileUpload fileUpload = new DiskFileUpload();
List list = fileUpload.parseRequest(request);
Iterator iterator = list.iterator();
FileItem fileItem = (FileItem)iterator.next();
if(fileItem.getContentType().indexOf("application/x-zip-compressed") == -1){
throw new Exception("Only zip format is accepted!");
}
try{
WorkflowEngine workflowEngine = ServiceLocator.getWorkflowEngine()
String pdname = workflowEngine.deployProcessDefinition(fileItem.getInputStream(),null);
out.println(" :"+pdname);
}catch(Exception e){
}
jbpmContext.close();
--------------------------------------------------------------------------------
saveQingjiaForm.jsp // , ,
// , , ,
QingjiaForm qingjiaForm = new QingjiaForm();
qingjiaForm.setApplier((String)session.getAttribute("actorId"));
qingjiaForm.setNday(Integer.parseInt(ndays));
qingjiaForm.setReason(reason);
if("commit".equals(actionType)){
qingjiaForm.setState(QingjiaForm.SENT);
}else{
qingjiaForm.setState(QingjiaForm.INITIAL);
}
JbpmContext jbpmContext = JbpmConfiguration.getInstance().getCurrentJbpmContext();
jbpmContext.getSession().save(qingjiaForm) ; //
if("commit".equals(actionType)){ // ,
WorkflowEngine workflowEngine = ServiceLocator.getWorkflowEngine();
Map varMap = new HashMap();
varMap.put("infoid",qingjiaForm.getId());
// , , qingjia
// , ,
//String pdname,String starter,String version,Map varMap
workflowEngine.startProcess("qingjia",(String)session.getAttribute("actorId"),varMap);
}
--------listTaskInstances.jsp-->openTask.jsp--------------------------------------------------------
JbpmContext jbpmContext = JbpmConfiguration.getInstance().getCurrentJbpmContext();
Session session = jbpmContext.getSession();
Criteria rootCriteria = session.createCriteria(TaskInstance.class);
String pdname = request.getParameter("pdname");
String actorId = request.getParameter("actorId");
String tname = request.getParameter("tname");
String tstate = request.getParameter("tstate");
WorkflowEngine workflowEngine = ServiceLocator.getWorkflowEngine();
WorkitemCriteria workitemCriteria = new WorkitemCriteria();
workitemCriteria.setPdname(pdnane);
workitemCriteria.setTname(tname);
workitemCriteria.setActorId((String)session.getAttribute("actorId"));
String pageNum = request.getParameter("pageNum");
pageNum = pageNum == null || pageNum.equals("")?"0":pageNum;
int everyPage = workitemCriteria.getNeveryPage();
int target = Integer.parseInt(pageNum);
int startNum = targetPage * everyPage;
workitemCriteria.setStart(startNum);
workitemCriteria.setStatus(tstate);
PagedObject po = workflowEngine.getWorklist(workitemCriteria);
pageContext.setAttribute("list",po.getResult());
<c:forEach items="${list}" var="ti">
<a href="<c:url value="/sysadmin/openTask.jsp?tiid=${ti.id}" />"><c:out value="ti.name" /></a>
</c:forEach>
--------------------------------------------------------------------
OpenTask.jsp
String tiid = request.getParameter("tiid");
WorkflowEngine workflowEngine.takeWorkitem(null,tiid);
pageContext.forward(view+"?tiid="+tiid);
------------------------------------------------
auditQingjiaForm.jsp --->endTask.jsp
Long tiid = Long.parseLong(request.getParameter("tiid"));
JbpmContext jbpmContext = JbpmConfiguration.getInstance().getCurrentJbpmContext();
TaskInstance ti = jbpmContext.loadTaskInstance(tiid);
pageContext.setAttribute("tokenId",ti.getToken().getId());
Long infoid = (Long)ti.getProcessInstance().getContextInstance().getVariable("infoid");
QingjiaForm qingjiaForm = (QingjiaForm)jbpmContext.getSession().get(QingjiaForm.class,infoid);
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
...
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
<input type="hidden" name="tiid" value="<%=tiid%>" />
List list = ti.getTask().getTaskNode().getLeavingTransitions();
pageContext.setAttribute("nextTrans",list);
if(list.size()>1){
<select name="nextPath">
<c:forEach items="${nextTrans}" var="nextTran" varStatus="s">
<option value="<c:out value="${nextTran.name}"/>"><c:out value="${nextTran.name}"/></option>
</c:forEach>
</select>
}
<input type="submit" value=" " />
----------------------------------------------
endTask.jsp
String tiid = request.getParameter("tiid");
String transitionName = request.getParameter("nextPath");
String actorId = request.getParameter("actorId");
ti.getProcessInstance().getContextInstance().setVariable("currentUser",session.getAttribute("actorId"));
WorkflowEngine workflowEngine = ServiceLocator.getWorkflowEngine();
workflowEngine.completeWorkitem(tiid,new NextStep(transitionName.actorId));
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
Java swing drawImagegetImage 가 즉시 돌아 오기 때문에 그림 이 불 러 올 때 까지 기다 리 지 않 고 프로그램 에서 다른 작업 을 수행 할 수 있 습 니 다.성능 을 향상 시 킬 수 있 지만 효과 적 인 프로그램 은 더 많은 ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.