PM-939 "Support for Message-Event (Message-Event CRON)"

- Se a completado el envio de mensajes (para que el caso
  se "despause") para los eventos "INTERMEDIATE-CATCH-MESSAGE-EVENT"
This commit is contained in:
Victor Saisa Lopez
2015-02-24 14:07:29 -04:00
parent b7fbaffc64
commit 48c6195b8a
12 changed files with 309 additions and 45 deletions

View File

@@ -108,6 +108,7 @@ try {
Bootstrap::registerClass("wsResponse", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.wsResponse.php"); Bootstrap::registerClass("wsResponse", PATH_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.wsResponse.php");
G::LoadClass("processes"); G::LoadClass("processes");
G::LoadClass("derivation");
G::LoadClass("dates"); //Load Criteria G::LoadClass("dates"); //Load Criteria
//Workflow //Workflow
@@ -198,6 +199,10 @@ try {
$rbac = &RBAC::getSingleton(PATH_DATA, session_id()); $rbac = &RBAC::getSingleton(PATH_DATA, session_id());
$rbac->sSystem = "PROCESSMAKER"; $rbac->sSystem = "PROCESSMAKER";
if (!defined("DB_ADAPTER")) {
define("DB_ADAPTER", $DB_ADAPTER);
}
eprintln("Processing workspace: " . $workflow, "green"); eprintln("Processing workspace: " . $workflow, "green");
try { try {

View File

@@ -6,7 +6,7 @@ require_once 'classes/model/om/BaseListCanceled.php';
/** /**
* Skeleton subclass for representing a row from the 'LIST_CANCELED' table. * Skeleton subclass for representing a row from the 'LIST_CANCELED' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
@@ -269,6 +269,11 @@ class ListCanceled extends BaseListCanceled {
$criteria->addSelectColumn(ListCanceledPeer::DEL_DUE_DATE); $criteria->addSelectColumn(ListCanceledPeer::DEL_DUE_DATE);
$criteria->addSelectColumn(ListCanceledPeer::DEL_PRIORITY); $criteria->addSelectColumn(ListCanceledPeer::DEL_PRIORITY);
$arrayTaskTypeToExclude = array("WEBENTRYEVENT", "END-MESSAGE-EVENT", "START-MESSAGE-EVENT", "INTERMEDIATE-THROW-MESSAGE-EVENT", "INTERMEDIATE-CATCH-MESSAGE-EVENT");
$criteria->addJoin(ListCanceledPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
$criteria->add(TaskPeer::TAS_TYPE, $arrayTaskTypeToExclude, Criteria::NOT_IN);
$criteria->add( ListCanceledPeer::USR_UID, $usr_uid, Criteria::EQUAL ); $criteria->add( ListCanceledPeer::USR_UID, $usr_uid, Criteria::EQUAL );
self::loadFilters($criteria, $filters); self::loadFilters($criteria, $filters);
@@ -300,3 +305,4 @@ class ListCanceled extends BaseListCanceled {
return $data; return $data;
} }
} // ListCanceled } // ListCanceled

View File

@@ -6,7 +6,7 @@ require_once 'classes/model/om/BaseListCompleted.php';
/** /**
* Skeleton subclass for representing a row from the 'LIST_COMPLETED' table. * Skeleton subclass for representing a row from the 'LIST_COMPLETED' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
@@ -248,6 +248,11 @@ class ListCompleted extends BaseListCompleted
$criteria->addSelectColumn(ListCompletedPeer::DEL_CURRENT_USR_LASTNAME); $criteria->addSelectColumn(ListCompletedPeer::DEL_CURRENT_USR_LASTNAME);
$criteria->addSelectColumn(ListCompletedPeer::DEL_CURRENT_USR_USERNAME); $criteria->addSelectColumn(ListCompletedPeer::DEL_CURRENT_USR_USERNAME);
$arrayTaskTypeToExclude = array("WEBENTRYEVENT", "END-MESSAGE-EVENT", "START-MESSAGE-EVENT", "INTERMEDIATE-THROW-MESSAGE-EVENT", "INTERMEDIATE-CATCH-MESSAGE-EVENT");
$criteria->addJoin(ListCompletedPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
$criteria->add(TaskPeer::TAS_TYPE, $arrayTaskTypeToExclude, Criteria::NOT_IN);
$criteria->add( ListCompletedPeer::USR_UID, $usr_uid, Criteria::EQUAL ); $criteria->add( ListCompletedPeer::USR_UID, $usr_uid, Criteria::EQUAL );
self::loadFilters($criteria, $filters); self::loadFilters($criteria, $filters);
@@ -279,3 +284,4 @@ class ListCompleted extends BaseListCompleted
return $data; return $data;
} }
} // ListCompleted } // ListCompleted

View File

@@ -6,7 +6,7 @@ require_once 'classes/model/om/BaseListInbox.php';
/** /**
* Skeleton subclass for representing a row from the 'LIST_INBOX' table. * Skeleton subclass for representing a row from the 'LIST_INBOX' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
@@ -313,6 +313,11 @@ class ListInbox extends BaseListInbox
$criteria->addSelectColumn(ListInboxPeer::DEL_DUE_DATE); $criteria->addSelectColumn(ListInboxPeer::DEL_DUE_DATE);
$criteria->addSelectColumn(ListInboxPeer::DEL_PRIORITY); $criteria->addSelectColumn(ListInboxPeer::DEL_PRIORITY);
$arrayTaskTypeToExclude = array("WEBENTRYEVENT", "END-MESSAGE-EVENT", "START-MESSAGE-EVENT", "INTERMEDIATE-THROW-MESSAGE-EVENT", "INTERMEDIATE-CATCH-MESSAGE-EVENT");
$criteria->addJoin(ListInboxPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
$criteria->add(TaskPeer::TAS_TYPE, $arrayTaskTypeToExclude, Criteria::NOT_IN);
$criteria->add( ListInboxPeer::USR_UID, $usr_uid, Criteria::EQUAL ); $criteria->add( ListInboxPeer::USR_UID, $usr_uid, Criteria::EQUAL );
self::loadFilters($criteria, $filters); self::loadFilters($criteria, $filters);
@@ -352,3 +357,4 @@ class ListInbox extends BaseListInbox
return $data; return $data;
} }
} }

View File

@@ -6,7 +6,7 @@ require_once 'classes/model/om/BaseListMyInbox.php';
/** /**
* Skeleton subclass for representing a row from the 'LIST_MY_INBOX' table. * Skeleton subclass for representing a row from the 'LIST_MY_INBOX' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
@@ -236,6 +236,11 @@ class ListMyInbox extends BaseListMyInbox
$criteria->addSelectColumn(ListMyInboxPeer::DEL_DUE_DATE); $criteria->addSelectColumn(ListMyInboxPeer::DEL_DUE_DATE);
$criteria->addSelectColumn(ListMyInboxPeer::DEL_PRIORITY); $criteria->addSelectColumn(ListMyInboxPeer::DEL_PRIORITY);
$arrayTaskTypeToExclude = array("WEBENTRYEVENT", "END-MESSAGE-EVENT", "START-MESSAGE-EVENT", "INTERMEDIATE-THROW-MESSAGE-EVENT", "INTERMEDIATE-CATCH-MESSAGE-EVENT");
$criteria->addJoin(ListMyInboxPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
$criteria->add(TaskPeer::TAS_TYPE, $arrayTaskTypeToExclude, Criteria::NOT_IN);
$criteria->add( ListMyInboxPeer::USR_UID, $usr_uid, Criteria::EQUAL ); $criteria->add( ListMyInboxPeer::USR_UID, $usr_uid, Criteria::EQUAL );
self::loadFilters($criteria, $filters); self::loadFilters($criteria, $filters);
@@ -269,3 +274,4 @@ class ListMyInbox extends BaseListMyInbox
return $data; return $data;
} }
} // ListMyInbox } // ListMyInbox

View File

@@ -6,7 +6,7 @@ require_once 'classes/model/om/BaseListParticipatedHistory.php';
/** /**
* Skeleton subclass for representing a row from the 'LIST_PARTICIPATED_HISTORY' table. * Skeleton subclass for representing a row from the 'LIST_PARTICIPATED_HISTORY' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
@@ -195,6 +195,11 @@ class ListParticipatedHistory extends BaseListParticipatedHistory
$criteria->addSelectColumn(ListParticipatedHistoryPeer::DEL_DUE_DATE); $criteria->addSelectColumn(ListParticipatedHistoryPeer::DEL_DUE_DATE);
$criteria->addSelectColumn(ListParticipatedHistoryPeer::DEL_PRIORITY); $criteria->addSelectColumn(ListParticipatedHistoryPeer::DEL_PRIORITY);
$arrayTaskTypeToExclude = array("WEBENTRYEVENT", "END-MESSAGE-EVENT", "START-MESSAGE-EVENT", "INTERMEDIATE-THROW-MESSAGE-EVENT", "INTERMEDIATE-CATCH-MESSAGE-EVENT");
$criteria->addJoin(ListParticipatedHistoryPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
$criteria->add(TaskPeer::TAS_TYPE, $arrayTaskTypeToExclude, Criteria::NOT_IN);
$criteria->add( ListParticipatedHistoryPeer::USR_UID, $usr_uid, Criteria::EQUAL ); $criteria->add( ListParticipatedHistoryPeer::USR_UID, $usr_uid, Criteria::EQUAL );
self::loadFilters($criteria, $filters); self::loadFilters($criteria, $filters);
@@ -228,3 +233,4 @@ class ListParticipatedHistory extends BaseListParticipatedHistory
return $data; return $data;
} }
} }

View File

@@ -6,7 +6,7 @@ require_once 'classes/model/om/BaseListParticipatedLast.php';
/** /**
* Skeleton subclass for representing a row from the 'LIST_PARTICIPATED_LAST' table. * Skeleton subclass for representing a row from the 'LIST_PARTICIPATED_LAST' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
@@ -218,6 +218,11 @@ class ListParticipatedLast extends BaseListParticipatedLast
$criteria->addSelectColumn(ListParticipatedLastPeer::DEL_DUE_DATE); $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_DUE_DATE);
$criteria->addSelectColumn(ListParticipatedLastPeer::DEL_PRIORITY); $criteria->addSelectColumn(ListParticipatedLastPeer::DEL_PRIORITY);
$arrayTaskTypeToExclude = array("WEBENTRYEVENT", "END-MESSAGE-EVENT", "START-MESSAGE-EVENT", "INTERMEDIATE-THROW-MESSAGE-EVENT", "INTERMEDIATE-CATCH-MESSAGE-EVENT");
$criteria->addJoin(ListParticipatedLastPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
$criteria->add(TaskPeer::TAS_TYPE, $arrayTaskTypeToExclude, Criteria::NOT_IN);
$criteria->add( ListParticipatedLastPeer::USR_UID, $usr_uid, Criteria::EQUAL ); $criteria->add( ListParticipatedLastPeer::USR_UID, $usr_uid, Criteria::EQUAL );
self::loadFilters($criteria, $filters); self::loadFilters($criteria, $filters);
@@ -251,3 +256,4 @@ class ListParticipatedLast extends BaseListParticipatedLast
return $data; return $data;
} }
} }

View File

@@ -6,7 +6,7 @@ require_once 'classes/model/om/BaseListPaused.php';
/** /**
* Skeleton subclass for representing a row from the 'LIST_PAUSED' table. * Skeleton subclass for representing a row from the 'LIST_PAUSED' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
@@ -287,6 +287,11 @@ class ListPaused extends BaseListPaused {
$criteria->addSelectColumn(ListPausedPeer::DEL_DUE_DATE); $criteria->addSelectColumn(ListPausedPeer::DEL_DUE_DATE);
$criteria->addSelectColumn(ListPausedPeer::DEL_PRIORITY); $criteria->addSelectColumn(ListPausedPeer::DEL_PRIORITY);
$arrayTaskTypeToExclude = array("WEBENTRYEVENT", "END-MESSAGE-EVENT", "START-MESSAGE-EVENT", "INTERMEDIATE-THROW-MESSAGE-EVENT", "INTERMEDIATE-CATCH-MESSAGE-EVENT");
$criteria->addJoin(ListPausedPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
$criteria->add(TaskPeer::TAS_TYPE, $arrayTaskTypeToExclude, Criteria::NOT_IN);
$criteria->add( ListPausedPeer::USR_UID, $usr_uid, Criteria::EQUAL ); $criteria->add( ListPausedPeer::USR_UID, $usr_uid, Criteria::EQUAL );
self::loadFilters($criteria, $filters); self::loadFilters($criteria, $filters);
@@ -318,3 +323,4 @@ class ListPaused extends BaseListPaused {
return $data; return $data;
} }
} // ListPaused } // ListPaused

View File

@@ -6,7 +6,7 @@ require_once 'classes/model/om/BaseListUnassigned.php';
/** /**
* Skeleton subclass for representing a row from the 'LIST_UNASSIGNED' table. * Skeleton subclass for representing a row from the 'LIST_UNASSIGNED' table.
* *
* *
* *
* You should add additional methods to this class to meet the * You should add additional methods to this class to meet the
* application requirements. This class will only be generated as * application requirements. This class will only be generated as
@@ -263,6 +263,11 @@ class ListUnassigned extends BaseListUnassigned
$criteria->addSelectColumn(ListUnassignedPeer::DEL_DUE_DATE); $criteria->addSelectColumn(ListUnassignedPeer::DEL_DUE_DATE);
$criteria->addSelectColumn(ListUnassignedPeer::DEL_PRIORITY); $criteria->addSelectColumn(ListUnassignedPeer::DEL_PRIORITY);
$arrayTaskTypeToExclude = array("WEBENTRYEVENT", "END-MESSAGE-EVENT", "START-MESSAGE-EVENT", "INTERMEDIATE-THROW-MESSAGE-EVENT", "INTERMEDIATE-CATCH-MESSAGE-EVENT");
$criteria->addJoin(ListUnassignedPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
$criteria->add(TaskPeer::TAS_TYPE, $arrayTaskTypeToExclude, Criteria::NOT_IN);
$aConditions = array(); $aConditions = array();
$aConditions[] = array(ListUnassignedPeer::UNA_UID, ListUnassignedGroupPeer::UNA_UID); $aConditions[] = array(ListUnassignedPeer::UNA_UID, ListUnassignedGroupPeer::UNA_UID);
$aConditions[] = array(ListUnassignedGroupPeer::USR_UID, "'" . $usr_uid . "'"); $aConditions[] = array(ListUnassignedGroupPeer::USR_UID, "'" . $usr_uid . "'");
@@ -312,4 +317,3 @@ class ListUnassigned extends BaseListUnassigned
} }
} }

View File

@@ -1983,6 +1983,13 @@ class Cases
public function throwMessageEventBetweenElementOriginAndElementDest($elementOriginUid, $elementDestUid, array $arrayApplicationData) public function throwMessageEventBetweenElementOriginAndElementDest($elementOriginUid, $elementDestUid, array $arrayApplicationData)
{ {
try { try {
//Verify if the Project is BPMN
$bpmn = new \ProcessMaker\Project\Bpmn();
if (!$bpmn->exists($arrayApplicationData["PRO_UID"])) {
return;
}
//Element origin and dest //Element origin and dest
$messageEventTaskRelation = new \ProcessMaker\BusinessModel\MessageEventTaskRelation(); $messageEventTaskRelation = new \ProcessMaker\BusinessModel\MessageEventTaskRelation();
@@ -2012,8 +2019,6 @@ class Cases
$elementDestType = $arrayElement["elementDest"]["type"]; $elementDestType = $arrayElement["elementDest"]["type"];
//Get Message-Events of throw type //Get Message-Events of throw type
$bpmn = new \ProcessMaker\Project\Bpmn();
$arrayEvent = $bpmn->getMessageEventsOfThrowTypeBetweenElementOriginAndElementDest( $arrayEvent = $bpmn->getMessageEventsOfThrowTypeBetweenElementOriginAndElementDest(
$elementOriginUid, $elementOriginUid,
$elementOriginType, $elementOriginType,
@@ -2047,50 +2052,137 @@ class Cases
//Set variables //Set variables
$ws = new \wsBase(); $ws = new \wsBase();
$case = new \Cases();
$messageApplication = new \ProcessMaker\BusinessModel\MessageApplication();
$messageApplication->setFrontEnd($frontEnd);
//Get data //Get data
$messageApplication = new \ProcessMaker\BusinessModel\MessageApplication(); $totalMessageEvent = 0;
$arrayMessageApplicationUnread = $messageApplication->getMessageApplications(array("messageApplicationStatus" => "UNREAD")); $counterStartMessageEvent = 0;
$counterIntermediateCatchMessageEvent = 0;
$counter = 0;
foreach ($arrayMessageApplicationUnread["data"] as $value) { $flagFirstTime = false;
$arrayMessageApplicationData = $value;
$processUid = $arrayMessageApplicationData["PRJ_UID"]; $messageApplication->frontEndShow("START");
$taskUid = $arrayMessageApplicationData["TAS_UID"];
$messageApplicationUid = $arrayMessageApplicationData["MSGAPP_UID"]; do {
$messageApplicationCorrelation = $arrayMessageApplicationData["MSGAPP_CORRELATION"]; $flagNextRecords = false;
$messageEventDefinitionUserUid = $arrayMessageApplicationData["MSGED_USR_UID"]; $arrayMessageApplicationUnread = $messageApplication->getMessageApplications(array("messageApplicationStatus" => "UNREAD"), null, null, 0, 1000);
$messageEventDefinitionVariables = $arrayMessageApplicationData["MSGED_VARIABLES"];
$messageEventDefinitionCorrelation = $arrayMessageApplicationData["MSGED_CORRELATION"];
switch ($arrayMessageApplicationData["EVN_TYPE"]) { if (!$flagFirstTime) {
case "START": $totalMessageEvent = $arrayMessageApplicationUnread["total"];
if ($messageApplicationCorrelation == $messageEventDefinitionCorrelation &&
$messageEventDefinitionUserUid != ""
) {
//Start and derivate new Case
//$result = $ws->newCase($processUid, $messageEventDefinitionUserUid, $taskUid, array("NAME1" => "value1"));
$result = $ws->newCase($processUid, $messageEventDefinitionUserUid, $taskUid, array());
$arrayResult = json_decode(json_encode($result), true); $flagFirstTime = true;
if ($arrayResult["status_code"] == 0) {
$applicationUid = $arrayResult["caseId"];
$result = $ws->derivateCase($messageEventDefinitionUserUid, $applicationUid, 1);
//Message-Application catch
$result = $messageApplication->update($messageApplicationUid, array("MSGAPP_STATUS" => "READ"));
}
}
break;
case "INTERMEDIATE":
break;
} }
}
foreach ($arrayMessageApplicationUnread["data"] as $value) {
if ($counter + 1 > $totalMessageEvent) {
$flagNextRecords = false;
break;
}
$arrayMessageApplicationData = $value;
$processUid = $arrayMessageApplicationData["PRJ_UID"];
$taskUid = $arrayMessageApplicationData["TAS_UID"];
$messageApplicationUid = $arrayMessageApplicationData["MSGAPP_UID"];
$messageApplicationCorrelation = $arrayMessageApplicationData["MSGAPP_CORRELATION"];
$messageEventDefinitionUserUid = $arrayMessageApplicationData["MSGED_USR_UID"];
$messageEventDefinitionCorrelation = $arrayMessageApplicationData["MSGED_CORRELATION"];
$arrayVariable = $messageApplication->mergeVariables($arrayMessageApplicationData["MSGED_VARIABLES"], $arrayMessageApplicationData["MSGAPP_VARIABLES"]);
$flagCatched = false;
switch ($arrayMessageApplicationData["EVN_TYPE"]) {
case "START":
if ($messageEventDefinitionCorrelation == $messageApplicationCorrelation && $messageEventDefinitionUserUid != "") {
//Start and derivate new Case
$result = $ws->newCase($processUid, $messageEventDefinitionUserUid, $taskUid, $arrayVariable);
$arrayResult = json_decode(json_encode($result), true);
if ($arrayResult["status_code"] == 0) {
$applicationUid = $arrayResult["caseId"];
$result = $ws->derivateCase($messageEventDefinitionUserUid, $applicationUid, 1);
$flagCatched = true;
//Counter
$counterStartMessageEvent++;
}
}
break;
case "INTERMEDIATE":
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\AppDelegationPeer::APP_UID);
$criteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX);
$criteria->addSelectColumn(\AppDelegationPeer::USR_UID);
$criteria->add(\AppDelegationPeer::PRO_UID, $processUid, \Criteria::EQUAL);
$criteria->add(\AppDelegationPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
$criteria->add(\AppDelegationPeer::DEL_THREAD_STATUS, "OPEN", \Criteria::EQUAL);
$criteria->add(\AppDelegationPeer::DEL_FINISH_DATE, null, \Criteria::ISNULL);
$rsCriteria = \AppDelegationPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$applicationUid = $row["APP_UID"];
$delIndex = $row["DEL_INDEX"];
$userUid = $row["USR_UID"];
$arrayApplicationData = $case->loadCase($applicationUid);
if (\G::replaceDataField($messageEventDefinitionCorrelation, $arrayApplicationData["APP_DATA"]) == $messageApplicationCorrelation) {
//"Unpause" and derivate Case
$arrayApplicationData["APP_DATA"] = array_merge($arrayApplicationData["APP_DATA"], $arrayVariable);
$arrayResult = $case->updateCase($applicationUid, $arrayApplicationData);
$result = $ws->derivateCase($userUid, $applicationUid, $delIndex);
$flagCatched = true;
}
}
//Counter
if ($flagCatched) {
$counterIntermediateCatchMessageEvent++;
}
break;
}
//Message-Application catch
if ($flagCatched) {
$result = $messageApplication->update($messageApplicationUid, array("MSGAPP_STATUS" => "READ"));
}
$counter++;
//Progress bar
$messageApplication->frontEndShow("BAR", "Message-Events (unread): " . $counter . "/" . $totalMessageEvent . " " . $messageApplication->progressBar($totalMessageEvent, $counter));
$flagNextRecords = true;
}
} while ($flagNextRecords);
$messageApplication->frontEndShow("TEXT", "Total Message-Events unread: " . $totalMessageEvent);
$messageApplication->frontEndShow("TEXT", "Total cases started: " . $counterStartMessageEvent);
$messageApplication->frontEndShow("TEXT", "Total cases continued: " . $counterIntermediateCatchMessageEvent);
$messageApplication->frontEndShow("TEXT", "Total Message-Events pending: " . ($totalMessageEvent - ($counterStartMessageEvent + $counterIntermediateCatchMessageEvent)));
$messageApplication->frontEndShow("END");
} catch (\Exception $e) { } catch (\Exception $e) {
throw $e; throw $e;
} }

View File

@@ -8,6 +8,8 @@ class MessageApplication
"limit" => "LIMIT" "limit" => "LIMIT"
); );
private $frontEnd = false;
/** /**
* Verify if exists the Message-Application * Verify if exists the Message-Application
* *
@@ -207,6 +209,102 @@ class MessageApplication
} }
} }
/**
* Set front end flag
*
* @param bool $flag Flag
*
* return void
*/
public function setFrontEnd($flag)
{
try {
$this->frontEnd = $flag;
} catch (Exception $e) {
throw $e;
}
}
/**
* Progress bar
*
* @param int $total Total
* @param int $count Count
*
* return string Return a string that represent progress bar
*/
public function progressBar($total, $count)
{
try {
$p = (int)(($count * 100) / $total);
$n = (int)($p / 2);
return "[" . str_repeat("|", $n) . str_repeat(" ", 50 - $n) . "] $p%";
} catch (Exception $e) {
throw $e;
}
}
/**
* Show front end
*
* @param string $option Option
* @param string $data Data string
*
* return void
*/
public function frontEndShow($option, $data = "")
{
try {
if (!$this->frontEnd) {
return;
}
$numc = 100;
switch ($option) {
case "BAR":
echo "\r" . "| " . $data . str_repeat(" ", $numc - 2 - strlen($data));
break;
case "TEXT":
echo "\r" . "| " . $data . str_repeat(" ", $numc - 2 - strlen($data)) . "\n";
break;
default:
//START, END
echo "\r" . "+" . str_repeat("-", $numc - 2) . "+" . "\n";
break;
}
} catch (Exception $e) {
throw $e;
}
}
/**
* Merge and get variables
*
* @param array $arrayVariableName Variables
* @param array $arrayVariableValue Values
*
* return array Return an array
*/
public function mergeVariables(array $arrayVariableName, array $arrayVariableValue)
{
try {
$arrayVariable = array();
foreach ($arrayVariableName as $key => $value) {
if (preg_match("/^@[@%#\?\x24\=]([A-Za-z_]\w*)$/", $value, $arrayMatch) && isset($arrayVariableValue[$key])) {
$arrayVariable[$arrayMatch[1]] = $arrayVariableValue[$key];
}
}
//Return
return $arrayVariable;
} catch (\Exception $e) {
throw $e;
}
}
/** /**
* Get all Message-Applications * Get all Message-Applications
* *

View File

@@ -91,6 +91,19 @@ class Bpmn extends Handler
} }
} }
public function exists($projectUid)
{
try {
$obj = ProjectPeer::retrieveByPK($projectUid);
return (!is_null($obj))? true : false;
} catch (\Exception $e) {
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
throw $e;
}
}
public static function load($prjUid) public static function load($prjUid)
{ {
$me = new self(); $me = new self();
@@ -588,6 +601,8 @@ class Bpmn extends Handler
//Return //Return
return false; return false;
} catch (\Exception $e) { } catch (\Exception $e) {
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
throw $e; throw $e;
} }
} }
@@ -661,6 +676,8 @@ class Bpmn extends Handler
} }
} }
} catch (\Exception $e) { } catch (\Exception $e) {
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
throw $e; throw $e;
} }
} }
@@ -1294,6 +1311,8 @@ class Bpmn extends Handler
//Return //Return
return $this->getGateway2($gatewayUid); return $this->getGateway2($gatewayUid);
} catch (\Exception $e) { } catch (\Exception $e) {
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
throw $e; throw $e;
} }
} }
@@ -1386,6 +1405,8 @@ class Bpmn extends Handler
return array(); return array();
} }
} catch (\Exception $e) { } catch (\Exception $e) {
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
throw $e; throw $e;
} }
} }
@@ -1427,6 +1448,8 @@ class Bpmn extends Handler
//Return //Return
return $arrayEvent; return $arrayEvent;
} catch (\Exception $e) { } catch (\Exception $e) {
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
throw $e; throw $e;
} }
} }