一个用数据库实现的工作流(4)

2008-02-23 09:55:08来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

if ((list != null) && (list.size() > 0)) {
return (WorkflowTemplate[]) list.toArray(new WorkflowTemplate[list.
size()]);
}

return null;
}

/**
* 得到指定工作流的当前结点
* @param work_id String
* @return WorkflowNode
*/
public WorkflowNode getCurrentNode(String work_id) {
Object obj = this.getJdbcTemplate().query(
"select flow_id from workflow_work where id=?",
new Object[] {work_id},
new int[] {Types.VARCHAR},
new ResultSetExtractor() {
public Object extractData(ResultSet rs) throws SQLException,
DataAccessException {
if (rs.next()) {
return rs.getString("flow_id");
}
return null;
}
});
if (obj != null) {
String flow_id = (String) obj;
//
return this.getWorkflowNodeById(flow_id);
}
return null;
}

public WorkflowNode getCurrentNode(Workflow workFlow) {
return null;
}

public WorkflowNode[] getCurrentWorkflowNodeByMan(String mam_id) {
return null;
}

public WorkflowTemplate getTemplateById(String id) {
Object obj = this.getJdbcTemplate().query(
"select * from workflow_template where id=?",
new Object[] {id}, new int[] {Types.VARCHAR},
new ResultSetExtractor() {
public Object extractData(ResultSet rs) throws SQLException,
DataAccessException {
if (rs.next()) {
WorkflowTemplate temp = new WorkflowTemplate();
temp.setId(rs.getString("id"));
temp.setName(rs.getString("name"));
temp.setDescription(rs.getString("description"));
temp.setCreateMan(rs.getString("createMan"));
temp.setCreateDate(rs.getTimestamp("createDate"));
temp.setStatus(rs.getInt("status"));

return temp;
}

return null;
}
});

if (obj != null) {
return (WorkflowTemplate) obj;
}

return null;
}

public WorkflowTemplate getTemplateByName(String name) {
return null;
}

public WorkflowTemplateNode getTemplateNodeById(String id) {
Object obj = this.getJdbcTemplate().query(
"select * from workflow_template_flow where id=?",
new Object[] {id}, new int[] {Types.VARCHAR},
new ResultSetExtractor() {
public Object extractData(ResultSet rs) throws SQLException,
DataAccessException {
if (rs.next()) {
WorkflowTemplateNode wfnode = new WorkflowTemplateNode();
wfnode.setId(rs.getString("id"));
wfnode.setName(rs.getString("name"));
wfnode.setDescription(rs.getString("description"));
wfnode.setWorkId(rs.getString("template_id"));
wfnode.setSequence(rs.getInt("sequence"));

return wfnode;
}

return null;
}
});

if (obj != null) {
return (WorkflowTemplateNode) obj;
}

return null;
}

public WorkflowTemplateNode getTemplateNodeByName(String name) {
return null;
}

public List getTemplateNodeMans(String template_flow_id) {
List list = this.getJdbcTemplate().query(
"select account_id from workflow_template_man where template_flow_id=? ",
new Object[] {template_flow_id}, new int[] {Types.VARCHAR},
new RowMapper() {
public Object mapRow(ResultSet rs, int _int) throws SQLException {
return rs.getString("account_id");
}
});

return list;
}

public List getWorkflowNodeMans(String work_flow_id) {
List list = this.getJdbcTemplate().query(
"select account_id from workflow_man where flow_id=? ",
new Object[] {work_flow_id}, new int[] {Types.VARCHAR},
new RowMapper() {
public Object mapRow(ResultSet rs, int _int) throws SQLException {
return rs.getString("account_id");

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:[学习小记]Java的反射机制

下一篇:我的J2ME编程联系(1)——List