OSWorkflow的第五支程式
第五支程式要用OSWorkflow提供的API做查詢,查詢出已完成工作流的工作流編號。
程式
Query.java
package tw.idv.idealist;
import java.util.*;
import com.opensymphony.workflow.*;
import com.opensymphony.workflow.query.*;
import com.opensymphony.workflow.spi.WorkflowEntry;
/**
* @author steven
*/
public class Query extends AbstractWorkflow {
public List getCompleted() {
FieldExpression fe = new FieldExpression(FieldExpression.STATE,
FieldExpression.ENTRY,
FieldExpression.EQUALS,
new Integer(WorkflowEntry.COMPLETED));
List list = null;
try {
list = getPersistence().query(new WorkflowExpressionQuery(fe));
} catch (StoreException e) {
e.printStackTrace();
}
return list;
}
}
completed.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<%@ page language="java" contentType="text/html; charset=BIG5" pageEncoding="BIG5" %>
<%@ page import="tw.idv.idealist.*" %>
<%@ page import="java.util.*" %>
<META http-equiv="Content-Type" content="text/html; charset=BIG5">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>completed.jsp</TITLE>
</HEAD>
<BODY>
已完成的工作流編號:<br>
<%
Query query = new Query();
List completed = query.getCompleted();
for(int i=0; i<completed.size(); i++) {
Long wfId = (Long) completed.get(i);
out.println("workflow id => " + wfId + "<br>");
}
%>
</BODY>
</HTML>
标签:workflow,程序,new,OSWorkflow,FieldExpression,import,第五个,opensymphony
From: https://blog.51cto.com/u_16085616/6441477