From 7424c97b4ed84a580f5e0379525d98b5f3047556 Mon Sep 17 00:00:00 2001 From: Brayan Osmar Pereyra Suxo Date: Mon, 6 Jan 2014 17:10:37 -0400 Subject: [PATCH] Adicion para la url PUT en events --- workflow/engine/src/BusinessModel/Event.php | 31 +++---------- .../Api/ProcessMaker/Project/Event.php | 43 +++++++++++++++++++ 2 files changed, 50 insertions(+), 24 deletions(-) diff --git a/workflow/engine/src/BusinessModel/Event.php b/workflow/engine/src/BusinessModel/Event.php index 8976409c3..db552640d 100644 --- a/workflow/engine/src/BusinessModel/Event.php +++ b/workflow/engine/src/BusinessModel/Event.php @@ -96,34 +96,18 @@ class Event $dataEvent['PRO_UID'] = $sProcessUID; $oEvent = new \Event(); - $uidNewEvent = $oEvent->create( $dataEvent ); + + if ($create) { + $uidNewEvent = $oEvent->create( $dataEvent ); + } else { + $uidNewEvent = $oEvent->update( $dataEvent ); + } + $dataEvent = $this->getEvents($sProcessUID, '', $uidNewEvent); $dataEvent = array_change_key_case($dataEvent, CASE_LOWER); return $dataEvent; } - /** - * Update Event Put - * - * @param string $eventUid - * - * @access public - * @author Brayan Pereyra (Cochalo) - * @copyright Colosa - Bolivia - * - * @return void - */ - public function updateEvent($dataEvent) - { - $dataEvent = array_change_key_case($dataEvent, CASE_UPPER); - try { - $oEvent = new \Event(); - $oEvent->update( $dataEvent ); - } catch (Exception $e) { - throw $e; - } - } - /** * Delete Event * @@ -144,6 +128,5 @@ class Event throw $e; } } - } diff --git a/workflow/engine/src/Services/Api/ProcessMaker/Project/Event.php b/workflow/engine/src/Services/Api/ProcessMaker/Project/Event.php index 49eadc2cf..30f3a8182 100644 --- a/workflow/engine/src/Services/Api/ProcessMaker/Project/Event.php +++ b/workflow/engine/src/Services/Api/ProcessMaker/Project/Event.php @@ -102,6 +102,7 @@ class Event extends Api * @return array * * @url POST /:projectUid/event + * @status 201 */ public function doPostEvent($projectUid, $request_data, $evn_description, $evn_status, $evn_action, $evn_related_to, $tas_uid, $evn_tas_uid_from, $evn_tas_estimated_duration, @@ -124,6 +125,48 @@ class Event extends Api } } + /** + * @param string $projectUid {@min 1} {@max 32} + * @param string $eventUid {@min 1} {@max 32} + * @param array $request_data + * @param string $evn_description {@from body} {@min 1} + * @param string $evn_status {@from body} {@choice ACTIVE,INACTIVE} + * @param string $evn_action {@from body} {@choice SEND_MESSAGE,EXECUTE_CONDITIONAL_TRIGGER,EXECUTE_TRIGGER} + * @param string $evn_related_to {@from body} {@choice SINGLE,MULTIPLE} + * @param string $tas_uid {@from body} {@min 1} + * @param string $evn_tas_uid_from {@from body} {@min 1} + * @param string $evn_tas_estimated_duration {@from body} {@min 1} + * @param string $evn_time_unit {@from body} {@choice DAYS,HOURS} + * @param string $evn_when {@from body} {@type float} + * @param string $evn_when_occurs {@from body} {@choice AFTER_TIME,TASK_STARTED} + * @param string $tri_uid {@from body} {@min 1} + * @param string $evn_tas_uid_to {@from body} + * @param string $evn_conditions {@from body} + * + * @access public + * @author Brayan Pereyra (Cochalo) + * @copyright Colosa - Bolivia + * + * @return void + * + * @url PUT /:projectUid/event/:eventUid + */ + public function doPutEvent ($projectUid, $eventUid, $request_data, $evn_description, $evn_status, $evn_action, + $evn_related_to, $tas_uid, $evn_tas_uid_from, $evn_tas_estimated_duration, + $evn_time_unit, $evn_when, $evn_when_occurs, $tri_uid, $evn_tas_uid_to = '', $evn_conditions = '') + { + try { + $hiddenFields = array('pro_uid', 'evn_action_parameters', + 'evn_posx', 'evn_posy', 'evn_type', 'tas_evn_uid', 'evn_max_attempts' + ); + $request_data['evn_uid'] = $eventUid; + $event = new \BusinessModel\Event(); + $event->saveEvents($projectUid, $request_data); + } catch (\Exception $e) { + throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); + } + } + /** * @param string $projectUid {@min 1} {@max 32} * @param string $EventUid {@min 1} {@max 32}