Merged in cochalo/processmaker (pull request #52)

Adicion para la url PUT en events
This commit is contained in:
Fernando Ontiveros
2014-01-06 17:17:23 -04:00
2 changed files with 50 additions and 24 deletions

View File

@@ -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) <brayan@colosa.com>
* @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;
}
}
}

View File

@@ -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) <brayan@colosa.com>
* @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}