Updating Workflow Adapter class
This commit is contained in:
@@ -215,21 +215,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//for end event
|
||||
// switch ($flow->getFloElementOriginType()) {
|
||||
// case "bpmnActivity":
|
||||
// switch ($flow->getFloElementDestType()) {
|
||||
// case "bpmnEvent":
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
|
||||
parent::removeEvent($evnUid);
|
||||
|
||||
}
|
||||
|
||||
public static function mapBpmnFlowsToWorkflowRoute($flow, $flows, $gateways, $events)
|
||||
@@ -256,15 +242,14 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
break;
|
||||
case 'bpmnGateway':
|
||||
$gatUid = $flow['FLO_ELEMENT_DEST'];
|
||||
|
||||
// if it is a gateway it can fork one or more routes
|
||||
//$gatFlows = BpmnModel::getBpmnCollectionBy('Flow', \BpmnFlowPeer::FLO_ELEMENT_ORIGIN, $gatUid);
|
||||
$gatFlow = self::findInArray($gatUid, "FLO_ELEMENT_ORIGIN", $flows);
|
||||
|
||||
//foreach ($gatFlows as $gatFlow) {
|
||||
switch ($gatFlow['FLO_ELEMENT_DEST_TYPE']) {
|
||||
case 'bpmnActivity':
|
||||
// getting gateway properties
|
||||
//$gateway = BpmnModel::getBpmnObjectBy('Gateway', \BpmnGatewayPeer::GAT_UID, $gatUid);
|
||||
$gateway = self::findInArray($gatUid, "GAT_UID", $gateways);
|
||||
|
||||
switch ($gateway['GAT_TYPE']) {
|
||||
@@ -287,15 +272,6 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
throw new \LogicException(sprintf("Unsupported Gateway type: %s", $gateway['GAT_TYPE']));
|
||||
}
|
||||
|
||||
/*$routes[] = array(
|
||||
'ROU_UID' => $gatFlow['FLO_UID'], //Hash::generateUID(),
|
||||
'PRO_UID' => $this->getUid(),
|
||||
'TAS_UID' => $fromUid,
|
||||
'ROU_NEXT_TASK' => $gatFlow['FLO_ELEMENT_DEST'],
|
||||
'ROU_TYPE' => $routeType
|
||||
);*/
|
||||
|
||||
//$this->wp->addRoute($fromUid, $gatFlow['FLO_ELEMENT_DEST'], $routeType);
|
||||
$result = array("from" => $fromUid, "to" => $gatFlow['FLO_ELEMENT_DEST'], "type" => $routeType);
|
||||
break;
|
||||
default:
|
||||
@@ -310,20 +286,11 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
break;
|
||||
case 'bpmnEvent':
|
||||
$evnUid = $flow['FLO_ELEMENT_DEST'];
|
||||
//$event = BpmnModel::getBpmnObjectBy('Event', \BpmnEventPeer::EVN_UID, $evnUid);
|
||||
$event = self::findInArray($evnUid, "EVN_UID", $events);
|
||||
|
||||
switch ($event['EVN_TYPE']) {
|
||||
case 'END':
|
||||
$routeType = 'SEQUENTIAL';
|
||||
/*$routes[] = array(
|
||||
'ROU_UID' => $data['FLO_UID'], //Hash::generateUID(),
|
||||
'PRO_UID' => $this->getUid(),
|
||||
'TAS_UID' => $fromUid,
|
||||
'ROU_NEXT_TASK' => '-1',
|
||||
'ROU_TYPE' => $routeType,
|
||||
'_action' => 'CREATE'
|
||||
);*/
|
||||
$result = array("from" => $fromUid, "to" => "-1", "type" => $routeType);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -55,6 +55,7 @@ class Workflow extends Handler
|
||||
public function create($data)
|
||||
{
|
||||
try {
|
||||
self::log("===> Executing -> ".__METHOD__, "Create Process with data:", $data);
|
||||
|
||||
// setting defaults
|
||||
$data['PRO_UID'] = array_key_exists('PRO_UID', $data) ? $data['PRO_UID'] : Hash::generateUID();
|
||||
@@ -86,8 +87,10 @@ class Workflow extends Handler
|
||||
$calendar->assignCalendarTo($this->proUid, $data["PRO_CALENDAR"], 'PROCESS');
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
throw new \RuntimeException($e);
|
||||
self::log("Create Process Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +101,14 @@ class Workflow extends Handler
|
||||
|
||||
public function remove()
|
||||
{
|
||||
$this->deleteProcess($this->proUid);
|
||||
try {
|
||||
self::log("===> Executing -> ".__METHOD__, "Remove Process with uid: {$this->proUid}");
|
||||
$this->deleteProcess($this->proUid);
|
||||
self::log("Remove Process Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public static function getList($start = null, $limit = null, $filter = "", $changeCaseTo = CASE_UPPER)
|
||||
@@ -142,7 +152,7 @@ class Workflow extends Handler
|
||||
$taskData['PRO_UID'] = $this->proUid;
|
||||
|
||||
try {
|
||||
self::log("Add Task with data: ", $taskData);
|
||||
self::log("===> Executing -> ".__METHOD__, "Add Task with data: ", $taskData);
|
||||
$task = new Task();
|
||||
$tasUid = $task->create($taskData, false);
|
||||
self::log("Add Task Success!");
|
||||
@@ -157,12 +167,10 @@ class Workflow extends Handler
|
||||
public function updateTask($tasUid, $taskData)
|
||||
{
|
||||
try {
|
||||
self::log("Update Task: $tasUid", "With data: ", $taskData);
|
||||
|
||||
self::log("===> Executing -> ".__METHOD__, "Update Task: $tasUid", "With data: ", $taskData);
|
||||
$task = new Task();
|
||||
$taskData['TAS_UID'] = $tasUid;
|
||||
$result = $task->update($taskData);
|
||||
|
||||
self::log("Update Task Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
@@ -175,11 +183,9 @@ class Workflow extends Handler
|
||||
public function removeTask($tasUid)
|
||||
{
|
||||
try {
|
||||
self::log("Remove Task: $tasUid");
|
||||
|
||||
self::log("===> Executing -> ".__METHOD__, "Remove Task: $tasUid");
|
||||
$task = new Task();
|
||||
$task->remove($tasUid);
|
||||
|
||||
self::log("Remove Task Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
@@ -281,10 +287,11 @@ class Workflow extends Handler
|
||||
$oTasks->deleteAllRoutesOfTask($this->proUid, $fromTasUid);
|
||||
//$oTasks->deleteAllGatewayOfTask($this->proUid, $fromTasUid);
|
||||
}
|
||||
|
||||
$result = $this->saveNewPattern($this->proUid, $fromTasUid, $toTasUid, $type, $delete);
|
||||
self::log("Add Route Success!");
|
||||
|
||||
return $this->saveNewPattern($this->proUid, $fromTasUid, $toTasUid, $type, $delete);
|
||||
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
throw $e;
|
||||
@@ -293,16 +300,32 @@ class Workflow extends Handler
|
||||
|
||||
public function updateRoute($rouUid, $routeData)
|
||||
{
|
||||
$route = new Route();
|
||||
$routeData['ROU_UID'] = $rouUid;
|
||||
$route->update($routeData);
|
||||
|
||||
try {
|
||||
self::log("===> Executing -> ".__METHOD__, "Update Route: $rouUid with data:", $routeData);
|
||||
$route = new Route();
|
||||
$route->update($routeData);
|
||||
self::log("Update Route Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function removeRoute($rouUid)
|
||||
{
|
||||
$route = new Route();
|
||||
try {
|
||||
self::log("===> Executing -> ".__METHOD__, "Remove Route: $rouUid");
|
||||
$route = new Route();
|
||||
$result = $route->remove($rouUid);
|
||||
self::log("Remove Route Success!");
|
||||
|
||||
return $route->remove($rouUid);
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function getRoute($rouUid)
|
||||
|
||||
Reference in New Issue
Block a user