Merged in victorsl/processmaker/PM-2576 (pull request #2391)
PM-2576 "Support for Timer-Event (End-points and Backend)" SOLVED
This commit is contained in:
1073
workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php
Normal file
1073
workflow/engine/src/ProcessMaker/BusinessModel/TimerEvent.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -391,7 +391,7 @@ abstract class Importer
|
||||
foreach ($arrayWorkflowTables["tasks"] as $key => $value) {
|
||||
$arrayTaskData = $value;
|
||||
|
||||
if (!in_array($arrayTaskData["TAS_TYPE"], array("GATEWAYTOGATEWAY", "WEBENTRYEVENT", "END-MESSAGE-EVENT", "START-MESSAGE-EVENT", "INTERMEDIATE-THROW-MESSAGE-EVENT", "INTERMEDIATE-CATCH-MESSAGE-EVENT", "END-EMAIL-EVENT", "INTERMEDIATE-EMAIL-EVENT"))) {
|
||||
if (!in_array($arrayTaskData["TAS_TYPE"], array("GATEWAYTOGATEWAY", "WEBENTRYEVENT", "END-MESSAGE-EVENT", "START-MESSAGE-EVENT", "INTERMEDIATE-THROW-MESSAGE-EVENT", "INTERMEDIATE-CATCH-MESSAGE-EVENT", "START-TIMER-EVENT", "INTERMEDIATE-CATCH-TIMER-EVENT", "END-EMAIL-EVENT", "INTERMEDIATE-EMAIL-EVENT"))) {
|
||||
$result = $workflow->updateTask($arrayTaskData["TAS_UID"], $arrayTaskData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
"start-message-event" => array("type" => "START-MESSAGE-EVENT", "prefix" => "sme-"),
|
||||
"intermediate-throw-message-event" => array("type" => "INTERMEDIATE-THROW-MESSAGE-EVENT", "prefix" => "itme-"),
|
||||
"intermediate-catch-message-event" => array("type" => "INTERMEDIATE-CATCH-MESSAGE-EVENT", "prefix" => "icme-"),
|
||||
"start-timer-event" => array("type" => "START-TIMER-EVENT", "prefix" => "ste-"),
|
||||
"intermediate-catch-timer-event" => array("type" => "INTERMEDIATE-CATCH-TIMER-EVENT", "prefix" => "icte-"),
|
||||
"end-email-event" => array("type" => "END-EMAIL-EVENT", "prefix" => "eee-")
|
||||
);
|
||||
|
||||
@@ -323,7 +325,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$this->wp->setStartTask($data["FLO_ELEMENT_DEST"]);
|
||||
}
|
||||
|
||||
$this->updateEventStartObjects($data["FLO_ELEMENT_ORIGIN"], $data["FLO_ELEMENT_DEST"]);
|
||||
//$this->updateEventStartObjects($data["FLO_ELEMENT_ORIGIN"], $data["FLO_ELEMENT_DEST"]);
|
||||
|
||||
//WebEntry-Event - Update
|
||||
$this->updateWebEntryEventByEvent($data["FLO_ELEMENT_ORIGIN"], array("ACT_UID" => $data["FLO_ELEMENT_DEST"]));
|
||||
@@ -373,7 +375,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
//Setting as start Task
|
||||
$this->wp->setStartTask($flowCurrent->getFloElementDest());
|
||||
|
||||
$this->updateEventStartObjects($flowCurrent->getFloElementOrigin(), $flowCurrent->getFloElementDest());
|
||||
//$this->updateEventStartObjects($flowCurrent->getFloElementOrigin(), $flowCurrent->getFloElementDest());
|
||||
|
||||
//WebEntry-Event - Update
|
||||
$this->updateWebEntryEventByEvent($flowCurrent->getFloElementOrigin(), array("ACT_UID" => $flowCurrent->getFloElementDest()));
|
||||
@@ -471,7 +473,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
}
|
||||
|
||||
$this->updateEventStartObjects($flow->getFloElementOrigin(), "");
|
||||
//$this->updateEventStartObjects($flow->getFloElementOrigin(), "");
|
||||
|
||||
//WebEntry-Event - Update
|
||||
if (is_null($bpmnFlow)) {
|
||||
@@ -559,15 +561,6 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
public function removeEventDefinition(\BpmnEvent $bpmnEvent)
|
||||
{
|
||||
try {
|
||||
//Case-Scheduler - Delete
|
||||
if ($bpmnEvent->getEvnType() == "START" && $bpmnEvent->getEvnMarker() == "TIMER") {
|
||||
$caseScheduler = new \CaseScheduler();
|
||||
|
||||
if ($caseScheduler->Exists($bpmnEvent->getEvnUid())) {
|
||||
$this->wp->removeCaseScheduler($bpmnEvent->getEvnUid());
|
||||
}
|
||||
}
|
||||
|
||||
//WebEntry-Event - Delete
|
||||
if ($bpmnEvent->getEvnType() == "START" && $bpmnEvent->getEvnMarker() == "EMPTY") {
|
||||
$webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
|
||||
@@ -593,6 +586,19 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
}
|
||||
|
||||
//Timer-Event - Delete
|
||||
$arrayEventType = array("START", "INTERMEDIATE");
|
||||
$arrayEventMarker = array("TIMER");
|
||||
|
||||
if (in_array($bpmnEvent->getEvnType(), $arrayEventType) && in_array($bpmnEvent->getEvnMarker(), $arrayEventMarker)) {
|
||||
$timerEvent = new \ProcessMaker\BusinessModel\TimerEvent();
|
||||
|
||||
$timerEvent->deleteWhere(array(
|
||||
\TimerEventPeer::PRJ_UID => array($bpmnEvent->getPrjUid(), \Criteria::EQUAL),
|
||||
\TimerEventPeer::EVN_UID => array($bpmnEvent->getEvnUid(), \Criteria::EQUAL)
|
||||
));
|
||||
}
|
||||
|
||||
//Email-Event - Delete
|
||||
$arrayEventType = array("END", "INTERMEDIATE");
|
||||
$arrayEventMarker = array("EMAIL");
|
||||
@@ -623,15 +629,15 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$eventUid = parent::addEvent($data);
|
||||
$event = \BpmnEventPeer::retrieveByPK($eventUid);
|
||||
|
||||
// create case scheduler
|
||||
if ($event && $event->getEvnMarker() == "TIMER" && $event->getEvnType() == "START") {
|
||||
$this->wp->addCaseScheduler($eventUid);
|
||||
}
|
||||
|
||||
// create web entry
|
||||
if ($event && $event->getEvnMarker() == "MESSAGE" && $event->getEvnType() == "START") {
|
||||
$this->wp->addWebEntry($eventUid);
|
||||
}
|
||||
//// create case scheduler
|
||||
//if ($event && $event->getEvnMarker() == "TIMER" && $event->getEvnType() == "START") {
|
||||
// $this->wp->addCaseScheduler($eventUid);
|
||||
//}
|
||||
//
|
||||
//// create web entry
|
||||
//if ($event && $event->getEvnMarker() == "MESSAGE" && $event->getEvnType() == "START") {
|
||||
// $this->wp->addWebEntry($eventUid);
|
||||
//}
|
||||
|
||||
return $eventUid;
|
||||
}
|
||||
@@ -668,6 +674,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
public function updateEventStartObjects($eventUid, $taskUid)
|
||||
{
|
||||
$event = \BpmnEventPeer::retrieveByPK($eventUid);
|
||||
@@ -686,6 +693,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
// $this->wp->updateWebEntry($eventUid, array("TAS_UID" => $taskUid));
|
||||
//}
|
||||
}
|
||||
*/
|
||||
|
||||
public function createTaskByElement($elementUid, $elementType, $key)
|
||||
{
|
||||
@@ -917,12 +925,19 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$arrayEventData = \BpmnEvent::findOneBy(\BpmnEventPeer::EVN_UID, $eventUid)->toArray();
|
||||
|
||||
if (!is_null($arrayEventData)) {
|
||||
//Event - INTERMEDIATE-CATCH-MESSAGE-EVENT
|
||||
if ($arrayEventData["EVN_TYPE"] == "INTERMEDIATE" && $arrayEventData["EVN_MARKER"] == "MESSAGECATCH") {
|
||||
$arrayEventType = array("INTERMEDIATE");
|
||||
$arrayEventMarker = array("MESSAGECATCH", "TIMER");
|
||||
|
||||
if (in_array($arrayEventData["EVN_TYPE"], $arrayEventType) && in_array($arrayEventData["EVN_MARKER"], $arrayEventMarker)) {
|
||||
$arrayKey = array(
|
||||
"MESSAGECATCH" => "intermediate-catch-message-event",
|
||||
"TIMER" => "intermediate-catch-timer-event"
|
||||
);
|
||||
|
||||
$taskUid = $this->createTaskByElement(
|
||||
$eventUid,
|
||||
"bpmnEvent",
|
||||
"intermediate-catch-message-event"
|
||||
$arrayKey[$arrayEventData["EVN_MARKER"]]
|
||||
);
|
||||
|
||||
$result = $this->wp->addRoute($activityUid, $taskUid, $routeType, $routeCondition, $routeDefault);
|
||||
@@ -1113,6 +1128,17 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
$this->wp->setStartTask($taskUid);
|
||||
|
||||
$this->mapBpmnEventToWorkflowRoutes($taskUid, $event["EVN_UID"]);
|
||||
break;
|
||||
case "TIMER":
|
||||
$taskUid = $this->createTaskByElement(
|
||||
$event["EVN_UID"],
|
||||
"bpmnEvent",
|
||||
"start-timer-event"
|
||||
);
|
||||
|
||||
$this->wp->setStartTask($taskUid);
|
||||
|
||||
$this->mapBpmnEventToWorkflowRoutes($taskUid, $event["EVN_UID"]);
|
||||
break;
|
||||
case "EMPTY":
|
||||
@@ -1120,10 +1146,10 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "END":
|
||||
break;
|
||||
case "INTERMEDIATE":
|
||||
break;
|
||||
//case "END":
|
||||
// break;
|
||||
//case "INTERMEDIATE":
|
||||
// break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1329,7 +1355,6 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
* @param $projectData
|
||||
* @return array
|
||||
*/
|
||||
|
||||
public static function updateFromStruct($prjUid, $projectData, $generateUid = true, $forceInsert = false)
|
||||
{
|
||||
$diagram = isset($projectData["diagrams"]) && isset($projectData["diagrams"][0]) ? $projectData["diagrams"][0] : array();
|
||||
@@ -1954,3 +1979,4 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -855,7 +855,17 @@ class Workflow extends Handler
|
||||
|
||||
$messageEventDefinition->delete($row["MSGED_UID"]);
|
||||
}
|
||||
|
||||
|
||||
//Delete Script-Task
|
||||
$scriptTask = new \ProcessMaker\BusinessModel\ScriptTask();
|
||||
|
||||
$scriptTask->deleteWhere(array(\ScriptTaskPeer::PRJ_UID => array($sProcessUID, \Criteria::EQUAL)));
|
||||
|
||||
//Delete Timer-Event
|
||||
$timerEvent = new \ProcessMaker\BusinessModel\TimerEvent();
|
||||
|
||||
$timerEvent->deleteWhere(array(\TimerEventPeer::PRJ_UID => array($sProcessUID, \Criteria::EQUAL)));
|
||||
|
||||
//Delete Email-Event
|
||||
$emailEvent = new \ProcessMaker\BusinessModel\EmailEvent();
|
||||
$criteria = new \Criteria("workflow");
|
||||
@@ -868,7 +878,7 @@ class Workflow extends Handler
|
||||
$row = $rsCriteria->getRow();
|
||||
$emailEvent->delete($sProcessUID,$row["EMAIL_EVENT_UID"],false);
|
||||
}
|
||||
|
||||
|
||||
//Delete files Manager
|
||||
$filesManager = new \ProcessMaker\BusinessModel\FilesManager();
|
||||
$criteria = new \Criteria("workflow");
|
||||
@@ -882,23 +892,6 @@ class Workflow extends Handler
|
||||
$filesManager->deleteProcessFilesManager($sProcessUID, $row["PRF_UID"]);
|
||||
}
|
||||
|
||||
//Delete Script-Task
|
||||
$scriptTask = new \ProcessMaker\BusinessModel\ScriptTask();
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\ScriptTaskPeer::SCRTAS_UID);
|
||||
$criteria->add(\ScriptTaskPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \ScriptTaskPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$scriptTask->delete($row["SCRTAS_UID"]);
|
||||
}
|
||||
|
||||
//Delete the process
|
||||
try {
|
||||
$oProcess->remove($sProcessUID);
|
||||
@@ -1238,80 +1231,33 @@ class Workflow extends Handler
|
||||
$processUidOld = $arrayUid[0]["old_uid"];
|
||||
$processUid = $arrayUid[0]["new_uid"];
|
||||
|
||||
//Update TASK.TAS_UID
|
||||
foreach ($arrayWorkflowData["tasks"] as $key => $value) {
|
||||
$taskUid = $arrayWorkflowData["tasks"][$key]["TAS_UID"];
|
||||
//Update Table.Field
|
||||
$arrayUpdateTableField = array(
|
||||
"tasks" => array("fieldname" => "TAS_UID", "oldFieldname" => "TAS_UID_OLD"), //Update TASK.TAS_UID
|
||||
"webEntryEvent" => array("fieldname" => "EVN_UID", "oldFieldname" => "EVN_UID_OLD"), //Update WEB_ENTRY_EVENT.EVN_UID
|
||||
"messageEventDefinition" => array("fieldname" => "EVN_UID", "oldFieldname" => "EVN_UID_OLD"), //Update MESSAGE_EVENT_DEFINITION.EVN_UID
|
||||
"scriptTask" => array("fieldname" => "ACT_UID", "oldFieldname" => "ACT_UID_OLD"), //Update SCRIPT_TASK.ACT_UID
|
||||
"timerEvent" => array("fieldname" => "EVN_UID", "oldFieldname" => "EVN_UID_OLD"), //Update TIMER_EVENT.EVN_UID
|
||||
"emailEvent" => array("fieldname" => "EVN_UID", "oldFieldname" => "EVN_UID_OLD") //Update EMAIL_EVENT.EVN_UID
|
||||
);
|
||||
|
||||
foreach ($arrayUid as $value2) {
|
||||
$arrayItem = $value2;
|
||||
foreach ($arrayUpdateTableField as $key => $value) {
|
||||
$table = $key;
|
||||
$fieldname = $value["fieldname"];
|
||||
$oldFieldname = $value["oldFieldname"];
|
||||
|
||||
if ($arrayItem["old_uid"] == $taskUid) {
|
||||
$arrayWorkflowData["tasks"][$key]["TAS_UID_OLD"] = $taskUid;
|
||||
$arrayWorkflowData["tasks"][$key]["TAS_UID"] = $arrayItem["new_uid"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($arrayWorkflowData[$table])) {
|
||||
foreach ($arrayWorkflowData[$table] as $key2 => $value2) {
|
||||
$uid = $arrayWorkflowData[$table][$key2][$fieldname];
|
||||
|
||||
//Update WEB_ENTRY_EVENT.EVN_UID
|
||||
if (isset($arrayWorkflowData["webEntryEvent"])) {
|
||||
foreach ($arrayWorkflowData["webEntryEvent"] as $key => $value) {
|
||||
$webEntryEventEventUid = $arrayWorkflowData["webEntryEvent"][$key]["EVN_UID"];
|
||||
foreach ($arrayUid as $value3) {
|
||||
$arrayItem = $value3;
|
||||
|
||||
foreach ($arrayUid as $value2) {
|
||||
$arrayItem = $value2;
|
||||
|
||||
if ($arrayItem["old_uid"] == $webEntryEventEventUid) {
|
||||
$arrayWorkflowData["webEntryEvent"][$key]["EVN_UID"] = $arrayItem["new_uid"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Update MESSAGE_EVENT_DEFINITION.EVN_UID
|
||||
if (isset($arrayWorkflowData["messageEventDefinition"])) {
|
||||
foreach ($arrayWorkflowData["messageEventDefinition"] as $key => $value) {
|
||||
$messageEventDefinitionEventUid = $arrayWorkflowData["messageEventDefinition"][$key]["EVN_UID"];
|
||||
|
||||
foreach ($arrayUid as $value2) {
|
||||
$arrayItem = $value2;
|
||||
|
||||
if ($arrayItem["old_uid"] == $messageEventDefinitionEventUid) {
|
||||
$arrayWorkflowData["messageEventDefinition"][$key]["EVN_UID"] = $arrayItem["new_uid"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Update EMAIL_EVENT.EVN_UID
|
||||
if (isset($arrayWorkflowData["emailEvent"])) {
|
||||
foreach ($arrayWorkflowData["emailEvent"] as $key => $value) {
|
||||
$emailEventEventUid = $arrayWorkflowData["emailEvent"][$key]["EVN_UID"];
|
||||
|
||||
foreach ($arrayUid as $value2) {
|
||||
$arrayItem = $value2;
|
||||
|
||||
if ($arrayItem["old_uid"] == $emailEventEventUid) {
|
||||
$arrayWorkflowData["emailEvent"][$key]["EVN_UID"] = $arrayItem["new_uid"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Update SCRIPT_TASK.ACT_UID
|
||||
if (isset($arrayWorkflowData["scriptTask"])) {
|
||||
foreach ($arrayWorkflowData["scriptTask"] as $key => $value) {
|
||||
$scriptTaskActivityUid = $arrayWorkflowData["scriptTask"][$key]["ACT_UID"];
|
||||
|
||||
foreach ($arrayUid as $value2) {
|
||||
$arrayItem = $value2;
|
||||
|
||||
if ($arrayItem["old_uid"] == $scriptTaskActivityUid) {
|
||||
$arrayWorkflowData["scriptTask"][$key]["ACT_UID"] = $arrayItem["new_uid"];
|
||||
break;
|
||||
if ($arrayItem["old_uid"] == $uid) {
|
||||
$arrayWorkflowData[$table][$key2][$fieldname] = $arrayItem["new_uid"];
|
||||
$arrayWorkflowData[$table][$key2][$oldFieldname] = $uid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1369,3 +1315,4 @@ class Workflow extends Handler
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\TimerEvent Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class TimerEvent extends Api
|
||||
{
|
||||
private $timerEvent;
|
||||
|
||||
/**
|
||||
* Constructor of the class
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
$this->timerEvent = new \ProcessMaker\BusinessModel\TimerEvent();
|
||||
|
||||
$this->timerEvent->setFormatFieldNameInUppercase(false);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/timer-events
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetTimerEvents($prj_uid)
|
||||
{
|
||||
try {
|
||||
$response = $this->timerEvent->getTimerEvents($prj_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/timer-event/:tmrevn_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $tmrevn_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetTimerEvent($prj_uid, $tmrevn_uid)
|
||||
{
|
||||
try {
|
||||
$response = $this->timerEvent->getTimerEvent($tmrevn_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/timer-event/event/:evn_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $evn_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetTimerEventEvent($prj_uid, $evn_uid)
|
||||
{
|
||||
try {
|
||||
$response = $this->timerEvent->getTimerEventByEvent($prj_uid, $evn_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prj_uid/timer-event
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostTimerEvent($prj_uid, array $request_data)
|
||||
{
|
||||
try {
|
||||
$arrayData = $this->timerEvent->create($prj_uid, $request_data);
|
||||
|
||||
$response = $arrayData;
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:prj_uid/timer-event/:tmrevn_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $tmrevn_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*/
|
||||
public function doPutTimerEvent($prj_uid, $tmrevn_uid, array $request_data)
|
||||
{
|
||||
try {
|
||||
$arrayData = $this->timerEvent->update($tmrevn_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prj_uid/timer-event/:tmrevn_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $tmrevn_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDeleteTimerEvent($prj_uid, $tmrevn_uid)
|
||||
{
|
||||
try {
|
||||
$this->timerEvent->delete($tmrevn_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,9 @@ debug = 1
|
||||
message-type-variable = "ProcessMaker\Services\Api\Project\MessageType\Variable"
|
||||
web-entry-event = "ProcessMaker\Services\Api\Project\WebEntryEvent"
|
||||
message-event-definition = "ProcessMaker\Services\Api\Project\MessageEventDefinition"
|
||||
script-task = "ProcessMaker\Services\Api\Project\ScriptTask"
|
||||
email-event = "ProcessMaker\Services\Api\Project\EmailEvent"
|
||||
script-task = "ProcessMaker\Services\Api\Project\ScriptTask"
|
||||
timer-event = "ProcessMaker\Services\Api\Project\TimerEvent"
|
||||
email-event = "ProcessMaker\Services\Api\Project\EmailEvent"
|
||||
|
||||
[alias: projects]
|
||||
project = "ProcessMaker\Services\Api\Project"
|
||||
@@ -112,3 +113,4 @@ debug = 1
|
||||
|
||||
[alias: catalog]
|
||||
dashboard = "ProcessMaker\Services\Api\Catalog"
|
||||
|
||||
|
||||
@@ -3,6 +3,78 @@ namespace ProcessMaker\Util;
|
||||
|
||||
class Common extends \Maveriks\Util\Common
|
||||
{
|
||||
private $frontEnd = false;
|
||||
|
||||
/**
|
||||
* Set front-end flag (Terminal's front-end)
|
||||
*
|
||||
* @param bool $flag Flag
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
public function setFrontEnd($flag)
|
||||
{
|
||||
try {
|
||||
$this->frontEnd = $flag;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show front-end (Terminal's 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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Progress bar (Progress bar for terminal)
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate random number
|
||||
*
|
||||
@@ -64,4 +136,5 @@ class Common extends \Maveriks\Util\Common
|
||||
|
||||
return $sCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user