首先我们假定一个封闭报销的流程: 报销人进行基本信息的登记---->部门领导进行审批---->分管领导进行审批---->财务总监进行审批---->进行金额判断---->金额小于1000的直接交由出纳;金额大于等于1000交到总经理那进行审批再交到出纳这里.

1. 报销单登记,录入报销的基本信息,界面【附件1】。上传报销单、发票到CE中。审批过程中上述两个材料是审批的依据。只有上传报销单、发票后才能提交审批

2. CE中的附件的目录结构:【年度】à【月份】à【报销单】、【发票】。“年度”目录下是“月份”目录,“月份”目录下面有两个目录是“报销单”、“发票”目录。

3. 报销单document class 属性:日期,报销人,合计,备注

4. 发票 document class 金额,日期,发票号码,发票代码,单位

5. 建立一个搜索模版:输入报销人,金额,日期等条件,查处所有的报销单。

6. 程序要求:基本信息登记要求用jsp,jsf或者flex等技术实现【附件1】的界面。【自己选择】

【上传报销单】按钮:调用CE、PE等api实现上传附件到【报销单】目录下。

【上传发票】按钮:同上,上传附件到【发票】目录下。

【登记完成】按钮:报销单、发票等材料附件到流程中。启动流程到下一步。

领导审批:所有的页面用eform实现。

有了上面的需求我们开始工作:

创建好所需的document class进入workplace设计流程,这个流程很简单,设计eform,为本流程新增一个表单策略,这些都在workplace下完成,比较简单,我在这里就不再详细说了,主要说下j2EE对流程操作的实现

(在此声明:本人也是刚开始学习fileNet,有说错地方还请各位多多包含,给予指正,只是现在在对于fileNet的资料国内实在是少,写给一些初学者,希望能对大家有所帮助。)

开发环境为:JSF+Tomcat 6.0

首先搭建工程,引入必要的包,配置PE,CE连接,配置文件:

点击下载此文件

解压后只要稍做修改就可以使用了.

创建包view和service,view用来放与页面交互的managedBean,在view里我们创建一个一厂类Credential用来管理我们要使用的CE,PE连接,如下:

package service;
import com.filenet.api.core.Connection;
import filenet.vw.api.VWSession;
public class Credential {
private VWSession vwSession;
private Connection connection;
public Credential(VWSession vwSession, Connection connection)
{
this.vwSession = vwSession;
this.connection = connection;
}
public VWSession getVWSession()
{
return vwSession;
}
public Connection getConnection()
{
return connection;
}
}

在view里创建FileNetManagedBean,好,准备工作做完,我们来实现fileNet的登录,代码如下:

登录页

用户名:

密码:

在我们的Bean里创建方法login public String login(){

Connection conn = this.logonCE(this.CONFIG_BUNDLE);
VWSession session;
try {
session = this.logonPE(this.CONFIG_BUNDLE);
this.credential = new Credential(session,conn);
return "suc";
} catch (VWException e) {
e.printStackTrace();
return "";
}
}

其中的CONFIG_BUNDLE为一个静态常量

//登录PE的所有配置文件
private static final String CONFIG_BUNDLE = "config/pe/pelogin";

需要用到的方法如下:

/**
* Logon PE and return a connected VWSession
*
* @return VWSession
* @throws VWException
*
*/
private VWSession logonPE(String url) throws VWException {
ResourceBundle configBundle = ResourceBundle
.getBundle(url);
// Setup parameters of JVM
setJVMParametersForPE(configBundle);
// get PE login configuration parameters from configuration file
String connectionPointName = configBundle
.getString("ConnectionPointName");
// Login to Process Engine
VWSession vwSession = new VWSession(this.userName, this.password,
connectionPointName);
return vwSession;
}
private Connection logonCE(String url)
{
ResourceBundle configBundle = ResourceBundle
.getBundle(url);
// Setup parameters of JVM
setJVMParametersForPE(configBundle);
// get PE login configuration parameters from configuration file
String ce_uri = configBundle.getString("ContentEngineURL");
Connection conn = Factory.Connection.getConnection(ce_uri);
Subject s = UserContext.createSubject(conn, this.userName, this.password, null);
UserContext uc = UserContext.get();
uc.pushSubject(s);
// uc.popSubject()
return conn;
}
/**
* Set JVM Parameters used to connect PE
*
* @param resourceBundle
* The resource file which contains the values of
* parameters
*/
private static void setJVMParametersForPE(
ResourceBundle resourceBundle) {
// Set WASP location
String waspLocation = resourceBundle.getString("WASP_Location");
System.out.println("***************************");
System.out.println("waspLocation = " + waspLocation);
if (null != waspLocation && !waspLocation.equals("")) {
URL waspLocationURL = FileNetManagedBean.class
.getResource(waspLocation);
String waspLocationPath = waspLocationURL.getPath();
System.setProperty("wasp.location", waspLocationPath);
}
// Set jaas configuration parameter
String jaasConfigFile = resourceBundle
.getString("JAAS_ConfigFile");
System.out.println("***************************");
System.out.println("jaasConfigFile = " + jaasConfigFile);
if (null != jaasConfigFile && !jaasConfigFile.equals("")) {
URL jaasConfigURL = FileNetManagedBean.class
.getResource(jaasConfigFile);
String jaasConfigFilePath = jaasConfigURL.getPath();
System.setProperty("java.security.auth.login.config",
jaasConfigFilePath);
}
// set the CE_URL for authentication
String ceURL = resourceBundle.getString("ContentEngineURL");
System.out.println("***************************");
System.out.println("ceURL = " + ceURL);
System.setProperty("filenet.pe.bootstrap.ceuri", ceURL);
}

登录成功跳转到报销登记页面.登记实现将在下篇介绍.