PM-767 "BPMN Designer Añr lista de messages"
> ProcessMaker-MA "Message (endpoints)"
- Se han implementado los siguientes Endpoints:
GET /api/1.0/{workspace}/project/{prj_uid}/message-types/{msgt_uid}
GET /api/1.0/{workspace}/project/{prj_uid}/message-type/{msgt_uid}
POST /api/1.0/{workspace}/project/{prj_uid}/message-type
PUT /api/1.0/{workspace}/project/{prj_uid}/message-type/{msgt_uid}
DELETE /api/1.0/{workspace}/project/{prj_uid}/message-type/{msgt_uid}
- Se han implementado los metodos necesarios para el Export, Import y Delete (delete Process) de este nuevo "Objeto"
This commit is contained in:
@@ -663,6 +663,48 @@ class Processes
|
|||||||
return $sNewUid;
|
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
|
* 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2212,6 +2260,77 @@ class Processes
|
|||||||
throw $e;
|
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
|
* Renew the GUID's for all the Uids for all the elements
|
||||||
*
|
*
|
||||||
@@ -2242,6 +2361,8 @@ class Processes
|
|||||||
$this->renewAllCaseScheduler( $oData );
|
$this->renewAllCaseScheduler( $oData );
|
||||||
$this->renewAllProcessUserUid($oData);
|
$this->renewAllProcessUserUid($oData);
|
||||||
$this->renewAllProcessVariableUid($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
|
* 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
|
* Cleanup Report Tables References from an array of data
|
||||||
*
|
*
|
||||||
@@ -3265,7 +3504,8 @@ class Processes
|
|||||||
$oData->processVariables = $this->getProcessVariables($sProUid);
|
$oData->processVariables = $this->getProcessVariables($sProUid);
|
||||||
$oData->webEntry = $this->getWebEntries($sProUid);
|
$oData->webEntry = $this->getWebEntries($sProUid);
|
||||||
$oData->webEntryEvent = $this->getWebEntryEvents($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->groupwfs = $this->groupwfsMerge($oData->groupwfs, $oData->processUser, "USR_UID");
|
||||||
$oData->process["PRO_TYPE_PROCESS"] = "PUBLIC";
|
$oData->process["PRO_TYPE_PROCESS"] = "PUBLIC";
|
||||||
|
|
||||||
@@ -4310,6 +4550,8 @@ class Processes
|
|||||||
$this->createProcessVariables((isset($oData->processVariables))? $oData->processVariables : array());
|
$this->createProcessVariables((isset($oData->processVariables))? $oData->processVariables : array());
|
||||||
$this->createWebEntry($arrayProcessData["PRO_UID"], $arrayProcessData["PRO_CREATE_USER"], (isset($oData->webEntry))? $oData->webEntry : 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->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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
@@ -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
|
|
||||||
5
workflow/engine/classes/model/MessageType.php
Normal file
5
workflow/engine/classes/model/MessageType.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
class MessageType extends BaseMessageType
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
5
workflow/engine/classes/model/MessageTypePeer.php
Normal file
5
workflow/engine/classes/model/MessageTypePeer.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
class MessageTypePeer extends BaseMessageTypePeer
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
5
workflow/engine/classes/model/MessageTypeVariable.php
Normal file
5
workflow/engine/classes/model/MessageTypeVariable.php
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
class MessageTypeVariable extends BaseMessageTypeVariable
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
class MessageTypeVariablePeer extends BaseMessageTypeVariablePeer
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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
|
* @package workflow.classes.model.map
|
||||||
*/
|
*/
|
||||||
class MessageMapBuilder
|
class MessageTypeMapBuilder
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The (dot-path) name of this class
|
* The (dot-path) name of this class
|
||||||
*/
|
*/
|
||||||
const CLASS_NAME = 'classes.model.map.MessageMapBuilder';
|
const CLASS_NAME = 'classes.model.map.MessageTypeMapBuilder';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The database map.
|
* The database map.
|
||||||
@@ -60,19 +60,17 @@ class MessageMapBuilder
|
|||||||
{
|
{
|
||||||
$this->dbMap = Propel::getDatabaseMap('workflow');
|
$this->dbMap = Propel::getDatabaseMap('workflow');
|
||||||
|
|
||||||
$tMap = $this->dbMap->addTable('MESSAGE');
|
$tMap = $this->dbMap->addTable('MESSAGE_TYPE');
|
||||||
$tMap->setPhpName('Message');
|
$tMap->setPhpName('MessageType');
|
||||||
|
|
||||||
$tMap->setUseIdGenerator(false);
|
$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('PRJ_UID', 'PrjUid', 'string', CreoleTypes::VARCHAR, true, 32);
|
||||||
|
|
||||||
$tMap->addColumn('MES_NAME', 'MesName', 'string', CreoleTypes::VARCHAR, false, 255);
|
$tMap->addColumn('MSGT_NAME', 'MsgtName', 'string', CreoleTypes::VARCHAR, false, 512);
|
||||||
|
|
||||||
$tMap->addColumn('MES_CONDITION', 'MesCondition', 'string', CreoleTypes::VARCHAR, false, 255);
|
|
||||||
|
|
||||||
} // doBuild()
|
} // doBuild()
|
||||||
|
|
||||||
} // MessageMapBuilder
|
} // MessageTypeMapBuilder
|
||||||
@@ -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
|
* @package workflow.classes.model.map
|
||||||
*/
|
*/
|
||||||
class MessageDetailMapBuilder
|
class MessageTypeVariableMapBuilder
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The (dot-path) name of this class
|
* The (dot-path) name of this class
|
||||||
*/
|
*/
|
||||||
const CLASS_NAME = 'classes.model.map.MessageDetailMapBuilder';
|
const CLASS_NAME = 'classes.model.map.MessageTypeVariableMapBuilder';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The database map.
|
* The database map.
|
||||||
@@ -60,19 +60,19 @@ class MessageDetailMapBuilder
|
|||||||
{
|
{
|
||||||
$this->dbMap = Propel::getDatabaseMap('workflow');
|
$this->dbMap = Propel::getDatabaseMap('workflow');
|
||||||
|
|
||||||
$tMap = $this->dbMap->addTable('MESSAGE_DETAIL');
|
$tMap = $this->dbMap->addTable('MESSAGE_TYPE_VARIABLE');
|
||||||
$tMap->setPhpName('MessageDetail');
|
$tMap->setPhpName('MessageTypeVariable');
|
||||||
|
|
||||||
$tMap->setUseIdGenerator(false);
|
$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()
|
} // doBuild()
|
||||||
|
|
||||||
} // MessageDetailMapBuilder
|
} // MessageTypeVariableMapBuilder
|
||||||
@@ -7,31 +7,31 @@ require_once 'propel/om/Persistent.php';
|
|||||||
|
|
||||||
include_once 'propel/util/Criteria.php';
|
include_once 'propel/util/Criteria.php';
|
||||||
|
|
||||||
include_once 'classes/model/MessagePeer.php';
|
include_once 'classes/model/MessageTypePeer.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class that represents a row from the 'MESSAGE' table.
|
* Base class that represents a row from the 'MESSAGE_TYPE' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @package workflow.classes.model.om
|
* @package workflow.classes.model.om
|
||||||
*/
|
*/
|
||||||
abstract class BaseMessage extends BaseObject implements Persistent
|
abstract class BaseMessageType extends BaseObject implements Persistent
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Peer class.
|
* The Peer class.
|
||||||
* Instance provides a convenient way of calling static methods on a class
|
* Instance provides a convenient way of calling static methods on a class
|
||||||
* that calling code may not be able to identify.
|
* that calling code may not be able to identify.
|
||||||
* @var MessagePeer
|
* @var MessageTypePeer
|
||||||
*/
|
*/
|
||||||
protected static $peer;
|
protected static $peer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the mes_uid field.
|
* The value for the msgt_uid field.
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $mes_uid;
|
protected $msgt_uid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the prj_uid field.
|
* The value for the prj_uid field.
|
||||||
@@ -40,16 +40,10 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
protected $prj_uid;
|
protected $prj_uid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the mes_name field.
|
* The value for the msgt_name field.
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $mes_name = '';
|
protected $msgt_name = '';
|
||||||
|
|
||||||
/**
|
|
||||||
* The value for the mes_condition field.
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected $mes_condition = '';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to prevent endless save loop, if this object is referenced
|
* Flag to prevent endless save loop, if this object is referenced
|
||||||
@@ -66,14 +60,14 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
protected $alreadyInValidation = false;
|
protected $alreadyInValidation = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [mes_uid] column value.
|
* Get the [msgt_uid] column value.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getMesUid()
|
public function getMsgtUid()
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->mes_uid;
|
return $this->msgt_uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,34 +82,23 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [mes_name] column value.
|
* Get the [msgt_name] column value.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getMesName()
|
public function getMsgtName()
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->mes_name;
|
return $this->msgt_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [mes_condition] column value.
|
* Set the value of [msgt_uid] column.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getMesCondition()
|
|
||||||
{
|
|
||||||
|
|
||||||
return $this->mes_condition;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the value of [mes_uid] column.
|
|
||||||
*
|
*
|
||||||
* @param string $v new value
|
* @param string $v new value
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setMesUid($v)
|
public function setMsgtUid($v)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Since the native PHP type for this column is string,
|
// Since the native PHP type for this column is string,
|
||||||
@@ -124,12 +107,12 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
$v = (string) $v;
|
$v = (string) $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->mes_uid !== $v) {
|
if ($this->msgt_uid !== $v) {
|
||||||
$this->mes_uid = $v;
|
$this->msgt_uid = $v;
|
||||||
$this->modifiedColumns[] = MessagePeer::MES_UID;
|
$this->modifiedColumns[] = MessageTypePeer::MSGT_UID;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // setMesUid()
|
} // setMsgtUid()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [prj_uid] column.
|
* Set the value of [prj_uid] column.
|
||||||
@@ -148,18 +131,18 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
|
|
||||||
if ($this->prj_uid !== $v) {
|
if ($this->prj_uid !== $v) {
|
||||||
$this->prj_uid = $v;
|
$this->prj_uid = $v;
|
||||||
$this->modifiedColumns[] = MessagePeer::PRJ_UID;
|
$this->modifiedColumns[] = MessageTypePeer::PRJ_UID;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // setPrjUid()
|
} // setPrjUid()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [mes_name] column.
|
* Set the value of [msgt_name] column.
|
||||||
*
|
*
|
||||||
* @param string $v new value
|
* @param string $v new value
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setMesName($v)
|
public function setMsgtName($v)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Since the native PHP type for this column is string,
|
// Since the native PHP type for this column is string,
|
||||||
@@ -168,34 +151,12 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
$v = (string) $v;
|
$v = (string) $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->mes_name !== $v || $v === '') {
|
if ($this->msgt_name !== $v || $v === '') {
|
||||||
$this->mes_name = $v;
|
$this->msgt_name = $v;
|
||||||
$this->modifiedColumns[] = MessagePeer::MES_NAME;
|
$this->modifiedColumns[] = MessageTypePeer::MSGT_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // setMesName()
|
} // setMsgtName()
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the value of [mes_condition] column.
|
|
||||||
*
|
|
||||||
* @param string $v new value
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function setMesCondition($v)
|
|
||||||
{
|
|
||||||
|
|
||||||
// Since the native PHP type for this column is string,
|
|
||||||
// we will cast the input to a string (if it is not).
|
|
||||||
if ($v !== null && !is_string($v)) {
|
|
||||||
$v = (string) $v;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->mes_condition !== $v || $v === '') {
|
|
||||||
$this->mes_condition = $v;
|
|
||||||
$this->modifiedColumns[] = MessagePeer::MES_CONDITION;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // setMesCondition()
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hydrates (populates) the object variables with values from the database resultset.
|
* Hydrates (populates) the object variables with values from the database resultset.
|
||||||
@@ -214,23 +175,21 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$this->mes_uid = $rs->getString($startcol + 0);
|
$this->msgt_uid = $rs->getString($startcol + 0);
|
||||||
|
|
||||||
$this->prj_uid = $rs->getString($startcol + 1);
|
$this->prj_uid = $rs->getString($startcol + 1);
|
||||||
|
|
||||||
$this->mes_name = $rs->getString($startcol + 2);
|
$this->msgt_name = $rs->getString($startcol + 2);
|
||||||
|
|
||||||
$this->mes_condition = $rs->getString($startcol + 3);
|
|
||||||
|
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
|
|
||||||
// FIXME - using NUM_COLUMNS may be clearer.
|
// FIXME - using NUM_COLUMNS may be clearer.
|
||||||
return $startcol + 4; // 4 = MessagePeer::NUM_COLUMNS - MessagePeer::NUM_LAZY_LOAD_COLUMNS).
|
return $startcol + 3; // 3 = MessageTypePeer::NUM_COLUMNS - MessageTypePeer::NUM_LAZY_LOAD_COLUMNS).
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating Message object", $e);
|
throw new PropelException("Error populating MessageType object", $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,12 +209,12 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(MessagePeer::DATABASE_NAME);
|
$con = Propel::getConnection(MessageTypePeer::DATABASE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$con->begin();
|
$con->begin();
|
||||||
MessagePeer::doDelete($this, $con);
|
MessageTypePeer::doDelete($this, $con);
|
||||||
$this->setDeleted(true);
|
$this->setDeleted(true);
|
||||||
$con->commit();
|
$con->commit();
|
||||||
} catch (PropelException $e) {
|
} catch (PropelException $e) {
|
||||||
@@ -281,7 +240,7 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(MessagePeer::DATABASE_NAME);
|
$con = Propel::getConnection(MessageTypePeer::DATABASE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -316,14 +275,14 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
// If this object has been modified, then save it to the database.
|
// If this object has been modified, then save it to the database.
|
||||||
if ($this->isModified()) {
|
if ($this->isModified()) {
|
||||||
if ($this->isNew()) {
|
if ($this->isNew()) {
|
||||||
$pk = MessagePeer::doInsert($this, $con);
|
$pk = MessageTypePeer::doInsert($this, $con);
|
||||||
$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
|
$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
|
||||||
// should always be true here (even though technically
|
// should always be true here (even though technically
|
||||||
// BasePeer::doInsert() can insert multiple rows).
|
// BasePeer::doInsert() can insert multiple rows).
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
} else {
|
} else {
|
||||||
$affectedRows += MessagePeer::doUpdate($this, $con);
|
$affectedRows += MessageTypePeer::doUpdate($this, $con);
|
||||||
}
|
}
|
||||||
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
|
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
|
||||||
}
|
}
|
||||||
@@ -394,7 +353,7 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
$failureMap = array();
|
$failureMap = array();
|
||||||
|
|
||||||
|
|
||||||
if (($retval = MessagePeer::doValidate($this, $columns)) !== true) {
|
if (($retval = MessageTypePeer::doValidate($this, $columns)) !== true) {
|
||||||
$failureMap = array_merge($failureMap, $retval);
|
$failureMap = array_merge($failureMap, $retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,7 +376,7 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
|
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
|
||||||
{
|
{
|
||||||
$pos = MessagePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
$pos = MessageTypePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
||||||
return $this->getByPosition($pos);
|
return $this->getByPosition($pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,16 +391,13 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
{
|
{
|
||||||
switch($pos) {
|
switch($pos) {
|
||||||
case 0:
|
case 0:
|
||||||
return $this->getMesUid();
|
return $this->getMsgtUid();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
return $this->getPrjUid();
|
return $this->getPrjUid();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
return $this->getMesName();
|
return $this->getMsgtName();
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
return $this->getMesCondition();
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@@ -461,12 +417,11 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
||||||
{
|
{
|
||||||
$keys = MessagePeer::getFieldNames($keyType);
|
$keys = MessageTypePeer::getFieldNames($keyType);
|
||||||
$result = array(
|
$result = array(
|
||||||
$keys[0] => $this->getMesUid(),
|
$keys[0] => $this->getMsgtUid(),
|
||||||
$keys[1] => $this->getPrjUid(),
|
$keys[1] => $this->getPrjUid(),
|
||||||
$keys[2] => $this->getMesName(),
|
$keys[2] => $this->getMsgtName(),
|
||||||
$keys[3] => $this->getMesCondition(),
|
|
||||||
);
|
);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@@ -483,7 +438,7 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
|
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
|
||||||
{
|
{
|
||||||
$pos = MessagePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
$pos = MessageTypePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
||||||
return $this->setByPosition($pos, $value);
|
return $this->setByPosition($pos, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -499,16 +454,13 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
{
|
{
|
||||||
switch($pos) {
|
switch($pos) {
|
||||||
case 0:
|
case 0:
|
||||||
$this->setMesUid($value);
|
$this->setMsgtUid($value);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$this->setPrjUid($value);
|
$this->setPrjUid($value);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$this->setMesName($value);
|
$this->setMsgtName($value);
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
$this->setMesCondition($value);
|
|
||||||
break;
|
break;
|
||||||
} // switch()
|
} // switch()
|
||||||
}
|
}
|
||||||
@@ -531,10 +483,10 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
|
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
|
||||||
{
|
{
|
||||||
$keys = MessagePeer::getFieldNames($keyType);
|
$keys = MessageTypePeer::getFieldNames($keyType);
|
||||||
|
|
||||||
if (array_key_exists($keys[0], $arr)) {
|
if (array_key_exists($keys[0], $arr)) {
|
||||||
$this->setMesUid($arr[$keys[0]]);
|
$this->setMsgtUid($arr[$keys[0]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($keys[1], $arr)) {
|
if (array_key_exists($keys[1], $arr)) {
|
||||||
@@ -542,11 +494,7 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($keys[2], $arr)) {
|
if (array_key_exists($keys[2], $arr)) {
|
||||||
$this->setMesName($arr[$keys[2]]);
|
$this->setMsgtName($arr[$keys[2]]);
|
||||||
}
|
|
||||||
|
|
||||||
if (array_key_exists($keys[3], $arr)) {
|
|
||||||
$this->setMesCondition($arr[$keys[3]]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -558,22 +506,18 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function buildCriteria()
|
public function buildCriteria()
|
||||||
{
|
{
|
||||||
$criteria = new Criteria(MessagePeer::DATABASE_NAME);
|
$criteria = new Criteria(MessageTypePeer::DATABASE_NAME);
|
||||||
|
|
||||||
if ($this->isColumnModified(MessagePeer::MES_UID)) {
|
if ($this->isColumnModified(MessageTypePeer::MSGT_UID)) {
|
||||||
$criteria->add(MessagePeer::MES_UID, $this->mes_uid);
|
$criteria->add(MessageTypePeer::MSGT_UID, $this->msgt_uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isColumnModified(MessagePeer::PRJ_UID)) {
|
if ($this->isColumnModified(MessageTypePeer::PRJ_UID)) {
|
||||||
$criteria->add(MessagePeer::PRJ_UID, $this->prj_uid);
|
$criteria->add(MessageTypePeer::PRJ_UID, $this->prj_uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isColumnModified(MessagePeer::MES_NAME)) {
|
if ($this->isColumnModified(MessageTypePeer::MSGT_NAME)) {
|
||||||
$criteria->add(MessagePeer::MES_NAME, $this->mes_name);
|
$criteria->add(MessageTypePeer::MSGT_NAME, $this->msgt_name);
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->isColumnModified(MessagePeer::MES_CONDITION)) {
|
|
||||||
$criteria->add(MessagePeer::MES_CONDITION, $this->mes_condition);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -590,9 +534,9 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function buildPkeyCriteria()
|
public function buildPkeyCriteria()
|
||||||
{
|
{
|
||||||
$criteria = new Criteria(MessagePeer::DATABASE_NAME);
|
$criteria = new Criteria(MessageTypePeer::DATABASE_NAME);
|
||||||
|
|
||||||
$criteria->add(MessagePeer::MES_UID, $this->mes_uid);
|
$criteria->add(MessageTypePeer::MSGT_UID, $this->msgt_uid);
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
}
|
}
|
||||||
@@ -603,18 +547,18 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function getPrimaryKey()
|
public function getPrimaryKey()
|
||||||
{
|
{
|
||||||
return $this->getMesUid();
|
return $this->getMsgtUid();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic method to set the primary key (mes_uid column).
|
* Generic method to set the primary key (msgt_uid column).
|
||||||
*
|
*
|
||||||
* @param string $key Primary key.
|
* @param string $key Primary key.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setPrimaryKey($key)
|
public function setPrimaryKey($key)
|
||||||
{
|
{
|
||||||
$this->setMesUid($key);
|
$this->setMsgtUid($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -623,7 +567,7 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
* If desired, this method can also make copies of all associated (fkey referrers)
|
* If desired, this method can also make copies of all associated (fkey referrers)
|
||||||
* objects.
|
* objects.
|
||||||
*
|
*
|
||||||
* @param object $copyObj An object of Message (or compatible) type.
|
* @param object $copyObj An object of MessageType (or compatible) type.
|
||||||
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
||||||
* @throws PropelException
|
* @throws PropelException
|
||||||
*/
|
*/
|
||||||
@@ -632,14 +576,12 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
|
|
||||||
$copyObj->setPrjUid($this->prj_uid);
|
$copyObj->setPrjUid($this->prj_uid);
|
||||||
|
|
||||||
$copyObj->setMesName($this->mes_name);
|
$copyObj->setMsgtName($this->msgt_name);
|
||||||
|
|
||||||
$copyObj->setMesCondition($this->mes_condition);
|
|
||||||
|
|
||||||
|
|
||||||
$copyObj->setNew(true);
|
$copyObj->setNew(true);
|
||||||
|
|
||||||
$copyObj->setMesUid(NULL); // this is a pkey column, so set to default value
|
$copyObj->setMsgtUid(NULL); // this is a pkey column, so set to default value
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,7 +594,7 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
* objects.
|
* objects.
|
||||||
*
|
*
|
||||||
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
||||||
* @return Message Clone of current object.
|
* @return MessageType Clone of current object.
|
||||||
* @throws PropelException
|
* @throws PropelException
|
||||||
*/
|
*/
|
||||||
public function copy($deepCopy = false)
|
public function copy($deepCopy = false)
|
||||||
@@ -671,12 +613,12 @@ abstract class BaseMessage extends BaseObject implements Persistent
|
|||||||
* same instance for all member of this class. The method could therefore
|
* same instance for all member of this class. The method could therefore
|
||||||
* be static, but this would prevent one from overriding the behavior.
|
* be static, but this would prevent one from overriding the behavior.
|
||||||
*
|
*
|
||||||
* @return MessagePeer
|
* @return MessageTypePeer
|
||||||
*/
|
*/
|
||||||
public function getPeer()
|
public function getPeer()
|
||||||
{
|
{
|
||||||
if (self::$peer === null) {
|
if (self::$peer === null) {
|
||||||
self::$peer = new MessagePeer();
|
self::$peer = new MessageTypePeer();
|
||||||
}
|
}
|
||||||
return self::$peer;
|
return self::$peer;
|
||||||
}
|
}
|
||||||
@@ -2,46 +2,43 @@
|
|||||||
|
|
||||||
require_once 'propel/util/BasePeer.php';
|
require_once 'propel/util/BasePeer.php';
|
||||||
// The object class -- needed for instanceof checks in this class.
|
// The object class -- needed for instanceof checks in this class.
|
||||||
// actual class may be a subclass -- as returned by MessagePeer::getOMClass()
|
// actual class may be a subclass -- as returned by MessageTypePeer::getOMClass()
|
||||||
include_once 'classes/model/Message.php';
|
include_once 'classes/model/MessageType.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base static class for performing query and update operations on the 'MESSAGE' table.
|
* Base static class for performing query and update operations on the 'MESSAGE_TYPE' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @package workflow.classes.model.om
|
* @package workflow.classes.model.om
|
||||||
*/
|
*/
|
||||||
abstract class BaseMessagePeer
|
abstract class BaseMessageTypePeer
|
||||||
{
|
{
|
||||||
|
|
||||||
/** the default database name for this class */
|
/** the default database name for this class */
|
||||||
const DATABASE_NAME = 'workflow';
|
const DATABASE_NAME = 'workflow';
|
||||||
|
|
||||||
/** the table name for this class */
|
/** the table name for this class */
|
||||||
const TABLE_NAME = 'MESSAGE';
|
const TABLE_NAME = 'MESSAGE_TYPE';
|
||||||
|
|
||||||
/** A class that can be returned by this peer. */
|
/** A class that can be returned by this peer. */
|
||||||
const CLASS_DEFAULT = 'classes.model.Message';
|
const CLASS_DEFAULT = 'classes.model.MessageType';
|
||||||
|
|
||||||
/** The total number of columns. */
|
/** The total number of columns. */
|
||||||
const NUM_COLUMNS = 4;
|
const NUM_COLUMNS = 3;
|
||||||
|
|
||||||
/** The number of lazy-loaded columns. */
|
/** The number of lazy-loaded columns. */
|
||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
|
||||||
|
|
||||||
/** the column name for the MES_UID field */
|
/** the column name for the MSGT_UID field */
|
||||||
const MES_UID = 'MESSAGE.MES_UID';
|
const MSGT_UID = 'MESSAGE_TYPE.MSGT_UID';
|
||||||
|
|
||||||
/** the column name for the PRJ_UID field */
|
/** the column name for the PRJ_UID field */
|
||||||
const PRJ_UID = 'MESSAGE.PRJ_UID';
|
const PRJ_UID = 'MESSAGE_TYPE.PRJ_UID';
|
||||||
|
|
||||||
/** the column name for the MES_NAME field */
|
/** the column name for the MSGT_NAME field */
|
||||||
const MES_NAME = 'MESSAGE.MES_NAME';
|
const MSGT_NAME = 'MESSAGE_TYPE.MSGT_NAME';
|
||||||
|
|
||||||
/** the column name for the MES_CONDITION field */
|
|
||||||
const MES_CONDITION = 'MESSAGE.MES_CONDITION';
|
|
||||||
|
|
||||||
/** The PHP to DB Name Mapping */
|
/** The PHP to DB Name Mapping */
|
||||||
private static $phpNameMap = null;
|
private static $phpNameMap = null;
|
||||||
@@ -54,10 +51,10 @@ abstract class BaseMessagePeer
|
|||||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
private static $fieldNames = array (
|
private static $fieldNames = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('MesUid', 'PrjUid', 'MesName', 'MesCondition', ),
|
BasePeer::TYPE_PHPNAME => array ('MsgtUid', 'PrjUid', 'MsgtName', ),
|
||||||
BasePeer::TYPE_COLNAME => array (MessagePeer::MES_UID, MessagePeer::PRJ_UID, MessagePeer::MES_NAME, MessagePeer::MES_CONDITION, ),
|
BasePeer::TYPE_COLNAME => array (MessageTypePeer::MSGT_UID, MessageTypePeer::PRJ_UID, MessageTypePeer::MSGT_NAME, ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('MES_UID', 'PRJ_UID', 'MES_NAME', 'MES_CONDITION', ),
|
BasePeer::TYPE_FIELDNAME => array ('MSGT_UID', 'PRJ_UID', 'MSGT_NAME', ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,10 +64,10 @@ abstract class BaseMessagePeer
|
|||||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
private static $fieldKeys = array (
|
private static $fieldKeys = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('MesUid' => 0, 'PrjUid' => 1, 'MesName' => 2, 'MesCondition' => 3, ),
|
BasePeer::TYPE_PHPNAME => array ('MsgtUid' => 0, 'PrjUid' => 1, 'MsgtName' => 2, ),
|
||||||
BasePeer::TYPE_COLNAME => array (MessagePeer::MES_UID => 0, MessagePeer::PRJ_UID => 1, MessagePeer::MES_NAME => 2, MessagePeer::MES_CONDITION => 3, ),
|
BasePeer::TYPE_COLNAME => array (MessageTypePeer::MSGT_UID => 0, MessageTypePeer::PRJ_UID => 1, MessageTypePeer::MSGT_NAME => 2, ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('MES_UID' => 0, 'PRJ_UID' => 1, 'MES_NAME' => 2, 'MES_CONDITION' => 3, ),
|
BasePeer::TYPE_FIELDNAME => array ('MSGT_UID' => 0, 'PRJ_UID' => 1, 'MSGT_NAME' => 2, ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, )
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,8 +77,8 @@ abstract class BaseMessagePeer
|
|||||||
*/
|
*/
|
||||||
public static function getMapBuilder()
|
public static function getMapBuilder()
|
||||||
{
|
{
|
||||||
include_once 'classes/model/map/MessageMapBuilder.php';
|
include_once 'classes/model/map/MessageTypeMapBuilder.php';
|
||||||
return BasePeer::getMapBuilder('classes.model.map.MessageMapBuilder');
|
return BasePeer::getMapBuilder('classes.model.map.MessageTypeMapBuilder');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Gets a map (hash) of PHP names to DB column names.
|
* Gets a map (hash) of PHP names to DB column names.
|
||||||
@@ -94,7 +91,7 @@ abstract class BaseMessagePeer
|
|||||||
public static function getPhpNameMap()
|
public static function getPhpNameMap()
|
||||||
{
|
{
|
||||||
if (self::$phpNameMap === null) {
|
if (self::$phpNameMap === null) {
|
||||||
$map = MessagePeer::getTableMap();
|
$map = MessageTypePeer::getTableMap();
|
||||||
$columns = $map->getColumns();
|
$columns = $map->getColumns();
|
||||||
$nameMap = array();
|
$nameMap = array();
|
||||||
foreach ($columns as $column) {
|
foreach ($columns as $column) {
|
||||||
@@ -149,12 +146,12 @@ abstract class BaseMessagePeer
|
|||||||
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
|
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
|
||||||
* </code>
|
* </code>
|
||||||
* @param string $alias The alias for the current table.
|
* @param string $alias The alias for the current table.
|
||||||
* @param string $column The column name for current table. (i.e. MessagePeer::COLUMN_NAME).
|
* @param string $column The column name for current table. (i.e. MessageTypePeer::COLUMN_NAME).
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function alias($alias, $column)
|
public static function alias($alias, $column)
|
||||||
{
|
{
|
||||||
return str_replace(MessagePeer::TABLE_NAME.'.', $alias.'.', $column);
|
return str_replace(MessageTypePeer::TABLE_NAME.'.', $alias.'.', $column);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -171,18 +168,16 @@ abstract class BaseMessagePeer
|
|||||||
public static function addSelectColumns(Criteria $criteria)
|
public static function addSelectColumns(Criteria $criteria)
|
||||||
{
|
{
|
||||||
|
|
||||||
$criteria->addSelectColumn(MessagePeer::MES_UID);
|
$criteria->addSelectColumn(MessageTypePeer::MSGT_UID);
|
||||||
|
|
||||||
$criteria->addSelectColumn(MessagePeer::PRJ_UID);
|
$criteria->addSelectColumn(MessageTypePeer::PRJ_UID);
|
||||||
|
|
||||||
$criteria->addSelectColumn(MessagePeer::MES_NAME);
|
$criteria->addSelectColumn(MessageTypePeer::MSGT_NAME);
|
||||||
|
|
||||||
$criteria->addSelectColumn(MessagePeer::MES_CONDITION);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const COUNT = 'COUNT(MESSAGE.MES_UID)';
|
const COUNT = 'COUNT(MESSAGE_TYPE.MSGT_UID)';
|
||||||
const COUNT_DISTINCT = 'COUNT(DISTINCT MESSAGE.MES_UID)';
|
const COUNT_DISTINCT = 'COUNT(DISTINCT MESSAGE_TYPE.MSGT_UID)';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of rows matching criteria.
|
* Returns the number of rows matching criteria.
|
||||||
@@ -200,9 +195,9 @@ abstract class BaseMessagePeer
|
|||||||
// clear out anything that might confuse the ORDER BY clause
|
// clear out anything that might confuse the ORDER BY clause
|
||||||
$criteria->clearSelectColumns()->clearOrderByColumns();
|
$criteria->clearSelectColumns()->clearOrderByColumns();
|
||||||
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||||
$criteria->addSelectColumn(MessagePeer::COUNT_DISTINCT);
|
$criteria->addSelectColumn(MessageTypePeer::COUNT_DISTINCT);
|
||||||
} else {
|
} else {
|
||||||
$criteria->addSelectColumn(MessagePeer::COUNT);
|
$criteria->addSelectColumn(MessageTypePeer::COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// just in case we're grouping: add those columns to the select statement
|
// just in case we're grouping: add those columns to the select statement
|
||||||
@@ -210,7 +205,7 @@ abstract class BaseMessagePeer
|
|||||||
$criteria->addSelectColumn($column);
|
$criteria->addSelectColumn($column);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rs = MessagePeer::doSelectRS($criteria, $con);
|
$rs = MessageTypePeer::doSelectRS($criteria, $con);
|
||||||
if ($rs->next()) {
|
if ($rs->next()) {
|
||||||
return $rs->getInt(1);
|
return $rs->getInt(1);
|
||||||
} else {
|
} else {
|
||||||
@@ -223,7 +218,7 @@ abstract class BaseMessagePeer
|
|||||||
*
|
*
|
||||||
* @param Criteria $criteria object used to create the SELECT statement.
|
* @param Criteria $criteria object used to create the SELECT statement.
|
||||||
* @param Connection $con
|
* @param Connection $con
|
||||||
* @return Message
|
* @return MessageType
|
||||||
* @throws PropelException Any exceptions caught during processing will be
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
* rethrown wrapped into a PropelException.
|
* rethrown wrapped into a PropelException.
|
||||||
*/
|
*/
|
||||||
@@ -231,7 +226,7 @@ abstract class BaseMessagePeer
|
|||||||
{
|
{
|
||||||
$critcopy = clone $criteria;
|
$critcopy = clone $criteria;
|
||||||
$critcopy->setLimit(1);
|
$critcopy->setLimit(1);
|
||||||
$objects = MessagePeer::doSelect($critcopy, $con);
|
$objects = MessageTypePeer::doSelect($critcopy, $con);
|
||||||
if ($objects) {
|
if ($objects) {
|
||||||
return $objects[0];
|
return $objects[0];
|
||||||
}
|
}
|
||||||
@@ -248,7 +243,7 @@ abstract class BaseMessagePeer
|
|||||||
*/
|
*/
|
||||||
public static function doSelect(Criteria $criteria, $con = null)
|
public static function doSelect(Criteria $criteria, $con = null)
|
||||||
{
|
{
|
||||||
return MessagePeer::populateObjects(MessagePeer::doSelectRS($criteria, $con));
|
return MessageTypePeer::populateObjects(MessageTypePeer::doSelectRS($criteria, $con));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Prepares the Criteria object and uses the parent doSelect()
|
* Prepares the Criteria object and uses the parent doSelect()
|
||||||
@@ -272,7 +267,7 @@ abstract class BaseMessagePeer
|
|||||||
|
|
||||||
if (!$criteria->getSelectColumns()) {
|
if (!$criteria->getSelectColumns()) {
|
||||||
$criteria = clone $criteria;
|
$criteria = clone $criteria;
|
||||||
MessagePeer::addSelectColumns($criteria);
|
MessageTypePeer::addSelectColumns($criteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the correct dbName
|
// Set the correct dbName
|
||||||
@@ -294,7 +289,7 @@ abstract class BaseMessagePeer
|
|||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
// set the class once to avoid overhead in the loop
|
// set the class once to avoid overhead in the loop
|
||||||
$cls = MessagePeer::getOMClass();
|
$cls = MessageTypePeer::getOMClass();
|
||||||
$cls = Propel::import($cls);
|
$cls = Propel::import($cls);
|
||||||
// populate the object(s)
|
// populate the object(s)
|
||||||
while ($rs->next()) {
|
while ($rs->next()) {
|
||||||
@@ -329,13 +324,13 @@ abstract class BaseMessagePeer
|
|||||||
*/
|
*/
|
||||||
public static function getOMClass()
|
public static function getOMClass()
|
||||||
{
|
{
|
||||||
return MessagePeer::CLASS_DEFAULT;
|
return MessageTypePeer::CLASS_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method perform an INSERT on the database, given a Message or Criteria object.
|
* Method perform an INSERT on the database, given a MessageType or Criteria object.
|
||||||
*
|
*
|
||||||
* @param mixed $values Criteria or Message object containing data that is used to create the INSERT statement.
|
* @param mixed $values Criteria or MessageType object containing data that is used to create the INSERT statement.
|
||||||
* @param Connection $con the connection to use
|
* @param Connection $con the connection to use
|
||||||
* @return mixed The new primary key.
|
* @return mixed The new primary key.
|
||||||
* @throws PropelException Any exceptions caught during processing will be
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
@@ -350,7 +345,7 @@ abstract class BaseMessagePeer
|
|||||||
if ($values instanceof Criteria) {
|
if ($values instanceof Criteria) {
|
||||||
$criteria = clone $values; // rename for clarity
|
$criteria = clone $values; // rename for clarity
|
||||||
} else {
|
} else {
|
||||||
$criteria = $values->buildCriteria(); // build Criteria from Message object
|
$criteria = $values->buildCriteria(); // build Criteria from MessageType object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -372,9 +367,9 @@ abstract class BaseMessagePeer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method perform an UPDATE on the database, given a Message or Criteria object.
|
* Method perform an UPDATE on the database, given a MessageType or Criteria object.
|
||||||
*
|
*
|
||||||
* @param mixed $values Criteria or Message object containing data create the UPDATE statement.
|
* @param mixed $values Criteria or MessageType object containing data create the UPDATE statement.
|
||||||
* @param Connection $con The connection to use (specify Connection exert more control over transactions).
|
* @param Connection $con The connection to use (specify Connection exert more control over transactions).
|
||||||
* @return int The number of affected rows (if supported by underlying database driver).
|
* @return int The number of affected rows (if supported by underlying database driver).
|
||||||
* @throws PropelException Any exceptions caught during processing will be
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
@@ -391,8 +386,8 @@ abstract class BaseMessagePeer
|
|||||||
if ($values instanceof Criteria) {
|
if ($values instanceof Criteria) {
|
||||||
$criteria = clone $values; // rename for clarity
|
$criteria = clone $values; // rename for clarity
|
||||||
|
|
||||||
$comparison = $criteria->getComparison(MessagePeer::MES_UID);
|
$comparison = $criteria->getComparison(MessageTypePeer::MSGT_UID);
|
||||||
$selectCriteria->add(MessagePeer::MES_UID, $criteria->remove(MessagePeer::MES_UID), $comparison);
|
$selectCriteria->add(MessageTypePeer::MSGT_UID, $criteria->remove(MessageTypePeer::MSGT_UID), $comparison);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$criteria = $values->buildCriteria(); // gets full criteria
|
$criteria = $values->buildCriteria(); // gets full criteria
|
||||||
@@ -406,7 +401,7 @@ abstract class BaseMessagePeer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to DELETE all rows from the MESSAGE table.
|
* Method to DELETE all rows from the MESSAGE_TYPE table.
|
||||||
*
|
*
|
||||||
* @return int The number of affected rows (if supported by underlying database driver).
|
* @return int The number of affected rows (if supported by underlying database driver).
|
||||||
*/
|
*/
|
||||||
@@ -420,7 +415,7 @@ abstract class BaseMessagePeer
|
|||||||
// use transaction because $criteria could contain info
|
// use transaction because $criteria could contain info
|
||||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||||
$con->begin();
|
$con->begin();
|
||||||
$affectedRows += BasePeer::doDeleteAll(MessagePeer::TABLE_NAME, $con);
|
$affectedRows += BasePeer::doDeleteAll(MessageTypePeer::TABLE_NAME, $con);
|
||||||
$con->commit();
|
$con->commit();
|
||||||
return $affectedRows;
|
return $affectedRows;
|
||||||
} catch (PropelException $e) {
|
} catch (PropelException $e) {
|
||||||
@@ -430,9 +425,9 @@ abstract class BaseMessagePeer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method perform a DELETE on the database, given a Message or Criteria object OR a primary key value.
|
* Method perform a DELETE on the database, given a MessageType or Criteria object OR a primary key value.
|
||||||
*
|
*
|
||||||
* @param mixed $values Criteria or Message object or primary key or array of primary keys
|
* @param mixed $values Criteria or MessageType object or primary key or array of primary keys
|
||||||
* which is used to create the DELETE statement
|
* which is used to create the DELETE statement
|
||||||
* @param Connection $con the connection to use
|
* @param Connection $con the connection to use
|
||||||
* @return int The number of affected rows (if supported by underlying database driver).
|
* @return int The number of affected rows (if supported by underlying database driver).
|
||||||
@@ -444,18 +439,18 @@ abstract class BaseMessagePeer
|
|||||||
public static function doDelete($values, $con = null)
|
public static function doDelete($values, $con = null)
|
||||||
{
|
{
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(MessagePeer::DATABASE_NAME);
|
$con = Propel::getConnection(MessageTypePeer::DATABASE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($values instanceof Criteria) {
|
if ($values instanceof Criteria) {
|
||||||
$criteria = clone $values; // rename for clarity
|
$criteria = clone $values; // rename for clarity
|
||||||
} elseif ($values instanceof Message) {
|
} elseif ($values instanceof MessageType) {
|
||||||
|
|
||||||
$criteria = $values->buildPkeyCriteria();
|
$criteria = $values->buildPkeyCriteria();
|
||||||
} else {
|
} else {
|
||||||
// it must be the primary key
|
// it must be the primary key
|
||||||
$criteria = new Criteria(self::DATABASE_NAME);
|
$criteria = new Criteria(self::DATABASE_NAME);
|
||||||
$criteria->add(MessagePeer::MES_UID, (array) $values, Criteria::IN);
|
$criteria->add(MessageTypePeer::MSGT_UID, (array) $values, Criteria::IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the correct dbName
|
// Set the correct dbName
|
||||||
@@ -478,24 +473,24 @@ abstract class BaseMessagePeer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates all modified columns of given Message object.
|
* Validates all modified columns of given MessageType object.
|
||||||
* If parameter $columns is either a single column name or an array of column names
|
* If parameter $columns is either a single column name or an array of column names
|
||||||
* than only those columns are validated.
|
* than only those columns are validated.
|
||||||
*
|
*
|
||||||
* NOTICE: This does not apply to primary or foreign keys for now.
|
* NOTICE: This does not apply to primary or foreign keys for now.
|
||||||
*
|
*
|
||||||
* @param Message $obj The object to validate.
|
* @param MessageType $obj The object to validate.
|
||||||
* @param mixed $cols Column name or array of column names.
|
* @param mixed $cols Column name or array of column names.
|
||||||
*
|
*
|
||||||
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
|
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
|
||||||
*/
|
*/
|
||||||
public static function doValidate(Message $obj, $cols = null)
|
public static function doValidate(MessageType $obj, $cols = null)
|
||||||
{
|
{
|
||||||
$columns = array();
|
$columns = array();
|
||||||
|
|
||||||
if ($cols) {
|
if ($cols) {
|
||||||
$dbMap = Propel::getDatabaseMap(MessagePeer::DATABASE_NAME);
|
$dbMap = Propel::getDatabaseMap(MessageTypePeer::DATABASE_NAME);
|
||||||
$tableMap = $dbMap->getTable(MessagePeer::TABLE_NAME);
|
$tableMap = $dbMap->getTable(MessageTypePeer::TABLE_NAME);
|
||||||
|
|
||||||
if (! is_array($cols)) {
|
if (! is_array($cols)) {
|
||||||
$cols = array($cols);
|
$cols = array($cols);
|
||||||
@@ -511,7 +506,7 @@ abstract class BaseMessagePeer
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return BasePeer::doValidate(MessagePeer::DATABASE_NAME, MessagePeer::TABLE_NAME, $columns);
|
return BasePeer::doValidate(MessageTypePeer::DATABASE_NAME, MessageTypePeer::TABLE_NAME, $columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -519,7 +514,7 @@ abstract class BaseMessagePeer
|
|||||||
*
|
*
|
||||||
* @param mixed $pk the primary key.
|
* @param mixed $pk the primary key.
|
||||||
* @param Connection $con the connection to use
|
* @param Connection $con the connection to use
|
||||||
* @return Message
|
* @return MessageType
|
||||||
*/
|
*/
|
||||||
public static function retrieveByPK($pk, $con = null)
|
public static function retrieveByPK($pk, $con = null)
|
||||||
{
|
{
|
||||||
@@ -527,12 +522,12 @@ abstract class BaseMessagePeer
|
|||||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
$criteria = new Criteria(MessagePeer::DATABASE_NAME);
|
$criteria = new Criteria(MessageTypePeer::DATABASE_NAME);
|
||||||
|
|
||||||
$criteria->add(MessagePeer::MES_UID, $pk);
|
$criteria->add(MessageTypePeer::MSGT_UID, $pk);
|
||||||
|
|
||||||
|
|
||||||
$v = MessagePeer::doSelect($criteria, $con);
|
$v = MessageTypePeer::doSelect($criteria, $con);
|
||||||
|
|
||||||
return !empty($v) > 0 ? $v[0] : null;
|
return !empty($v) > 0 ? $v[0] : null;
|
||||||
}
|
}
|
||||||
@@ -556,8 +551,8 @@ abstract class BaseMessagePeer
|
|||||||
$objs = array();
|
$objs = array();
|
||||||
} else {
|
} else {
|
||||||
$criteria = new Criteria();
|
$criteria = new Criteria();
|
||||||
$criteria->add(MessagePeer::MES_UID, $pks, Criteria::IN);
|
$criteria->add(MessageTypePeer::MSGT_UID, $pks, Criteria::IN);
|
||||||
$objs = MessagePeer::doSelect($criteria, $con);
|
$objs = MessageTypePeer::doSelect($criteria, $con);
|
||||||
}
|
}
|
||||||
return $objs;
|
return $objs;
|
||||||
}
|
}
|
||||||
@@ -569,14 +564,14 @@ if (Propel::isInit()) {
|
|||||||
// the MapBuilder classes register themselves with Propel during initialization
|
// the MapBuilder classes register themselves with Propel during initialization
|
||||||
// so we need to load them here.
|
// so we need to load them here.
|
||||||
try {
|
try {
|
||||||
BaseMessagePeer::getMapBuilder();
|
BaseMessageTypePeer::getMapBuilder();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
|
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// even if Propel is not yet initialized, the map builder class can be registered
|
// even if Propel is not yet initialized, the map builder class can be registered
|
||||||
// now and then it will be loaded when Propel initializes.
|
// now and then it will be loaded when Propel initializes.
|
||||||
require_once 'classes/model/map/MessageMapBuilder.php';
|
require_once 'classes/model/map/MessageTypeMapBuilder.php';
|
||||||
Propel::registerMapBuilder('classes.model.map.MessageMapBuilder');
|
Propel::registerMapBuilder('classes.model.map.MessageTypeMapBuilder');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7,49 +7,49 @@ require_once 'propel/om/Persistent.php';
|
|||||||
|
|
||||||
include_once 'propel/util/Criteria.php';
|
include_once 'propel/util/Criteria.php';
|
||||||
|
|
||||||
include_once 'classes/model/MessageDetailPeer.php';
|
include_once 'classes/model/MessageTypeVariablePeer.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class that represents a row from the 'MESSAGE_DETAIL' table.
|
* Base class that represents a row from the 'MESSAGE_TYPE_VARIABLE' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @package workflow.classes.model.om
|
* @package workflow.classes.model.om
|
||||||
*/
|
*/
|
||||||
abstract class BaseMessageDetail extends BaseObject implements Persistent
|
abstract class BaseMessageTypeVariable extends BaseObject implements Persistent
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Peer class.
|
* The Peer class.
|
||||||
* Instance provides a convenient way of calling static methods on a class
|
* Instance provides a convenient way of calling static methods on a class
|
||||||
* that calling code may not be able to identify.
|
* that calling code may not be able to identify.
|
||||||
* @var MessageDetailPeer
|
* @var MessageTypeVariablePeer
|
||||||
*/
|
*/
|
||||||
protected static $peer;
|
protected static $peer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the md_uid field.
|
* The value for the msgtv_uid field.
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $md_uid;
|
protected $msgtv_uid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the mes_uid field.
|
* The value for the msgt_uid field.
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $mes_uid;
|
protected $msgt_uid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the md_type field.
|
* The value for the msgtv_name field.
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $md_type = '';
|
protected $msgtv_name = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The value for the md_name field.
|
* The value for the msgtv_default_value field.
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $md_name = '';
|
protected $msgtv_default_value = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag to prevent endless save loop, if this object is referenced
|
* Flag to prevent endless save loop, if this object is referenced
|
||||||
@@ -66,56 +66,56 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
protected $alreadyInValidation = false;
|
protected $alreadyInValidation = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [md_uid] column value.
|
* Get the [msgtv_uid] column value.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getMdUid()
|
public function getMsgtvUid()
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->md_uid;
|
return $this->msgtv_uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [mes_uid] column value.
|
* Get the [msgt_uid] column value.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getMesUid()
|
public function getMsgtUid()
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->mes_uid;
|
return $this->msgt_uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [md_type] column value.
|
* Get the [msgtv_name] column value.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getMdType()
|
public function getMsgtvName()
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->md_type;
|
return $this->msgtv_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the [md_name] column value.
|
* Get the [msgtv_default_value] column value.
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getMdName()
|
public function getMsgtvDefaultValue()
|
||||||
{
|
{
|
||||||
|
|
||||||
return $this->md_name;
|
return $this->msgtv_default_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [md_uid] column.
|
* Set the value of [msgtv_uid] column.
|
||||||
*
|
*
|
||||||
* @param string $v new value
|
* @param string $v new value
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setMdUid($v)
|
public function setMsgtvUid($v)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Since the native PHP type for this column is string,
|
// Since the native PHP type for this column is string,
|
||||||
@@ -124,20 +124,20 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
$v = (string) $v;
|
$v = (string) $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->md_uid !== $v) {
|
if ($this->msgtv_uid !== $v) {
|
||||||
$this->md_uid = $v;
|
$this->msgtv_uid = $v;
|
||||||
$this->modifiedColumns[] = MessageDetailPeer::MD_UID;
|
$this->modifiedColumns[] = MessageTypeVariablePeer::MSGTV_UID;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // setMdUid()
|
} // setMsgtvUid()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [mes_uid] column.
|
* Set the value of [msgt_uid] column.
|
||||||
*
|
*
|
||||||
* @param string $v new value
|
* @param string $v new value
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setMesUid($v)
|
public function setMsgtUid($v)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Since the native PHP type for this column is string,
|
// Since the native PHP type for this column is string,
|
||||||
@@ -146,20 +146,20 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
$v = (string) $v;
|
$v = (string) $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->mes_uid !== $v) {
|
if ($this->msgt_uid !== $v) {
|
||||||
$this->mes_uid = $v;
|
$this->msgt_uid = $v;
|
||||||
$this->modifiedColumns[] = MessageDetailPeer::MES_UID;
|
$this->modifiedColumns[] = MessageTypeVariablePeer::MSGT_UID;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // setMesUid()
|
} // setMsgtUid()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [md_type] column.
|
* Set the value of [msgtv_name] column.
|
||||||
*
|
*
|
||||||
* @param string $v new value
|
* @param string $v new value
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setMdType($v)
|
public function setMsgtvName($v)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Since the native PHP type for this column is string,
|
// Since the native PHP type for this column is string,
|
||||||
@@ -168,20 +168,20 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
$v = (string) $v;
|
$v = (string) $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->md_type !== $v || $v === '') {
|
if ($this->msgtv_name !== $v || $v === '') {
|
||||||
$this->md_type = $v;
|
$this->msgtv_name = $v;
|
||||||
$this->modifiedColumns[] = MessageDetailPeer::MD_TYPE;
|
$this->modifiedColumns[] = MessageTypeVariablePeer::MSGTV_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // setMdType()
|
} // setMsgtvName()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the value of [md_name] column.
|
* Set the value of [msgtv_default_value] column.
|
||||||
*
|
*
|
||||||
* @param string $v new value
|
* @param string $v new value
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setMdName($v)
|
public function setMsgtvDefaultValue($v)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Since the native PHP type for this column is string,
|
// Since the native PHP type for this column is string,
|
||||||
@@ -190,12 +190,12 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
$v = (string) $v;
|
$v = (string) $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->md_name !== $v || $v === '') {
|
if ($this->msgtv_default_value !== $v || $v === '') {
|
||||||
$this->md_name = $v;
|
$this->msgtv_default_value = $v;
|
||||||
$this->modifiedColumns[] = MessageDetailPeer::MD_NAME;
|
$this->modifiedColumns[] = MessageTypeVariablePeer::MSGTV_DEFAULT_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // setMdName()
|
} // setMsgtvDefaultValue()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hydrates (populates) the object variables with values from the database resultset.
|
* Hydrates (populates) the object variables with values from the database resultset.
|
||||||
@@ -214,23 +214,23 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|
||||||
$this->md_uid = $rs->getString($startcol + 0);
|
$this->msgtv_uid = $rs->getString($startcol + 0);
|
||||||
|
|
||||||
$this->mes_uid = $rs->getString($startcol + 1);
|
$this->msgt_uid = $rs->getString($startcol + 1);
|
||||||
|
|
||||||
$this->md_type = $rs->getString($startcol + 2);
|
$this->msgtv_name = $rs->getString($startcol + 2);
|
||||||
|
|
||||||
$this->md_name = $rs->getString($startcol + 3);
|
$this->msgtv_default_value = $rs->getString($startcol + 3);
|
||||||
|
|
||||||
$this->resetModified();
|
$this->resetModified();
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
|
|
||||||
// FIXME - using NUM_COLUMNS may be clearer.
|
// FIXME - using NUM_COLUMNS may be clearer.
|
||||||
return $startcol + 4; // 4 = MessageDetailPeer::NUM_COLUMNS - MessageDetailPeer::NUM_LAZY_LOAD_COLUMNS).
|
return $startcol + 4; // 4 = MessageTypeVariablePeer::NUM_COLUMNS - MessageTypeVariablePeer::NUM_LAZY_LOAD_COLUMNS).
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw new PropelException("Error populating MessageDetail object", $e);
|
throw new PropelException("Error populating MessageTypeVariable object", $e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -250,12 +250,12 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(MessageDetailPeer::DATABASE_NAME);
|
$con = Propel::getConnection(MessageTypeVariablePeer::DATABASE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$con->begin();
|
$con->begin();
|
||||||
MessageDetailPeer::doDelete($this, $con);
|
MessageTypeVariablePeer::doDelete($this, $con);
|
||||||
$this->setDeleted(true);
|
$this->setDeleted(true);
|
||||||
$con->commit();
|
$con->commit();
|
||||||
} catch (PropelException $e) {
|
} catch (PropelException $e) {
|
||||||
@@ -281,7 +281,7 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(MessageDetailPeer::DATABASE_NAME);
|
$con = Propel::getConnection(MessageTypeVariablePeer::DATABASE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -316,14 +316,14 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
// If this object has been modified, then save it to the database.
|
// If this object has been modified, then save it to the database.
|
||||||
if ($this->isModified()) {
|
if ($this->isModified()) {
|
||||||
if ($this->isNew()) {
|
if ($this->isNew()) {
|
||||||
$pk = MessageDetailPeer::doInsert($this, $con);
|
$pk = MessageTypeVariablePeer::doInsert($this, $con);
|
||||||
$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
|
$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
|
||||||
// should always be true here (even though technically
|
// should always be true here (even though technically
|
||||||
// BasePeer::doInsert() can insert multiple rows).
|
// BasePeer::doInsert() can insert multiple rows).
|
||||||
|
|
||||||
$this->setNew(false);
|
$this->setNew(false);
|
||||||
} else {
|
} else {
|
||||||
$affectedRows += MessageDetailPeer::doUpdate($this, $con);
|
$affectedRows += MessageTypeVariablePeer::doUpdate($this, $con);
|
||||||
}
|
}
|
||||||
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
|
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
|
||||||
}
|
}
|
||||||
@@ -394,7 +394,7 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
$failureMap = array();
|
$failureMap = array();
|
||||||
|
|
||||||
|
|
||||||
if (($retval = MessageDetailPeer::doValidate($this, $columns)) !== true) {
|
if (($retval = MessageTypeVariablePeer::doValidate($this, $columns)) !== true) {
|
||||||
$failureMap = array_merge($failureMap, $retval);
|
$failureMap = array_merge($failureMap, $retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -417,7 +417,7 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
|
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
|
||||||
{
|
{
|
||||||
$pos = MessageDetailPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
$pos = MessageTypeVariablePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
||||||
return $this->getByPosition($pos);
|
return $this->getByPosition($pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,16 +432,16 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
{
|
{
|
||||||
switch($pos) {
|
switch($pos) {
|
||||||
case 0:
|
case 0:
|
||||||
return $this->getMdUid();
|
return $this->getMsgtvUid();
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
return $this->getMesUid();
|
return $this->getMsgtUid();
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
return $this->getMdType();
|
return $this->getMsgtvName();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
return $this->getMdName();
|
return $this->getMsgtvDefaultValue();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
@@ -461,12 +461,12 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
||||||
{
|
{
|
||||||
$keys = MessageDetailPeer::getFieldNames($keyType);
|
$keys = MessageTypeVariablePeer::getFieldNames($keyType);
|
||||||
$result = array(
|
$result = array(
|
||||||
$keys[0] => $this->getMdUid(),
|
$keys[0] => $this->getMsgtvUid(),
|
||||||
$keys[1] => $this->getMesUid(),
|
$keys[1] => $this->getMsgtUid(),
|
||||||
$keys[2] => $this->getMdType(),
|
$keys[2] => $this->getMsgtvName(),
|
||||||
$keys[3] => $this->getMdName(),
|
$keys[3] => $this->getMsgtvDefaultValue(),
|
||||||
);
|
);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@@ -483,7 +483,7 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
|
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
|
||||||
{
|
{
|
||||||
$pos = MessageDetailPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
$pos = MessageTypeVariablePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
|
||||||
return $this->setByPosition($pos, $value);
|
return $this->setByPosition($pos, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -499,16 +499,16 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
{
|
{
|
||||||
switch($pos) {
|
switch($pos) {
|
||||||
case 0:
|
case 0:
|
||||||
$this->setMdUid($value);
|
$this->setMsgtvUid($value);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
$this->setMesUid($value);
|
$this->setMsgtUid($value);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$this->setMdType($value);
|
$this->setMsgtvName($value);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
$this->setMdName($value);
|
$this->setMsgtvDefaultValue($value);
|
||||||
break;
|
break;
|
||||||
} // switch()
|
} // switch()
|
||||||
}
|
}
|
||||||
@@ -531,22 +531,22 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
|
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
|
||||||
{
|
{
|
||||||
$keys = MessageDetailPeer::getFieldNames($keyType);
|
$keys = MessageTypeVariablePeer::getFieldNames($keyType);
|
||||||
|
|
||||||
if (array_key_exists($keys[0], $arr)) {
|
if (array_key_exists($keys[0], $arr)) {
|
||||||
$this->setMdUid($arr[$keys[0]]);
|
$this->setMsgtvUid($arr[$keys[0]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($keys[1], $arr)) {
|
if (array_key_exists($keys[1], $arr)) {
|
||||||
$this->setMesUid($arr[$keys[1]]);
|
$this->setMsgtUid($arr[$keys[1]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($keys[2], $arr)) {
|
if (array_key_exists($keys[2], $arr)) {
|
||||||
$this->setMdType($arr[$keys[2]]);
|
$this->setMsgtvName($arr[$keys[2]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (array_key_exists($keys[3], $arr)) {
|
if (array_key_exists($keys[3], $arr)) {
|
||||||
$this->setMdName($arr[$keys[3]]);
|
$this->setMsgtvDefaultValue($arr[$keys[3]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -558,22 +558,22 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function buildCriteria()
|
public function buildCriteria()
|
||||||
{
|
{
|
||||||
$criteria = new Criteria(MessageDetailPeer::DATABASE_NAME);
|
$criteria = new Criteria(MessageTypeVariablePeer::DATABASE_NAME);
|
||||||
|
|
||||||
if ($this->isColumnModified(MessageDetailPeer::MD_UID)) {
|
if ($this->isColumnModified(MessageTypeVariablePeer::MSGTV_UID)) {
|
||||||
$criteria->add(MessageDetailPeer::MD_UID, $this->md_uid);
|
$criteria->add(MessageTypeVariablePeer::MSGTV_UID, $this->msgtv_uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isColumnModified(MessageDetailPeer::MES_UID)) {
|
if ($this->isColumnModified(MessageTypeVariablePeer::MSGT_UID)) {
|
||||||
$criteria->add(MessageDetailPeer::MES_UID, $this->mes_uid);
|
$criteria->add(MessageTypeVariablePeer::MSGT_UID, $this->msgt_uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isColumnModified(MessageDetailPeer::MD_TYPE)) {
|
if ($this->isColumnModified(MessageTypeVariablePeer::MSGTV_NAME)) {
|
||||||
$criteria->add(MessageDetailPeer::MD_TYPE, $this->md_type);
|
$criteria->add(MessageTypeVariablePeer::MSGTV_NAME, $this->msgtv_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->isColumnModified(MessageDetailPeer::MD_NAME)) {
|
if ($this->isColumnModified(MessageTypeVariablePeer::MSGTV_DEFAULT_VALUE)) {
|
||||||
$criteria->add(MessageDetailPeer::MD_NAME, $this->md_name);
|
$criteria->add(MessageTypeVariablePeer::MSGTV_DEFAULT_VALUE, $this->msgtv_default_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -590,9 +590,9 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function buildPkeyCriteria()
|
public function buildPkeyCriteria()
|
||||||
{
|
{
|
||||||
$criteria = new Criteria(MessageDetailPeer::DATABASE_NAME);
|
$criteria = new Criteria(MessageTypeVariablePeer::DATABASE_NAME);
|
||||||
|
|
||||||
$criteria->add(MessageDetailPeer::MD_UID, $this->md_uid);
|
$criteria->add(MessageTypeVariablePeer::MSGTV_UID, $this->msgtv_uid);
|
||||||
|
|
||||||
return $criteria;
|
return $criteria;
|
||||||
}
|
}
|
||||||
@@ -603,18 +603,18 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
*/
|
*/
|
||||||
public function getPrimaryKey()
|
public function getPrimaryKey()
|
||||||
{
|
{
|
||||||
return $this->getMdUid();
|
return $this->getMsgtvUid();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic method to set the primary key (md_uid column).
|
* Generic method to set the primary key (msgtv_uid column).
|
||||||
*
|
*
|
||||||
* @param string $key Primary key.
|
* @param string $key Primary key.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setPrimaryKey($key)
|
public function setPrimaryKey($key)
|
||||||
{
|
{
|
||||||
$this->setMdUid($key);
|
$this->setMsgtvUid($key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -623,23 +623,23 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
* If desired, this method can also make copies of all associated (fkey referrers)
|
* If desired, this method can also make copies of all associated (fkey referrers)
|
||||||
* objects.
|
* objects.
|
||||||
*
|
*
|
||||||
* @param object $copyObj An object of MessageDetail (or compatible) type.
|
* @param object $copyObj An object of MessageTypeVariable (or compatible) type.
|
||||||
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
||||||
* @throws PropelException
|
* @throws PropelException
|
||||||
*/
|
*/
|
||||||
public function copyInto($copyObj, $deepCopy = false)
|
public function copyInto($copyObj, $deepCopy = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
$copyObj->setMesUid($this->mes_uid);
|
$copyObj->setMsgtUid($this->msgt_uid);
|
||||||
|
|
||||||
$copyObj->setMdType($this->md_type);
|
$copyObj->setMsgtvName($this->msgtv_name);
|
||||||
|
|
||||||
$copyObj->setMdName($this->md_name);
|
$copyObj->setMsgtvDefaultValue($this->msgtv_default_value);
|
||||||
|
|
||||||
|
|
||||||
$copyObj->setNew(true);
|
$copyObj->setNew(true);
|
||||||
|
|
||||||
$copyObj->setMdUid(NULL); // this is a pkey column, so set to default value
|
$copyObj->setMsgtvUid(NULL); // this is a pkey column, so set to default value
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,7 +652,7 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
* objects.
|
* objects.
|
||||||
*
|
*
|
||||||
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
|
||||||
* @return MessageDetail Clone of current object.
|
* @return MessageTypeVariable Clone of current object.
|
||||||
* @throws PropelException
|
* @throws PropelException
|
||||||
*/
|
*/
|
||||||
public function copy($deepCopy = false)
|
public function copy($deepCopy = false)
|
||||||
@@ -671,12 +671,12 @@ abstract class BaseMessageDetail extends BaseObject implements Persistent
|
|||||||
* same instance for all member of this class. The method could therefore
|
* same instance for all member of this class. The method could therefore
|
||||||
* be static, but this would prevent one from overriding the behavior.
|
* be static, but this would prevent one from overriding the behavior.
|
||||||
*
|
*
|
||||||
* @return MessageDetailPeer
|
* @return MessageTypeVariablePeer
|
||||||
*/
|
*/
|
||||||
public function getPeer()
|
public function getPeer()
|
||||||
{
|
{
|
||||||
if (self::$peer === null) {
|
if (self::$peer === null) {
|
||||||
self::$peer = new MessageDetailPeer();
|
self::$peer = new MessageTypeVariablePeer();
|
||||||
}
|
}
|
||||||
return self::$peer;
|
return self::$peer;
|
||||||
}
|
}
|
||||||
@@ -2,27 +2,27 @@
|
|||||||
|
|
||||||
require_once 'propel/util/BasePeer.php';
|
require_once 'propel/util/BasePeer.php';
|
||||||
// The object class -- needed for instanceof checks in this class.
|
// The object class -- needed for instanceof checks in this class.
|
||||||
// actual class may be a subclass -- as returned by MessageDetailPeer::getOMClass()
|
// actual class may be a subclass -- as returned by MessageTypeVariablePeer::getOMClass()
|
||||||
include_once 'classes/model/MessageDetail.php';
|
include_once 'classes/model/MessageTypeVariable.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base static class for performing query and update operations on the 'MESSAGE_DETAIL' table.
|
* Base static class for performing query and update operations on the 'MESSAGE_TYPE_VARIABLE' table.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @package workflow.classes.model.om
|
* @package workflow.classes.model.om
|
||||||
*/
|
*/
|
||||||
abstract class BaseMessageDetailPeer
|
abstract class BaseMessageTypeVariablePeer
|
||||||
{
|
{
|
||||||
|
|
||||||
/** the default database name for this class */
|
/** the default database name for this class */
|
||||||
const DATABASE_NAME = 'workflow';
|
const DATABASE_NAME = 'workflow';
|
||||||
|
|
||||||
/** the table name for this class */
|
/** the table name for this class */
|
||||||
const TABLE_NAME = 'MESSAGE_DETAIL';
|
const TABLE_NAME = 'MESSAGE_TYPE_VARIABLE';
|
||||||
|
|
||||||
/** A class that can be returned by this peer. */
|
/** A class that can be returned by this peer. */
|
||||||
const CLASS_DEFAULT = 'classes.model.MessageDetail';
|
const CLASS_DEFAULT = 'classes.model.MessageTypeVariable';
|
||||||
|
|
||||||
/** The total number of columns. */
|
/** The total number of columns. */
|
||||||
const NUM_COLUMNS = 4;
|
const NUM_COLUMNS = 4;
|
||||||
@@ -31,17 +31,17 @@ abstract class BaseMessageDetailPeer
|
|||||||
const NUM_LAZY_LOAD_COLUMNS = 0;
|
const NUM_LAZY_LOAD_COLUMNS = 0;
|
||||||
|
|
||||||
|
|
||||||
/** the column name for the MD_UID field */
|
/** the column name for the MSGTV_UID field */
|
||||||
const MD_UID = 'MESSAGE_DETAIL.MD_UID';
|
const MSGTV_UID = 'MESSAGE_TYPE_VARIABLE.MSGTV_UID';
|
||||||
|
|
||||||
/** the column name for the MES_UID field */
|
/** the column name for the MSGT_UID field */
|
||||||
const MES_UID = 'MESSAGE_DETAIL.MES_UID';
|
const MSGT_UID = 'MESSAGE_TYPE_VARIABLE.MSGT_UID';
|
||||||
|
|
||||||
/** the column name for the MD_TYPE field */
|
/** the column name for the MSGTV_NAME field */
|
||||||
const MD_TYPE = 'MESSAGE_DETAIL.MD_TYPE';
|
const MSGTV_NAME = 'MESSAGE_TYPE_VARIABLE.MSGTV_NAME';
|
||||||
|
|
||||||
/** the column name for the MD_NAME field */
|
/** the column name for the MSGTV_DEFAULT_VALUE field */
|
||||||
const MD_NAME = 'MESSAGE_DETAIL.MD_NAME';
|
const MSGTV_DEFAULT_VALUE = 'MESSAGE_TYPE_VARIABLE.MSGTV_DEFAULT_VALUE';
|
||||||
|
|
||||||
/** The PHP to DB Name Mapping */
|
/** The PHP to DB Name Mapping */
|
||||||
private static $phpNameMap = null;
|
private static $phpNameMap = null;
|
||||||
@@ -54,9 +54,9 @@ abstract class BaseMessageDetailPeer
|
|||||||
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
|
||||||
*/
|
*/
|
||||||
private static $fieldNames = array (
|
private static $fieldNames = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('MdUid', 'MesUid', 'MdType', 'MdName', ),
|
BasePeer::TYPE_PHPNAME => array ('MsgtvUid', 'MsgtUid', 'MsgtvName', 'MsgtvDefaultValue', ),
|
||||||
BasePeer::TYPE_COLNAME => array (MessageDetailPeer::MD_UID, MessageDetailPeer::MES_UID, MessageDetailPeer::MD_TYPE, MessageDetailPeer::MD_NAME, ),
|
BasePeer::TYPE_COLNAME => array (MessageTypeVariablePeer::MSGTV_UID, MessageTypeVariablePeer::MSGT_UID, MessageTypeVariablePeer::MSGTV_NAME, MessageTypeVariablePeer::MSGTV_DEFAULT_VALUE, ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('MD_UID', 'MES_UID', 'MD_TYPE', 'MD_NAME', ),
|
BasePeer::TYPE_FIELDNAME => array ('MSGTV_UID', 'MSGT_UID', 'MSGTV_NAME', 'MSGTV_DEFAULT_VALUE', ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -67,9 +67,9 @@ abstract class BaseMessageDetailPeer
|
|||||||
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
|
||||||
*/
|
*/
|
||||||
private static $fieldKeys = array (
|
private static $fieldKeys = array (
|
||||||
BasePeer::TYPE_PHPNAME => array ('MdUid' => 0, 'MesUid' => 1, 'MdType' => 2, 'MdName' => 3, ),
|
BasePeer::TYPE_PHPNAME => array ('MsgtvUid' => 0, 'MsgtUid' => 1, 'MsgtvName' => 2, 'MsgtvDefaultValue' => 3, ),
|
||||||
BasePeer::TYPE_COLNAME => array (MessageDetailPeer::MD_UID => 0, MessageDetailPeer::MES_UID => 1, MessageDetailPeer::MD_TYPE => 2, MessageDetailPeer::MD_NAME => 3, ),
|
BasePeer::TYPE_COLNAME => array (MessageTypeVariablePeer::MSGTV_UID => 0, MessageTypeVariablePeer::MSGT_UID => 1, MessageTypeVariablePeer::MSGTV_NAME => 2, MessageTypeVariablePeer::MSGTV_DEFAULT_VALUE => 3, ),
|
||||||
BasePeer::TYPE_FIELDNAME => array ('MD_UID' => 0, 'MES_UID' => 1, 'MD_TYPE' => 2, 'MD_NAME' => 3, ),
|
BasePeer::TYPE_FIELDNAME => array ('MSGTV_UID' => 0, 'MSGT_UID' => 1, 'MSGTV_NAME' => 2, 'MSGTV_DEFAULT_VALUE' => 3, ),
|
||||||
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
|
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -80,8 +80,8 @@ abstract class BaseMessageDetailPeer
|
|||||||
*/
|
*/
|
||||||
public static function getMapBuilder()
|
public static function getMapBuilder()
|
||||||
{
|
{
|
||||||
include_once 'classes/model/map/MessageDetailMapBuilder.php';
|
include_once 'classes/model/map/MessageTypeVariableMapBuilder.php';
|
||||||
return BasePeer::getMapBuilder('classes.model.map.MessageDetailMapBuilder');
|
return BasePeer::getMapBuilder('classes.model.map.MessageTypeVariableMapBuilder');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Gets a map (hash) of PHP names to DB column names.
|
* Gets a map (hash) of PHP names to DB column names.
|
||||||
@@ -94,7 +94,7 @@ abstract class BaseMessageDetailPeer
|
|||||||
public static function getPhpNameMap()
|
public static function getPhpNameMap()
|
||||||
{
|
{
|
||||||
if (self::$phpNameMap === null) {
|
if (self::$phpNameMap === null) {
|
||||||
$map = MessageDetailPeer::getTableMap();
|
$map = MessageTypeVariablePeer::getTableMap();
|
||||||
$columns = $map->getColumns();
|
$columns = $map->getColumns();
|
||||||
$nameMap = array();
|
$nameMap = array();
|
||||||
foreach ($columns as $column) {
|
foreach ($columns as $column) {
|
||||||
@@ -149,12 +149,12 @@ abstract class BaseMessageDetailPeer
|
|||||||
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
|
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
|
||||||
* </code>
|
* </code>
|
||||||
* @param string $alias The alias for the current table.
|
* @param string $alias The alias for the current table.
|
||||||
* @param string $column The column name for current table. (i.e. MessageDetailPeer::COLUMN_NAME).
|
* @param string $column The column name for current table. (i.e. MessageTypeVariablePeer::COLUMN_NAME).
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function alias($alias, $column)
|
public static function alias($alias, $column)
|
||||||
{
|
{
|
||||||
return str_replace(MessageDetailPeer::TABLE_NAME.'.', $alias.'.', $column);
|
return str_replace(MessageTypeVariablePeer::TABLE_NAME.'.', $alias.'.', $column);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -171,18 +171,18 @@ abstract class BaseMessageDetailPeer
|
|||||||
public static function addSelectColumns(Criteria $criteria)
|
public static function addSelectColumns(Criteria $criteria)
|
||||||
{
|
{
|
||||||
|
|
||||||
$criteria->addSelectColumn(MessageDetailPeer::MD_UID);
|
$criteria->addSelectColumn(MessageTypeVariablePeer::MSGTV_UID);
|
||||||
|
|
||||||
$criteria->addSelectColumn(MessageDetailPeer::MES_UID);
|
$criteria->addSelectColumn(MessageTypeVariablePeer::MSGT_UID);
|
||||||
|
|
||||||
$criteria->addSelectColumn(MessageDetailPeer::MD_TYPE);
|
$criteria->addSelectColumn(MessageTypeVariablePeer::MSGTV_NAME);
|
||||||
|
|
||||||
$criteria->addSelectColumn(MessageDetailPeer::MD_NAME);
|
$criteria->addSelectColumn(MessageTypeVariablePeer::MSGTV_DEFAULT_VALUE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const COUNT = 'COUNT(MESSAGE_DETAIL.MD_UID)';
|
const COUNT = 'COUNT(MESSAGE_TYPE_VARIABLE.MSGTV_UID)';
|
||||||
const COUNT_DISTINCT = 'COUNT(DISTINCT MESSAGE_DETAIL.MD_UID)';
|
const COUNT_DISTINCT = 'COUNT(DISTINCT MESSAGE_TYPE_VARIABLE.MSGTV_UID)';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of rows matching criteria.
|
* Returns the number of rows matching criteria.
|
||||||
@@ -200,9 +200,9 @@ abstract class BaseMessageDetailPeer
|
|||||||
// clear out anything that might confuse the ORDER BY clause
|
// clear out anything that might confuse the ORDER BY clause
|
||||||
$criteria->clearSelectColumns()->clearOrderByColumns();
|
$criteria->clearSelectColumns()->clearOrderByColumns();
|
||||||
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
|
||||||
$criteria->addSelectColumn(MessageDetailPeer::COUNT_DISTINCT);
|
$criteria->addSelectColumn(MessageTypeVariablePeer::COUNT_DISTINCT);
|
||||||
} else {
|
} else {
|
||||||
$criteria->addSelectColumn(MessageDetailPeer::COUNT);
|
$criteria->addSelectColumn(MessageTypeVariablePeer::COUNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// just in case we're grouping: add those columns to the select statement
|
// just in case we're grouping: add those columns to the select statement
|
||||||
@@ -210,7 +210,7 @@ abstract class BaseMessageDetailPeer
|
|||||||
$criteria->addSelectColumn($column);
|
$criteria->addSelectColumn($column);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rs = MessageDetailPeer::doSelectRS($criteria, $con);
|
$rs = MessageTypeVariablePeer::doSelectRS($criteria, $con);
|
||||||
if ($rs->next()) {
|
if ($rs->next()) {
|
||||||
return $rs->getInt(1);
|
return $rs->getInt(1);
|
||||||
} else {
|
} else {
|
||||||
@@ -223,7 +223,7 @@ abstract class BaseMessageDetailPeer
|
|||||||
*
|
*
|
||||||
* @param Criteria $criteria object used to create the SELECT statement.
|
* @param Criteria $criteria object used to create the SELECT statement.
|
||||||
* @param Connection $con
|
* @param Connection $con
|
||||||
* @return MessageDetail
|
* @return MessageTypeVariable
|
||||||
* @throws PropelException Any exceptions caught during processing will be
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
* rethrown wrapped into a PropelException.
|
* rethrown wrapped into a PropelException.
|
||||||
*/
|
*/
|
||||||
@@ -231,7 +231,7 @@ abstract class BaseMessageDetailPeer
|
|||||||
{
|
{
|
||||||
$critcopy = clone $criteria;
|
$critcopy = clone $criteria;
|
||||||
$critcopy->setLimit(1);
|
$critcopy->setLimit(1);
|
||||||
$objects = MessageDetailPeer::doSelect($critcopy, $con);
|
$objects = MessageTypeVariablePeer::doSelect($critcopy, $con);
|
||||||
if ($objects) {
|
if ($objects) {
|
||||||
return $objects[0];
|
return $objects[0];
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ abstract class BaseMessageDetailPeer
|
|||||||
*/
|
*/
|
||||||
public static function doSelect(Criteria $criteria, $con = null)
|
public static function doSelect(Criteria $criteria, $con = null)
|
||||||
{
|
{
|
||||||
return MessageDetailPeer::populateObjects(MessageDetailPeer::doSelectRS($criteria, $con));
|
return MessageTypeVariablePeer::populateObjects(MessageTypeVariablePeer::doSelectRS($criteria, $con));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Prepares the Criteria object and uses the parent doSelect()
|
* Prepares the Criteria object and uses the parent doSelect()
|
||||||
@@ -272,7 +272,7 @@ abstract class BaseMessageDetailPeer
|
|||||||
|
|
||||||
if (!$criteria->getSelectColumns()) {
|
if (!$criteria->getSelectColumns()) {
|
||||||
$criteria = clone $criteria;
|
$criteria = clone $criteria;
|
||||||
MessageDetailPeer::addSelectColumns($criteria);
|
MessageTypeVariablePeer::addSelectColumns($criteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the correct dbName
|
// Set the correct dbName
|
||||||
@@ -294,7 +294,7 @@ abstract class BaseMessageDetailPeer
|
|||||||
$results = array();
|
$results = array();
|
||||||
|
|
||||||
// set the class once to avoid overhead in the loop
|
// set the class once to avoid overhead in the loop
|
||||||
$cls = MessageDetailPeer::getOMClass();
|
$cls = MessageTypeVariablePeer::getOMClass();
|
||||||
$cls = Propel::import($cls);
|
$cls = Propel::import($cls);
|
||||||
// populate the object(s)
|
// populate the object(s)
|
||||||
while ($rs->next()) {
|
while ($rs->next()) {
|
||||||
@@ -329,13 +329,13 @@ abstract class BaseMessageDetailPeer
|
|||||||
*/
|
*/
|
||||||
public static function getOMClass()
|
public static function getOMClass()
|
||||||
{
|
{
|
||||||
return MessageDetailPeer::CLASS_DEFAULT;
|
return MessageTypeVariablePeer::CLASS_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method perform an INSERT on the database, given a MessageDetail or Criteria object.
|
* Method perform an INSERT on the database, given a MessageTypeVariable or Criteria object.
|
||||||
*
|
*
|
||||||
* @param mixed $values Criteria or MessageDetail object containing data that is used to create the INSERT statement.
|
* @param mixed $values Criteria or MessageTypeVariable object containing data that is used to create the INSERT statement.
|
||||||
* @param Connection $con the connection to use
|
* @param Connection $con the connection to use
|
||||||
* @return mixed The new primary key.
|
* @return mixed The new primary key.
|
||||||
* @throws PropelException Any exceptions caught during processing will be
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
@@ -350,7 +350,7 @@ abstract class BaseMessageDetailPeer
|
|||||||
if ($values instanceof Criteria) {
|
if ($values instanceof Criteria) {
|
||||||
$criteria = clone $values; // rename for clarity
|
$criteria = clone $values; // rename for clarity
|
||||||
} else {
|
} else {
|
||||||
$criteria = $values->buildCriteria(); // build Criteria from MessageDetail object
|
$criteria = $values->buildCriteria(); // build Criteria from MessageTypeVariable object
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -372,9 +372,9 @@ abstract class BaseMessageDetailPeer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method perform an UPDATE on the database, given a MessageDetail or Criteria object.
|
* Method perform an UPDATE on the database, given a MessageTypeVariable or Criteria object.
|
||||||
*
|
*
|
||||||
* @param mixed $values Criteria or MessageDetail object containing data create the UPDATE statement.
|
* @param mixed $values Criteria or MessageTypeVariable object containing data create the UPDATE statement.
|
||||||
* @param Connection $con The connection to use (specify Connection exert more control over transactions).
|
* @param Connection $con The connection to use (specify Connection exert more control over transactions).
|
||||||
* @return int The number of affected rows (if supported by underlying database driver).
|
* @return int The number of affected rows (if supported by underlying database driver).
|
||||||
* @throws PropelException Any exceptions caught during processing will be
|
* @throws PropelException Any exceptions caught during processing will be
|
||||||
@@ -391,8 +391,8 @@ abstract class BaseMessageDetailPeer
|
|||||||
if ($values instanceof Criteria) {
|
if ($values instanceof Criteria) {
|
||||||
$criteria = clone $values; // rename for clarity
|
$criteria = clone $values; // rename for clarity
|
||||||
|
|
||||||
$comparison = $criteria->getComparison(MessageDetailPeer::MD_UID);
|
$comparison = $criteria->getComparison(MessageTypeVariablePeer::MSGTV_UID);
|
||||||
$selectCriteria->add(MessageDetailPeer::MD_UID, $criteria->remove(MessageDetailPeer::MD_UID), $comparison);
|
$selectCriteria->add(MessageTypeVariablePeer::MSGTV_UID, $criteria->remove(MessageTypeVariablePeer::MSGTV_UID), $comparison);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$criteria = $values->buildCriteria(); // gets full criteria
|
$criteria = $values->buildCriteria(); // gets full criteria
|
||||||
@@ -406,7 +406,7 @@ abstract class BaseMessageDetailPeer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to DELETE all rows from the MESSAGE_DETAIL table.
|
* Method to DELETE all rows from the MESSAGE_TYPE_VARIABLE table.
|
||||||
*
|
*
|
||||||
* @return int The number of affected rows (if supported by underlying database driver).
|
* @return int The number of affected rows (if supported by underlying database driver).
|
||||||
*/
|
*/
|
||||||
@@ -420,7 +420,7 @@ abstract class BaseMessageDetailPeer
|
|||||||
// use transaction because $criteria could contain info
|
// use transaction because $criteria could contain info
|
||||||
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
// for more than one table or we could emulating ON DELETE CASCADE, etc.
|
||||||
$con->begin();
|
$con->begin();
|
||||||
$affectedRows += BasePeer::doDeleteAll(MessageDetailPeer::TABLE_NAME, $con);
|
$affectedRows += BasePeer::doDeleteAll(MessageTypeVariablePeer::TABLE_NAME, $con);
|
||||||
$con->commit();
|
$con->commit();
|
||||||
return $affectedRows;
|
return $affectedRows;
|
||||||
} catch (PropelException $e) {
|
} catch (PropelException $e) {
|
||||||
@@ -430,9 +430,9 @@ abstract class BaseMessageDetailPeer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method perform a DELETE on the database, given a MessageDetail or Criteria object OR a primary key value.
|
* Method perform a DELETE on the database, given a MessageTypeVariable or Criteria object OR a primary key value.
|
||||||
*
|
*
|
||||||
* @param mixed $values Criteria or MessageDetail object or primary key or array of primary keys
|
* @param mixed $values Criteria or MessageTypeVariable object or primary key or array of primary keys
|
||||||
* which is used to create the DELETE statement
|
* which is used to create the DELETE statement
|
||||||
* @param Connection $con the connection to use
|
* @param Connection $con the connection to use
|
||||||
* @return int The number of affected rows (if supported by underlying database driver).
|
* @return int The number of affected rows (if supported by underlying database driver).
|
||||||
@@ -444,18 +444,18 @@ abstract class BaseMessageDetailPeer
|
|||||||
public static function doDelete($values, $con = null)
|
public static function doDelete($values, $con = null)
|
||||||
{
|
{
|
||||||
if ($con === null) {
|
if ($con === null) {
|
||||||
$con = Propel::getConnection(MessageDetailPeer::DATABASE_NAME);
|
$con = Propel::getConnection(MessageTypeVariablePeer::DATABASE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($values instanceof Criteria) {
|
if ($values instanceof Criteria) {
|
||||||
$criteria = clone $values; // rename for clarity
|
$criteria = clone $values; // rename for clarity
|
||||||
} elseif ($values instanceof MessageDetail) {
|
} elseif ($values instanceof MessageTypeVariable) {
|
||||||
|
|
||||||
$criteria = $values->buildPkeyCriteria();
|
$criteria = $values->buildPkeyCriteria();
|
||||||
} else {
|
} else {
|
||||||
// it must be the primary key
|
// it must be the primary key
|
||||||
$criteria = new Criteria(self::DATABASE_NAME);
|
$criteria = new Criteria(self::DATABASE_NAME);
|
||||||
$criteria->add(MessageDetailPeer::MD_UID, (array) $values, Criteria::IN);
|
$criteria->add(MessageTypeVariablePeer::MSGTV_UID, (array) $values, Criteria::IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the correct dbName
|
// Set the correct dbName
|
||||||
@@ -478,24 +478,24 @@ abstract class BaseMessageDetailPeer
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validates all modified columns of given MessageDetail object.
|
* Validates all modified columns of given MessageTypeVariable object.
|
||||||
* If parameter $columns is either a single column name or an array of column names
|
* If parameter $columns is either a single column name or an array of column names
|
||||||
* than only those columns are validated.
|
* than only those columns are validated.
|
||||||
*
|
*
|
||||||
* NOTICE: This does not apply to primary or foreign keys for now.
|
* NOTICE: This does not apply to primary or foreign keys for now.
|
||||||
*
|
*
|
||||||
* @param MessageDetail $obj The object to validate.
|
* @param MessageTypeVariable $obj The object to validate.
|
||||||
* @param mixed $cols Column name or array of column names.
|
* @param mixed $cols Column name or array of column names.
|
||||||
*
|
*
|
||||||
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
|
* @return mixed TRUE if all columns are valid or the error message of the first invalid column.
|
||||||
*/
|
*/
|
||||||
public static function doValidate(MessageDetail $obj, $cols = null)
|
public static function doValidate(MessageTypeVariable $obj, $cols = null)
|
||||||
{
|
{
|
||||||
$columns = array();
|
$columns = array();
|
||||||
|
|
||||||
if ($cols) {
|
if ($cols) {
|
||||||
$dbMap = Propel::getDatabaseMap(MessageDetailPeer::DATABASE_NAME);
|
$dbMap = Propel::getDatabaseMap(MessageTypeVariablePeer::DATABASE_NAME);
|
||||||
$tableMap = $dbMap->getTable(MessageDetailPeer::TABLE_NAME);
|
$tableMap = $dbMap->getTable(MessageTypeVariablePeer::TABLE_NAME);
|
||||||
|
|
||||||
if (! is_array($cols)) {
|
if (! is_array($cols)) {
|
||||||
$cols = array($cols);
|
$cols = array($cols);
|
||||||
@@ -511,7 +511,7 @@ abstract class BaseMessageDetailPeer
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return BasePeer::doValidate(MessageDetailPeer::DATABASE_NAME, MessageDetailPeer::TABLE_NAME, $columns);
|
return BasePeer::doValidate(MessageTypeVariablePeer::DATABASE_NAME, MessageTypeVariablePeer::TABLE_NAME, $columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -519,7 +519,7 @@ abstract class BaseMessageDetailPeer
|
|||||||
*
|
*
|
||||||
* @param mixed $pk the primary key.
|
* @param mixed $pk the primary key.
|
||||||
* @param Connection $con the connection to use
|
* @param Connection $con the connection to use
|
||||||
* @return MessageDetail
|
* @return MessageTypeVariable
|
||||||
*/
|
*/
|
||||||
public static function retrieveByPK($pk, $con = null)
|
public static function retrieveByPK($pk, $con = null)
|
||||||
{
|
{
|
||||||
@@ -527,12 +527,12 @@ abstract class BaseMessageDetailPeer
|
|||||||
$con = Propel::getConnection(self::DATABASE_NAME);
|
$con = Propel::getConnection(self::DATABASE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
$criteria = new Criteria(MessageDetailPeer::DATABASE_NAME);
|
$criteria = new Criteria(MessageTypeVariablePeer::DATABASE_NAME);
|
||||||
|
|
||||||
$criteria->add(MessageDetailPeer::MD_UID, $pk);
|
$criteria->add(MessageTypeVariablePeer::MSGTV_UID, $pk);
|
||||||
|
|
||||||
|
|
||||||
$v = MessageDetailPeer::doSelect($criteria, $con);
|
$v = MessageTypeVariablePeer::doSelect($criteria, $con);
|
||||||
|
|
||||||
return !empty($v) > 0 ? $v[0] : null;
|
return !empty($v) > 0 ? $v[0] : null;
|
||||||
}
|
}
|
||||||
@@ -556,8 +556,8 @@ abstract class BaseMessageDetailPeer
|
|||||||
$objs = array();
|
$objs = array();
|
||||||
} else {
|
} else {
|
||||||
$criteria = new Criteria();
|
$criteria = new Criteria();
|
||||||
$criteria->add(MessageDetailPeer::MD_UID, $pks, Criteria::IN);
|
$criteria->add(MessageTypeVariablePeer::MSGTV_UID, $pks, Criteria::IN);
|
||||||
$objs = MessageDetailPeer::doSelect($criteria, $con);
|
$objs = MessageTypeVariablePeer::doSelect($criteria, $con);
|
||||||
}
|
}
|
||||||
return $objs;
|
return $objs;
|
||||||
}
|
}
|
||||||
@@ -569,14 +569,14 @@ if (Propel::isInit()) {
|
|||||||
// the MapBuilder classes register themselves with Propel during initialization
|
// the MapBuilder classes register themselves with Propel during initialization
|
||||||
// so we need to load them here.
|
// so we need to load them here.
|
||||||
try {
|
try {
|
||||||
BaseMessageDetailPeer::getMapBuilder();
|
BaseMessageTypeVariablePeer::getMapBuilder();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
|
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// even if Propel is not yet initialized, the map builder class can be registered
|
// even if Propel is not yet initialized, the map builder class can be registered
|
||||||
// now and then it will be loaded when Propel initializes.
|
// now and then it will be loaded when Propel initializes.
|
||||||
require_once 'classes/model/map/MessageDetailMapBuilder.php';
|
require_once 'classes/model/map/MessageTypeVariableMapBuilder.php';
|
||||||
Propel::registerMapBuilder('classes.model.map.MessageDetailMapBuilder');
|
Propel::registerMapBuilder('classes.model.map.MessageTypeVariableMapBuilder');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4171,17 +4171,40 @@
|
|||||||
<column name="TYPE" type="VARCHAR" size="255" required="true" primaryKey="true" default=""/>
|
<column name="TYPE" type="VARCHAR" size="255" required="true" primaryKey="true" default=""/>
|
||||||
<column name="TYP_UID" type="VARCHAR" size="32" required="true" default=""/>
|
<column name="TYP_UID" type="VARCHAR" size="32" required="true" default=""/>
|
||||||
</table>
|
</table>
|
||||||
<table name="MESSAGE">
|
<table name="MESSAGE_TYPE">
|
||||||
<column name="MES_UID" type="VARCHAR" size="32" required="true" primaryKey="true" />
|
<vendor type="mysql">
|
||||||
<column name="PRJ_UID" type="VARCHAR" size="32" required="true"/>
|
<parameter name="Name" value="MESSAGE_TYPE" />
|
||||||
<column name="MES_NAME" type="VARCHAR" size="255" default=""/>
|
<parameter name="Engine" value="InnoDB" />
|
||||||
<column name="MES_CONDITION" type="VARCHAR" size="255" default=""/>
|
<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>
|
||||||
<table name="MESSAGE_DETAIL">
|
<table name="MESSAGE_TYPE_VARIABLE">
|
||||||
<column name="MD_UID" type="VARCHAR" size="32" required="true" primaryKey="true" />
|
<vendor type="mysql">
|
||||||
<column name="MES_UID" type="VARCHAR" size="32" required="true"/>
|
<parameter name="Name" value="MESSAGE_TYPE_VARIABLE" />
|
||||||
<column name="MD_TYPE" type="VARCHAR" size="32" default=""/>
|
<parameter name="Engine" value="InnoDB" />
|
||||||
<column name="MD_NAME" type="VARCHAR" size="255" default=""/>
|
<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>
|
||||||
<table name="EMAIL_SERVER">
|
<table name="EMAIL_SERVER">
|
||||||
<vendor type="mysql">
|
<vendor type="mysql">
|
||||||
|
|||||||
@@ -2379,37 +2379,33 @@ CREATE TABLE `LIST_UNASSIGNED_GROUP`
|
|||||||
PRIMARY KEY (`UNA_UID`,`USR_UID`,`TYPE`)
|
PRIMARY KEY (`UNA_UID`,`USR_UID`,`TYPE`)
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Unassiged list';
|
)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_TYPE
|
||||||
CREATE TABLE `MESSAGE`
|
|
||||||
(
|
(
|
||||||
`MES_UID` VARCHAR(32) NOT NULL,
|
MSGT_UID VARCHAR(32) default '' NOT NULL,
|
||||||
`PRJ_UID` VARCHAR(32) NOT NULL,
|
PRJ_UID VARCHAR(32) default '' NOT NULL,
|
||||||
`MES_NAME` VARCHAR(255) default '',
|
MSGT_NAME VARCHAR(256) default '' NOT NULL,
|
||||||
`MES_CONDITION` VARCHAR(255) default '',
|
PRIMARY KEY (MSGT_UID)
|
||||||
PRIMARY KEY (`MES_UID`)
|
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
|
||||||
)ENGINE=InnoDB ;
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
#-- MESSAGE_DETAIL
|
#-- MESSAGE_TYPE_VARIABLE
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `MESSAGE_DETAIL`;
|
DROP TABLE IF EXISTS MESSAGE_TYPE_VARIABLE;
|
||||||
|
|
||||||
|
CREATE TABLE MESSAGE_TYPE_VARIABLE
|
||||||
CREATE TABLE `MESSAGE_DETAIL`
|
|
||||||
(
|
(
|
||||||
`MD_UID` VARCHAR(32) NOT NULL,
|
MSGTV_UID VARCHAR(32) default '' NOT NULL,
|
||||||
`MES_UID` VARCHAR(32) NOT NULL,
|
MSGT_UID VARCHAR(32) default '' NOT NULL,
|
||||||
`MD_TYPE` VARCHAR(32) default '',
|
MSGTV_NAME VARCHAR(256) default '' NOT NULL,
|
||||||
`MD_NAME` VARCHAR(255) default '',
|
MSGTV_DEFAULT_VALUE VARCHAR(256) default '' NOT NULL,
|
||||||
PRIMARY KEY (`MD_UID`)
|
PRIMARY KEY (MSGTV_UID)
|
||||||
)ENGINE=InnoDB ;
|
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
|
||||||
# This restores the fkey checks, after having unset them earlier
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
#-- TABLE: EMAIL_SERVER
|
#-- TABLE: EMAIL_SERVER
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ class EmailServer
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
$arrayTestMailResult = $this->sendTestMail($arrayDataMail);
|
$arrayTestMailResult = $this->sendTestMail($arrayDataMail);
|
||||||
} catch (Exception $error) {
|
} catch (Exception $e) {
|
||||||
$arrayTestMailResult["status"] = false;
|
$arrayTestMailResult["status"] = false;
|
||||||
$arrayTestMailResult["message"] = $e->getMessage();
|
$arrayTestMailResult["message"] = $e->getMessage();
|
||||||
|
|
||||||
|
|||||||
@@ -1,415 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace ProcessMaker\BusinessModel;
|
|
||||||
|
|
||||||
class Message
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Create Message for a Process
|
|
||||||
*
|
|
||||||
* @param string $processUid Unique id of Message
|
|
||||||
* @param array $arrayData Data
|
|
||||||
*
|
|
||||||
* return array Return data of the new Message created
|
|
||||||
*/
|
|
||||||
public function create($processUid, array $arrayData)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
//Verify data
|
|
||||||
Validator::proUid($processUid, '$prj_uid');
|
|
||||||
|
|
||||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
|
||||||
|
|
||||||
$this->existsName($processUid, $arrayData["MES_NAME"]);
|
|
||||||
|
|
||||||
$this->throwExceptionFieldDefinition($arrayData);
|
|
||||||
|
|
||||||
//Create
|
|
||||||
$cnn = \Propel::getConnection("workflow");
|
|
||||||
try {
|
|
||||||
$message = new \Message();
|
|
||||||
|
|
||||||
$sPkMessage = \ProcessMaker\Util\Common::generateUID();
|
|
||||||
|
|
||||||
$message->setMesUid($sPkMessage);
|
|
||||||
$message->setPrjUid($processUid);
|
|
||||||
|
|
||||||
if ($message->validate()) {
|
|
||||||
$cnn->begin();
|
|
||||||
|
|
||||||
if (isset($arrayData["MES_NAME"])) {
|
|
||||||
$message->setMesName($arrayData["MES_NAME"]);
|
|
||||||
} else {
|
|
||||||
throw new \Exception(\G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('$mes_name' )));
|
|
||||||
}
|
|
||||||
if (isset($arrayData["MES_DETAIL"])) {
|
|
||||||
|
|
||||||
foreach ($arrayData["MES_DETAIL"] as $i => $type) {
|
|
||||||
$messageDetail = new \MessageDetail();
|
|
||||||
|
|
||||||
$sPkMessageDetail = \ProcessMaker\Util\Common::generateUID();
|
|
||||||
|
|
||||||
$messageDetail->setMdUid($sPkMessageDetail);
|
|
||||||
$messageDetail->setMdType($type["md_type"]);
|
|
||||||
$messageDetail->setMdName($type["md_name"]);
|
|
||||||
$messageDetail->setMesUid($sPkMessage);
|
|
||||||
$messageDetail->save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$message->save();
|
|
||||||
$cnn->commit();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
$msg = "";
|
|
||||||
|
|
||||||
foreach ($message->getValidationFailures() as $validationFailure) {
|
|
||||||
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . "\n" . $msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$cnn->rollback();
|
|
||||||
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Return
|
|
||||||
$message = $this->getMessage($processUid, $sPkMessage);
|
|
||||||
|
|
||||||
return $message;
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update Message
|
|
||||||
*
|
|
||||||
* @param string $processUid Unique id of Process
|
|
||||||
* @param string $messageUid Unique id of Message
|
|
||||||
* @param array $arrayData Data
|
|
||||||
*
|
|
||||||
* return array Return data of the Message updated
|
|
||||||
*/
|
|
||||||
public function update($processUid, $messageUid, $arrayData)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
//Verify data
|
|
||||||
Validator::proUid($processUid, '$prj_uid');
|
|
||||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
|
||||||
|
|
||||||
$this->throwExceptionFieldDefinition($arrayData);
|
|
||||||
|
|
||||||
//Update
|
|
||||||
$cnn = \Propel::getConnection("workflow");
|
|
||||||
try {
|
|
||||||
$message = \MessagePeer::retrieveByPK($messageUid);
|
|
||||||
|
|
||||||
if (is_null($message)) {
|
|
||||||
throw new \Exception('mes_uid: '.$messageUid. ' '.\G::LoadTranslation("ID_DOES_NOT_EXIST"));
|
|
||||||
} else {
|
|
||||||
$cnn->begin();
|
|
||||||
if (isset($arrayData["MES_NAME"])) {
|
|
||||||
$this->existsName($processUid, $arrayData["MES_NAME"]);
|
|
||||||
$message->setMesName($arrayData["MES_NAME"]);
|
|
||||||
}
|
|
||||||
if (isset($arrayData["MES_DETAIL"])) {
|
|
||||||
|
|
||||||
foreach ($arrayData["MES_DETAIL"] as $i => $type) {
|
|
||||||
|
|
||||||
$messageDetail = \MessageDetailPeer::retrieveByPK($type["md_uid"]);
|
|
||||||
if (is_null($messageDetail)) {
|
|
||||||
throw new \Exception('md_uid: '.$type["md_uid"]. ' '.\G::LoadTranslation("ID_DOES_NOT_EXIST"));
|
|
||||||
} else {
|
|
||||||
$messageDetail->setMdType($type["md_type"]);
|
|
||||||
$messageDetail->setMdName($type["md_name"]);
|
|
||||||
|
|
||||||
$messageDetail->save();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$message->save();
|
|
||||||
$cnn->commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
$cnn->rollback();
|
|
||||||
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete Message
|
|
||||||
*
|
|
||||||
* @param string $processUid Unique id of Process
|
|
||||||
* @param string $messageUid Unique id of Message
|
|
||||||
*
|
|
||||||
* return void
|
|
||||||
*/
|
|
||||||
public function delete($processUid, $messageUid)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
//Verify data
|
|
||||||
Validator::proUid($processUid, '$prj_uid');
|
|
||||||
|
|
||||||
$this->throwExceptionIfNotExistsMessage($messageUid);
|
|
||||||
|
|
||||||
//Delete
|
|
||||||
$criteria = new \Criteria("workflow");
|
|
||||||
|
|
||||||
$criteria->add(\MessagePeer::MES_UID, $messageUid);
|
|
||||||
|
|
||||||
\MessagePeer::doDelete($criteria);
|
|
||||||
|
|
||||||
//Delete Detail
|
|
||||||
$criteriaDetail = new \Criteria("workflow");
|
|
||||||
|
|
||||||
$criteriaDetail->add(\MessageDetailPeer::MES_UID, $messageUid);
|
|
||||||
|
|
||||||
\MessageDetailPeer::doDelete($criteriaDetail);
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get data of a Message
|
|
||||||
* @param string $processUid Unique id of Process
|
|
||||||
* @param string $messageUid Unique id of Message
|
|
||||||
*
|
|
||||||
* return array Return an array with data of a Message
|
|
||||||
*/
|
|
||||||
public function getMessage($processUid, $messageUid)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
//Verify data
|
|
||||||
Validator::proUid($processUid, '$prj_uid');
|
|
||||||
|
|
||||||
$this->throwExceptionIfNotExistsMessage($messageUid);
|
|
||||||
|
|
||||||
//Get data
|
|
||||||
$criteria = new \Criteria("workflow");
|
|
||||||
|
|
||||||
$criteria->addSelectColumn(\MessagePeer::MES_UID);
|
|
||||||
$criteria->addSelectColumn(\MessagePeer::MES_NAME);
|
|
||||||
$criteria->addSelectColumn(\MessagePeer::PRJ_UID);
|
|
||||||
|
|
||||||
$criteria->add(\MessagePeer::PRJ_UID, $processUid, \Criteria::EQUAL);
|
|
||||||
$criteria->add(\MessagePeer::MES_UID, $messageUid, \Criteria::EQUAL);
|
|
||||||
|
|
||||||
$rsCriteria = \MessagePeer::doSelectRS($criteria);
|
|
||||||
|
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
||||||
|
|
||||||
$rsCriteria->next();
|
|
||||||
$arrayMessage = array();
|
|
||||||
|
|
||||||
while ($aRow = $rsCriteria->getRow()) {
|
|
||||||
$oCriteriaU = new \Criteria('workflow');
|
|
||||||
$oCriteriaU->setDistinct();
|
|
||||||
$oCriteriaU->addSelectColumn(\MessageDetailPeer::MD_UID);
|
|
||||||
$oCriteriaU->addSelectColumn(\MessageDetailPeer::MD_NAME);
|
|
||||||
$oCriteriaU->addSelectColumn(\MessageDetailPeer::MD_TYPE);
|
|
||||||
$oCriteriaU->add(\MessageDetailPeer::MES_UID, $aRow['MES_UID']);
|
|
||||||
$oDatasetU = \MessageDetailPeer::doSelectRS($oCriteriaU);
|
|
||||||
$oDatasetU->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$aType = array();
|
|
||||||
while ($oDatasetU->next()) {
|
|
||||||
$aRowU = $oDatasetU->getRow();
|
|
||||||
$aType[] = array('md_uid' => $aRowU['MD_UID'],
|
|
||||||
'md_name' => $aRowU['MD_NAME'],
|
|
||||||
'md_type' => $aRowU['MD_TYPE']);
|
|
||||||
|
|
||||||
}
|
|
||||||
$arrayMessage = array('mes_uid' => $aRow['MES_UID'],
|
|
||||||
'prj_uid' => $aRow['PRJ_UID'],
|
|
||||||
'mes_name' => $aRow['MES_NAME'],
|
|
||||||
'mes_detail' => $aType);
|
|
||||||
$rsCriteria->next();
|
|
||||||
}
|
|
||||||
//Return
|
|
||||||
return $arrayMessage;
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get data of Message
|
|
||||||
*
|
|
||||||
* @param string $processUid Unique id of Message
|
|
||||||
*
|
|
||||||
* return array Return an array with data of a Message
|
|
||||||
*/
|
|
||||||
public function getMessages($processUid)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
//Verify data
|
|
||||||
Validator::proUid($processUid, '$prj_uid');
|
|
||||||
|
|
||||||
//Get data
|
|
||||||
$criteria = new \Criteria("workflow");
|
|
||||||
|
|
||||||
$criteria->addSelectColumn(\MessagePeer::MES_UID);
|
|
||||||
$criteria->addSelectColumn(\MessagePeer::MES_NAME);
|
|
||||||
$criteria->addSelectColumn(\MessagePeer::PRJ_UID);
|
|
||||||
|
|
||||||
$criteria->add(\MessagePeer::PRJ_UID, $processUid, \Criteria::EQUAL);
|
|
||||||
|
|
||||||
$rsCriteria = \MessagePeer::doSelectRS($criteria);
|
|
||||||
|
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
||||||
|
|
||||||
$rsCriteria->next();
|
|
||||||
$arrayMessages = array();
|
|
||||||
|
|
||||||
while ($aRow = $rsCriteria->getRow()) {
|
|
||||||
$oCriteriaU = new \Criteria('workflow');
|
|
||||||
$oCriteriaU->setDistinct();
|
|
||||||
$oCriteriaU->addSelectColumn(\MessageDetailPeer::MD_UID);
|
|
||||||
$oCriteriaU->addSelectColumn(\MessageDetailPeer::MD_NAME);
|
|
||||||
$oCriteriaU->addSelectColumn(\MessageDetailPeer::MD_TYPE);
|
|
||||||
$oCriteriaU->add(\MessageDetailPeer::MES_UID, $aRow['MES_UID']);
|
|
||||||
$oDatasetU = \MessageDetailPeer::doSelectRS($oCriteriaU);
|
|
||||||
$oDatasetU->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$aType = array();
|
|
||||||
while ($oDatasetU->next()) {
|
|
||||||
$aRowU = $oDatasetU->getRow();
|
|
||||||
$aType[] = array('md_uid' => $aRowU['MD_UID'],
|
|
||||||
'md_name' => $aRowU['MD_NAME'],
|
|
||||||
'mes_type' => $aRowU['MD_TYPE']);
|
|
||||||
|
|
||||||
}
|
|
||||||
$arrayMessages[] = array('mes_uid' => $aRow['MES_UID'],
|
|
||||||
'prj_uid' => $aRow['PRJ_UID'],
|
|
||||||
'mes_name' => $aRow['MES_NAME'],
|
|
||||||
'mes_detail' => $aType);
|
|
||||||
$rsCriteria->next();
|
|
||||||
}
|
|
||||||
//Return
|
|
||||||
return $arrayMessages;
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify field definition
|
|
||||||
*
|
|
||||||
* @param array $aData Unique id of Message to exclude
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function throwExceptionFieldDefinition($aData)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
if (isset($aData["MES_NAME"])) {
|
|
||||||
Validator::isString($aData['MES_NAME'], '$mes_name');
|
|
||||||
Validator::isNotEmpty($aData['MES_NAME'], '$mes_name');
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify if exists the name of a message
|
|
||||||
*
|
|
||||||
* @param string $processUid Unique id of Process
|
|
||||||
* @param string $messageName Name
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public function existsName($processUid, $messageName)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$criteria = new \Criteria("workflow");
|
|
||||||
$criteria->addSelectColumn(\MessagePeer::MES_UID);
|
|
||||||
$criteria->add(\MessagePeer::MES_NAME, $messageName, \Criteria::EQUAL);
|
|
||||||
$criteria->add(\MessagePeer::PRJ_UID, $processUid, \Criteria::EQUAL);
|
|
||||||
$rsCriteria = \MessagePeer::doSelectRS($criteria);
|
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$rsCriteria->next();
|
|
||||||
if ($rsCriteria->getRow()) {
|
|
||||||
throw new \Exception(\G::LoadTranslation("DYNAFIELD_ALREADY_EXIST"));
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get required variables in the SQL
|
|
||||||
*
|
|
||||||
* @param string $sql SQL
|
|
||||||
*
|
|
||||||
* return array Return an array with required variables in the SQL
|
|
||||||
*/
|
|
||||||
public function sqlGetRequiredVariables($sql)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$arrayVariableRequired = array();
|
|
||||||
|
|
||||||
preg_match_all("/@[@%#\?\x24\=]([A-Za-z_]\w*)/", $sql, $arrayMatch, PREG_SET_ORDER);
|
|
||||||
|
|
||||||
foreach ($arrayMatch as $value) {
|
|
||||||
$arrayVariableRequired[] = $value[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
return $arrayVariableRequired;
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify if some required variable in the SQL is missing in the variables
|
|
||||||
*
|
|
||||||
* @param string $variableName Variable name
|
|
||||||
* @param string $variableSql SQL
|
|
||||||
* @param array $arrayVariable The variables
|
|
||||||
*
|
|
||||||
* return void Throw exception if some required variable in the SQL is missing in the variables
|
|
||||||
*/
|
|
||||||
public function throwExceptionIfSomeRequiredVariableSqlIsMissingInVariables($variableName, $variableSql, array $arrayVariable)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$arrayResult = array_diff(array_unique($this->sqlGetRequiredVariables($variableSql)), array_keys($arrayVariable));
|
|
||||||
|
|
||||||
if (count($arrayResult) > 0) {
|
|
||||||
throw new \Exception(\G::LoadTranslation("ID_PROCESS_VARIABLE_REQUIRED_VARIABLES_FOR_QUERY", array($variableName, implode(", ", $arrayResult))));
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Verify if does not exist the message in table MESSAGE
|
|
||||||
*
|
|
||||||
* @param string $messageUid Unique id of variable
|
|
||||||
*
|
|
||||||
* return void Throw exception if does not exist the message in table MESSAGE
|
|
||||||
*/
|
|
||||||
public function throwExceptionIfNotExistsMessage($messageUid)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$obj = \MessagePeer::retrieveByPK($messageUid);
|
|
||||||
|
|
||||||
if (is_null($obj)) {
|
|
||||||
throw new \Exception('mes_uid: '.$messageUid. ' '.\G::LoadTranslation("ID_DOES_NOT_EXIST"));
|
|
||||||
}
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
throw $e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
727
workflow/engine/src/ProcessMaker/BusinessModel/MessageType.php
Normal file
727
workflow/engine/src/ProcessMaker/BusinessModel/MessageType.php
Normal file
@@ -0,0 +1,727 @@
|
|||||||
|
<?php
|
||||||
|
namespace ProcessMaker\BusinessModel;
|
||||||
|
|
||||||
|
class MessageType
|
||||||
|
{
|
||||||
|
private $arrayFieldDefinition = array(
|
||||||
|
"MSGT_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "messageTypeUid"),
|
||||||
|
"PRJ_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "projectUid"),
|
||||||
|
"MSGT_NAME" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "messageTypeName"),
|
||||||
|
"MSGT_VARIABLES" => array("type" => "array", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "messageTypeVariables")
|
||||||
|
);
|
||||||
|
|
||||||
|
private $formatFieldNameInUppercase = true;
|
||||||
|
|
||||||
|
private $arrayFieldNameForException = array(
|
||||||
|
"start" => "START",
|
||||||
|
"limit" => "LIMIT"
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor of the class
|
||||||
|
*
|
||||||
|
* return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
foreach ($this->arrayFieldDefinition as $key => $value) {
|
||||||
|
$this->arrayFieldNameForException[$value["fieldNameAux"]] = $key;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the format of the fields name (uppercase, lowercase)
|
||||||
|
*
|
||||||
|
* @param bool $flag Value that set the format
|
||||||
|
*
|
||||||
|
* return void
|
||||||
|
*/
|
||||||
|
public function setFormatFieldNameInUppercase($flag)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->formatFieldNameInUppercase = $flag;
|
||||||
|
|
||||||
|
$this->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set exception messageTypes for fields
|
||||||
|
*
|
||||||
|
* @param array $arrayData Data with the fields
|
||||||
|
*
|
||||||
|
* return void
|
||||||
|
*/
|
||||||
|
public function setArrayFieldNameForException(array $arrayData)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
foreach ($arrayData as $key => $value) {
|
||||||
|
$this->arrayFieldNameForException[$key] = $this->getFieldNameByFormatFieldName($value);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the field according to the format
|
||||||
|
*
|
||||||
|
* @param string $fieldName Field name
|
||||||
|
*
|
||||||
|
* return string Return the field name according the format
|
||||||
|
*/
|
||||||
|
public function getFieldNameByFormatFieldName($fieldName)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify if exists the Message-Type
|
||||||
|
*
|
||||||
|
* @param string $messageTypeUid Unique id of Message-Type
|
||||||
|
*
|
||||||
|
* return bool Return true if exists the Message-Type, false otherwise
|
||||||
|
*/
|
||||||
|
public function exists($messageTypeUid)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$obj = \MessageTypePeer::retrieveByPK($messageTypeUid);
|
||||||
|
|
||||||
|
return (!is_null($obj))? true : false;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify if exists the Name of a Message-Type
|
||||||
|
*
|
||||||
|
* @param string $projectUid Unique id of Project
|
||||||
|
* @param string $messageTypeName Name
|
||||||
|
* @param string $messageTypeUidToExclude Unique id of Message to exclude
|
||||||
|
*
|
||||||
|
* return bool Return true if exists the Name of a Message-Type, false otherwise
|
||||||
|
*/
|
||||||
|
public function existsName($projectUid, $messageTypeName, $messageTypeUidToExclude = "")
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$criteria = $this->getMessageTypeCriteria();
|
||||||
|
|
||||||
|
if ($messageTypeUidToExclude != "") {
|
||||||
|
$criteria->add(\MessageTypePeer::MSGT_UID, $messageTypeUidToExclude, \Criteria::NOT_EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->add(\MessageTypePeer::PRJ_UID, $projectUid, \Criteria::EQUAL);
|
||||||
|
$criteria->add(\MessageTypePeer::MSGT_NAME, $messageTypeName, \Criteria::EQUAL);
|
||||||
|
|
||||||
|
//QUERY
|
||||||
|
$rsCriteria = \MessageTypePeer::doSelectRS($criteria);
|
||||||
|
|
||||||
|
return ($rsCriteria->next())? true : false;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function throwExceptionCheckIfThereIsRepeatedVariableName(array $arrayDataVariables)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$i = 0;
|
||||||
|
$arrayDataVarAux = $arrayDataVariables;
|
||||||
|
|
||||||
|
while ($i <= count($arrayDataVariables) - 1) {
|
||||||
|
if (array_key_exists("MSGTV_NAME", $arrayDataVariables[$i])) {
|
||||||
|
$msgtvNameAux = $arrayDataVariables[$i]["MSGTV_NAME"];
|
||||||
|
$counter = 0;
|
||||||
|
|
||||||
|
foreach ($arrayDataVarAux as $key => $value) {
|
||||||
|
if ($value["MSGTV_NAME"] == $msgtvNameAux) {
|
||||||
|
$counter = $counter + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($counter > 1) {
|
||||||
|
throw new \Exception(\G::LoadTranslation("ID_MESSAGE_TYPE_NAME_VARIABLE_EXISTS", array($value["MSGTV_NAME"])));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$i = $i + 1;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify if exists the Name of a Message-Type
|
||||||
|
*
|
||||||
|
* @param string $projectUid Unique id of Project
|
||||||
|
* @param string $messageTypeName Name
|
||||||
|
* @param string $fieldNameForException Field name for the exception
|
||||||
|
* @param string $messageTypeUidToExclude Unique id of Message-Type to exclude
|
||||||
|
*
|
||||||
|
* return void Throw exception if exists the title of a Message-Type
|
||||||
|
*/
|
||||||
|
public function throwExceptionIfExistsName($projectUid, $messageTypeName, $fieldNameForException, $messageTypeUidToExclude = "")
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if ($this->existsName($projectUid, $messageTypeName, $messageTypeUidToExclude)) {
|
||||||
|
throw new \Exception(\G::LoadTranslation("ID_MESSAGE_TYPE_NAME_ALREADY_EXISTS", array($fieldNameForException, $messageTypeName)));
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate the data if they are invalid (INSERT and UPDATE)
|
||||||
|
*
|
||||||
|
* @param string $messageTypeUid Unique id of Message-Type
|
||||||
|
* @param string $projectUid Unique id of Project
|
||||||
|
* @param array $arrayData Data
|
||||||
|
*
|
||||||
|
* return void Throw exception if data has an invalid value
|
||||||
|
*/
|
||||||
|
public function throwExceptionIfDataIsInvalid($messageTypeUid, $projectUid, array $arrayData)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//Set variables
|
||||||
|
$arrayMessageTypeData = ($messageTypeUid == "")? array() : $this->getMessageType($messageTypeUid, true);
|
||||||
|
$flagInsert = ($messageTypeUid == "")? true : false;
|
||||||
|
|
||||||
|
$arrayFinalData = array_merge($arrayMessageTypeData, $arrayData);
|
||||||
|
|
||||||
|
//Verify data - Field definition
|
||||||
|
$process = new \ProcessMaker\BusinessModel\Process();
|
||||||
|
|
||||||
|
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, $flagInsert);
|
||||||
|
|
||||||
|
//Verify data
|
||||||
|
if (isset($arrayData["MSGT_NAME"])) {
|
||||||
|
$this->throwExceptionIfExistsName($projectUid, $arrayData["MSGT_NAME"], $this->arrayFieldNameForException["messageTypeName"], $messageTypeUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($arrayData["MSGT_VARIABLES"]) && count($arrayData["MSGT_VARIABLES"]) > 0) {
|
||||||
|
$this->throwExceptionCheckIfThereIsRepeatedVariableName($arrayData["MSGT_VARIABLES"]);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify if does not exist the Message-Type
|
||||||
|
*
|
||||||
|
* @param string $messageTypeUid Unique id of Message-Type
|
||||||
|
* @param string $fieldNameForException Field name for the exception
|
||||||
|
*
|
||||||
|
* return void Throw exception if does not exist the Message-Type
|
||||||
|
*/
|
||||||
|
public function throwExceptionIfNotExistsMessageType($messageTypeUid, $fieldNameForException)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$obj = \MessageTypePeer::retrieveByPK($messageTypeUid);
|
||||||
|
|
||||||
|
if (!$this->exists($messageTypeUid)) {
|
||||||
|
throw new \Exception(\G::LoadTranslation("ID_MESSAGE_TYPE_DOES_NOT_EXIST", array($fieldNameForException, $messageTypeUid)));
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Message-Type
|
||||||
|
*
|
||||||
|
* @param string $projectUid Unique id of Project
|
||||||
|
* @param array $arrayData Data
|
||||||
|
*
|
||||||
|
* return array Return data of the new Message-Type created
|
||||||
|
*/
|
||||||
|
public function create($projectUid, array $arrayData)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//Verify data
|
||||||
|
$process = new \ProcessMaker\BusinessModel\Process();
|
||||||
|
$validator = new \ProcessMaker\BusinessModel\Validator();
|
||||||
|
|
||||||
|
$validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
|
||||||
|
$validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
|
||||||
|
|
||||||
|
//Set data
|
||||||
|
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||||
|
|
||||||
|
if (isset($arrayData["MSGT_VARIABLES"]) && is_array($arrayData["MSGT_VARIABLES"])) {
|
||||||
|
foreach ($arrayData["MSGT_VARIABLES"] as $key => $value) {
|
||||||
|
$arrayData["MSGT_VARIABLES"][$key] = array_change_key_case($value, CASE_UPPER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($arrayData["MSGT_UID"]);
|
||||||
|
unset($arrayData["PRJ_UID"]);
|
||||||
|
|
||||||
|
$process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]);
|
||||||
|
|
||||||
|
$this->throwExceptionIfDataIsInvalid("", $projectUid, $arrayData);
|
||||||
|
|
||||||
|
//Create
|
||||||
|
$cnn = \Propel::getConnection("workflow");
|
||||||
|
|
||||||
|
try {
|
||||||
|
$messageType = new \MessageType();
|
||||||
|
|
||||||
|
$messageType->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
|
$messageTypeUid = \ProcessMaker\Util\Common::generateUID();
|
||||||
|
|
||||||
|
$messageType->setMsgtUid($messageTypeUid);
|
||||||
|
$messageType->setPrjUid($projectUid);
|
||||||
|
|
||||||
|
if ($messageType->validate()) {
|
||||||
|
$cnn->begin();
|
||||||
|
|
||||||
|
$result = $messageType->save();
|
||||||
|
|
||||||
|
$cnn->commit();
|
||||||
|
|
||||||
|
if (isset($arrayData["MSGT_VARIABLES"]) && count($arrayData["MSGT_VARIABLES"]) > 0) {
|
||||||
|
$variable = new \ProcessMaker\BusinessModel\MessageType\Variable();
|
||||||
|
$variable->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||||
|
|
||||||
|
foreach ($arrayData["MSGT_VARIABLES"] as $key => $value) {
|
||||||
|
$arrayVariable = $value;
|
||||||
|
|
||||||
|
$arrayResult = $variable->create($messageTypeUid, $arrayVariable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Return
|
||||||
|
return $this->getMessageType($messageTypeUid);
|
||||||
|
} else {
|
||||||
|
$msg = "";
|
||||||
|
|
||||||
|
foreach ($messageType->getValidationFailures() as $validationFailure) {
|
||||||
|
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$cnn->rollback();
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Single create Message-Type
|
||||||
|
*
|
||||||
|
* @param array $arrayData Data
|
||||||
|
*
|
||||||
|
* return int Return integer
|
||||||
|
*/
|
||||||
|
public function singleCreate(array $arrayData)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$cnn = \Propel::getConnection("workflow");
|
||||||
|
|
||||||
|
try {
|
||||||
|
$messageType = new \MessageType();
|
||||||
|
|
||||||
|
$messageType->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
|
if ($messageType->validate()) {
|
||||||
|
$cnn->begin();
|
||||||
|
|
||||||
|
$result = $messageType->save();
|
||||||
|
|
||||||
|
$cnn->commit();
|
||||||
|
|
||||||
|
//Return
|
||||||
|
return $result;
|
||||||
|
} else {
|
||||||
|
$msg = "";
|
||||||
|
|
||||||
|
foreach ($messageType->getValidationFailures() as $validationFailure) {
|
||||||
|
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$cnn->rollback();
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update Message-Type
|
||||||
|
*
|
||||||
|
* @param string $messageTypeUid Unique id of Message-Type
|
||||||
|
* @param array $arrayData Data
|
||||||
|
*
|
||||||
|
* return array Return data of the Message-Type updated
|
||||||
|
*/
|
||||||
|
public function update($messageTypeUid, $arrayData)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//Verify data
|
||||||
|
$process = new \ProcessMaker\BusinessModel\Process();
|
||||||
|
$validator = new \ProcessMaker\BusinessModel\Validator();
|
||||||
|
|
||||||
|
$validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
|
||||||
|
$validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
|
||||||
|
|
||||||
|
//Set data
|
||||||
|
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||||
|
$arrayDataBackup = $arrayData;
|
||||||
|
|
||||||
|
unset($arrayData["MSGT_UID"]);
|
||||||
|
unset($arrayData["PRJ_UID"]);
|
||||||
|
|
||||||
|
if (isset($arrayData["MSGT_VARIABLES"]) && is_array($arrayData["MSGT_VARIABLES"])) {
|
||||||
|
foreach ($arrayData["MSGT_VARIABLES"] as $key => $value) {
|
||||||
|
$arrayData["MSGT_VARIABLES"][$key] = array_change_key_case($value, CASE_UPPER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Set variables
|
||||||
|
$arrayMessageTypeData = $this->getMessageType($messageTypeUid, true);
|
||||||
|
|
||||||
|
//Verify data
|
||||||
|
$this->throwExceptionIfNotExistsMessageType($messageTypeUid, $this->arrayFieldNameForException["messageTypeUid"]);
|
||||||
|
|
||||||
|
$this->throwExceptionIfDataIsInvalid($messageTypeUid, $arrayMessageTypeData["PRJ_UID"], $arrayData);
|
||||||
|
|
||||||
|
//Update
|
||||||
|
$cnn = \Propel::getConnection("workflow");
|
||||||
|
|
||||||
|
try {
|
||||||
|
$messageType = \MessageTypePeer::retrieveByPK($messageTypeUid);
|
||||||
|
$messageType->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
|
if ($messageType->validate()) {
|
||||||
|
$cnn->begin();
|
||||||
|
|
||||||
|
$result = $messageType->save();
|
||||||
|
|
||||||
|
$cnn->commit();
|
||||||
|
|
||||||
|
//----- *****
|
||||||
|
$variable = new \ProcessMaker\BusinessModel\MessageType\Variable();
|
||||||
|
$variable->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||||
|
|
||||||
|
$criteria = new \Criteria("workflow");
|
||||||
|
|
||||||
|
$criteria->add(\MessageTypeVariablePeer::MSGT_UID, $messageTypeUid, \Criteria::EQUAL);
|
||||||
|
|
||||||
|
\MessageTypeVariablePeer::doDelete($criteria);
|
||||||
|
|
||||||
|
if (isset($arrayData["MSGT_VARIABLES"]) && count($arrayData["MSGT_VARIABLES"]) > 0) {
|
||||||
|
$variable = new \ProcessMaker\BusinessModel\MessageType\Variable();
|
||||||
|
$variable->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||||
|
|
||||||
|
foreach ($arrayData["MSGT_VARIABLES"] as $key => $value) {
|
||||||
|
$arrayVariable = $value;
|
||||||
|
|
||||||
|
$arrayResult = $variable->create($messageTypeUid, $arrayVariable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----- *****
|
||||||
|
|
||||||
|
//Return
|
||||||
|
$arrayData = $arrayDataBackup;
|
||||||
|
|
||||||
|
if (!$this->formatFieldNameInUppercase) {
|
||||||
|
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arrayData;
|
||||||
|
} else {
|
||||||
|
$msg = "";
|
||||||
|
|
||||||
|
foreach ($messageType->getValidationFailures() as $validationFailure) {
|
||||||
|
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \Exception(\G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . (($msg != "")? "\n" . $msg : ""));
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$cnn->rollback();
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete Message-Type
|
||||||
|
*
|
||||||
|
* @param string $messageTypeUid Unique id of Message-Type
|
||||||
|
*
|
||||||
|
* return void
|
||||||
|
*/
|
||||||
|
public function delete($messageTypeUid)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->throwExceptionIfNotExistsMessageType($messageTypeUid, $this->arrayFieldNameForException["messageTypeUid"]);
|
||||||
|
|
||||||
|
//Delete Message-Type-Variable
|
||||||
|
$criteria = new \Criteria("workflow");
|
||||||
|
|
||||||
|
$criteria->add(\MessageTypeVariablePeer::MSGT_UID, $messageTypeUid, \Criteria::EQUAL);
|
||||||
|
|
||||||
|
\MessageTypeVariablePeer::doDelete($criteria);
|
||||||
|
|
||||||
|
//Delete Message-Type
|
||||||
|
$criteria = $this->getMessageTypeCriteria();
|
||||||
|
|
||||||
|
$criteria->add(\MessageTypePeer::MSGT_UID, $messageTypeUid, \Criteria::EQUAL);
|
||||||
|
|
||||||
|
\MessageTypePeer::doDelete($criteria);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get criteria for Message-Type
|
||||||
|
*
|
||||||
|
* return object
|
||||||
|
*/
|
||||||
|
public function getMessageTypeCriteria()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$criteria = new \Criteria("workflow");
|
||||||
|
|
||||||
|
$criteria->addSelectColumn(\MessageTypePeer::MSGT_UID);
|
||||||
|
$criteria->addSelectColumn(\MessageTypePeer::PRJ_UID);
|
||||||
|
$criteria->addSelectColumn(\MessageTypePeer::MSGT_NAME);
|
||||||
|
|
||||||
|
return $criteria;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get data of a from a record
|
||||||
|
*
|
||||||
|
* @param array $record Record
|
||||||
|
*
|
||||||
|
* return array Return an array with data Message-Type
|
||||||
|
*/
|
||||||
|
public function getMessageTypeDataFromRecord(array $record)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return array(
|
||||||
|
$this->getFieldNameByFormatFieldName("MSGT_UID") => $record["MSGT_UID"],
|
||||||
|
$this->getFieldNameByFormatFieldName("MSGT_NAME") => $record["MSGT_NAME"],
|
||||||
|
$this->getFieldNameByFormatFieldName("MSGT_VARIABLES") => $record["MSGT_VARIABLES"]
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all Message-Type
|
||||||
|
*
|
||||||
|
* @param string $projectUid {@min 32}{@max 32}
|
||||||
|
* @param array $arrayFilterData Data of the filters
|
||||||
|
* @param string $sortField Field name to sort
|
||||||
|
* @param string $sortDir Direction of sorting (ASC, DESC)
|
||||||
|
* @param int $start Start
|
||||||
|
* @param int $limit Limit
|
||||||
|
*
|
||||||
|
* return array Return an array with all Message
|
||||||
|
*/
|
||||||
|
public function getMessageTypes($projectUid, $arrayFilterData = null, $sortField = null, $sortDir = null, $start = null, $limit = null)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$arrayMessage = array();
|
||||||
|
|
||||||
|
//Verify data
|
||||||
|
$process = new \ProcessMaker\BusinessModel\Process();
|
||||||
|
|
||||||
|
$process->throwExceptionIfNotExistsProcess($projectUid, $this->arrayFieldNameForException["projectUid"]);
|
||||||
|
|
||||||
|
$process->throwExceptionIfDataNotMetPagerVarDefinition(array("start" => $start, "limit" => $limit), $this->arrayFieldNameForException);
|
||||||
|
|
||||||
|
//Get data
|
||||||
|
if (!is_null($limit) && $limit . "" == "0") {
|
||||||
|
return $arrayMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
//SQL
|
||||||
|
$criteria = $this->getMessageTypeCriteria();
|
||||||
|
$criteria->add(\MessageTypePeer::PRJ_UID, $projectUid, \Criteria::EQUAL);
|
||||||
|
|
||||||
|
if (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData["filter"]) && trim($arrayFilterData["filter"]) != "") {
|
||||||
|
$criteria->add(
|
||||||
|
$criteria->getNewCriterion(\MessageTypePeer::MSGT_NAME, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Number records total
|
||||||
|
$criteriaCount = clone $criteria;
|
||||||
|
|
||||||
|
$criteriaCount->clearSelectColumns();
|
||||||
|
$criteriaCount->addSelectColumn("COUNT(" . \MessageTypePeer::MSGT_UID . ") AS NUM_REC");
|
||||||
|
|
||||||
|
$rsCriteriaCount = \MessageTypePeer::doSelectRS($criteriaCount);
|
||||||
|
$rsCriteriaCount->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
$rsCriteriaCount->next();
|
||||||
|
$row = $rsCriteriaCount->getRow();
|
||||||
|
|
||||||
|
$numRecTotal = $row["NUM_REC"];
|
||||||
|
|
||||||
|
//SQL
|
||||||
|
if (!is_null($sortField) && trim($sortField) != "") {
|
||||||
|
$sortField = strtoupper($sortField);
|
||||||
|
|
||||||
|
if (in_array($sortField, array("MSGT_NAME"))) {
|
||||||
|
$sortField = \MessageTypePeer::TABLE_NAME . "." . $sortField;
|
||||||
|
} else {
|
||||||
|
$sortField = \MessageTypePeer::MSGT_NAME;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$sortField = \MessageTypePeer::MSGT_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_null($sortDir) && trim($sortDir) != "" && strtoupper($sortDir) == "DESC") {
|
||||||
|
$criteria->addDescendingOrderByColumn($sortField);
|
||||||
|
} else {
|
||||||
|
$criteria->addAscendingOrderByColumn($sortField);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_null($start)) {
|
||||||
|
$criteria->setOffset((int)($start));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_null($limit)) {
|
||||||
|
$criteria->setLimit((int)($limit));
|
||||||
|
}
|
||||||
|
|
||||||
|
$rsCriteria = \MessageTypePeer::doSelectRS($criteria);
|
||||||
|
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
while ($rsCriteria->next()) {
|
||||||
|
$row = $rsCriteria->getRow();
|
||||||
|
|
||||||
|
$arrayVariable = array();
|
||||||
|
|
||||||
|
$variable = new \ProcessMaker\BusinessModel\MessageType\Variable();
|
||||||
|
$variable->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||||
|
|
||||||
|
$criteriaMessageTypeVariable = $variable->getMessageTypeVariableCriteria();
|
||||||
|
$criteriaMessageTypeVariable->add(\MessageTypeVariablePeer::MSGT_UID, $row["MSGT_UID"], \Criteria::EQUAL);
|
||||||
|
|
||||||
|
$rsCriteriaMessageTypeVariable = \MessageTypeVariablePeer::doSelectRS($criteriaMessageTypeVariable);
|
||||||
|
$rsCriteriaMessageTypeVariable->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
while ($rsCriteriaMessageTypeVariable->next()) {
|
||||||
|
$row2 = $rsCriteriaMessageTypeVariable->getRow();
|
||||||
|
|
||||||
|
$arrayVariable[] = $variable->getMessageTypeVariableDataFromRecord($row2, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
$row["MSGT_VARIABLES"] = $arrayVariable;
|
||||||
|
|
||||||
|
$arrayMessage[] = $this->getMessageTypeDataFromRecord($row);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Return
|
||||||
|
return array(
|
||||||
|
"total" => $numRecTotal,
|
||||||
|
"start" => (int)((!is_null($start))? $start : 0),
|
||||||
|
"limit" => (int)((!is_null($limit))? $limit : 0),
|
||||||
|
"filter" => (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData["filter"]))? $arrayFilterData["filter"] : "",
|
||||||
|
"data" => $arrayMessage
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get data of a Message-Type
|
||||||
|
*
|
||||||
|
* @param string $messageTypeUid Unique id of Message-Type
|
||||||
|
* @param bool $flagGetRecord Value that set the getting
|
||||||
|
*
|
||||||
|
* return array Return an array with data of a Message-Type
|
||||||
|
*/
|
||||||
|
public function getMessageType($messageTypeUid, $flagGetRecord = false)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//Verify data
|
||||||
|
$this->throwExceptionIfNotExistsMessageType($messageTypeUid, $this->arrayFieldNameForException["messageTypeUid"]);
|
||||||
|
|
||||||
|
//Get data
|
||||||
|
//SQL
|
||||||
|
$criteria = $this->getMessageTypeCriteria();
|
||||||
|
|
||||||
|
$criteria->add(\MessageTypePeer::MSGT_UID, $messageTypeUid, \Criteria::EQUAL);
|
||||||
|
|
||||||
|
$rsCriteria = \MessageTypePeer::doSelectRS($criteria);
|
||||||
|
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
$rsCriteria->next();
|
||||||
|
|
||||||
|
$row = $rsCriteria->getRow();
|
||||||
|
|
||||||
|
//Variable
|
||||||
|
$arrayVariable = array();
|
||||||
|
|
||||||
|
$variable = new \ProcessMaker\BusinessModel\MessageType\Variable();
|
||||||
|
$variable->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||||
|
|
||||||
|
$criteriaMessageTypeVariable = $variable->getMessageTypeVariableCriteria();
|
||||||
|
$criteriaMessageTypeVariable->add(\MessageTypeVariablePeer::MSGT_UID, $messageTypeUid, \Criteria::EQUAL);
|
||||||
|
|
||||||
|
$rsCriteriaMessageTypeVariable = \MessageTypeVariablePeer::doSelectRS($criteriaMessageTypeVariable);
|
||||||
|
$rsCriteriaMessageTypeVariable->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
while ($rsCriteriaMessageTypeVariable->next()) {
|
||||||
|
$row2 = $rsCriteriaMessageTypeVariable->getRow();
|
||||||
|
|
||||||
|
if (!$flagGetRecord) {
|
||||||
|
$arrayVariable[] = $variable->getMessageTypeVariableDataFromRecord($row2, false);
|
||||||
|
} else {
|
||||||
|
unset($row2["MSGTV_UID"]);
|
||||||
|
|
||||||
|
$arrayVariable[] = $row2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$row["MSGT_VARIABLES"] = $arrayVariable;
|
||||||
|
|
||||||
|
//Return
|
||||||
|
return (!$flagGetRecord)? $this->getMessageTypeDataFromRecord($row) : $row;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,598 @@
|
|||||||
|
<?php
|
||||||
|
namespace ProcessMaker\BusinessModel\MessageType;
|
||||||
|
|
||||||
|
class Variable
|
||||||
|
{
|
||||||
|
private $arrayFieldDefinition = array(
|
||||||
|
"MSGTV_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "messageTypeVariableUid"),
|
||||||
|
"MSGT_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "messageTypeUid"),
|
||||||
|
"MSGTV_NAME" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "messageTypeVariableName"),
|
||||||
|
"MSGTV_DEFAULT_VALUE" => array("type" => "string", "required" => false, "empty" => true, "defaultValues" => array(), "fieldNameAux" => "messageTypeVariableDefaultValue")
|
||||||
|
);
|
||||||
|
|
||||||
|
private $formatFieldNameInUppercase = true;
|
||||||
|
|
||||||
|
private $arrayFieldNameForException = array(
|
||||||
|
"start" => "START",
|
||||||
|
"limit" => "LIMIT"
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor of the class
|
||||||
|
*
|
||||||
|
* return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
foreach ($this->arrayFieldDefinition as $key => $value) {
|
||||||
|
$this->arrayFieldNameForException[$value["fieldNameAux"]] = $key;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the format of the fields name (uppercase, lowercase)
|
||||||
|
*
|
||||||
|
* @param bool $flag Value that set the format
|
||||||
|
*
|
||||||
|
* return void
|
||||||
|
*/
|
||||||
|
public function setFormatFieldNameInUppercase($flag)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->formatFieldNameInUppercase = $flag;
|
||||||
|
|
||||||
|
$this->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set exception messages for fields
|
||||||
|
*
|
||||||
|
* @param array $arrayData Data with the fields
|
||||||
|
*
|
||||||
|
* return void
|
||||||
|
*/
|
||||||
|
public function setArrayFieldNameForException(array $arrayData)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
foreach ($arrayData as $key => $value) {
|
||||||
|
$this->arrayFieldNameForException[$key] = $this->getFieldNameByFormatFieldName($value);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the field according to the format
|
||||||
|
*
|
||||||
|
* @param string $fieldName Field name
|
||||||
|
*
|
||||||
|
* return string Return the field name according the format
|
||||||
|
*/
|
||||||
|
public function getFieldNameByFormatFieldName($fieldName)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify if exists the Message-Type-Variable
|
||||||
|
*
|
||||||
|
* @param string $messageTypeVariableUid Unique id of Message-Type-Variable
|
||||||
|
*
|
||||||
|
* return bool Return true if exists the Message-Type-Variable, false otherwise
|
||||||
|
*/
|
||||||
|
public function exists($messageTypeVariableUid)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$obj = \MessageTypeVariablePeer::retrieveByPK($messageTypeVariableUid);
|
||||||
|
|
||||||
|
return (!is_null($obj))? true : false;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify if exists the Name of a Message-Type-Variable
|
||||||
|
*
|
||||||
|
* @param string $messageTypeUid Unique id of Project
|
||||||
|
* @param string $messageTypeVariableName Name
|
||||||
|
* @param string $messageTypeVariableUidToExclude Unique id of Message-Type-Variable to exclude
|
||||||
|
*
|
||||||
|
* return bool Return true if exists the Name of a Message-Type-Variable, false otherwise
|
||||||
|
*/
|
||||||
|
public function existsName($messageTypeUid, $messageTypeVariableName, $messageTypeVariableUidToExclude = "")
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$criteria = $this->getMessageTypeVariableCriteria();
|
||||||
|
|
||||||
|
if ($messageTypeVariableUidToExclude != "") {
|
||||||
|
$criteria->add(\MessageTypeVariablePeer::MSGTV_UID, $messageTypeVariableUidToExclude, \Criteria::NOT_EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->add(\MessageTypeVariablePeer::MSGT_UID, $messageTypeUid, \Criteria::EQUAL);
|
||||||
|
$criteria->add(\MessageTypeVariablePeer::MSGTV_NAME, $messageTypeVariableName, \Criteria::EQUAL);
|
||||||
|
|
||||||
|
//QUERY
|
||||||
|
$rsCriteria = \MessageTypeVariablePeer::doSelectRS($criteria);
|
||||||
|
|
||||||
|
return ($rsCriteria->next())? true : false;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify if exists the Name of a Message-Type-Variable
|
||||||
|
*
|
||||||
|
* @param string $messageTypeUid Unique id of Project
|
||||||
|
* @param string $messageTypeVariableName Name
|
||||||
|
* @param string $fieldNameForException Field name for the exception
|
||||||
|
* @param string $messageTypeVariableUidToExclude Unique id of Message to exclude
|
||||||
|
*
|
||||||
|
* return void Throw exception if exists the Name of a Message-Type-Variable
|
||||||
|
*/
|
||||||
|
public function throwExceptionIfExistsName($messageTypeUid, $messageTypeVariableName, $fieldNameForException, $messageTypeVariableUidToExclude = "")
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if ($this->existsName($messageTypeUid, $messageTypeVariableName, $messageTypeVariableUidToExclude)) {
|
||||||
|
throw new \Exception(\G::LoadTranslation("ID_MESSAGE_TYPE_VARIABLE_NAME_ALREADY_EXISTS", array($fieldNameForException, $messageTypeVariableName)));
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Validate the data if they are invalid (INSERT and UPDATE)
|
||||||
|
*
|
||||||
|
* @param string $messageTypeVariableUid Unique id of Message-Type-Variable
|
||||||
|
* @param string $messageTypeUid Unique id of Project
|
||||||
|
* @param array $arrayData Data
|
||||||
|
*
|
||||||
|
* return void Throw exception if data has an invalid value
|
||||||
|
*/
|
||||||
|
public function throwExceptionIfDataIsInvalid($messageTypeVariableUid, $messageTypeUid, array $arrayData)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//Set variables
|
||||||
|
$arrayMsgTypeVarData = ($messageTypeVariableUid == "")? array() : $this->getMessageTypeVariable($messageTypeVariableUid, true);
|
||||||
|
$flagInsert = ($messageTypeVariableUid == "")? true : false;
|
||||||
|
|
||||||
|
$arrayFinalData = array_merge($arrayMsgTypeVarData, $arrayData);
|
||||||
|
|
||||||
|
//Verify data - Field definition
|
||||||
|
$process = new \ProcessMaker\BusinessModel\Process();
|
||||||
|
|
||||||
|
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, $flagInsert);
|
||||||
|
|
||||||
|
//Verify data
|
||||||
|
if (isset($arrayData["MSGTV_NAME"])) {
|
||||||
|
$this->throwExceptionIfExistsName($messageTypeUid, $arrayData["MSGTV_NAME"], $this->arrayFieldNameForException["messageTypeVariableName"], $messageTypeVariableUid);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify if does not exist the Message-Type-Variable
|
||||||
|
*
|
||||||
|
* @param string $messageTypeVariableUid Unique id of Message-Type-Variable
|
||||||
|
* @param string $fieldNameForException Field name for the exception
|
||||||
|
*
|
||||||
|
* return void Throw exception if does not exist the Message-Type-Variable
|
||||||
|
*/
|
||||||
|
public function throwExceptionIfNotExistsMessageTypeVariable($messageTypeVariableUid, $fieldNameForException)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (!$this->exists($messageTypeVariableUid)) {
|
||||||
|
throw new \Exception(\G::LoadTranslation("ID_MESSAGE_TYPE_VARIABLE_DOES_NOT_EXIST", array($fieldNameForException, $messageTypeVariableUid)));
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Variable
|
||||||
|
*
|
||||||
|
* @param string $messageUid Unique id of Project
|
||||||
|
* @param array $arrayData Data
|
||||||
|
*
|
||||||
|
* return array Return data of the new Message created
|
||||||
|
*/
|
||||||
|
public function create($messageTypeUid, array $arrayData)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//Verify data
|
||||||
|
$validator = new \ProcessMaker\BusinessModel\Validator();
|
||||||
|
$messageType = new \ProcessMaker\BusinessModel\MessageType();
|
||||||
|
|
||||||
|
$validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
|
||||||
|
$validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
|
||||||
|
|
||||||
|
//Set data
|
||||||
|
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||||
|
|
||||||
|
unset($arrayData["MSGTV_UID"]);
|
||||||
|
unset($arrayData["MSGT_UID"]);
|
||||||
|
|
||||||
|
//Verify data
|
||||||
|
$messageType->throwExceptionIfNotExistsMessageType($messageTypeUid, $this->arrayFieldNameForException["messageTypeUid"]);
|
||||||
|
|
||||||
|
$this->throwExceptionIfDataIsInvalid("", $messageTypeUid, $arrayData);
|
||||||
|
|
||||||
|
//Create
|
||||||
|
$cnn = \Propel::getConnection("workflow");
|
||||||
|
|
||||||
|
try {
|
||||||
|
$messageTypeVariable = new \MessageTypeVariable();
|
||||||
|
|
||||||
|
$messageTypeVariable->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
|
$messageTypeVariableUid = \ProcessMaker\Util\Common::generateUID();
|
||||||
|
|
||||||
|
$messageTypeVariable->setMsgtvUid($messageTypeVariableUid);
|
||||||
|
$messageTypeVariable->setMsgtUid($messageTypeUid);
|
||||||
|
|
||||||
|
if ($messageTypeVariable->validate()) {
|
||||||
|
$cnn->begin();
|
||||||
|
|
||||||
|
$result = $messageTypeVariable->save();
|
||||||
|
|
||||||
|
$cnn->commit();
|
||||||
|
|
||||||
|
//Return
|
||||||
|
return $this->getMessageTypeVariable($messageTypeVariableUid);
|
||||||
|
} else {
|
||||||
|
$msg = "";
|
||||||
|
|
||||||
|
foreach ($messageTypeVariable->getValidationFailures() as $validationFailure) {
|
||||||
|
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$cnn->rollback();
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Single create Message-Type-Variable
|
||||||
|
*
|
||||||
|
* @param array $arrayData Data
|
||||||
|
*
|
||||||
|
* return int Return integer
|
||||||
|
*/
|
||||||
|
public function singleCreate(array $arrayData)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$cnn = \Propel::getConnection("workflow");
|
||||||
|
|
||||||
|
try {
|
||||||
|
$messageTypeVariable = new \MessageTypeVariable();
|
||||||
|
|
||||||
|
$messageTypeVariable->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
|
if ($messageTypeVariable->validate()) {
|
||||||
|
$cnn->begin();
|
||||||
|
|
||||||
|
$result = $messageTypeVariable->save();
|
||||||
|
|
||||||
|
$cnn->commit();
|
||||||
|
|
||||||
|
//Return
|
||||||
|
return $result;
|
||||||
|
} else {
|
||||||
|
$msg = "";
|
||||||
|
|
||||||
|
foreach ($messageTypeVariable->getValidationFailures() as $validationFailure) {
|
||||||
|
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$cnn->rollback();
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update Message-Type-Variable
|
||||||
|
*
|
||||||
|
* @param string $messageTypeVariable Uid Unique id of Message-Type-Variable
|
||||||
|
* @param array $arrayData Data
|
||||||
|
*
|
||||||
|
* return array Return data of the Message-Type-Variable updated
|
||||||
|
*/
|
||||||
|
public function update($messageTypeVariableUid, array $arrayData)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//Verify data
|
||||||
|
$validator = new \ProcessMaker\BusinessModel\Validator();
|
||||||
|
|
||||||
|
$validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
|
||||||
|
$validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
|
||||||
|
|
||||||
|
//Set data
|
||||||
|
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||||
|
|
||||||
|
unset($arrayData["MSGTV_UID"]);
|
||||||
|
unset($arrayData["MSGT_UID"]);
|
||||||
|
|
||||||
|
//Set variables
|
||||||
|
$arrayMessageTypeVariableData = $this->getMessageTypeVariable($messageTypeVariableUid, true);
|
||||||
|
|
||||||
|
//Verify data
|
||||||
|
$this->throwExceptionIfNotExistsMessageTypeVariable($messageTypeVariableUid, $this->arrayFieldNameForException["messageTypeVariableUid"]);
|
||||||
|
|
||||||
|
$this->throwExceptionIfDataIsInvalid($messageTypeVariableUid, $arrayMessageTypeVariableData["MSGT_UID"], $arrayData);
|
||||||
|
|
||||||
|
//Update
|
||||||
|
$cnn = \Propel::getConnection("workflow");
|
||||||
|
|
||||||
|
try {
|
||||||
|
$messageTypeVariable = \MessageTypeVariablePeer::retrieveByPK($messageTypeVariableUid);
|
||||||
|
$messageTypeVariable->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
|
if ($messageTypeVariable->validate()) {
|
||||||
|
$cnn->begin();
|
||||||
|
|
||||||
|
$result = $messageTypeVariable->save();
|
||||||
|
|
||||||
|
$cnn->commit();
|
||||||
|
|
||||||
|
//Return
|
||||||
|
if (!$this->formatFieldNameInUppercase) {
|
||||||
|
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arrayData;
|
||||||
|
} else {
|
||||||
|
$msg = "";
|
||||||
|
|
||||||
|
foreach ($messageTypeVariable->getValidationFailures() as $validationFailure) {
|
||||||
|
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new \Exception(\G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . (($msg != "")? "\n" . $msg : ""));
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$cnn->rollback();
|
||||||
|
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete Message-Type-Variable
|
||||||
|
*
|
||||||
|
* @param string $messageTypeVariable Uid Unique id of Message-Type
|
||||||
|
*
|
||||||
|
* return void
|
||||||
|
*/
|
||||||
|
public function delete($messageTypeVariableUid)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->throwExceptionIfNotExistsMessageTypeVariable($messageTypeVariableUid, $this->arrayFieldNameForException["messageTypeVariableUid"]);
|
||||||
|
|
||||||
|
$criteria = $this->getMessageTypeVariableCriteria();
|
||||||
|
|
||||||
|
$criteria->add(\MessageTypeVariablePeer::MSGTV_UID, $messageTypeVariableUid, \Criteria::EQUAL);
|
||||||
|
|
||||||
|
\MessageTypeVariablePeer::doDelete($criteria);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get criteria for Message-Type-Variable
|
||||||
|
*
|
||||||
|
* return object
|
||||||
|
*/
|
||||||
|
public function getMessageTypeVariableCriteria()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$criteria = new \Criteria("workflow");
|
||||||
|
|
||||||
|
$criteria->addSelectColumn(\MessageTypeVariablePeer::MSGTV_UID);
|
||||||
|
$criteria->addSelectColumn(\MessageTypeVariablePeer::MSGT_UID);
|
||||||
|
$criteria->addSelectColumn(\MessageTypeVariablePeer::MSGTV_NAME);
|
||||||
|
$criteria->addSelectColumn(\MessageTypeVariablePeer::MSGTV_DEFAULT_VALUE);
|
||||||
|
|
||||||
|
return $criteria;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get data of a from a record
|
||||||
|
*
|
||||||
|
* @param array $record Record
|
||||||
|
*
|
||||||
|
* return array Return an array with data Message-Type-Variable
|
||||||
|
*/
|
||||||
|
public function getMessageTypeVariableDataFromRecord(array $record, $includeUid = true)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$arrayRecord = array();
|
||||||
|
|
||||||
|
if ($includeUid) {
|
||||||
|
$arrayRecord[$this->getFieldNameByFormatFieldName("MSGTV_UID")] = $record["MSGTV_UID"];
|
||||||
|
}
|
||||||
|
|
||||||
|
$arrayRecord[$this->getFieldNameByFormatFieldName("MSGTV_NAME")] = $record["MSGTV_NAME"];
|
||||||
|
$arrayRecord[$this->getFieldNameByFormatFieldName("MSGTV_DEFAULT_VALUE")] = $record["MSGTV_DEFAULT_VALUE"] . "";
|
||||||
|
|
||||||
|
return $arrayRecord;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all Message-Type-Variable
|
||||||
|
*
|
||||||
|
* @param string $messageTypeUid {@min 32}{@max 32}
|
||||||
|
* @param array $arrayFilterData Data of the filters
|
||||||
|
* @param string $sortField Field name to sort
|
||||||
|
* @param string $sortDir Direction of sorting (ASC, DESC)
|
||||||
|
* @param int $start Start
|
||||||
|
* @param int $limit Limit
|
||||||
|
*
|
||||||
|
* return array Return an array with all Message-Type-Variable
|
||||||
|
*/
|
||||||
|
public function getMessageTypeVariables($messageTypeUid, $arrayFilterData = null, $sortField = null, $sortDir = null, $start = null, $limit = null)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$arrayMessage = array();
|
||||||
|
|
||||||
|
//Verify data
|
||||||
|
$process = new \ProcessMaker\BusinessModel\Process();
|
||||||
|
$messageType = new \ProcessMaker\BusinessModel\MessageType();
|
||||||
|
|
||||||
|
$messageType->throwExceptionIfNotExistsMessageType($messageTypeUid, $this->arrayFieldNameForException["messageTypeUid"]);
|
||||||
|
|
||||||
|
$process->throwExceptionIfDataNotMetPagerVarDefinition(array("start" => $start, "limit" => $limit), $this->arrayFieldNameForException);
|
||||||
|
|
||||||
|
//Get data
|
||||||
|
if (!is_null($limit) && $limit . "" == "0") {
|
||||||
|
return $arrayMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
//SQL
|
||||||
|
$criteria = $this->getMessageTypeVariableCriteria();
|
||||||
|
$criteria->add(\MessageTypeVariablePeer::MSGT_UID, $messageTypeUid, \Criteria::EQUAL);
|
||||||
|
|
||||||
|
if (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData["filter"]) && trim($arrayFilterData["filter"]) != "") {
|
||||||
|
$criteria->add(
|
||||||
|
$criteria->getNewCriterion(\MessageTypeVariablePeer::MSGTV_NAME, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Number records total
|
||||||
|
$criteriaCount = clone $criteria;
|
||||||
|
|
||||||
|
$criteriaCount->clearSelectColumns();
|
||||||
|
$criteriaCount->addSelectColumn("COUNT(" . \MessageTypeVariablePeer::MSGTV_UID . ") AS NUM_REC");
|
||||||
|
|
||||||
|
$rsCriteriaCount = \MessageTypeVariablePeer::doSelectRS($criteriaCount);
|
||||||
|
$rsCriteriaCount->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
$rsCriteriaCount->next();
|
||||||
|
$row = $rsCriteriaCount->getRow();
|
||||||
|
|
||||||
|
$numRecTotal = $row["NUM_REC"];
|
||||||
|
|
||||||
|
//SQL
|
||||||
|
if (!is_null($sortField) && trim($sortField) != "") {
|
||||||
|
$sortField = strtoupper($sortField);
|
||||||
|
|
||||||
|
if (in_array($sortField, array("MSGTV_NAME"))) {
|
||||||
|
$sortField = \MessageTypeVariablePeer::TABLE_NAME . "." . $sortField;
|
||||||
|
} else {
|
||||||
|
$sortField = \MessageTypeVariablePeer::MSGTV_NAME;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$sortField = \MessageTypeVariablePeer::MSGTV_NAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_null($sortDir) && trim($sortDir) != "" && strtoupper($sortDir) == "DESC") {
|
||||||
|
$criteria->addDescendingOrderByColumn($sortField);
|
||||||
|
} else {
|
||||||
|
$criteria->addAscendingOrderByColumn($sortField);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_null($start)) {
|
||||||
|
$criteria->setOffset((int)($start));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_null($limit)) {
|
||||||
|
$criteria->setLimit((int)($limit));
|
||||||
|
}
|
||||||
|
|
||||||
|
$rsCriteria = \MessageTypeVariablePeer::doSelectRS($criteria);
|
||||||
|
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
while ($rsCriteria->next()) {
|
||||||
|
$row = $rsCriteria->getRow();
|
||||||
|
|
||||||
|
$arrayMessage[] = $this->getMessageTypeVariableDataFromRecord($row);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Return
|
||||||
|
return array(
|
||||||
|
"total" => $numRecTotal,
|
||||||
|
"start" => (int)((!is_null($start))? $start : 0),
|
||||||
|
"limit" => (int)((!is_null($limit))? $limit : 0),
|
||||||
|
"filter" => (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData["filter"]))? $arrayFilterData["filter"] : "",
|
||||||
|
"data" => $arrayMessage
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get data of a Message-Type-Variable
|
||||||
|
*
|
||||||
|
* @param string $messageTypeVariableUid Unique id of Message-Type-Variable
|
||||||
|
* @param bool $flagGetRecord Value that set the getting
|
||||||
|
*
|
||||||
|
* return array Return an array with data of a Message-Type-Variable
|
||||||
|
*/
|
||||||
|
public function getMessageTypeVariable($messageTypeVariableUid, $flagGetRecord = false)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//Verify data
|
||||||
|
$this->throwExceptionIfNotExistsMessageTypeVariable($messageTypeVariableUid, $this->arrayFieldNameForException["messageTypeVariableUid"]);
|
||||||
|
|
||||||
|
//Get data
|
||||||
|
//SQL
|
||||||
|
$criteria = $this->getMessageTypeVariableCriteria();
|
||||||
|
|
||||||
|
$criteria->add(\MessageTypeVariablePeer::MSGTV_UID, $messageTypeVariableUid, \Criteria::EQUAL);
|
||||||
|
|
||||||
|
$rsCriteria = \MessageTypeVariablePeer::doSelectRS($criteria);
|
||||||
|
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
$rsCriteria->next();
|
||||||
|
|
||||||
|
$row = $rsCriteria->getRow();
|
||||||
|
|
||||||
|
//Return
|
||||||
|
return (!$flagGetRecord)? $this->getMessageTypeVariableDataFromRecord($row) : $row;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -798,6 +798,23 @@ class Workflow extends Handler
|
|||||||
$webEntryEvent->delete($row["WEE_UID"]);
|
$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
|
//Delete the process
|
||||||
try {
|
try {
|
||||||
$oProcess->remove($sProcessUID);
|
$oProcess->remove($sProcessUID);
|
||||||
|
|||||||
@@ -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()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -36,8 +36,9 @@ debug = 1
|
|||||||
sub-process= "ProcessMaker\Services\Api\Project\SubProcess"
|
sub-process= "ProcessMaker\Services\Api\Project\SubProcess"
|
||||||
trigger-wizard = "ProcessMaker\Services\Api\Project\TriggerWizard"
|
trigger-wizard = "ProcessMaker\Services\Api\Project\TriggerWizard"
|
||||||
category = "ProcessMaker\Services\Api\ProcessCategory"
|
category = "ProcessMaker\Services\Api\ProcessCategory"
|
||||||
process-variable = "ProcessMaker\Services\Api\Project\Variable"
|
process-variable = "ProcessMaker\Services\Api\Project\Variable"
|
||||||
message = "ProcessMaker\Services\Api\Project\Message"
|
message-type = "ProcessMaker\Services\Api\Project\MessageType"
|
||||||
|
message-type-variable = "ProcessMaker\Services\Api\Project\MessageType\Variable"
|
||||||
web-entry-event = "ProcessMaker\Services\Api\Project\WebEntryEvent"
|
web-entry-event = "ProcessMaker\Services\Api\Project\WebEntryEvent"
|
||||||
|
|
||||||
[alias: projects]
|
[alias: projects]
|
||||||
|
|||||||
Reference in New Issue
Block a user