jbpm4.4流程


  • /** 流程发布*/
    function processDeploy(){
    if(selectedTr!=null){
    if(confirm("您确定发布该流程吗?")){
    var i = selectedTr.childNodes[0].innerText; ///取得行号。。跟据行号进行赋值。
    var name = msgs[i].name;
    $.ajax({
    type:"POST", 
    url:"workflow.do?op=processDeploy&deploymentId="+name, 
    dataType:"json", 
    success:function (msg) {
    if(msg==true){
    alert("部署成功!");
    doQuery();
    }else{
    alert("部署失败!");
    }
    
    
    }});
    }
    }else{
    alert("请选择要发布的数据!");
    }
    }

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request , HttpServletResponse response) throws Exception {
String op = request.getParameter("op");
//流程发布.
 if ("processDeploy".equals(op)) {
try {
String deploymentId = request.getParameter("deploymentId");
FlowDefineType flowDefineType = FlowDefineType.valueOf(deploymentId);
WorkflowService.deployment(flowDefineType);
response.getWriter().print("true");
} catch (Exception e) {
response.getWriter().print("false");
}
}
}

/**
 * 流程定义.
 */
public enum FlowDefineType {
gjjt("gjjt", "jbpm/bizflow/公交集团审批流程.jpdl.xml", "公交集团审批流程","jbpm/bizflow/公交集团审批流程.png");

private FlowDefineType(String name, String path, String descript, String imageSrc) {
this.name = name;
this.path = path;
this.descript = descript;
this.imageSrc = imageSrc;
}


private String name;
private String path;
private String descript;
private String imageSrc;


public String getName() {
return name;
}


public String getPath() {
return path;
}


public String getDescript() {
return descript;
}


/**
* 返回指定name的FlowDefineType对象,若无匹配则返回null.
*/
public static FlowDefineType valueOfname(String name) {
for (FlowDefineType flowDefineType : values()) {
if (flowDefineType.getName().equals(name))
return flowDefineType;
}
return null;
}


public String getImageSrc() {
return imageSrc;
}


public void setImageSrc(String imageSrc) {
this.imageSrc = imageSrc;
}


}


WorkflowService.java
/**
* 流程发布.
* 
* @param flowDefineType
* @return 流程发布ID
*/
static public String deployment(FlowDefineType flowDefineType) {
//logger.info("发布流程...:" + flowDefineType.getName() + " path:" + flowDefineType.getPath() + " descript:"
// + flowDefineType.getDescript());
RepositoryService repositoryService = getRepositoryService();
String deploymentId = repositoryService.createDeployment().addResourceFromClasspath(flowDefineType.getPath())
.deploy();
//logger.info("流程:" + flowDefineType.getName() + "发布成功!流程发布ID:" + deploymentId);
return deploymentId;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值