PM-3083 "PM-3083 and PM-3046" SOLVED
Issue:
- PM-3083: La funcionalidad cambiar tipo de gateway desde el diseñr no funciona
- PM-3046: DesignerBPMN>Conexiones Gateway to Gateway muestran error al ejecutar un caso
Cause:
En PM-3083 y PM-3046 los gateway-joins (converging) PARALLEL e INCLUSIVE no son actualizados
correctamente en Back-end
Solution:
- Se define el gateway de tipo converging para PARALLEL e INCLUSIVE cuando
uno o mas flows ingresan al geteway, esto en Back-end
- Se mejoro la verificacion de hilos abiertos al derivar un caso, esto en Running-case
This commit is contained in:
@@ -1353,42 +1353,48 @@ class Cases
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* This function returns the threads open in a task
|
||||
* get an array with all sibling threads open from next task
|
||||
*
|
||||
* @name getOpenSiblingThreads,
|
||||
* @param string $sNextTask
|
||||
* @param string $sAppUid
|
||||
* @param string $iDelIndex
|
||||
* @param string $sCurrentTask
|
||||
* @return $aThreads
|
||||
* @param string $nextTaskUid
|
||||
* @param string $applicationUid
|
||||
* @param string $delIndex
|
||||
* @param string $currentTaskUid
|
||||
*
|
||||
* return array Return $arrayThread
|
||||
*/
|
||||
|
||||
public function getOpenSiblingThreads($sNextTask, $sAppUid, $iDelIndex, $sCurrentTask)
|
||||
public function getOpenSiblingThreads($nextTaskUid, $applicationUid, $delIndex, $currentTaskUid)
|
||||
{
|
||||
try {
|
||||
//Get all tasks that are previous to my NextTask, we want to know if there are pending task for my nexttask
|
||||
//we need to filter only seq joins going to my next task
|
||||
//and we are removing the current task from the search
|
||||
$aThreads = array();
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(RoutePeer::ROU_NEXT_TASK, $sNextTask);
|
||||
$oCriteria->add(RoutePeer::TAS_UID, $sCurrentTask, Criteria::NOT_EQUAL);
|
||||
$oCriteria->add(RoutePeer::ROU_TYPE, 'SEC-JOIN');
|
||||
$oDataset = RoutePeer::doSelectRs($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$aPrevious = $this->searchOpenPreviousTasks($aRow['TAS_UID'], $sAppUid);
|
||||
if (is_array($aPrevious) && count($aPrevious) > 0) {
|
||||
$aThreads[] = array_merge($aPrevious, $aThreads);
|
||||
$arrayThread = array();
|
||||
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->add(RoutePeer::TAS_UID, $currentTaskUid, Criteria::NOT_EQUAL);
|
||||
$criteria->add(RoutePeer::ROU_NEXT_TASK, $nextTaskUid, Criteria::EQUAL);
|
||||
$criteria->add(RoutePeer::ROU_TYPE, "SEC-JOIN", Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = RoutePeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$arrayPrevious = $this->searchOpenPreviousTasks($row["TAS_UID"], $applicationUid);
|
||||
|
||||
if (is_array($arrayPrevious) && !empty($arrayPrevious)) {
|
||||
$arrayThread = array_merge($arrayThread, $arrayPrevious);
|
||||
}
|
||||
$oDataset->next();
|
||||
}
|
||||
return $aThreads;
|
||||
} catch (exception $e) {
|
||||
throw ($e);
|
||||
|
||||
//Return
|
||||
return $arrayThread;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1426,11 +1432,12 @@ class Cases
|
||||
$oCriteria->add(RoutePeer::ROU_NEXT_TASK, $taskUid);
|
||||
$oDataset = RoutePeer::doSelectRs($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
while (is_array($aRow)) {
|
||||
while ($oDataset->next()) {
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
$delegations = $this->getReviewedTasks($aRow['TAS_UID'], $sAppUid);
|
||||
|
||||
if ($delegations !== false) {
|
||||
if (count($delegations['open']) > 0) {
|
||||
//there is an open delegation, so we need to return the delegation row
|
||||
@@ -1439,7 +1446,7 @@ class Cases
|
||||
if ($aRow['ROU_TYPE'] == 'PARALLEL-BY-EVALUATION') {
|
||||
$aTaskReviewed = array();
|
||||
} else {
|
||||
$aTaskReviewed = array_merge($aTaskReviewed, $delegations['closed']);
|
||||
//$aTaskReviewed = array_merge($aTaskReviewed, $delegations['closed']);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -1453,8 +1460,6 @@ class Cases
|
||||
}
|
||||
}
|
||||
}
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
}
|
||||
return $aTaskReviewed;
|
||||
}
|
||||
|
||||
@@ -576,7 +576,7 @@ class Derivation
|
||||
* @param array $nextDelegations
|
||||
* @return void
|
||||
*/
|
||||
function derivate ($currentDelegation = array(), $nextDelegations = array(), $removeList = true)
|
||||
function derivate($currentDelegation = array(), $nextDelegations = array(), $removeList = true)
|
||||
{
|
||||
//define this...
|
||||
if (! defined( 'TASK_FINISH_PROCESS' )) {
|
||||
@@ -704,20 +704,10 @@ class Derivation
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if ($currentDelegation['ROU_TYPE'] == 'SEC-JOIN') {
|
||||
$siblingThreads = $this->case->getOpenSiblingThreads( $nextDel['TAS_UID'], $currentDelegation['APP_UID'], $currentDelegation['DEL_INDEX'], $currentDelegation['TAS_UID'], $currentDelegation['ROU_TYPE'] );
|
||||
$canDerivate = count( $siblingThreads ) == 0;
|
||||
} elseif ($currentDelegation['ROU_TYPE'] == 'DISCRIMINATOR') {
|
||||
//First get the total threads of Next Task where route type='Discriminator'
|
||||
$siblingThreads = $this->case->getOpenSiblingThreads( $nextDel['TAS_UID'], $currentDelegation['APP_UID'], $currentDelegation['DEL_INDEX'], $currentDelegation['TAS_UID'], $currentDelegation['ROU_TYPE'] );
|
||||
$siblingThreadsCount = count( $siblingThreads );
|
||||
$discriminateThread = $currentDelegation['ROU_CONDITION'];
|
||||
//$checkThread = count($totalThreads) - $cond;
|
||||
if ($discriminateThread == $siblingThreadsCount) {
|
||||
$canDerivate = true;
|
||||
} else {
|
||||
$canDerivate = false;
|
||||
}
|
||||
if ($currentDelegation["ROU_TYPE"] == "SEC-JOIN") {
|
||||
$siblingThreads = $this->case->getOpenSiblingThreads($nextDel["TAS_UID"], $currentDelegation["APP_UID"], $currentDelegation["DEL_INDEX"], $currentDelegation["TAS_UID"]);
|
||||
|
||||
$canDerivate = empty($siblingThreads);
|
||||
} else {
|
||||
$canDerivate = true;
|
||||
}
|
||||
|
||||
@@ -423,14 +423,11 @@ class Tasks
|
||||
public function deleteAllRoutesOfTask($sProcessUID = '', $sTaskUID = '', $bAll = false)
|
||||
{
|
||||
try {
|
||||
$oProcess = new Process();
|
||||
$aFields = $oProcess->load($sProcessUID);
|
||||
$oTask = new Task();
|
||||
$aFields = $oTask->load($sTaskUID);
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(RoutePeer::PRO_UID, $sProcessUID);
|
||||
$oCriteria->add(RoutePeer::TAS_UID, $sTaskUID);
|
||||
RoutePeer::doDelete($oCriteria);
|
||||
|
||||
if ($bAll) {
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(RoutePeer::PRO_UID, $sProcessUID);
|
||||
|
||||
@@ -1366,6 +1366,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$diagram["participants"] = isset($diagram["participants"])? $diagram["participants"]: array();
|
||||
$diagram["laneset"] = isset($diagram["laneset"])? $diagram["laneset"]: array();
|
||||
$diagram["lanes"] = isset($diagram["lanes"])? $diagram["lanes"]: array();
|
||||
|
||||
$result = array();
|
||||
|
||||
$projectData['prj_uid'] = $prjUid;
|
||||
@@ -1595,8 +1596,8 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
* Diagram's Gateways Handling
|
||||
*/
|
||||
$arrayGatewayUid = array();
|
||||
$arrayUidGatewayParallel = array();
|
||||
$flagGatewayParallel = false;
|
||||
$arrayGatewayParallelUid = array();
|
||||
$arrayGatewayUidToCheckConverging = array(); //PARALLEL, INCLUSIVE
|
||||
|
||||
$whiteList = array();
|
||||
|
||||
@@ -1641,9 +1642,14 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
if ($flagAddOrUpdate) {
|
||||
$arrayGatewayData = $bwp->getGateway($gatewayData["GAT_UID"]);
|
||||
|
||||
if ($arrayGatewayData["GAT_TYPE"] == "PARALLEL") {
|
||||
$arrayUidGatewayParallel[] = $gatewayData["GAT_UID"];
|
||||
$flagGatewayParallel = true;
|
||||
switch ($arrayGatewayData["GAT_TYPE"]) {
|
||||
case self::BPMN_GATEWAY_PARALLEL:
|
||||
$arrayGatewayParallelUid[] = $gatewayData["GAT_UID"];
|
||||
$arrayGatewayUidToCheckConverging[] = $gatewayData["GAT_UID"];
|
||||
break;
|
||||
case self::BPMN_GATEWAY_INCLUSIVE:
|
||||
$arrayGatewayUidToCheckConverging[] = $gatewayData["GAT_UID"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1867,7 +1873,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
|
||||
//Update condition
|
||||
if ($flagGatewayParallel && $flowData["FLO_ELEMENT_ORIGIN_TYPE"] == "bpmnGateway" && in_array($flowData["FLO_ELEMENT_ORIGIN"], $arrayUidGatewayParallel)) {
|
||||
if ($flowData["FLO_ELEMENT_ORIGIN_TYPE"] == "bpmnGateway" && in_array($flowData["FLO_ELEMENT_ORIGIN"], $arrayGatewayParallelUid)) {
|
||||
$flowData["FLO_CONDITION"] = "";
|
||||
}
|
||||
|
||||
@@ -1900,11 +1906,29 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
}
|
||||
|
||||
//Update BPMN_GATEWAY.GAT_DIRECTION
|
||||
foreach ($arrayGatewayUidToCheckConverging as $value) {
|
||||
$arrayGatewayData = $bwp->getGateway($value);
|
||||
|
||||
if (!is_null($arrayGatewayData)) {
|
||||
$arrayFlow = \BpmnFlow::findAllBy(array(
|
||||
\BpmnFlowPeer::FLO_TYPE => array("MESSAGE", \Criteria::NOT_EQUAL),
|
||||
\BpmnFlowPeer::FLO_ELEMENT_DEST => $arrayGatewayData["GAT_UID"],
|
||||
\BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE => "bpmnGateway"
|
||||
));
|
||||
|
||||
if (count($arrayFlow) > 1) {
|
||||
$bwp->updateGateway($arrayGatewayData["GAT_UID"], array("GAT_DIRECTION" => "CONVERGING"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Update BPMN_GATEWAY.GAT_DEFAULT_FLOW
|
||||
foreach ($arrayGatewayGatDefaultFlow as $key => $value) {
|
||||
$bwp->updateGateway($key, array("GAT_DEFAULT_FLOW" => $value));
|
||||
}
|
||||
|
||||
//Map Bpmn-Flows to Workflow-Routes
|
||||
$bwp->mapBpmnFlowsToWorkflowRoutes();
|
||||
|
||||
//Return
|
||||
|
||||
Reference in New Issue
Block a user