PM 940 "ProcessMaker-MA "Email Server (endpoints)"" SOLVED

> ProcessMaker-MA "Email Server (endpoints)"

  - Se han implementado los siguientes Endpoints:
	GET    /api/1.0/{workspace}/email/paged?filter={filter}&start={start}&limit={limit}
	GET    /api/1.0/{workspace}/emails?filter={filter}&start={start}&limit={limit}
	GET    /api/1.0/{workspace}/email/{mess_uid}
	POST   /api/1.0/{workspace}/email
	POST   /api/1.0/{workspace}/email/test-connection
	PUT    /api/1.0/{workspace}/email/{mess_uid}
	DELETE /api/1.0/{workspace}/email/{mess_uid}

  - Se esta creando un 1er registro en la tabla EMAIL_SERVER, esto al ejecutar el comando "./processmaker upgrade".
  - El metodo "System::getEmailConfiguration()" recupera el EMAIL_SERVER por default, caso contrario trabajara como lo
    hacia anteriormente.

Merge branch 'master' of bitbucket.org:colosa/processmaker into PM-940

Conflicts:
	workflow/engine/config/schema.xml
	workflow/engine/data/mysql/schema.sql
This commit is contained in:
Luis Fernando Saisa Lopez
2014-12-12 15:13:53 -04:00
32 changed files with 3572 additions and 44 deletions

View File

@@ -20,7 +20,7 @@ Scenario Outline: Get the case schedulers list when there are exactly case sched
| test_description | project | record |
| Get case scheduler of process Test Michelangelo | 1265557095225ff5c688f46031700471 | 0 |
| Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 2 |
| Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 1 |
Scenario Outline: Create any case scheduler for a project
@@ -110,7 +110,7 @@ Scenario: Create a new case scheduler with same name
And the response status message should have the following text "Duplicate"
Scenario Outline: Get the case schedulers list when there are exactly 16 after 18 case schedulers in each process
Scenario Outline: Get the case schedulers list when there are exactly 16 after 17 case schedulers in each process
Given I request "project/<project>/case-schedulers"
Then the response status code should be 200
And the response charset is "UTF-8"
@@ -122,7 +122,7 @@ Scenario Outline: Get the case schedulers list when there are exactly 16 after 1
| test_description | project | record |
| Get case scheduler of process Test Michelangelo | 1265557095225ff5c688f46031700471 | 16 |
| Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 18 |
| Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 17 |
Scenario Outline: Update the case schedulers for a project and then check if the values had changed

View File

@@ -152,7 +152,7 @@ Scenario: Delete a Project created previously in this script
Scenario Outline: Import a process
Given POST upload a project file "<project_file>" to "project/import?option=<import_option>&option_group=merge"
Then the response status code should be 200
Then the response status code should be 201
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "object"
@@ -426,7 +426,7 @@ Scenario: Get a list of projects
Scenario Outline: Import a process
Given POST upload a project file "<project_file>" to "project/import?option=<import_option>"
Then the response status code should be 200
Then the response status code should be 201
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "object"
@@ -455,7 +455,7 @@ Scenario: Delete a Project created previously in this script "Export process emp
Scenario: Import a process "Export process empty"
Given POST upload a project file "Export_process_empty.pmx" to "project/import?option=create"
Then the response status code should be 200
Then the response status code should be 201
And the response charset is "UTF-8"
And the content type is "application/json"
And the type is "object"

View File

@@ -149,7 +149,7 @@ abstract class FileSystem {
* by the given abstract pathname, or zero if it does not exist or some
* other I/O error occurs.
*/
function getBooleanAttributes($f) {
function getBooleanAttributes(&$f = null) {
throw new Exception("SYSTEM ERROR method getBooleanAttributes() not implemented by fs driver");
}

View File

@@ -191,7 +191,7 @@ class UnixFileSystem extends FileSystem {
/* -- most of the following is mapped to the php natives wrapped by FileSystem */
/* -- Attribute accessors -- */
function getBooleanAttributes(&$f) {
function getBooleanAttributes(&$f = null) {
//$rv = getBooleanAttributes0($f);
$name = $f->getName();
$hidden = (strlen($name) > 0) && ($name{0} == '.');

View File

@@ -986,11 +986,13 @@ class Cases
unset($Fields['APP_DESCRIPTION']);
}
if (isset($Fields["APP_STATUS"]) && $Fields["APP_STATUS"] == "COMPLETED") {
$Fields['USR_UID'] = $Fields['CURRENT_USER_UID'];
$listCompleted = new ListCompleted();
$listCompleted->create($Fields);
$listMyInbox = new ListMyInbox();
$listMyInbox->refresh($Fields);
if (isset($Fields['CURRENT_USER_UID'])) {
$Fields['USR_UID'] = $Fields['CURRENT_USER_UID'];
$listCompleted = new ListCompleted();
$listCompleted->create($Fields);
$listMyInbox = new ListMyInbox();
$listMyInbox->refresh($Fields);
}
}
$oApp->update($Fields);

View File

@@ -154,8 +154,9 @@ class dbConnections
$result = DbSourcePeer::doSelectRS( $c );
$result->next();
$row = $result->getRow();
while ($row = $result->getRow()) {
if (trim( $pProUid ) == trim( $row[1] )) {
if ((trim( $pProUid ) == trim( $row[1] )) && ($row[2] == 'mysql')) {
$connections[] = Array ('DBS_UID' => $row[0],'DBS_NAME' => '[' . $row[3] . '] ' . $row[2] . ': ' . $row[4]
);
}

View File

@@ -40,6 +40,7 @@ class PmTable
private $schemaFile = '';
private $tableName;
private $columns;
private $primaryKey= array();
private $baseDir = '';
private $targetDir = '';
private $configDir = '';
@@ -182,7 +183,7 @@ class PmTable
* Build the pmTable with all dependencies
*/
public function build ()
{
{
$this->prepare();
$this->preparePropelIniFile();
$this->buildSchema();
@@ -400,7 +401,7 @@ class PmTable
* Save the xml schema for propel
*/
public function saveSchema ()
{
{
$this->dom->save( $this->configDir . $this->schemaFilename );
}
@@ -671,8 +672,29 @@ class PmTable
$sql = "SELECT * FROM $tableBackup";
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
// array the primary keys
foreach($this->columns as $value) {
if ($value->field_key == 1) {
$this->primaryKey[] = $value->field_name;
}
}
$flagPrimaryKey = 1;
while ($rs->next()) {
$row = $rs->getRow();
if ($flagPrimaryKey) {
// verify row has all primary keys
$keys = 0;
foreach ($row as $colName => $value) {
if (in_array($colName,$this->primaryKey)){
$keys++;
}
}
if ($keys != count($this->primaryKey)) {
return $stmt->executeQuery(str_replace($table, $tableBackup, $queryStack["drop"]));
}
$flagPrimaryKey = 0;
}
$oTable = new $tableFileName();
$oTable->fromArray($row, BasePeer::TYPE_FIELDNAME);

View File

@@ -973,8 +973,7 @@ class System
$arrayEmailServerDefault = $emailServer->getEmailServerDefault();
if (count($arrayEmailServerDefault) > 0) {
//Return
return $arrayDataEmailServerConfig = array(
$arrayDataEmailServerConfig = array(
"MESS_ENGINE" => $arrayEmailServerDefault["MESS_ENGINE"],
"MESS_SERVER" => $arrayEmailServerDefault["MESS_SERVER"],
"MESS_PORT" => (int)($arrayEmailServerDefault["MESS_PORT"]),
@@ -993,6 +992,9 @@ class System
"MESS_EXECUTE_EVERY" => "",
"MESS_SEND_MAX" => ""
);
//Return
return $arrayDataEmailServerConfig;
} else {
G::LoadClass("configuration");

View File

@@ -517,13 +517,14 @@ class Dynaform extends BaseDynaform
return $G_FORM->fields;
}
public function verifyExistingName ($sName, $sProUid)
public function verifyExistingName ($sName, $sProUid, $sDynUid)
{
$sNameDyanform = urldecode( $sName );
$sProUid = urldecode( $sProUid );
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( DynaformPeer::DYN_UID );
$oCriteria->add( DynaformPeer::PRO_UID, $sProUid );
$oCriteria->add( DynaformPeer::DYN_UID, $sDynUid );
$oDataset = DynaformPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$flag = true;
@@ -532,14 +533,16 @@ class Dynaform extends BaseDynaform
$oCriteria1 = new Criteria( 'workflow' );
$oCriteria1->addSelectColumn( 'COUNT(*) AS DYNAFORMS' );
$oCriteria1->add( ContentPeer::CON_CATEGORY, 'DYN_TITLE' );
$oCriteria1->add( ContentPeer::CON_ID, $aRow['DYN_UID'] );
$oCriteria1->add( ContentPeer::CON_ID, $sDynUid, Criteria::NOT_EQUAL);
$oCriteria1->add( ContentPeer::CON_VALUE, $sNameDyanform );
$oCriteria1->add( ContentPeer::CON_LANG, SYS_LANG );
$oCriteria1->add( DynaformPeer::PRO_UID, $sProUid);
$oCriteria1->addJoin( ContentPeer::CON_ID, DynaformPeer::DYN_UID, Criteria::INNER_JOIN );
$oDataset1 = ContentPeer::doSelectRS( $oCriteria1 );
$oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset1->next();
$aRow1 = $oDataset1->getRow();
if ($aRow1['DYNAFORMS']) {
if ($aRow1['DYNAFORMS'] == 1) {
$flag = false;
break;
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,78 @@
<?php
require_once 'propel/map/MapBuilder.php';
include_once 'creole/CreoleTypes.php';
/**
* This class adds structure of 'MESSAGE_DETAIL' table to 'workflow' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package workflow.classes.model.map
*/
class MessageDetailMapBuilder
{
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'classes.model.map.MessageDetailMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('workflow');
$tMap = $this->dbMap->addTable('MESSAGE_DETAIL');
$tMap->setPhpName('MessageDetail');
$tMap->setUseIdGenerator(false);
$tMap->addPrimaryKey('MD_UID', 'MdUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('MES_UID', 'MesUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('MD_TYPE', 'MdType', 'string', CreoleTypes::VARCHAR, false, 32);
$tMap->addColumn('MD_NAME', 'MdName', 'string', CreoleTypes::VARCHAR, false, 255);
} // doBuild()
} // MessageDetailMapBuilder

View File

@@ -0,0 +1,78 @@
<?php
require_once 'propel/map/MapBuilder.php';
include_once 'creole/CreoleTypes.php';
/**
* This class adds structure of 'MESSAGE' table to 'workflow' DatabaseMap object.
*
*
*
* These statically-built map classes are used by Propel to do runtime db structure discovery.
* For example, the createSelectSql() method checks the type of a given column used in an
* ORDER BY clause to know whether it needs to apply SQL to make the ORDER BY case-insensitive
* (i.e. if it's a text column type).
*
* @package workflow.classes.model.map
*/
class MessageMapBuilder
{
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'classes.model.map.MessageMapBuilder';
/**
* The database map.
*/
private $dbMap;
/**
* Tells us if this DatabaseMapBuilder is built so that we
* don't have to re-build it every time.
*
* @return boolean true if this DatabaseMapBuilder is built, false otherwise.
*/
public function isBuilt()
{
return ($this->dbMap !== null);
}
/**
* Gets the databasemap this map builder built.
*
* @return the databasemap
*/
public function getDatabaseMap()
{
return $this->dbMap;
}
/**
* The doBuild() method builds the DatabaseMap
*
* @return void
* @throws PropelException
*/
public function doBuild()
{
$this->dbMap = Propel::getDatabaseMap('workflow');
$tMap = $this->dbMap->addTable('MESSAGE');
$tMap->setPhpName('Message');
$tMap->setUseIdGenerator(false);
$tMap->addPrimaryKey('MES_UID', 'MesUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('PRJ_UID', 'PrjUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('MES_NAME', 'MesName', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('MES_CONDITION', 'MesCondition', 'string', CreoleTypes::VARCHAR, false, 255);
} // doBuild()
} // MessageMapBuilder

View File

@@ -0,0 +1,684 @@
<?php
require_once 'propel/om/BaseObject.php';
require_once 'propel/om/Persistent.php';
include_once 'propel/util/Criteria.php';
include_once 'classes/model/MessagePeer.php';
/**
* Base class that represents a row from the 'MESSAGE' table.
*
*
*
* @package workflow.classes.model.om
*/
abstract class BaseMessage extends BaseObject implements Persistent
{
/**
* The Peer class.
* Instance provides a convenient way of calling static methods on a class
* that calling code may not be able to identify.
* @var MessagePeer
*/
protected static $peer;
/**
* The value for the mes_uid field.
* @var string
*/
protected $mes_uid;
/**
* The value for the prj_uid field.
* @var string
*/
protected $prj_uid;
/**
* The value for the mes_name field.
* @var string
*/
protected $mes_name = '';
/**
* The value for the mes_condition field.
* @var string
*/
protected $mes_condition = '';
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInSave = false;
/**
* Flag to prevent endless validation loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInValidation = false;
/**
* Get the [mes_uid] column value.
*
* @return string
*/
public function getMesUid()
{
return $this->mes_uid;
}
/**
* Get the [prj_uid] column value.
*
* @return string
*/
public function getPrjUid()
{
return $this->prj_uid;
}
/**
* Get the [mes_name] column value.
*
* @return string
*/
public function getMesName()
{
return $this->mes_name;
}
/**
* Get the [mes_condition] column value.
*
* @return string
*/
public function getMesCondition()
{
return $this->mes_condition;
}
/**
* Set the value of [mes_uid] column.
*
* @param string $v new value
* @return void
*/
public function setMesUid($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_uid !== $v) {
$this->mes_uid = $v;
$this->modifiedColumns[] = MessagePeer::MES_UID;
}
} // setMesUid()
/**
* Set the value of [prj_uid] column.
*
* @param string $v new value
* @return void
*/
public function setPrjUid($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->prj_uid !== $v) {
$this->prj_uid = $v;
$this->modifiedColumns[] = MessagePeer::PRJ_UID;
}
} // setPrjUid()
/**
* Set the value of [mes_name] column.
*
* @param string $v new value
* @return void
*/
public function setMesName($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_name !== $v || $v === '') {
$this->mes_name = $v;
$this->modifiedColumns[] = MessagePeer::MES_NAME;
}
} // setMesName()
/**
* 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.
*
* An offset (1-based "start column") is specified so that objects can be hydrated
* with a subset of the columns in the resultset rows. This is needed, for example,
* for results of JOIN queries where the resultset row includes columns from two or
* more tables.
*
* @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
* @param int $startcol 1-based offset column which indicates which restultset column to start with.
* @return int next starting column
* @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
*/
public function hydrate(ResultSet $rs, $startcol = 1)
{
try {
$this->mes_uid = $rs->getString($startcol + 0);
$this->prj_uid = $rs->getString($startcol + 1);
$this->mes_name = $rs->getString($startcol + 2);
$this->mes_condition = $rs->getString($startcol + 3);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 4; // 4 = MessagePeer::NUM_COLUMNS - MessagePeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating Message object", $e);
}
}
/**
* Removes this object from datastore and sets delete attribute.
*
* @param Connection $con
* @return void
* @throws PropelException
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
public function delete($con = null)
{
if ($this->isDeleted()) {
throw new PropelException("This object has already been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(MessagePeer::DATABASE_NAME);
}
try {
$con->begin();
MessagePeer::doDelete($this, $con);
$this->setDeleted(true);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Stores the object in the database. If the object is new,
* it inserts it; otherwise an update is performed. This method
* wraps the doSave() worker method in a transaction.
*
* @param Connection $con
* @return int The number of rows affected by this insert/update
* @throws PropelException
* @see doSave()
*/
public function save($con = null)
{
if ($this->isDeleted()) {
throw new PropelException("You cannot save an object that has been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(MessagePeer::DATABASE_NAME);
}
try {
$con->begin();
$affectedRows = $this->doSave($con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Stores the object in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param Connection $con
* @return int The number of rows affected by this insert/update and any referring
* @throws PropelException
* @see save()
*/
protected function doSave($con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = MessagePeer::doInsert($this, $con);
$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setNew(false);
} else {
$affectedRows += MessagePeer::doUpdate($this, $con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
}
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
*/
protected $validationFailures = array();
/**
* Gets any ValidationFailed objects that resulted from last call to validate().
*
*
* @return array ValidationFailed[]
* @see validate()
*/
public function getValidationFailures()
{
return $this->validationFailures;
}
/**
* Validates the objects modified field values and all objects related to this table.
*
* If $columns is either a column name or an array of column names
* only those columns are validated.
*
* @param mixed $columns Column name or an array of column names.
* @return boolean Whether all columns pass validation.
* @see doValidate()
* @see getValidationFailures()
*/
public function validate($columns = null)
{
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
}
/**
* This function performs the validation work for complex object models.
*
* In addition to checking the current object, all related objects will
* also be validated. If all pass then <code>true</code> is returned; otherwise
* an aggreagated array of ValidationFailed objects will be returned.
*
* @param array $columns Array of column names to validate.
* @return mixed <code>true</code> if all validations pass;
array of <code>ValidationFailed</code> objects otherwise.
*/
protected function doValidate($columns = null)
{
if (!$this->alreadyInValidation) {
$this->alreadyInValidation = true;
$retval = null;
$failureMap = array();
if (($retval = MessagePeer::doValidate($this, $columns)) !== true) {
$failureMap = array_merge($failureMap, $retval);
}
$this->alreadyInValidation = false;
}
return (!empty($failureMap) ? $failureMap : true);
}
/**
* Retrieves a field from the object by name passed in as a string.
*
* @param string $name name
* @param string $type The type of fieldname the $name is of:
* one of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = MessagePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->getByPosition($pos);
}
/**
* Retrieves a field from the object by Position as specified in the xml schema.
* Zero-based.
*
* @param int $pos position in xml schema
* @return mixed Value of field at $pos
*/
public function getByPosition($pos)
{
switch($pos) {
case 0:
return $this->getMesUid();
break;
case 1:
return $this->getPrjUid();
break;
case 2:
return $this->getMesName();
break;
case 3:
return $this->getMesCondition();
break;
default:
return null;
break;
} // switch()
}
/**
* Exports the object as an array.
*
* You can specify the key type of the array by passing one of the class
* type constants.
*
* @param string $keyType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
{
$keys = MessagePeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getMesUid(),
$keys[1] => $this->getPrjUid(),
$keys[2] => $this->getMesName(),
$keys[3] => $this->getMesCondition(),
);
return $result;
}
/**
* Sets a field from the object by name passed in as a string.
*
* @param string $name peer name
* @param mixed $value field value
* @param string $type The type of fieldname the $name is of:
* one of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = MessagePeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
}
/**
* Sets a field from the object by Position as specified in the xml schema.
* Zero-based.
*
* @param int $pos position in xml schema
* @param mixed $value field value
* @return void
*/
public function setByPosition($pos, $value)
{
switch($pos) {
case 0:
$this->setMesUid($value);
break;
case 1:
$this->setPrjUid($value);
break;
case 2:
$this->setMesName($value);
break;
case 3:
$this->setMesCondition($value);
break;
} // switch()
}
/**
* Populates the object using an array.
*
* This is particularly useful when populating an object from one of the
* request arrays (e.g. $_POST). This method goes through the column
* names, checking to see whether a matching key exists in populated
* array. If so the setByName() method is called for that column.
*
* You can specify the key type of the array by additionally passing one
* of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
* TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
* @return void
*/
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = MessagePeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) {
$this->setMesUid($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setPrjUid($arr[$keys[1]]);
}
if (array_key_exists($keys[2], $arr)) {
$this->setMesName($arr[$keys[2]]);
}
if (array_key_exists($keys[3], $arr)) {
$this->setMesCondition($arr[$keys[3]]);
}
}
/**
* Build a Criteria object containing the values of all modified columns in this object.
*
* @return Criteria The Criteria object containing all modified values.
*/
public function buildCriteria()
{
$criteria = new Criteria(MessagePeer::DATABASE_NAME);
if ($this->isColumnModified(MessagePeer::MES_UID)) {
$criteria->add(MessagePeer::MES_UID, $this->mes_uid);
}
if ($this->isColumnModified(MessagePeer::PRJ_UID)) {
$criteria->add(MessagePeer::PRJ_UID, $this->prj_uid);
}
if ($this->isColumnModified(MessagePeer::MES_NAME)) {
$criteria->add(MessagePeer::MES_NAME, $this->mes_name);
}
if ($this->isColumnModified(MessagePeer::MES_CONDITION)) {
$criteria->add(MessagePeer::MES_CONDITION, $this->mes_condition);
}
return $criteria;
}
/**
* Builds a Criteria object containing the primary key for this object.
*
* Unlike buildCriteria() this method includes the primary key values regardless
* of whether or not they have been modified.
*
* @return Criteria The Criteria object containing value(s) for primary key(s).
*/
public function buildPkeyCriteria()
{
$criteria = new Criteria(MessagePeer::DATABASE_NAME);
$criteria->add(MessagePeer::MES_UID, $this->mes_uid);
return $criteria;
}
/**
* Returns the primary key for this object (row).
* @return string
*/
public function getPrimaryKey()
{
return $this->getMesUid();
}
/**
* Generic method to set the primary key (mes_uid column).
*
* @param string $key Primary key.
* @return void
*/
public function setPrimaryKey($key)
{
$this->setMesUid($key);
}
/**
* Sets contents of passed object to values from current object.
*
* If desired, this method can also make copies of all associated (fkey referrers)
* objects.
*
* @param object $copyObj An object of Message (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
{
$copyObj->setPrjUid($this->prj_uid);
$copyObj->setMesName($this->mes_name);
$copyObj->setMesCondition($this->mes_condition);
$copyObj->setNew(true);
$copyObj->setMesUid(NULL); // this is a pkey column, so set to default value
}
/**
* Makes a copy of this object that will be inserted as a new row in table when saved.
* It creates a new object filling in the simple attributes, but skipping any primary
* keys that are defined for the table.
*
* If desired, this method can also make copies of all associated (fkey referrers)
* objects.
*
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @return Message Clone of current object.
* @throws PropelException
*/
public function copy($deepCopy = false)
{
// we use get_class(), because this might be a subclass
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
/**
* Returns a peer instance associated with this om.
*
* Since Peer classes are not to have any instance attributes, this method returns the
* same instance for all member of this class. The method could therefore
* be static, but this would prevent one from overriding the behavior.
*
* @return MessagePeer
*/
public function getPeer()
{
if (self::$peer === null) {
self::$peer = new MessagePeer();
}
return self::$peer;
}
}

View File

@@ -0,0 +1,684 @@
<?php
require_once 'propel/om/BaseObject.php';
require_once 'propel/om/Persistent.php';
include_once 'propel/util/Criteria.php';
include_once 'classes/model/MessageDetailPeer.php';
/**
* Base class that represents a row from the 'MESSAGE_DETAIL' table.
*
*
*
* @package workflow.classes.model.om
*/
abstract class BaseMessageDetail extends BaseObject implements Persistent
{
/**
* The Peer class.
* Instance provides a convenient way of calling static methods on a class
* that calling code may not be able to identify.
* @var MessageDetailPeer
*/
protected static $peer;
/**
* The value for the md_uid field.
* @var string
*/
protected $md_uid;
/**
* The value for the mes_uid field.
* @var string
*/
protected $mes_uid;
/**
* The value for the md_type field.
* @var string
*/
protected $md_type = '';
/**
* The value for the md_name field.
* @var string
*/
protected $md_name = '';
/**
* Flag to prevent endless save loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInSave = false;
/**
* Flag to prevent endless validation loop, if this object is referenced
* by another object which falls in this transaction.
* @var boolean
*/
protected $alreadyInValidation = false;
/**
* Get the [md_uid] column value.
*
* @return string
*/
public function getMdUid()
{
return $this->md_uid;
}
/**
* Get the [mes_uid] column value.
*
* @return string
*/
public function getMesUid()
{
return $this->mes_uid;
}
/**
* Get the [md_type] column value.
*
* @return string
*/
public function getMdType()
{
return $this->md_type;
}
/**
* Get the [md_name] column value.
*
* @return string
*/
public function getMdName()
{
return $this->md_name;
}
/**
* Set the value of [md_uid] column.
*
* @param string $v new value
* @return void
*/
public function setMdUid($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->md_uid !== $v) {
$this->md_uid = $v;
$this->modifiedColumns[] = MessageDetailPeer::MD_UID;
}
} // setMdUid()
/**
* Set the value of [mes_uid] column.
*
* @param string $v new value
* @return void
*/
public function setMesUid($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_uid !== $v) {
$this->mes_uid = $v;
$this->modifiedColumns[] = MessageDetailPeer::MES_UID;
}
} // setMesUid()
/**
* Set the value of [md_type] column.
*
* @param string $v new value
* @return void
*/
public function setMdType($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->md_type !== $v || $v === '') {
$this->md_type = $v;
$this->modifiedColumns[] = MessageDetailPeer::MD_TYPE;
}
} // setMdType()
/**
* Set the value of [md_name] column.
*
* @param string $v new value
* @return void
*/
public function setMdName($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->md_name !== $v || $v === '') {
$this->md_name = $v;
$this->modifiedColumns[] = MessageDetailPeer::MD_NAME;
}
} // setMdName()
/**
* Hydrates (populates) the object variables with values from the database resultset.
*
* An offset (1-based "start column") is specified so that objects can be hydrated
* with a subset of the columns in the resultset rows. This is needed, for example,
* for results of JOIN queries where the resultset row includes columns from two or
* more tables.
*
* @param ResultSet $rs The ResultSet class with cursor advanced to desired record pos.
* @param int $startcol 1-based offset column which indicates which restultset column to start with.
* @return int next starting column
* @throws PropelException - Any caught Exception will be rewrapped as a PropelException.
*/
public function hydrate(ResultSet $rs, $startcol = 1)
{
try {
$this->md_uid = $rs->getString($startcol + 0);
$this->mes_uid = $rs->getString($startcol + 1);
$this->md_type = $rs->getString($startcol + 2);
$this->md_name = $rs->getString($startcol + 3);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 4; // 4 = MessageDetailPeer::NUM_COLUMNS - MessageDetailPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating MessageDetail object", $e);
}
}
/**
* Removes this object from datastore and sets delete attribute.
*
* @param Connection $con
* @return void
* @throws PropelException
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
public function delete($con = null)
{
if ($this->isDeleted()) {
throw new PropelException("This object has already been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(MessageDetailPeer::DATABASE_NAME);
}
try {
$con->begin();
MessageDetailPeer::doDelete($this, $con);
$this->setDeleted(true);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Stores the object in the database. If the object is new,
* it inserts it; otherwise an update is performed. This method
* wraps the doSave() worker method in a transaction.
*
* @param Connection $con
* @return int The number of rows affected by this insert/update
* @throws PropelException
* @see doSave()
*/
public function save($con = null)
{
if ($this->isDeleted()) {
throw new PropelException("You cannot save an object that has been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(MessageDetailPeer::DATABASE_NAME);
}
try {
$con->begin();
$affectedRows = $this->doSave($con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Stores the object in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param Connection $con
* @return int The number of rows affected by this insert/update and any referring
* @throws PropelException
* @see save()
*/
protected function doSave($con)
{
$affectedRows = 0; // initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// If this object has been modified, then save it to the database.
if ($this->isModified()) {
if ($this->isNew()) {
$pk = MessageDetailPeer::doInsert($this, $con);
$affectedRows += 1; // we are assuming that there is only 1 row per doInsert() which
// should always be true here (even though technically
// BasePeer::doInsert() can insert multiple rows).
$this->setNew(false);
} else {
$affectedRows += MessageDetailPeer::doUpdate($this, $con);
}
$this->resetModified(); // [HL] After being saved an object is no longer 'modified'
}
$this->alreadyInSave = false;
}
return $affectedRows;
} // doSave()
/**
* Array of ValidationFailed objects.
* @var array ValidationFailed[]
*/
protected $validationFailures = array();
/**
* Gets any ValidationFailed objects that resulted from last call to validate().
*
*
* @return array ValidationFailed[]
* @see validate()
*/
public function getValidationFailures()
{
return $this->validationFailures;
}
/**
* Validates the objects modified field values and all objects related to this table.
*
* If $columns is either a column name or an array of column names
* only those columns are validated.
*
* @param mixed $columns Column name or an array of column names.
* @return boolean Whether all columns pass validation.
* @see doValidate()
* @see getValidationFailures()
*/
public function validate($columns = null)
{
$res = $this->doValidate($columns);
if ($res === true) {
$this->validationFailures = array();
return true;
} else {
$this->validationFailures = $res;
return false;
}
}
/**
* This function performs the validation work for complex object models.
*
* In addition to checking the current object, all related objects will
* also be validated. If all pass then <code>true</code> is returned; otherwise
* an aggreagated array of ValidationFailed objects will be returned.
*
* @param array $columns Array of column names to validate.
* @return mixed <code>true</code> if all validations pass;
array of <code>ValidationFailed</code> objects otherwise.
*/
protected function doValidate($columns = null)
{
if (!$this->alreadyInValidation) {
$this->alreadyInValidation = true;
$retval = null;
$failureMap = array();
if (($retval = MessageDetailPeer::doValidate($this, $columns)) !== true) {
$failureMap = array_merge($failureMap, $retval);
}
$this->alreadyInValidation = false;
}
return (!empty($failureMap) ? $failureMap : true);
}
/**
* Retrieves a field from the object by name passed in as a string.
*
* @param string $name name
* @param string $type The type of fieldname the $name is of:
* one of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return mixed Value of field.
*/
public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
{
$pos = MessageDetailPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->getByPosition($pos);
}
/**
* Retrieves a field from the object by Position as specified in the xml schema.
* Zero-based.
*
* @param int $pos position in xml schema
* @return mixed Value of field at $pos
*/
public function getByPosition($pos)
{
switch($pos) {
case 0:
return $this->getMdUid();
break;
case 1:
return $this->getMesUid();
break;
case 2:
return $this->getMdType();
break;
case 3:
return $this->getMdName();
break;
default:
return null;
break;
} // switch()
}
/**
* Exports the object as an array.
*
* You can specify the key type of the array by passing one of the class
* type constants.
*
* @param string $keyType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return an associative array containing the field names (as keys) and field values
*/
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
{
$keys = MessageDetailPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getMdUid(),
$keys[1] => $this->getMesUid(),
$keys[2] => $this->getMdType(),
$keys[3] => $this->getMdName(),
);
return $result;
}
/**
* Sets a field from the object by name passed in as a string.
*
* @param string $name peer name
* @param mixed $value field value
* @param string $type The type of fieldname the $name is of:
* one of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return void
*/
public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
{
$pos = MessageDetailPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
return $this->setByPosition($pos, $value);
}
/**
* Sets a field from the object by Position as specified in the xml schema.
* Zero-based.
*
* @param int $pos position in xml schema
* @param mixed $value field value
* @return void
*/
public function setByPosition($pos, $value)
{
switch($pos) {
case 0:
$this->setMdUid($value);
break;
case 1:
$this->setMesUid($value);
break;
case 2:
$this->setMdType($value);
break;
case 3:
$this->setMdName($value);
break;
} // switch()
}
/**
* Populates the object using an array.
*
* This is particularly useful when populating an object from one of the
* request arrays (e.g. $_POST). This method goes through the column
* names, checking to see whether a matching key exists in populated
* array. If so the setByName() method is called for that column.
*
* You can specify the key type of the array by additionally passing one
* of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
* TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
*
* @param array $arr An array to populate the object from.
* @param string $keyType The type of keys the array uses.
* @return void
*/
public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
{
$keys = MessageDetailPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) {
$this->setMdUid($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setMesUid($arr[$keys[1]]);
}
if (array_key_exists($keys[2], $arr)) {
$this->setMdType($arr[$keys[2]]);
}
if (array_key_exists($keys[3], $arr)) {
$this->setMdName($arr[$keys[3]]);
}
}
/**
* Build a Criteria object containing the values of all modified columns in this object.
*
* @return Criteria The Criteria object containing all modified values.
*/
public function buildCriteria()
{
$criteria = new Criteria(MessageDetailPeer::DATABASE_NAME);
if ($this->isColumnModified(MessageDetailPeer::MD_UID)) {
$criteria->add(MessageDetailPeer::MD_UID, $this->md_uid);
}
if ($this->isColumnModified(MessageDetailPeer::MES_UID)) {
$criteria->add(MessageDetailPeer::MES_UID, $this->mes_uid);
}
if ($this->isColumnModified(MessageDetailPeer::MD_TYPE)) {
$criteria->add(MessageDetailPeer::MD_TYPE, $this->md_type);
}
if ($this->isColumnModified(MessageDetailPeer::MD_NAME)) {
$criteria->add(MessageDetailPeer::MD_NAME, $this->md_name);
}
return $criteria;
}
/**
* Builds a Criteria object containing the primary key for this object.
*
* Unlike buildCriteria() this method includes the primary key values regardless
* of whether or not they have been modified.
*
* @return Criteria The Criteria object containing value(s) for primary key(s).
*/
public function buildPkeyCriteria()
{
$criteria = new Criteria(MessageDetailPeer::DATABASE_NAME);
$criteria->add(MessageDetailPeer::MD_UID, $this->md_uid);
return $criteria;
}
/**
* Returns the primary key for this object (row).
* @return string
*/
public function getPrimaryKey()
{
return $this->getMdUid();
}
/**
* Generic method to set the primary key (md_uid column).
*
* @param string $key Primary key.
* @return void
*/
public function setPrimaryKey($key)
{
$this->setMdUid($key);
}
/**
* Sets contents of passed object to values from current object.
*
* If desired, this method can also make copies of all associated (fkey referrers)
* objects.
*
* @param object $copyObj An object of MessageDetail (or compatible) type.
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @throws PropelException
*/
public function copyInto($copyObj, $deepCopy = false)
{
$copyObj->setMesUid($this->mes_uid);
$copyObj->setMdType($this->md_type);
$copyObj->setMdName($this->md_name);
$copyObj->setNew(true);
$copyObj->setMdUid(NULL); // this is a pkey column, so set to default value
}
/**
* Makes a copy of this object that will be inserted as a new row in table when saved.
* It creates a new object filling in the simple attributes, but skipping any primary
* keys that are defined for the table.
*
* If desired, this method can also make copies of all associated (fkey referrers)
* objects.
*
* @param boolean $deepCopy Whether to also copy all rows that refer (by fkey) to the current row.
* @return MessageDetail Clone of current object.
* @throws PropelException
*/
public function copy($deepCopy = false)
{
// we use get_class(), because this might be a subclass
$clazz = get_class($this);
$copyObj = new $clazz();
$this->copyInto($copyObj, $deepCopy);
return $copyObj;
}
/**
* Returns a peer instance associated with this om.
*
* Since Peer classes are not to have any instance attributes, this method returns the
* same instance for all member of this class. The method could therefore
* be static, but this would prevent one from overriding the behavior.
*
* @return MessageDetailPeer
*/
public function getPeer()
{
if (self::$peer === null) {
self::$peer = new MessageDetailPeer();
}
return self::$peer;
}
}

View File

@@ -0,0 +1,582 @@
<?php
require_once 'propel/util/BasePeer.php';
// The object class -- needed for instanceof checks in this class.
// actual class may be a subclass -- as returned by MessageDetailPeer::getOMClass()
include_once 'classes/model/MessageDetail.php';
/**
* Base static class for performing query and update operations on the 'MESSAGE_DETAIL' table.
*
*
*
* @package workflow.classes.model.om
*/
abstract class BaseMessageDetailPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'workflow';
/** the table name for this class */
const TABLE_NAME = 'MESSAGE_DETAIL';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'classes.model.MessageDetail';
/** The total number of columns. */
const NUM_COLUMNS = 4;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the MD_UID field */
const MD_UID = 'MESSAGE_DETAIL.MD_UID';
/** the column name for the MES_UID field */
const MES_UID = 'MESSAGE_DETAIL.MES_UID';
/** the column name for the MD_TYPE field */
const MD_TYPE = 'MESSAGE_DETAIL.MD_TYPE';
/** the column name for the MD_NAME field */
const MD_NAME = 'MESSAGE_DETAIL.MD_NAME';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('MdUid', 'MesUid', 'MdType', 'MdName', ),
BasePeer::TYPE_COLNAME => array (MessageDetailPeer::MD_UID, MessageDetailPeer::MES_UID, MessageDetailPeer::MD_TYPE, MessageDetailPeer::MD_NAME, ),
BasePeer::TYPE_FIELDNAME => array ('MD_UID', 'MES_UID', 'MD_TYPE', 'MD_NAME', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('MdUid' => 0, 'MesUid' => 1, 'MdType' => 2, 'MdName' => 3, ),
BasePeer::TYPE_COLNAME => array (MessageDetailPeer::MD_UID => 0, MessageDetailPeer::MES_UID => 1, MessageDetailPeer::MD_TYPE => 2, MessageDetailPeer::MD_NAME => 3, ),
BasePeer::TYPE_FIELDNAME => array ('MD_UID' => 0, 'MES_UID' => 1, 'MD_TYPE' => 2, 'MD_NAME' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
* @return MapBuilder the map builder for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getMapBuilder()
{
include_once 'classes/model/map/MessageDetailMapBuilder.php';
return BasePeer::getMapBuilder('classes.model.map.MessageDetailMapBuilder');
}
/**
* Gets a map (hash) of PHP names to DB column names.
*
* @return array The PHP to DB name map for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
*/
public static function getPhpNameMap()
{
if (self::$phpNameMap === null) {
$map = MessageDetailPeer::getTableMap();
$columns = $map->getColumns();
$nameMap = array();
foreach ($columns as $column) {
$nameMap[$column->getPhpName()] = $column->getColumnName();
}
self::$phpNameMap = $nameMap;
}
return self::$phpNameMap;
}
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
*/
static public function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return array A list of field names
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
}
return self::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. MessageDetailPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(MessageDetailPeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param criteria object containing the columns to add.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria)
{
$criteria->addSelectColumn(MessageDetailPeer::MD_UID);
$criteria->addSelectColumn(MessageDetailPeer::MES_UID);
$criteria->addSelectColumn(MessageDetailPeer::MD_TYPE);
$criteria->addSelectColumn(MessageDetailPeer::MD_NAME);
}
const COUNT = 'COUNT(MESSAGE_DETAIL.MD_UID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT MESSAGE_DETAIL.MD_UID)';
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(MessageDetailPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(MessageDetailPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach ($criteria->getGroupByColumns() as $column) {
$criteria->addSelectColumn($column);
}
$rs = MessageDetailPeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Method to select one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param Connection $con
* @return MessageDetail
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = MessageDetailPeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, $con = null)
{
return MessageDetailPeer::populateObjects(MessageDetailPeer::doSelectRS($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect()
* method to get a ResultSet.
*
* Use this method directly if you want to just get the resultset
* (instead of an array of objects).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return ResultSet The resultset object with numerically-indexed fields.
* @see BasePeer::doSelect()
*/
public static function doSelectRS(Criteria $criteria, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if (!$criteria->getSelectColumns()) {
$criteria = clone $criteria;
MessageDetailPeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
// BasePeer returns a Creole ResultSet, set to return
// rows indexed numerically.
return BasePeer::doSelect($criteria, $con);
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(ResultSet $rs)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = MessageDetailPeer::getOMClass();
$cls = Propel::import($cls);
// populate the object(s)
while ($rs->next()) {
$obj = new $cls();
$obj->hydrate($rs);
$results[] = $obj;
}
return $results;
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
}
/**
* The class that the Peer will make instances of.
*
* This uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @return string path.to.ClassName
*/
public static function getOMClass()
{
return MessageDetailPeer::CLASS_DEFAULT;
}
/**
* Method perform an INSERT on the database, given a MessageDetail or Criteria object.
*
* @param mixed $values Criteria or MessageDetail object containing data that is used to create the INSERT statement.
* @param Connection $con the connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from MessageDetail object
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->begin();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
return $pk;
}
/**
* Method perform an UPDATE on the database, given a MessageDetail or Criteria object.
*
* @param mixed $values Criteria or MessageDetail object containing data create the UPDATE statement.
* @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).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(MessageDetailPeer::MD_UID);
$selectCriteria->add(MessageDetailPeer::MD_UID, $criteria->remove(MessageDetailPeer::MD_UID), $comparison);
} else {
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the MESSAGE_DETAIL table.
*
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll($con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDeleteAll(MessageDetailPeer::TABLE_NAME, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a MessageDetail or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or MessageDetail object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param Connection $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(MessageDetailPeer::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} elseif ($values instanceof MessageDetail) {
$criteria = $values->buildPkeyCriteria();
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
$criteria->add(MessageDetailPeer::MD_UID, (array) $values, Criteria::IN);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDelete($criteria, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Validates all modified columns of given MessageDetail object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param MessageDetail $obj The object to validate.
* @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.
*/
public static function doValidate(MessageDetail $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(MessageDetailPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(MessageDetailPeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(MessageDetailPeer::DATABASE_NAME, MessageDetailPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param mixed $pk the primary key.
* @param Connection $con the connection to use
* @return MessageDetail
*/
public static function retrieveByPK($pk, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria(MessageDetailPeer::DATABASE_NAME);
$criteria->add(MessageDetailPeer::MD_UID, $pk);
$v = MessageDetailPeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria();
$criteria->add(MessageDetailPeer::MD_UID, $pks, Criteria::IN);
$objs = MessageDetailPeer::doSelect($criteria, $con);
}
return $objs;
}
}
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
// the MapBuilder classes register themselves with Propel during initialization
// so we need to load them here.
try {
BaseMessageDetailPeer::getMapBuilder();
} catch (Exception $e) {
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
}
} else {
// even if Propel is not yet initialized, the map builder class can be registered
// now and then it will be loaded when Propel initializes.
require_once 'classes/model/map/MessageDetailMapBuilder.php';
Propel::registerMapBuilder('classes.model.map.MessageDetailMapBuilder');
}

View File

@@ -0,0 +1,582 @@
<?php
require_once 'propel/util/BasePeer.php';
// The object class -- needed for instanceof checks in this class.
// actual class may be a subclass -- as returned by MessagePeer::getOMClass()
include_once 'classes/model/Message.php';
/**
* Base static class for performing query and update operations on the 'MESSAGE' table.
*
*
*
* @package workflow.classes.model.om
*/
abstract class BaseMessagePeer
{
/** the default database name for this class */
const DATABASE_NAME = 'workflow';
/** the table name for this class */
const TABLE_NAME = 'MESSAGE';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'classes.model.Message';
/** The total number of columns. */
const NUM_COLUMNS = 4;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the MES_UID field */
const MES_UID = 'MESSAGE.MES_UID';
/** the column name for the PRJ_UID field */
const PRJ_UID = 'MESSAGE.PRJ_UID';
/** the column name for the MES_NAME field */
const MES_NAME = 'MESSAGE.MES_NAME';
/** the column name for the MES_CONDITION field */
const MES_CONDITION = 'MESSAGE.MES_CONDITION';
/** The PHP to DB Name Mapping */
private static $phpNameMap = null;
/**
* holds an array of fieldnames
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('MesUid', 'PrjUid', 'MesName', 'MesCondition', ),
BasePeer::TYPE_COLNAME => array (MessagePeer::MES_UID, MessagePeer::PRJ_UID, MessagePeer::MES_NAME, MessagePeer::MES_CONDITION, ),
BasePeer::TYPE_FIELDNAME => array ('MES_UID', 'PRJ_UID', 'MES_NAME', 'MES_CONDITION', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
* holds an array of keys for quick access to the fieldnames array
*
* first dimension keys are the type constants
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('MesUid' => 0, 'PrjUid' => 1, 'MesName' => 2, 'MesCondition' => 3, ),
BasePeer::TYPE_COLNAME => array (MessagePeer::MES_UID => 0, MessagePeer::PRJ_UID => 1, MessagePeer::MES_NAME => 2, MessagePeer::MES_CONDITION => 3, ),
BasePeer::TYPE_FIELDNAME => array ('MES_UID' => 0, 'PRJ_UID' => 1, 'MES_NAME' => 2, 'MES_CONDITION' => 3, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, )
);
/**
* @return MapBuilder the map builder for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getMapBuilder()
{
include_once 'classes/model/map/MessageMapBuilder.php';
return BasePeer::getMapBuilder('classes.model.map.MessageMapBuilder');
}
/**
* Gets a map (hash) of PHP names to DB column names.
*
* @return array The PHP to DB name map for this peer
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @deprecated Use the getFieldNames() and translateFieldName() methods instead of this.
*/
public static function getPhpNameMap()
{
if (self::$phpNameMap === null) {
$map = MessagePeer::getTableMap();
$columns = $map->getColumns();
$nameMap = array();
foreach ($columns as $column) {
$nameMap[$column->getPhpName()] = $column->getColumnName();
}
self::$phpNameMap = $nameMap;
}
return self::$phpNameMap;
}
/**
* Translates a fieldname to another type
*
* @param string $name field name
* @param string $fromType One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @param string $toType One of the class type constants
* @return string translated name of the field.
*/
static public function translateFieldName($name, $fromType, $toType)
{
$toNames = self::getFieldNames($toType);
$key = isset(self::$fieldKeys[$fromType][$name]) ? self::$fieldKeys[$fromType][$name] : null;
if ($key === null) {
throw new PropelException("'$name' could not be found in the field names of type '$fromType'. These are: " . print_r(self::$fieldKeys[$fromType], true));
}
return $toNames[$key];
}
/**
* Returns an array of of field names.
*
* @param string $type The type of fieldnames to return:
* One of the class type constants TYPE_PHPNAME,
* TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM
* @return array A list of field names
*/
static public function getFieldNames($type = BasePeer::TYPE_PHPNAME)
{
if (!array_key_exists($type, self::$fieldNames)) {
throw new PropelException('Method getFieldNames() expects the parameter $type to be one of the class constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME, TYPE_NUM. ' . $type . ' was given.');
}
return self::$fieldNames[$type];
}
/**
* Convenience method which changes table.column to alias.column.
*
* Using this method you can maintain SQL abstraction while using column aliases.
* <code>
* $c->addAlias("alias1", TablePeer::TABLE_NAME);
* $c->addJoin(TablePeer::alias("alias1", TablePeer::PRIMARY_KEY_COLUMN), TablePeer::PRIMARY_KEY_COLUMN);
* </code>
* @param string $alias The alias for the current table.
* @param string $column The column name for current table. (i.e. MessagePeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(MessagePeer::TABLE_NAME.'.', $alias.'.', $column);
}
/**
* Add all the columns needed to create a new object.
*
* Note: any columns that were marked with lazyLoad="true" in the
* XML schema will not be added to the select list and only loaded
* on demand.
*
* @param criteria object containing the columns to add.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function addSelectColumns(Criteria $criteria)
{
$criteria->addSelectColumn(MessagePeer::MES_UID);
$criteria->addSelectColumn(MessagePeer::PRJ_UID);
$criteria->addSelectColumn(MessagePeer::MES_NAME);
$criteria->addSelectColumn(MessagePeer::MES_CONDITION);
}
const COUNT = 'COUNT(MESSAGE.MES_UID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT MESSAGE.MES_UID)';
/**
* Returns the number of rows matching criteria.
*
* @param Criteria $criteria
* @param boolean $distinct Whether to select only distinct columns (You can also set DISTINCT modifier in Criteria).
* @param Connection $con
* @return int Number of matching rows.
*/
public static function doCount(Criteria $criteria, $distinct = false, $con = null)
{
// we're going to modify criteria, so copy it first
$criteria = clone $criteria;
// clear out anything that might confuse the ORDER BY clause
$criteria->clearSelectColumns()->clearOrderByColumns();
if ($distinct || in_array(Criteria::DISTINCT, $criteria->getSelectModifiers())) {
$criteria->addSelectColumn(MessagePeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(MessagePeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach ($criteria->getGroupByColumns() as $column) {
$criteria->addSelectColumn($column);
}
$rs = MessagePeer::doSelectRS($criteria, $con);
if ($rs->next()) {
return $rs->getInt(1);
} else {
// no rows returned; we infer that means 0 matches.
return 0;
}
}
/**
* Method to select one object from the DB.
*
* @param Criteria $criteria object used to create the SELECT statement.
* @param Connection $con
* @return Message
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelectOne(Criteria $criteria, $con = null)
{
$critcopy = clone $criteria;
$critcopy->setLimit(1);
$objects = MessagePeer::doSelect($critcopy, $con);
if ($objects) {
return $objects[0];
}
return null;
}
/**
* Method to do selects.
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con
* @return array Array of selected Objects
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doSelect(Criteria $criteria, $con = null)
{
return MessagePeer::populateObjects(MessagePeer::doSelectRS($criteria, $con));
}
/**
* Prepares the Criteria object and uses the parent doSelect()
* method to get a ResultSet.
*
* Use this method directly if you want to just get the resultset
* (instead of an array of objects).
*
* @param Criteria $criteria The Criteria object used to build the SELECT statement.
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
* @return ResultSet The resultset object with numerically-indexed fields.
* @see BasePeer::doSelect()
*/
public static function doSelectRS(Criteria $criteria, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if (!$criteria->getSelectColumns()) {
$criteria = clone $criteria;
MessagePeer::addSelectColumns($criteria);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
// BasePeer returns a Creole ResultSet, set to return
// rows indexed numerically.
return BasePeer::doSelect($criteria, $con);
}
/**
* The returned array will contain objects of the default type or
* objects that inherit from the default.
*
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function populateObjects(ResultSet $rs)
{
$results = array();
// set the class once to avoid overhead in the loop
$cls = MessagePeer::getOMClass();
$cls = Propel::import($cls);
// populate the object(s)
while ($rs->next()) {
$obj = new $cls();
$obj->hydrate($rs);
$results[] = $obj;
}
return $results;
}
/**
* Returns the TableMap related to this peer.
* This method is not needed for general use but a specific application could have a need.
* @return TableMap
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function getTableMap()
{
return Propel::getDatabaseMap(self::DATABASE_NAME)->getTable(self::TABLE_NAME);
}
/**
* The class that the Peer will make instances of.
*
* This uses a dot-path notation which is tranalted into a path
* relative to a location on the PHP include_path.
* (e.g. path.to.MyClass -> 'path/to/MyClass.php')
*
* @return string path.to.ClassName
*/
public static function getOMClass()
{
return MessagePeer::CLASS_DEFAULT;
}
/**
* Method perform an INSERT on the database, given a Message or Criteria object.
*
* @param mixed $values Criteria or Message object containing data that is used to create the INSERT statement.
* @param Connection $con the connection to use
* @return mixed The new primary key.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doInsert($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} else {
$criteria = $values->buildCriteria(); // build Criteria from Message object
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
try {
// use transaction because $criteria could contain info
// for more than one table (I guess, conceivably)
$con->begin();
$pk = BasePeer::doInsert($criteria, $con);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
return $pk;
}
/**
* Method perform an UPDATE on the database, given a Message or Criteria object.
*
* @param mixed $values Criteria or Message object containing data create the UPDATE statement.
* @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).
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doUpdate($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$selectCriteria = new Criteria(self::DATABASE_NAME);
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
$comparison = $criteria->getComparison(MessagePeer::MES_UID);
$selectCriteria->add(MessagePeer::MES_UID, $criteria->remove(MessagePeer::MES_UID), $comparison);
} else {
$criteria = $values->buildCriteria(); // gets full criteria
$selectCriteria = $values->buildPkeyCriteria(); // gets criteria w/ primary key(s)
}
// set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
return BasePeer::doUpdate($selectCriteria, $criteria, $con);
}
/**
* Method to DELETE all rows from the MESSAGE table.
*
* @return int The number of affected rows (if supported by underlying database driver).
*/
public static function doDeleteAll($con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDeleteAll(MessagePeer::TABLE_NAME, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a Message or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or Message object or primary key or array of primary keys
* which is used to create the DELETE statement
* @param Connection $con the connection to use
* @return int The number of affected rows (if supported by underlying database driver).
* This includes CASCADE-related rows
* if supported by native driver or if emulated using Propel.
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function doDelete($values, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(MessagePeer::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} elseif ($values instanceof Message) {
$criteria = $values->buildPkeyCriteria();
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
$criteria->add(MessagePeer::MES_UID, (array) $values, Criteria::IN);
}
// Set the correct dbName
$criteria->setDbName(self::DATABASE_NAME);
$affectedRows = 0; // initialize var to track total num of affected rows
try {
// use transaction because $criteria could contain info
// for more than one table or we could emulating ON DELETE CASCADE, etc.
$con->begin();
$affectedRows += BasePeer::doDelete($criteria, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Validates all modified columns of given Message object.
* If parameter $columns is either a single column name or an array of column names
* than only those columns are validated.
*
* NOTICE: This does not apply to primary or foreign keys for now.
*
* @param Message $obj The object to validate.
* @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.
*/
public static function doValidate(Message $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(MessagePeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(MessagePeer::TABLE_NAME);
if (! is_array($cols)) {
$cols = array($cols);
}
foreach ($cols as $colName) {
if ($tableMap->containsColumn($colName)) {
$get = 'get' . $tableMap->getColumn($colName)->getPhpName();
$columns[$colName] = $obj->$get();
}
}
} else {
}
return BasePeer::doValidate(MessagePeer::DATABASE_NAME, MessagePeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param mixed $pk the primary key.
* @param Connection $con the connection to use
* @return Message
*/
public static function retrieveByPK($pk, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria(MessagePeer::DATABASE_NAME);
$criteria->add(MessagePeer::MES_UID, $pk);
$v = MessagePeer::doSelect($criteria, $con);
return !empty($v) > 0 ? $v[0] : null;
}
/**
* Retrieve multiple objects by pkey.
*
* @param array $pks List of primary keys
* @param Connection $con the connection to use
* @throws PropelException Any exceptions caught during processing will be
* rethrown wrapped into a PropelException.
*/
public static function retrieveByPKs($pks, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$objs = null;
if (empty($pks)) {
$objs = array();
} else {
$criteria = new Criteria();
$criteria->add(MessagePeer::MES_UID, $pks, Criteria::IN);
$objs = MessagePeer::doSelect($criteria, $con);
}
return $objs;
}
}
// static code to register the map builder for this Peer with the main Propel class
if (Propel::isInit()) {
// the MapBuilder classes register themselves with Propel during initialization
// so we need to load them here.
try {
BaseMessagePeer::getMapBuilder();
} catch (Exception $e) {
Propel::log('Could not initialize Peer: ' . $e->getMessage(), Propel::LOG_ERR);
}
} else {
// even if Propel is not yet initialized, the map builder class can be registered
// now and then it will be loaded when Propel initializes.
require_once 'classes/model/map/MessageMapBuilder.php';
Propel::registerMapBuilder('classes.model.map.MessageMapBuilder');
}

View File

@@ -4176,7 +4176,18 @@
<column name="TYPE" type="VARCHAR" size="255" required="true" primaryKey="true" default=""/>
<column name="TYP_UID" type="VARCHAR" size="32" required="true" default=""/>
</table>
<table name="MESSAGE">
<column name="MES_UID" type="VARCHAR" size="32" required="true" primaryKey="true" />
<column name="PRJ_UID" type="VARCHAR" size="32" required="true"/>
<column name="MES_NAME" type="VARCHAR" size="255" default=""/>
<column name="MES_CONDITION" type="VARCHAR" size="255" default=""/>
</table>
<table name="MESSAGE_DETAIL">
<column name="MD_UID" type="VARCHAR" size="32" required="true" primaryKey="true" />
<column name="MES_UID" type="VARCHAR" size="32" required="true"/>
<column name="MD_TYPE" type="VARCHAR" size="32" default=""/>
<column name="MD_NAME" type="VARCHAR" size="255" default=""/>
</table>
<table name="EMAIL_SERVER">
<vendor type="mysql">
<parameter name="Name" value="EMAIL_SERVER" />

View File

@@ -116,13 +116,19 @@ class pmTablesProxy extends HttpProxyController
$proUid = $_POST['PRO_UID'];
$dbConn = new DbConnections();
$dbConnections = $dbConn->getConnectionsProUid( $proUid );
$defaultConnections = array (array ('DBS_UID' => 'workflow','DBS_NAME' => 'Workflow'
),array ('DBS_UID' => 'rp','DBS_NAME' => 'REPORT'
)
);
$workSpace = new workspaceTools(SYS_SYS);
$workspaceDB = $workSpace->getDBInfo();
if ($workspaceDB['DB_NAME'] == $workspaceDB['DB_RBAC_NAME']) {
$defaultConnections = array (array ('DBS_UID' => 'workflow','DBS_NAME' => 'Workflow'));
} else {
$defaultConnections = array (array ('DBS_UID' => 'workflow','DBS_NAME' => 'Workflow'),
array ('DBS_UID' => 'rp','DBS_NAME' => 'REPORT'));
}
$dbConnections = array_merge( $defaultConnections, $dbConnections );
return $dbConnections;
}
@@ -208,13 +214,11 @@ class pmTablesProxy extends HttpProxyController
$result = new StdClass();
try {
$result = new stdClass();
ob_start();
$data = (array) $httpData;
$data['PRO_UID'] = trim( $data['PRO_UID'] );
$data['columns'] = G::json_decode( stripslashes( $httpData->columns ) ); //decofing data columns
$isReportTable = $data['PRO_UID'] != '' ? true : false;
$oAdditionalTables = new AdditionalTables();
$oFields = new Fields();
@@ -252,7 +256,6 @@ class pmTablesProxy extends HttpProxyController
) ) ));
}
}
//backward compatility
foreach ($columns as $i => $column) {
if (in_array( strtoupper( $columns[$i]->field_name ), $reservedWordsSql ) || in_array( strtolower( $columns[$i]->field_name ), $reservedWordsPhp )) {
@@ -318,7 +321,6 @@ class pmTablesProxy extends HttpProxyController
$oCriteria->add( FieldsPeer::ADD_TAB_UID, $data['REP_TAB_UID'] );
FieldsPeer::doDelete( $oCriteria );
}
// Updating pmtable fields
foreach ($columns as $i => $column) {
$field = array (
@@ -747,7 +749,7 @@ class pmTablesProxy extends HttpProxyController
*/
public function exportCSV ($httpData)
{
$result = new StdClass();
try {
$link = '';

View File

@@ -3278,3 +3278,82 @@ CREATE TABLE APP_ASSIGN_SELF_SERVICE_VALUE
GRP_UID VARCHAR(32) DEFAULT '' NOT NULL
);
/* ---------------------------------------------------------------------- */
/* MESSAGE */
/* ---------------------------------------------------------------------- */
IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'MESSAGE')
BEGIN
DECLARE @reftable_108 nvarchar(60), @constraintname_108 nvarchar(60)
DECLARE refcursor CURSOR FOR
select reftables.name tablename, cons.name constraintname
from sysobjects tables,
sysobjects reftables,
sysobjects cons,
sysreferences ref
where tables.id = ref.rkeyid
and cons.id = ref.constid
and reftables.id = ref.fkeyid
and tables.name = 'MESSAGE'
OPEN refcursor
FETCH NEXT from refcursor into @reftable_108, @constraintname_108
while @@FETCH_STATUS = 0
BEGIN
exec ('alter table '+@reftable_108+' drop constraint '+@constraintname_108)
FETCH NEXT from refcursor into @reftable_108, @constraintname_108
END
CLOSE refcursor
DEALLOCATE refcursor
DROP TABLE [MESSAGE]
END
CREATE TABLE [MESSAGE]
(
[MES_UID] VARCHAR(32) NOT NULL,
[PRJ_UID] VARCHAR(32) NOT NULL,
[MES_NAME] VARCHAR(255) default '' NULL,
[MES_CONDITION] VARCHAR(255) default '' NULL,
CONSTRAINT MESSAGE_PK PRIMARY KEY ([MES_UID])
);
/* ---------------------------------------------------------------------- */
/* MESSAGE_DETAIL */
/* ---------------------------------------------------------------------- */
IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'MESSAGE_DETAIL')
BEGIN
DECLARE @reftable_109 nvarchar(60), @constraintname_109 nvarchar(60)
DECLARE refcursor CURSOR FOR
select reftables.name tablename, cons.name constraintname
from sysobjects tables,
sysobjects reftables,
sysobjects cons,
sysreferences ref
where tables.id = ref.rkeyid
and cons.id = ref.constid
and reftables.id = ref.fkeyid
and tables.name = 'MESSAGE_DETAIL'
OPEN refcursor
FETCH NEXT from refcursor into @reftable_109, @constraintname_109
while @@FETCH_STATUS = 0
BEGIN
exec ('alter table '+@reftable_109+' drop constraint '+@constraintname_109)
FETCH NEXT from refcursor into @reftable_109, @constraintname_109
END
CLOSE refcursor
DEALLOCATE refcursor
DROP TABLE [MESSAGE_DETAIL]
END
CREATE TABLE [MESSAGE_DETAIL]
(
[MD_UID] VARCHAR(32) NOT NULL,
[MES_UID] VARCHAR(32) NOT NULL,
[MD_TYPE] VARCHAR(32) default '' NULL,
[MD_NAME] VARCHAR(255) default '' NULL,
CONSTRAINT MESSAGE_DETAIL_PK PRIMARY KEY ([MD_UID])
);

View File

@@ -486,10 +486,10 @@ CREATE TABLE `ROUTE`
`ROU_PARENT` VARCHAR(32) default '0' NOT NULL,
`PRO_UID` VARCHAR(32) default '' NOT NULL,
`TAS_UID` VARCHAR(32) default '' NOT NULL,
`ROU_NEXT_TASK` VARCHAR(32) default '0' NOT NULL,
`ROU_NEXT_TASK` VARCHAR(32) default '0' NOT NULL,
`ROU_CASE` INTEGER default 0 NOT NULL,
`ROU_TYPE` VARCHAR(25) default 'SEQUENTIAL' NOT NULL,
`ROU_DEFAULT` INTEGER default 0 NOT NULL,
`ROU_DEFAULT` INTEGER default 0 NOT NULL,
`ROU_CONDITION` VARCHAR(512) default '' NOT NULL,
`ROU_TO_LAST_USER` VARCHAR(20) default 'FALSE' NOT NULL,
`ROU_OPTIONAL` VARCHAR(20) default 'FALSE' NOT NULL,
@@ -1207,7 +1207,7 @@ CREATE TABLE `APP_HISTORY`
`PRO_UID` VARCHAR(32) default '' NOT NULL,
`TAS_UID` VARCHAR(32) default '' NOT NULL,
`DYN_UID` VARCHAR(32) default '' NOT NULL,
`OBJ_TYPE` VARCHAR(20) default 'DYNAFORM' NOT NULL,
`OBJ_TYPE` VARCHAR(20) default 'DYNAFORM' NOT NULL,
`USR_UID` VARCHAR(32) default '' NOT NULL,
`APP_STATUS` VARCHAR(100) default '' NOT NULL,
`HISTORY_DATE` DATETIME,
@@ -2380,6 +2380,36 @@ CREATE TABLE `LIST_UNASSIGNED_GROUP`
`TYP_UID` VARCHAR(32) default '' NOT NULL,
PRIMARY KEY (`UNA_UID`,`USR_UID`,`TYPE`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8' COMMENT='Unassiged list';
#-----------------------------------------------------------------------------
#-- MESSAGE
#-----------------------------------------------------------------------------
DROP TABLE IF EXISTS `MESSAGE`;
CREATE TABLE `MESSAGE`
(
`MES_UID` VARCHAR(32) NOT NULL,
`PRJ_UID` VARCHAR(32) NOT NULL,
`MES_NAME` VARCHAR(255) default '',
`MES_CONDITION` VARCHAR(255) default '',
PRIMARY KEY (`MES_UID`)
)ENGINE=InnoDB ;
#-----------------------------------------------------------------------------
#-- MESSAGE_DETAIL
#-----------------------------------------------------------------------------
DROP TABLE IF EXISTS `MESSAGE_DETAIL`;
CREATE TABLE `MESSAGE_DETAIL`
(
`MD_UID` VARCHAR(32) NOT NULL,
`MES_UID` VARCHAR(32) NOT NULL,
`MD_TYPE` VARCHAR(32) default '',
`MD_NAME` VARCHAR(255) default '',
PRIMARY KEY (`MD_UID`)
)ENGINE=InnoDB ;
# This restores the fkey checks, after having unset them earlier
SET FOREIGN_KEY_CHECKS = 1;
@@ -2388,6 +2418,7 @@ SET FOREIGN_KEY_CHECKS = 1;
#-----------------------------------------------------------------------------
DROP TABLE IF EXISTS `EMAIL_SERVER`;
CREATE TABLE `EMAIL_SERVER`
(
`MESS_UID` VARCHAR(32) default '' NOT NULL,

View File

@@ -1850,3 +1850,42 @@ CREATE TABLE APP_ASSIGN_SELF_SERVICE_VALUE
GRP_UID VARCHAR2(32) DEFAULT '' NOT NULL
);
/* -----------------------------------------------------------------------
MESSAGE
----------------------------------------------------------------------- */
DROP TABLE "MESSAGE" CASCADE CONSTRAINTS;
CREATE TABLE "MESSAGE"
(
"MES_UID" VARCHAR2(32) NOT NULL,
"PRJ_UID" VARCHAR2(32) NOT NULL,
"MES_NAME" VARCHAR2(255) default '',
"MES_CONDITION" VARCHAR2(255) default ''
);
ALTER TABLE "MESSAGE"
ADD CONSTRAINT "MESSAGE_PK"
PRIMARY KEY ("MES_UID");
/* -----------------------------------------------------------------------
MESSAGE_DETAIL
----------------------------------------------------------------------- */
DROP TABLE "MESSAGE_DETAIL" CASCADE CONSTRAINTS;
CREATE TABLE "MESSAGE_DETAIL"
(
"MD_UID" VARCHAR2(32) NOT NULL,
"MES_UID" VARCHAR2(32) NOT NULL,
"MD_TYPE" VARCHAR2(32) default '',
"MD_NAME" VARCHAR2(255) default ''
);
ALTER TABLE "MESSAGE_DETAIL"
ADD CONSTRAINT "MESSAGE_DETAIL_PK"
PRIMARY KEY ("MD_UID");

View File

@@ -856,6 +856,13 @@ var dynaformEditor={
/*getField("ENABLETEMPLATE","dynaforms_Properties").checked=(prop.ENABLETEMPLATE=="1");*/
getField("MODE","dynaforms_Properties").value=prop.MODE;
},
refreshPropertiesDynTitle:function()
{
var form=this.views["properties"].getElementsByTagName("form")[0];
var prop=this.ajax.get_properties(this.A,this.dynUid);
getField("A","dynaforms_Properties").value=prop.A;
getField("DYN_TITLE","dynaforms_Properties").value=prop.DYN_TITLE;
},
// Internal functions
runScripts:function(scripts)
{

View File

@@ -26,6 +26,11 @@
*
* @author David Callizaya <davidsantos@colosa.com>
*/
if (isset($_POST['dynaformName'])) {
$dynaForm = new Dynaform();
$res = $dynaForm->verifyExistingName($_POST['dynaformName'], $_POST['proUid'], $_POST['dynaformUid']);
print ($res) ? 1 : 0;
}
global $_DBArray;
if (! isset( $_DBArray )) {
$_DBArray = array ();

View File

@@ -158,13 +158,13 @@ if (isset( $sfunction ) && $sfunction == 'lookforNameDynaform') {
$copyDynGrdDescription = $row["CON_VALUE"];
//Create grid
$aDataAux = $aData;
$dynaformGrid = new dynaform();
$aDataAux = $aData;
$aDataAux["DYN_TYPE"] = "grid";
$aDataAux["DYN_TITLE"] = $copyDynGrdTitle;
$aDataAux["DYN_TITLE"] = $copyDynGrdTitle . ((!$dynaformGrid->verifyExistingName($copyDynGrdTitle, $dynaform->getProUid()))? " (" . $dynaform->getDynTitle() . ")" : "");
$aDataAux["DYN_DESCRIPTION"] = $copyDynGrdDescription;
$dynaformGrid = new dynaform();
$aFields = $dynaformGrid->create($aDataAux);
$dynaformGridUid = $dynaformGrid->getDynUid();

View File

@@ -602,15 +602,15 @@ class DynaForm
$dynGrdDescriptionCopyImport = $row["CON_VALUE"];
//Create Grid
$dynaFormGrid = new \Dynaform();
$arrayDataAux = array(
"PRO_UID" => $processUid,
"DYN_TITLE" => $dynGrdTitleCopyImport,
"DYN_TITLE" => $dynGrdTitleCopyImport . (($this->existsTitle($processUid, $dynGrdTitleCopyImport))? " (" . $arrayData["DYN_TITLE"] . ")" : ""),
"DYN_DESCRIPTION" => $dynGrdDescriptionCopyImport,
"DYN_TYPE" => "grid"
);
$dynaFormGrid = new \Dynaform();
$dynaFormGridUid = $dynaFormGrid->create($arrayDataAux);
//Copy files of the DynaForm Grid
@@ -1124,6 +1124,5 @@ class DynaForm
throw $e;
}
}
}

View File

@@ -0,0 +1,415 @@
<?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;
}
}
}

View File

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

View File

@@ -37,6 +37,7 @@ debug = 1
trigger-wizard = "ProcessMaker\Services\Api\Project\TriggerWizard"
category = "ProcessMaker\Services\Api\ProcessCategory"
process-variable = "ProcessMaker\Services\Api\Project\Variable"
message = "ProcessMaker\Services\Api\Project\Message"
[alias: projects]
project = "ProcessMaker\Services\Api\Project"
@@ -92,4 +93,4 @@ debug = 1
email = "ProcessMaker\Services\Api\EmailServer"
[alias: emails]
email = "ProcessMaker\Services\Api\EmailServer"
email = "ProcessMaker\Services\Api\EmailServer"

View File

@@ -73,8 +73,34 @@
</PME_PROP_REVERT>
<sdfsdf type="javascript">
<![CDATA[
leimnud.event.add(getField('DYN_TITLE'), 'blur', function()
{
var isTrue;
oRPC = new leimnud.module.rpc.xmlhttp({
url : "../dynaforms/dynaforms_Ajax",
method: 'POST',
async : true,
args : 'dynaformName=' + getField('DYN_TITLE').value + '&dynaformUid=' + getField('DYN_UID').value + '&proUid=' + getField('PRO_UID').value
});
oRPC.callback = function(oRPC) {
var response = oRPC.xmlhttp.responseText;
response = parseInt(response);
var nDynaform = new input(getField('DYN_TITLE'));
if (response){
nDynaform.passed();
} else {
nDynaform.failed();
nDynaform.focus();
msgBox("@G::LoadTranslation(ID_EXIST_DYNAFORM)", "alert");
dynaformEditor.refreshPropertiesDynTitle();
}
}.extend(this);
isTrue = oRPC.make();
return isTrue;
});
// added by gustavo cruz gustavo-at-colosa.com
// function getElementsByClassNameCrossBrowser
// CrossBrowser implemetation of the getElementsByClassName firefox function