📄 jlcmccopendocaction.java
字号:
package com.mdcl.mocha.jlcmcc.contract.action;
/**
* <strong>Title : JLCMCCOpenDocAction<br></strong>
* <strong>Description : 获取文档id</strong><br>
* <strong>Create on : 2007-9-15<br></strong>
* <p>
* <strong>Copyright (C) Mocha Software Co.,Ltd.<br></strong>
* <p>
* @author zhanghd zhanghd@mochasoft.com.cn<br>
* @version <strong>吉林移动BPM一期</strong><br>
* <br>
* <strong>修改历史:</strong><br>
* 修改人 修改日期 修改描述<br>
* -------------------------------------------<br>
* <br>
* <br>
*/
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.mdcl.mocha.bpm.sdk.ServiceManager;
import com.mdcl.mocha.bpm.sdk.bo.entity.IBizObjectDefinition;
import com.mdcl.mocha.bpm.sdk.bo.entity.IBizObjectTypeDefinition;
import com.mdcl.mocha.bpm.sdk.bo.service.IBizObjectTypeDefinitionService;
import com.mdcl.mocha.bpm.sdk.boins.BoInsException;
import com.mdcl.mocha.bpm.sdk.boins.entity.IBoInstance;
import com.mdcl.mocha.bpm.sdk.boins.service.IBoInstanceService;
import com.mdcl.mocha.bpm.sdk.license.ExpiryException;
import com.mdcl.mocha.bpm.sdk.license.LicenseException;
import com.mdcl.mocha.bpm.sdk.license.NotFoundModuleException;
import com.mdcl.mocha.bpm.webcommons.action.BPMBaseAction;
import com.mdcl.mocha.jlcmcc.configmanager.ConfigManager;
public class JLCMCCOpenDocAction extends BPMBaseAction{
/**
* 根据流程实例id(boInsId)、用户id(userID)
*
* 得到用户已完成的流程实例的文档id 的list(Documentlist)
*/
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
String UserID = request.getParameter("userID");
String userName = request.getParameter("userName");
String BoInsId = (String)request.getParameter("boInsId");
String Boproperties = (String)request.getParameter("boinsname");
List BoInsIdlist = new ArrayList();
try {
//获取业务流程类型列表
IBizObjectTypeDefinitionService IBi=(IBizObjectTypeDefinitionService) ServiceManager.getInstance().getService(IBizObjectTypeDefinitionService.class);
List IBioTypelist = null;
IBioTypelist=IBi.getAll();
//获得流程实例名
String getBoins=getPath(Boproperties);
//根据业务流程类型获取所有业务流程定义
String BoinsID = null;
for(int i=0;i<IBioTypelist.size();i++){
IBizObjectTypeDefinition t_IBioType=(IBizObjectTypeDefinition)IBioTypelist.get(i);
List temp=IBi.getBoDefs(t_IBioType.getId());
for(int j=0;j<temp.size();j++){
IBizObjectDefinition BoDef=(IBizObjectDefinition)temp.get(j);
String BodefId=BoDef.getboDefID();
if(BodefId.equals(getBoins)){
BoinsID = BoDef.getboDefID();
break;
}
}
}
//获取服务
IBoInstanceService IBoSer = (IBoInstanceService)ServiceManager.getInstance().getService(IBoInstanceService.class);
//已知的合同会签流程的BoDefId
//得到BoDefId下的所有实例的List
List Bolist=IBoSer.getInstancesByBoDefId(BoinsID);
for (int i=0;i<Bolist.size();i++){
IBoInstance temp=(IBoInstance)Bolist.get(i);
boolean flag=temp.getCreaterID().equalsIgnoreCase(UserID);
boolean flag2=temp.ifFinished();
if(flag&&flag2){
BoInsIdlist.add(temp);
}
}
} catch (NotFoundModuleException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (ExpiryException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
} catch (LicenseException e3) {
// TODO Auto-generated catch block
e3.printStackTrace();
} catch (BoInsException e4) {
// TODO Auto-generated catch block
e4.printStackTrace();
}catch (Exception e5) {
// TODO Auto-generated catch block
e5.printStackTrace();
}
//回传到下一个界面的参数
request.setAttribute("Boproperties", Boproperties);
request.setAttribute("UserID",UserID);
request.setAttribute("BoInsId",BoInsId);
request.setAttribute("userName",userName);
request.setAttribute("BoInsIdlist", BoInsIdlist);
return mapping.findForward("CHOOSE");
}
/**
*
* 读取配置文件
*
* @return 流程实例名称值
*/
public String getPath(String path)
{
String result="";
ConfigManager cm;
try {
cm = (ConfigManager)ServiceManager.getInstance().getService(ConfigManager.class);
result = cm.getPath("jlcmcc-contract.properties",path);
} catch (NotFoundModuleException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ExpiryException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (LicenseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -