PM-939 "Support for Message-Event (Endpoints and Backend)"
- Se han implementado los siguientes Endpoints:
GET /api/1.0/{workspace}/project/{prj_uid}/message-event-definitions
GET /api/1.0/{workspace}/project/{prj_uid}/message-event-definition/{msged_uid}
GET /api/1.0/{workspace}/project/{prj_uid}/message-event-definition/event/{evn_uid}
POST /api/1.0/{workspace}/project/{prj_uid}/message-event-definition
PUT /api/1.0/{workspace}/project/{prj_uid}/message-event-definition/{msged_uid}
DELETE /api/1.0/{workspace}/project/{prj_uid}/message-event-definition/{msged_uid}
- Se han implementado los metodos necesarios/requeridos para el backend
del DESIGNER para esta nueva funcionalidad
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\MessageEventDefinition Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class MessageEventDefinition extends Api
|
||||
{
|
||||
private $messageEventDefinition;
|
||||
|
||||
/**
|
||||
* Constructor of the class
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
$this->messageEventDefinition = new \ProcessMaker\BusinessModel\MessageEventDefinition();
|
||||
|
||||
$this->messageEventDefinition->setFormatFieldNameInUppercase(false);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/message-event-definitions
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetMessageEventDefinitions($prj_uid)
|
||||
{
|
||||
try {
|
||||
$response = $this->messageEventDefinition->getMessageEventDefinitions($prj_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/message-event-definition/:msged_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $msged_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetMessageEventDefinition($prj_uid, $msged_uid)
|
||||
{
|
||||
try {
|
||||
$response = $this->messageEventDefinition->getMessageEventDefinition($msged_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/message-event-definition/event/:evn_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $evn_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetMessageEventDefinitionEvent($prj_uid, $evn_uid)
|
||||
{
|
||||
try {
|
||||
$response = $this->messageEventDefinition->getMessageEventDefinitionByEvent($prj_uid, $evn_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prj_uid/message-event-definition
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostMessageEventDefinition($prj_uid, array $request_data)
|
||||
{
|
||||
try {
|
||||
$arrayData = $this->messageEventDefinition->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/message-event-definition/:msged_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $msged_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*/
|
||||
public function doPutMessageEventDefinition($prj_uid, $msged_uid, array $request_data)
|
||||
{
|
||||
try {
|
||||
$arrayData = $this->messageEventDefinition->update($msged_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prj_uid/message-event-definition/:msged_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $msged_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDeleteMessageEventDefinition($prj_uid, $msged_uid)
|
||||
{
|
||||
try {
|
||||
$this->messageEventDefinition->delete($msged_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user