使用jBpm支持高级用户交互模式
2010-01-21 00:00:00 来源:WEB开发网清单6 扩展TaskInstance类
这个实现扩展了jBPM提供的TaskInstance类,并跟踪完成该实例所需的参与者个数。它引入了几个新方法,允许参与者预留(reserve)/退还(unreserve)任务实例,以及让指定参与者完成任务执行。
清单6的实现依赖一个支持类Assignee(清单7)
package com.navteq.jbpm.extensions;
import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Assignee implements Serializable{
private static final long serialVersionUID = 1L;
private static final DateFormat dateFormat = new
SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
long id = 0;
protected String startDate = null;
protected String userID = null;
protected String endDate = null;
public Assignee(){}
public Assignee(String uID){
userID = uID;
startDate = dateFormat.format(new Date());
}
////////////Setters and Getters ///////////////////
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getUserID() {
return userID;
}
public void setUserID(String id) {
userID = id;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public void setEndDate(Date endDate) {
this.endDate = dateFormat.format(endDate);
}
public void setEndDate() {
this.endDate = dateFormat.format(new Date());
}
public String toString(){
StringBuffer bf = new StringBuffer();
bf.append(" Assigned to ");
bf.append(userID);
bf.append(" at ");
bf.append(startDate);
bf.append(" completed at ");
bf.append(endDate);
return bf.toString();
}
}
更多精彩
赞助商链接