WorkflowTransition workflowTransition)
{
WorkflowCase workflowCase = workflowWork.getWorkflowCase();
WorkflowActivity dispActivity = workflowTransition.getFromWorkflowActivity();
String disp_owner_process_id = dispActivity.getWorkflowProcess().getUUID();
String disp_activity_id = dispActivity.getUUID();
WorkflowActivity joinActivity = workflowTransition.getToWorkflowActivity();
String join_owner_process_id = joinActivity.getWorkflowProcess().getUUID();
String join_activity_id = joinActivity.getUUID();
String packageId = workflowProcess.getWorkflowPackage().getUUID();
String processId = workflowProcess.getUUID();
String caseId = workflowWork.getWorkflowCase().getUUID();
Connection conn = (Connection) userTransaction.getStoreConnection().get();
PreparedStatement pstmt = null;
ResultSet rs = null;
String strSQL = null;
MonitorEventResult eventResult = new MonitorEventResult();
try
{
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int join_monitor_counter = 0;
int join_activity_batchNo = 0;
int disp_activity_batchNo = 0;
//--------------------------------------------------------------------
// DISP ACTIVITY DISPATCH INFO
// 1. ȡ�ñ����ɷ��Ĺ������������Ļ�ڵ���Ϣ
strSQL =
"SELECT int_batchNo,int_join_monitor FROM "+userTransaction.getDatabase().getSchemaContext().getTableName(SchemaContext.SCHEMA_ACTIVITY_DISPATCH)+" "
+ "WHERE vc_packageid=? "
+ "AND vc_processid=? "
+ "AND vc_caseid=? "
+ "AND vc_owner_processid=? "
+ "AND vc_activityid=? ";
pstmt = conn.prepareStatement(strSQL);
pstmt.setString(1, packageId);
pstmt.setString(2, processId);
pstmt.setString(3, caseId);
pstmt.setString(4, disp_owner_process_id);
pstmt.setString(5, disp_activity_id);
rs = pstmt.executeQuery();
if (rs.next())
{
disp_activity_batchNo = rs.getInt("int_batchNo");
eventResult.setBatchNo(disp_activity_batchNo);
}
//--------------------------------------------------------------------
// JOIN ACTIVITY DISPATCH INFO
// 2.ȡ�ù��������۵Ļ�ڵ���Ϣ
//--------------------------------------------------------------------
pstmt.setString(1, packageId);
pstmt.setString(2, processId);
pstmt.setString(3, caseId);
pstmt.setString(4, join_owner_process_id);
pstmt.setString(5, join_activity_id);
rs = pstmt.executeQuery();
if (rs.next())
{
join_activity_batchNo = rs.getInt("int_batchNo");
join_monitor_counter = rs.getInt("int_join_monitor");
}
ConnUtils.cleanupNoThrow(pstmt);
pstmt = null;
if ((disp_activity_batchNo + 1) < join_activity_batchNo)
{
eventResult.first(false);
eventResult.last(false);
return eventResult;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// 3. ȡ�û�۵Ļ�ڵ㵱ǰ��ɵ�ǰ�̹�������Ϣ
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
List inTrans = joinActivity.getIncomingTransitions();
int inTrans_size = inTrans.size();
int falseTrans_size = 0;
strSQL =
"SELECT int_batchNo FROM "+userTransaction.getDatabase().getSchemaContext().getTableName(SchemaContext.SCHEMA_ACTIVITY_DISPATCH)+" "
+ "WHERE vc_disp_flag=? "
+ "AND vc_packageid=? "
+ "AND vc_processid=? "
+ "AND vc_caseid=? "
+ "AND vc_owner_processid=? "
+ "AND vc_activityid=? ";
pstmt = conn.prepareStatement(strSQL);
List not_found_inTrans = new ArrayList();
for (int i = 0; i < inTrans_size; ++i)
{
WorkflowTransition flaseTransition = (WorkflowTransition) inTrans.get(i);
WorkflowActivity falseActivity = flaseTransition.getFromWorkflowActivity();
String false_owner_process_id = falseActivity.getWorkflowProcess().getUUID();
String false_activity_id = falseActivity.getUUID();
pstmt.setString(1, "FALSE");
pstmt.setString(2, packageId);
pstmt.setString(3, processId);
pstmt.setString(4, caseId);
pstmt.setString(5, false_owner_process_id);
pstmt.setString(6, false_activity_id);
rs = pstmt.executeQuery();
if (rs.next())
{
falseTrans_size += 1;
}
else
{
not_found_inTrans.add(flaseTransition);
}
}
ConnUtils.cleanupNoThrow(pstmt);
pstmt = null;
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
// -----------------Lookup In event_userTransaction ---------------------------------
//------------------VIP Code Section By zosatapo----------------------------------------
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Connection event_conn = null;
PreparedStatement event_pstmt = null;
ResultSet event_rs=null;
try
{
event_conn = (Connection) event_userTransaction.getStoreConnection().get();
strSQL =
"SELECT int_batchNo FROM "+userTransaction.getDatabase().getSchemaContext().getTableName(SchemaContext.SCHEMA_ACTIVITY_DISPATCH)+" "
+ "WHERE vc_disp_flag=? "
+ "AND vc_packageid=? "
+ "AND vc_processid=? "
+ "AND vc_caseid=? "
+ "AND vc_owner_processid=? "
+ "AND vc_activityid=? ";
event_pstmt = event_conn.prepareStatement(strSQL);
int not_found_inTrans_size = not_found_inTrans.size();
for (int i = 0; i < not_found_inTrans_size; ++i)
{
WorkflowTransition flaseTransition = (WorkflowTransition) not_found_inTrans.get(i);
WorkflowActivity falseActivity = flaseTransition.getFromWorkflowActivity();
String false_owner_process_id = falseActivity.getWorkflowProcess().getUUID();
String false_activity_id = falseActivity.getUUID();
event_pstmt.setString(1, "FALSE");
event_pstmt.setString(2, packageId);
event_pstmt.setString(3, processId);
event_pstmt.setString(4, caseId);