IDEMPIERE-3942 Implement JoinElement ADN Status

This commit is contained in:
Ray Lee 2019-04-08 06:01:10 +08:00
parent a726ea78ee
commit f61ef24e77
1 changed files with 43 additions and 1 deletions

View File

@ -369,9 +369,23 @@ public class MWFProcess extends X_AD_WF_Process
// Start new Activity...
MWFActivity activity = new MWFActivity (this, transitions[i].getAD_WF_Next_ID(), lastPO);
/**
* IDEMPIERE-3942
* Implement JoinElement AND Status
*/
if(MWFNode.JOINELEMENT_AND.equals(activity.getNode().getJoinElement()))
{
if(!isJoinElementANDProcessed(activity))
{
activity.delete(true, get_TrxName());
continue;
}
}
activity.set_TrxName(trxName);
activity.run();
// only the first valid if XOR
if (MWFNode.SPLITELEMENT_XOR.equals(split))
return true;
@ -379,7 +393,35 @@ public class MWFProcess extends X_AD_WF_Process
return true;
} // startNext
/*
* IDEMPIERE-3942
* Implement JoinElement AND Status
*/
private boolean isJoinElementANDProcessed(MWFActivity activity) {
Query queryNodeNextTest = new Query(Env.getCtx(), MWFNodeNext.Table_Name, "AD_WF_Next_ID = ?", get_TrxName());
queryNodeNextTest.setParameters(activity.getAD_WF_Node_ID());
List<MWFNodeNext> NodeNexts = queryNodeNextTest.list();
for (MWFNodeNext nodeNext : NodeNexts) {
Query queryMWFActivity = new Query(Env.getCtx(), MWFActivity.Table_Name,
"AD_WF_Process_ID = ? AND AD_WF_Node_ID = ? ", get_TrxName());
Object params[] = { activity.getAD_WF_Process_ID(), nodeNext.getAD_WF_Node_ID() };
queryMWFActivity.setParameters(params);
List<MWFActivity> parentActivitys = queryMWFActivity.list();
for (MWFActivity parentActivity : parentActivitys) {
if(!parentActivity.isProcessed())
return false;
}
}
return true;
}
/**************************************************************************
* Set Workflow Responsible.
* Searches for a Invoker.