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