UserTransaction userTransaction,
WorkflowWork workflowWork)
throws WorkflowException
{
WorkflowActivity workflowActivity = workflowWork.getWorkflowActivity();
WorkflowCase workflowCase = workflowWork.getWorkflowCase();
WorkflowPackage workflowPackage = workflowProcess.getWorkflowPackage();
WorkflowTransition rever_transition = null;
//�ɷ��Ĺ��������ɻ���(revert)�����Ĺ������Ҫ�����
String strSQL =
"SELECT vc_from,vc_owner_processid,vc_transitionid FROM "
+ caseDatabase.getSchemaContext().getTableName(SchemaContext.SCHEMA_PATH)
+ " "
+ "WHERE vc_packageid=? "
+ "AND vc_processid=? "
+ "AND vc_caseid=? "
+ "AND vc_to=? "
+ "AND int_eventType=? ";
Connection conn = (Connection) userTransaction.getStoreConnection().get();
PreparedStatement pstmt = null;
try
{
pstmt = conn.prepareStatement(strSQL);
pstmt.setString(1, workflowPackage.getUUID());
pstmt.setString(2, workflowProcess.getUUID());
pstmt.setString(3, workflowCase.getUUID());
pstmt.setString(4, workflowWork.getUUID());
pstmt.setInt(5, WorkflowActivityEvent.WORK_REVERT);//<-----very important
ResultSet rs = pstmt.executeQuery();
if (rs.next())
{
String fromWorkID = rs.getString("vc_from");
//----------------------------------------------------------------------------
// ֧�ֻ��˴���Ĺ���������ڵ���Ҫ�����ϸ��������
//
// ���Ի��˴���Ĺ�����ǰ�̹��������Ψһ��
// ͬʱǰ�̹������ֻ��Ψһ�ĺ�̹����� (���ϵ�����,���ݽṹ)
//----------------------------------------------------------------------------
if (rs.next())
{
throw new WorkflowException("Fatal WorkflowService Engine Error");
}
WorkflowWork fromWork =
caseDatabase.findWorkflowWork(
workflowProcess,
operator,
userTransaction,
workflowCase,
fromWorkID);
String vc_owner_processid = rs.getString("vc_owner_processid");
if (vc_owner_processid != null && !"".equals(vc_owner_processid))
{
String vc_transitionid = rs.getString("vc_transitionid");
WorkflowProcess owner_processid = workflowPackage.findWorkflowProcess(vc_owner_processid);
rever_transition = owner_processid.findWorkflowTransition(vc_transitionid);
}
else
{
rever_transition =
workflowProcess.findWorkflowTransition(
workflowWork.getWorkflowActivity(),
fromWork.getWorkflowActivity());
}
//�����ߴ������������ڲ����ݽṹ�����й�ϵ
workflowCase.getCaseContext().setPerformersByTransition(
rever_transition,
new WorkflowParticipant[] { fromWork.getPerformer()});
}
}
catch (SQLException ex)