Merged in luisfernandosl/processmaker/PM-767 (pull request #1381)

PM-767 "BPMN Designer Añr lista de messages"
This commit is contained in:
Julio Cesar Laura Avendaño
2015-02-05 11:43:53 -04:00
26 changed files with 2227 additions and 1035 deletions

View File

@@ -663,6 +663,48 @@ class Processes
return $sNewUid;
}
/**
* Get an unused unique id for Message-Type
*
* @return string $uid
*/
public function getUnusedMessageTypeUid()
{
try {
$messageType = new \ProcessMaker\BusinessModel\MessageType();
do {
$newUid = \ProcessMaker\Util\Common::generateUID();
} while ($messageType->exists($newUid));
return $newUid;
} catch (Exception $e) {
throw $e;
}
}
/**
* Get an unused unique id for Message-Type-Variable
*
* @return string $uid
*/
public function getUnusedMessageTypeVariableUid()
{
try {
$variable = new \ProcessMaker\BusinessModel\MessageType\Variable();
do {
$newUid = \ProcessMaker\Util\Common::generateUID();
} while ($variable->exists($newUid));
return $newUid;
} catch (Exception $e) {
throw $e;
}
}
/**
* change the GUID for a serialized process
*
@@ -800,6 +842,12 @@ class Processes
}
}
if (isset($oData->messageType)) {
foreach ($oData->messageType as $key => $value) {
$oData->messageType[$key]["PRJ_UID"] = $sNewProUid;
}
}
return true;
}
@@ -2212,6 +2260,77 @@ class Processes
throw $e;
}
}
/**
* Renew all the unique id for Message-Type
*
* @param object $data Object with the data
*
* return void
*/
public function renewAllMessageTypeUid(&$data)
{
try {
$map = array();
foreach ($data->messageType as $key => $value) {
$record = $value;
if (isset($record["MSGT_UID"])) {
$newUid = $this->getUnusedMessageTypeUid();
$map[$record["MSGT_UID"]] = $newUid;
$data->messageType[$key]["MSGT_UID"] = $newUid;
}
}
$data->uid["MESSAGE_TYPE"] = $map;
if (isset($data->messageTypeVariable)) {
foreach ($data->messageTypeVariable as $key => $value) {
$record = $value;
if (isset($map[$record["MSGT_UID"]])) {
$newUid = $map[$record["MSGT_UID"]];
$data->messageTypeVariable[$key]["MSGT_UID"] = $newUid;
}
}
}
} catch (Exception $e) {
throw $e;
}
}
/**
* Renew all the unique id for Message-Type-Variable
*
* @param object $data Object with the data
*
* return void
*/
public function renewAllMessageTypeVariableUid(&$data)
{
try {
$map = array();
foreach ($data->messageTypeVariable as $key => $value) {
$record = $value;
if (isset($record["MSGTV_UID"])) {
$newUid = $this->getUnusedMessageTypeVariableUid();
$map[$record["MSGTV_UID"]] = $newUid;
$data->messageTypeVariable[$key]["MSGTV_UID"] = $newUid;
}
}
$data->uid["MESSAGE_TYPE_VARIABLE"] = $map;
} catch (Exception $e) {
throw $e;
}
}
/**
* Renew the GUID's for all the Uids for all the elements
*
@@ -2242,6 +2361,8 @@ class Processes
$this->renewAllCaseScheduler( $oData );
$this->renewAllProcessUserUid($oData);
$this->renewAllProcessVariableUid($oData);
$this->renewAllMessageTypeUid($oData);
$this->renewAllMessageTypeVariableUid($oData);
}
/**
@@ -2891,6 +3012,71 @@ class Processes
}
}
public function getMessageTypes($processUid)
{
try {
$arrayMessageType = array();
$messageType = new \ProcessMaker\BusinessModel\MessageType();
//Get data
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(MessageTypePeer::MSGT_UID);
$criteria->add(MessageTypePeer::PRJ_UID, $processUid, Criteria::EQUAL);
$rsCriteria = MessageTypePeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$arrayAux = $messageType->getMessageType($row["MSGT_UID"], true);
unset($arrayAux["MSGT_VARIABLES"]);
$arrayMessageType[] = $arrayAux;
}
//Return
return $arrayMessageType;
} catch (Exception $e) {
throw $e;
}
}
public function getMessageTypeVariables($processUid)
{
try {
$arrayVariable = array();
$variable = new \ProcessMaker\BusinessModel\MessageType\Variable();
//Get data
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(MessageTypeVariablePeer::MSGTV_UID);
$criteria->addJoin(MessageTypePeer::MSGT_UID, MessageTypeVariablePeer::MSGT_UID, Criteria::LEFT_JOIN);
$criteria->add(MessageTypePeer::PRJ_UID, $processUid, Criteria::EQUAL);
$rsCriteria = MessageTypeVariablePeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$arrayVariable[] = $variable->getMessageTypeVariable($row["MSGTV_UID"], true);
}
//Return
return $arrayVariable;
} catch (Exception $e) {
throw $e;
}
}
/**
* Get Task User Rows from an array of data
*
@@ -3079,6 +3265,59 @@ class Processes
}
}
/**
* Create Message-Type records
*
* @param array $arrayData Data
*
* return void
*/
public function createMessageType(array $arrayData)
{
try {
$messageType = new \ProcessMaker\BusinessModel\MessageType();
foreach ($arrayData as $value) {
$record = $value;
if ($messageType->exists($record["MSGT_UID"])) {
$messageType->delete($record["MSGT_UID"]);
}
$result = $messageType->singleCreate($record);
}
} catch (Exception $e) {
throw $e;
}
}
/**
* Create Message-Type-Variable records
*
* @param array $arrayData Data
*
* return void
*/
public function createMessageTypeVariable(array $arrayData)
{
try {
$variable = new \ProcessMaker\BusinessModel\MessageType\Variable();
foreach ($arrayData as $value) {
$record = $value;
if ($variable->exists($record["MSGTV_UID"])) {
$variable->delete($record["MSGTV_UID"]);
}
$result = $variable->singleCreate($record);
}
} catch (Exception $e) {
throw $e;
}
}
/**
* Cleanup Report Tables References from an array of data
*
@@ -3265,7 +3504,8 @@ class Processes
$oData->processVariables = $this->getProcessVariables($sProUid);
$oData->webEntry = $this->getWebEntries($sProUid);
$oData->webEntryEvent = $this->getWebEntryEvents($sProUid);
$oData->messageType = $this->getMessageTypes($sProUid);
$oData->messageTypeVariable = $this->getMessageTypeVariables($sProUid);
$oData->groupwfs = $this->groupwfsMerge($oData->groupwfs, $oData->processUser, "USR_UID");
$oData->process["PRO_TYPE_PROCESS"] = "PUBLIC";
@@ -4310,6 +4550,8 @@ class Processes
$this->createProcessVariables((isset($oData->processVariables))? $oData->processVariables : array());
$this->createWebEntry($arrayProcessData["PRO_UID"], $arrayProcessData["PRO_CREATE_USER"], (isset($oData->webEntry))? $oData->webEntry : array());
$this->createWebEntryEvent($arrayProcessData["PRO_UID"], $arrayProcessData["PRO_CREATE_USER"], (isset($oData->webEntryEvent))? $oData->webEntryEvent : array());
$this->createMessageType((isset($oData->messageType))? $oData->messageType : array());
$this->createMessageTypeVariable((isset($oData->messageTypeVariable))? $oData->messageTypeVariable : array());
}

View File

@@ -1,19 +0,0 @@
<?php
require_once 'classes/model/om/BaseMessage.php';
/**
* Skeleton subclass for representing a row from the 'MESSAGE' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package classes.model
*/
class Message extends BaseMessage {
} // Message

View File

@@ -1,19 +0,0 @@
<?php
require_once 'classes/model/om/BaseMessageDetail.php';
/**
* Skeleton subclass for representing a row from the 'MESSAGE_DETAIL' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package classes.model
*/
class MessageDetail extends BaseMessageDetail {
} // MessageDetail

View File

@@ -1,23 +0,0 @@
<?php
// include base peer class
require_once 'classes/model/om/BaseMessageDetailPeer.php';
// include object class
include_once 'classes/model/MessageDetail.php';
/**
* Skeleton subclass for performing query and update operations on the 'MESSAGE_DETAIL' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package classes.model
*/
class MessageDetailPeer extends BaseMessageDetailPeer {
} // MessageDetailPeer

View File

@@ -1,23 +0,0 @@
<?php
// include base peer class
require_once 'classes/model/om/BaseMessagePeer.php';
// include object class
include_once 'classes/model/Message.php';
/**
* Skeleton subclass for performing query and update operations on the 'MESSAGE' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package classes.model
*/
class MessagePeer extends BaseMessagePeer {
} // MessagePeer

View File

@@ -0,0 +1,5 @@
<?php
class MessageType extends BaseMessageType
{
}

View File

@@ -0,0 +1,5 @@
<?php
class MessageTypePeer extends BaseMessageTypePeer
{
}

View File

@@ -0,0 +1,5 @@
<?php
class MessageTypeVariable extends BaseMessageTypeVariable
{
}

View File

@@ -0,0 +1,5 @@
<?php
class MessageTypeVariablePeer extends BaseMessageTypeVariablePeer
{
}

View File

@@ -5,7 +5,7 @@ include_once 'creole/CreoleTypes.php';
/**
* This class adds structure of 'MESSAGE' table to 'workflow' DatabaseMap object.
* This class adds structure of 'MESSAGE_TYPE' table to 'workflow' DatabaseMap object.
*
*
*
@@ -16,13 +16,13 @@ include_once 'creole/CreoleTypes.php';
*
* @package workflow.classes.model.map
*/
class MessageMapBuilder
class MessageTypeMapBuilder
{
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'classes.model.map.MessageMapBuilder';
const CLASS_NAME = 'classes.model.map.MessageTypeMapBuilder';
/**
* The database map.
@@ -60,19 +60,17 @@ class MessageMapBuilder
{
$this->dbMap = Propel::getDatabaseMap('workflow');
$tMap = $this->dbMap->addTable('MESSAGE');
$tMap->setPhpName('Message');
$tMap = $this->dbMap->addTable('MESSAGE_TYPE');
$tMap->setPhpName('MessageType');
$tMap->setUseIdGenerator(false);
$tMap->addPrimaryKey('MES_UID', 'MesUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addPrimaryKey('MSGT_UID', 'MsgtUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('PRJ_UID', 'PrjUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('MES_NAME', 'MesName', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('MES_CONDITION', 'MesCondition', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('MSGT_NAME', 'MsgtName', 'string', CreoleTypes::VARCHAR, false, 512);
} // doBuild()
} // MessageMapBuilder
} // MessageTypeMapBuilder

View File

@@ -5,7 +5,7 @@ include_once 'creole/CreoleTypes.php';
/**
* This class adds structure of 'MESSAGE_DETAIL' table to 'workflow' DatabaseMap object.
* This class adds structure of 'MESSAGE_TYPE_VARIABLE' table to 'workflow' DatabaseMap object.
*
*
*
@@ -16,13 +16,13 @@ include_once 'creole/CreoleTypes.php';
*
* @package workflow.classes.model.map
*/
class MessageDetailMapBuilder
class MessageTypeVariableMapBuilder
{
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'classes.model.map.MessageDetailMapBuilder';
const CLASS_NAME = 'classes.model.map.MessageTypeVariableMapBuilder';
/**
* The database map.
@@ -60,19 +60,19 @@ class MessageDetailMapBuilder
{
$this->dbMap = Propel::getDatabaseMap('workflow');
$tMap = $this->dbMap->addTable('MESSAGE_DETAIL');
$tMap->setPhpName('MessageDetail');
$tMap = $this->dbMap->addTable('MESSAGE_TYPE_VARIABLE');
$tMap->setPhpName('MessageTypeVariable');
$tMap->setUseIdGenerator(false);
$tMap->addPrimaryKey('MD_UID', 'MdUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addPrimaryKey('MSGTV_UID', 'MsgtvUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('MES_UID', 'MesUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('MSGT_UID', 'MsgtUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('MD_TYPE', 'MdType', 'string', CreoleTypes::VARCHAR, false, 32);
$tMap->addColumn('MSGTV_NAME', 'MsgtvName', 'string', CreoleTypes::VARCHAR, false, 512);
$tMap->addColumn('MD_NAME', 'MdName', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('MSGTV_DEFAULT_VALUE', 'MsgtvDefaultValue', 'string', CreoleTypes::VARCHAR, false, 512);
} // doBuild()
} // MessageDetailMapBuilder
} // MessageTypeVariableMapBuilder

View File

@@ -4171,17 +4171,40 @@
<column name="TYPE" type="VARCHAR" size="255" required="true" primaryKey="true" default=""/>
<column name="TYP_UID" type="VARCHAR" size="32" required="true" default=""/>
</table>
<table name="MESSAGE">
<column name="MES_UID" type="VARCHAR" size="32" required="true" primaryKey="true" />
<column name="PRJ_UID" type="VARCHAR" size="32" required="true"/>
<column name="MES_NAME" type="VARCHAR" size="255" default=""/>
<column name="MES_CONDITION" type="VARCHAR" size="255" default=""/>
<table name="MESSAGE_TYPE">
<vendor type="mysql">
<parameter name="Name" value="MESSAGE_TYPE" />
<parameter name="Engine" value="InnoDB" />
<parameter name="Version" value="10" />
<parameter name="Row_format" value="Dynamic" />
<parameter name="Data_free" value="0" />
<parameter name="Auto_increment" value="" />
<parameter name="Check_time" value="" />
<parameter name="Collation" value="utf8_general_ci" />
<parameter name="Checksum" value="" />
<parameter name="Create_options" value="" />
</vendor>
<column name="MSGT_UID" type="VARCHAR" size="32" required="true" primaryKey="true" />
<column name="PRJ_UID" type="VARCHAR" size="32" required="true" />
<column name="MSGT_NAME" type="VARCHAR" size="512" default="" />
</table>
<table name="MESSAGE_DETAIL">
<column name="MD_UID" type="VARCHAR" size="32" required="true" primaryKey="true" />
<column name="MES_UID" type="VARCHAR" size="32" required="true"/>
<column name="MD_TYPE" type="VARCHAR" size="32" default=""/>
<column name="MD_NAME" type="VARCHAR" size="255" default=""/>
<table name="MESSAGE_TYPE_VARIABLE">
<vendor type="mysql">
<parameter name="Name" value="MESSAGE_TYPE_VARIABLE" />
<parameter name="Engine" value="InnoDB" />
<parameter name="Version" value="10" />
<parameter name="Row_format" value="Dynamic" />
<parameter name="Data_free" value="0" />
<parameter name="Auto_increment" value="" />
<parameter name="Check_time" value="" />
<parameter name="Collation" value="utf8_general_ci" />
<parameter name="Checksum" value="" />
<parameter name="Create_options" value="" />
</vendor>
<column name="MSGTV_UID" type="VARCHAR" size="32" required="true" primaryKey="true" />
<column name="MSGT_UID" type="VARCHAR" size="32" required="true" />
<column name="MSGTV_NAME" type="VARCHAR" size="512" default="" />
<column name="MSGTV_DEFAULT_VALUE" type="VARCHAR" size="512" default="" />
</table>
<table name="EMAIL_SERVER">
<vendor type="mysql">

View File

@@ -2379,37 +2379,33 @@ CREATE TABLE `LIST_UNASSIGNED_GROUP`
PRIMARY KEY (`UNA_UID`,`USR_UID`,`TYPE`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Unassiged list';
#-----------------------------------------------------------------------------
#-- MESSAGE
#-- MESSAGE_TYPE
#-----------------------------------------------------------------------------
DROP TABLE IF EXISTS `MESSAGE`;
DROP TABLE IF EXISTS MESSAGE_TYPE;
CREATE TABLE `MESSAGE`
CREATE TABLE MESSAGE_TYPE
(
`MES_UID` VARCHAR(32) NOT NULL,
`PRJ_UID` VARCHAR(32) NOT NULL,
`MES_NAME` VARCHAR(255) default '',
`MES_CONDITION` VARCHAR(255) default '',
PRIMARY KEY (`MES_UID`)
)ENGINE=InnoDB ;
MSGT_UID VARCHAR(32) default '' NOT NULL,
PRJ_UID VARCHAR(32) default '' NOT NULL,
MSGT_NAME VARCHAR(256) default '' NOT NULL,
PRIMARY KEY (MSGT_UID)
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
#-----------------------------------------------------------------------------
#-- MESSAGE_DETAIL
#-- MESSAGE_TYPE_VARIABLE
#-----------------------------------------------------------------------------
DROP TABLE IF EXISTS `MESSAGE_DETAIL`;
DROP TABLE IF EXISTS MESSAGE_TYPE_VARIABLE;
CREATE TABLE `MESSAGE_DETAIL`
CREATE TABLE MESSAGE_TYPE_VARIABLE
(
`MD_UID` VARCHAR(32) NOT NULL,
`MES_UID` VARCHAR(32) NOT NULL,
`MD_TYPE` VARCHAR(32) default '',
`MD_NAME` VARCHAR(255) default '',
PRIMARY KEY (`MD_UID`)
)ENGINE=InnoDB ;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;
MSGTV_UID VARCHAR(32) default '' NOT NULL,
MSGT_UID VARCHAR(32) default '' NOT NULL,
MSGTV_NAME VARCHAR(256) default '' NOT NULL,
MSGTV_DEFAULT_VALUE VARCHAR(256) default '' NOT NULL,
PRIMARY KEY (MSGTV_UID)
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
#-----------------------------------------------------------------------------
#-- TABLE: EMAIL_SERVER

View File

@@ -225,7 +225,7 @@ class EmailServer
try {
$arrayTestMailResult = $this->sendTestMail($arrayDataMail);
} catch (Exception $error) {
} catch (Exception $e) {
$arrayTestMailResult["status"] = false;
$arrayTestMailResult["message"] = $e->getMessage();

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -798,6 +798,23 @@ class Workflow extends Handler
$webEntryEvent->delete($row["WEE_UID"]);
}
//Delete MessageTypes
$messageType = new \ProcessMaker\BusinessModel\MessageType();
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\MessageTypePeer::MSGT_UID);
$criteria->add(\MessageTypePeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
$rsCriteria = \MessageTypePeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$messageType->delete($row["MSGT_UID"]);
}
//Delete the process
try {
$oProcess->remove($sProcessUID);

View File

@@ -1,111 +0,0 @@
<?php
namespace ProcessMaker\Services\Api\Project;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* Project\Message Api Controller
*
* @protected
*/
class Message extends Api
{
/**
* @url GET /:prj_uid/messages
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetMessages($prj_uid)
{
try {
$message = new \ProcessMaker\BusinessModel\Message();
$response = $message->getMessages($prj_uid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:prj_uid/message/:mes_uid
*
* @param string $mes_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetMessage($mes_uid, $prj_uid)
{
try {
$message = new \ProcessMaker\BusinessModel\Message();
$response = $message->getMessage($prj_uid, $mes_uid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url POST /:prj_uid/message
*
* @param string $prj_uid {@min 32}{@max 32}
* @param array $request_data
*
* @status 201
*/
public function doPostMessage($prj_uid, $request_data)
{
try {
$request_data = (array)($request_data);
$message = new \ProcessMaker\BusinessModel\Message();
$arrayData = $message->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/:mes_uid
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $mes_uid {@min 32}{@max 32}
* @param array $request_data
*/
public function doPutMessage($prj_uid, $mes_uid, array $request_data)
{
try {
$request_data = (array)($request_data);
$message = new \ProcessMaker\BusinessModel\Message();
$message->update($prj_uid, $mes_uid, $request_data);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url DELETE /:prj_uid/message/:mes_uid
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $mes_uid {@min 32}{@max 32}
*/
public function doDeleteMessage($prj_uid, $mes_uid)
{
try {
$message = new \ProcessMaker\BusinessModel\Message();
$message->delete($prj_uid, $mes_uid);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}

View File

@@ -0,0 +1,119 @@
<?php
namespace ProcessMaker\Services\Api\Project;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* Project\MessageType Api Controller
*
* @protected
*/
class MessageType extends Api
{
private $message;
/**
* Constructor of the class
*
* return void
*/
public function __construct()
{
try {
$this->messageType = new \ProcessMaker\BusinessModel\MessageType();
$this->messageType->setFormatFieldNameInUppercase(false);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:prj_uid/message-types
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetMessageTypes($prj_uid, $filter = null, $start = null, $limit = null)
{
try {
$arrayAux = $this->messageType->getMessageTypes($prj_uid, array("filter" => $filter), null, null, $start, $limit);
$response = $arrayAux["data"];
return $response;
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url GET /:prj_uid/message-type/:msgt_uid
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $msgt_uid {@min 32}{@max 32}
*/
public function doGetMessageType($prj_uid, $msgt_uid)
{
try {
$response = $this->messageType->getMessageType($msgt_uid);
return $response;
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url POST /:prj_uid/message-type
*
* @param string $prj_uid {@min 32}{@max 32}
* @param array $request_data
*
* @status 201
*/
public function doPostMessageType($prj_uid, array $request_data)
{
try {
$arrayData = $this->messageType->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-type/:msgt_uid
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $msgt_uid {@min 32}{@max 32}
* @param array $request_data
*/
public function doPutMessageType($prj_uid, $msgt_uid, array $request_data)
{
try {
$arrayData = $this->messageType->update($msgt_uid, $request_data);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url DELETE /:prj_uid/message-type/:msgt_uid
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $msgt_uid {@min 32}{@max 32}
*/
public function doDeleteMessageType($prj_uid, $msgt_uid)
{
try {
$this->messageType->delete($msgt_uid);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
}

View File

@@ -0,0 +1,124 @@
<?php
namespace ProcessMaker\Services\Api\Project\MessageType;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* Project\MessageType\Variable Api Controller
*
* @protected
*/
class Variable extends Api
{
private $variable;
/**
* Constructor of the class
*
* return void
*/
public function __construct()
{
try {
$this->variable = new \ProcessMaker\BusinessModel\MessageType\Variable();
$this->variable->setFormatFieldNameInUppercase(false);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getVariable()));
}
}
/**
* @url GET /:prj_uid/message-type/:msgt_uid/variables
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $msgt_uid {@min 32}{@max 32}
*/
public function doGetMessageTypeVariables($prj_uid, $msgt_uid)
{
try {
$arrayAux = $this->variable->getMessageTypeVariables($msgt_uid);
$response = $arrayAux["data"];
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getVariable()));
}
}
/**
* @url GET /:prj_uid/message-type/:msgt_uid/variable/:msgtv_uid
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $msgt_uid {@min 32}{@max 32}
* @param string $msgtv_uid {@min 32}{@max 32}
*/
public function doGetVariable($prj_uid, $msgt_uid, $msgtv_uid)
{
try {
$response = $this->variable->getMessageTypeVariable($msgtv_uid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getVariable()));
}
}
/**
* @url POST /:prj_uid/message-type/:msgt_uid/variable
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $msgt_uid {@min 32}{@max 32}
* @param array $request_data
*
* @status 201
*/
public function doPostMessageTypeVariable($prj_uid, $msgt_uid, array $request_data)
{
try {
$arrayData = $this->variable->create($msgt_uid, $request_data);
$response = $arrayData;
return $response;
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url PUT /:prj_uid/message-type/:msgt_uid/variable/:msgtv_uid
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $msgt_uid {@min 32}{@max 32}
* @param string $msgtv_uid {@min 32}{@max 32}
* @param array $request_data
*/
public function doPutMessageTypeVariable($prj_uid, $msgt_uid, $msgtv_uid, array $request_data)
{
try {
$arrayData = $this->variable->update($msgtv_uid, $request_data);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url DELETE /:prj_uid/message-type/:msgt_uid/variable/:msgtv_uid
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $msgt_uid {@min 32}{@max 32}
* @param string $msgtv_uid {@min 32}{@max 32}
*/
public function doDeleteMessageTypeVariable($prj_uid, $msgt_uid, $msgtv_uid)
{
try {
$this->variable->delete($msgtv_uid);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
}

View File

@@ -36,8 +36,9 @@ debug = 1
sub-process= "ProcessMaker\Services\Api\Project\SubProcess"
trigger-wizard = "ProcessMaker\Services\Api\Project\TriggerWizard"
category = "ProcessMaker\Services\Api\ProcessCategory"
process-variable = "ProcessMaker\Services\Api\Project\Variable"
message = "ProcessMaker\Services\Api\Project\Message"
process-variable = "ProcessMaker\Services\Api\Project\Variable"
message-type = "ProcessMaker\Services\Api\Project\MessageType"
message-type-variable = "ProcessMaker\Services\Api\Project\MessageType\Variable"
web-entry-event = "ProcessMaker\Services\Api\Project\WebEntryEvent"
[alias: projects]