Merged in victorsl/processmaker/PM-939 (pull request #1351)

PM-1005 "WebEntry-Event (Endpoints)"
This commit is contained in:
Julio Cesar Laura Avendaño
2015-01-28 15:25:58 -04:00
20 changed files with 3296 additions and 43 deletions

View File

@@ -256,6 +256,7 @@ class Cases
$c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$c->addJoin(TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN);
$c->add(ProcessPeer::PRO_STATUS, 'ACTIVE');
$c->add(TaskPeer::TAS_TYPE, "WEBENTRYEVENT", Criteria::NOT_EQUAL);
$c->add(TaskPeer::TAS_START, 'TRUE');
$c->add(TaskUserPeer::USR_UID, $sUIDUser);
@@ -281,6 +282,7 @@ class Cases
$c->addJoin(TaskPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN);
$c->addJoin(TaskPeer::TAS_UID, TaskUserPeer::TAS_UID, Criteria::LEFT_JOIN);
$c->add(ProcessPeer::PRO_STATUS, 'ACTIVE');
$c->add(TaskPeer::TAS_TYPE, "WEBENTRYEVENT", Criteria::NOT_EQUAL);
$c->add(TaskPeer::TAS_START, 'TRUE');
$c->add(TaskUserPeer::USR_UID, $aGroups, Criteria::IN);

View File

@@ -851,9 +851,14 @@ class Processes
}
if (isset( $oData->steps ) && is_array( $oData->steps )) {
foreach ($oData->steps as $key => $val) {
$newGuid = $map[$val['TAS_UID']];
$oData->steps[$key]['TAS_UID'] = $newGuid;
foreach ($oData->steps as $key => $value) {
$record = $value;
if (isset($map[$record["TAS_UID"]])) {
$newUid = $map[$record["TAS_UID"]];
$oData->steps[$key]["TAS_UID"] = $newUid;
}
}
}
@@ -910,6 +915,29 @@ class Processes
}
}
if (isset($oData->webEntry)) {
foreach ($oData->webEntry as $key => $value) {
$record = $value;
if (isset($map[$record["TAS_UID"]])) {
$newUid = $map[$record["TAS_UID"]];
$oData->webEntry[$key]["TAS_UID"] = $newUid;
}
}
}
if (isset($oData->webEntryEvent)) {
foreach ($oData->webEntryEvent as $key => $value) {
$record = $value;
if (isset($map[$record["ACT_UID"]])) {
$newUid = $map[$record["ACT_UID"]];
$oData->webEntryEvent[$key]["ACT_UID"] = $newUid;
}
}
}
}
/**
@@ -994,6 +1022,29 @@ class Processes
}
}
if (isset($oData->webEntry)) {
foreach ($oData->webEntry as $key => $value) {
$record = $value;
if (isset($map[$record["DYN_UID"]])) {
$newUid = $map[$record["DYN_UID"]];
$oData->webEntry[$key]["DYN_UID"] = $newUid;
}
}
}
if (isset($oData->webEntryEvent)) {
foreach ($oData->webEntryEvent as $key => $value) {
$record = $value;
if (isset($map[$record["DYN_UID"]])) {
$newUid = $map[$record["DYN_UID"]];
$oData->webEntryEvent[$key]["DYN_UID"] = $newUid;
}
}
}
}
/**
@@ -2747,6 +2798,97 @@ class Processes
}
}
/**
* Get all WebEntry records of a Process
*
* @param string $processUid Unique id of Process
*
* return array Return an array with all WebEntry records of a Process
*/
public function getWebEntries($processUid)
{
try {
$arrayWebEntry = array();
$webEntry = new \ProcessMaker\BusinessModel\WebEntry();
//Get UIDs to exclude
$arrayWebEntryUidToExclude = array();
$criteria = new Criteria("workflow");
$criteria->setDistinct();
$criteria->addSelectColumn(WebEntryEventPeer::WEE_WE_UID);
$criteria->add(WebEntryEventPeer::PRJ_UID, $processUid, Criteria::EQUAL);
$rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$arrayWebEntryUidToExclude[] = $row["WEE_WE_UID"];
}
//Get data
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(WebEntryPeer::WE_UID);
$criteria->add(WebEntryPeer::PRO_UID, $processUid, Criteria::EQUAL);
$criteria->add(WebEntryPeer::WE_UID, $arrayWebEntryUidToExclude, Criteria::NOT_IN);
$rsCriteria = WebEntryPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$arrayWebEntry[] = $webEntry->getWebEntry($row["WE_UID"], true);
}
//Return
return $arrayWebEntry;
} catch (Exception $e) {
throw $e;
}
}
/**
* Get all WebEntry-Event records of a Process
*
* @param string $processUid Unique id of Process
*
* return array Return an array with all WebEntry-Event records of a Process
*/
public function getWebEntryEvents($processUid)
{
try {
$arrayWebEntryEvent = array();
$webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
//Get data
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(WebEntryEventPeer::WEE_UID);
$criteria->add(WebEntryEventPeer::PRJ_UID, $processUid, Criteria::EQUAL);
$rsCriteria = WebEntryEventPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$arrayWebEntryEvent[] = $webEntryEvent->getWebEntryEvent($row["WEE_UID"], true);
}
//Return
return $arrayWebEntryEvent;
} catch (Exception $e) {
throw $e;
}
}
/**
* Get Task User Rows from an array of data
*
@@ -2887,6 +3029,53 @@ class Processes
}
} #@!neyek
/**
* Create WebEntry records
*
* @param string $processUid Unique id of Process
* @param string $userUidCreator Unique id of creator User
* @param array $arrayData Data
*
* return void
*/
public function createWebEntry($processUid, $userUidCreator, array $arrayData)
{
try {
$webEntry = new \ProcessMaker\BusinessModel\WebEntry();
foreach ($arrayData as $value) {
$record = $value;
$arrayWebEntryData = $webEntry->create($processUid, $userUidCreator, $record);
}
} catch (Exception $e) {
//throw $e;
}
}
/**
* Create WebEntry-Event records
*
* @param string $processUid Unique id of Process
* @param string $userUidCreator Unique id of creator User
* @param array $arrayData Data
*
* return void
*/
public function createWebEntryEvent($processUid, $userUidCreator, array $arrayData)
{
try {
$webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
foreach ($arrayData as $value) {
$record = $value;
$arrayWebEntryEventData = $webEntryEvent->create($processUid, $userUidCreator, $record);
}
} catch (Exception $e) {
//throw $e;
}
}
/**
* Cleanup Report Tables References from an array of data
@@ -3072,14 +3261,13 @@ class Processes
$oData->taskExtraProperties = $this->getTaskExtraPropertiesRows( $sProUid );
$oData->processUser = $this->getProcessUser($sProUid);
$oData->processVariables = $this->getProcessVariables($sProUid);
$oData->webEntry = $this->getWebEntries($sProUid);
$oData->webEntryEvent = $this->getWebEntryEvents($sProUid);
$oData->groupwfs = $this->groupwfsMerge($oData->groupwfs, $oData->processUser, "USR_UID");
$oData->process["PRO_TYPE_PROCESS"] = "PUBLIC";
//krumo ($oData);die;
//$oJSON = new Services_JSON();
//krumo ( $oJSON->encode($oData) );
//return $oJSON->encode($oData);
//Return
return $oData;
}
@@ -4077,6 +4265,8 @@ class Processes
public function createProcessPropertiesFromData ($oData)
{
$arrayProcessData = $oData->process;
// (*) Creating process dependencies
// creating the process category
$this->createProcessCategoryRow( isset( $oData->processCategory ) ? $oData->processCategory : null );
@@ -4116,7 +4306,8 @@ class Processes
$this->createProcessUser((isset($oData->processUser))? $oData->processUser : array());
$this->createProcessVariables((isset($oData->processVariables))? $oData->processVariables : array());
$this->createWebEntry($arrayProcessData["PRO_UID"], $arrayProcessData["PRO_CREATE_USER"], (isset($oData->webEntry))? $oData->webEntry : array());
$this->createWebEntryEvent($arrayProcessData["PRO_UID"], $arrayProcessData["PRO_CREATE_USER"], (isset($oData->webEntryEvent))? $oData->webEntryEvent : array());
}

View File

@@ -0,0 +1,5 @@
<?php
class WebEntryEvent extends BaseWebEntryEvent
{
}

View File

@@ -0,0 +1,5 @@
<?php
class WebEntryEventPeer extends BaseWebEntryEventPeer
{
}

View File

@@ -159,7 +159,7 @@ class TaskMapBuilder
$tMap->addColumn('TAS_SELFSERVICE_EXECUTION', 'TasSelfserviceExecution', 'string', CreoleTypes::VARCHAR, false, 15);
$tMap->addValidator('TAS_TYPE', 'validValues', 'propel.validator.ValidValuesValidator', 'NORMAL|ADHOC|SUBPROCESS|HIDDEN|GATEWAYTOGATEWAY', 'Please enter a valid value for TAS_TYPE');
$tMap->addValidator('TAS_TYPE', 'validValues', 'propel.validator.ValidValuesValidator', 'NORMAL|ADHOC|SUBPROCESS|HIDDEN|GATEWAYTOGATEWAY|WEBENTRYEVENT', 'Please enter a valid value for TAS_TYPE');
$tMap->addValidator('TAS_TIMEUNIT', 'validValues', 'propel.validator.ValidValuesValidator', 'MINUTES|HOURS|DAYS|WEEKS|MONTHS', 'Please select a valid value for TAS_TIMEUNIT.');

View File

@@ -0,0 +1,90 @@
<?php
require_once 'propel/map/MapBuilder.php';
include_once 'creole/CreoleTypes.php';
/**
* This class adds structure of 'WEB_ENTRY_EVENT' 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 WebEntryEventMapBuilder
{
/**
* The (dot-path) name of this class
*/
const CLASS_NAME = 'classes.model.map.WebEntryEventMapBuilder';
/**
* 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('WEB_ENTRY_EVENT');
$tMap->setPhpName('WebEntryEvent');
$tMap->setUseIdGenerator(false);
$tMap->addPrimaryKey('WEE_UID', 'WeeUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('PRJ_UID', 'PrjUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('EVN_UID', 'EvnUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('ACT_UID', 'ActUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('DYN_UID', 'DynUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('USR_UID', 'UsrUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('WEE_STATUS', 'WeeStatus', 'string', CreoleTypes::VARCHAR, true, 10);
$tMap->addColumn('WEE_WE_UID', 'WeeWeUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addColumn('WEE_WE_TAS_UID', 'WeeWeTasUid', 'string', CreoleTypes::VARCHAR, true, 32);
$tMap->addValidator('WEE_STATUS', 'validValues', 'propel.validator.ValidValuesValidator', 'ENABLED|DISABLED', 'Please enter a valid value for WEE_STATUS');
} // doBuild()
} // WebEntryEventMapBuilder

View File

@@ -0,0 +1,974 @@
<?php
require_once 'propel/om/BaseObject.php';
require_once 'propel/om/Persistent.php';
include_once 'propel/util/Criteria.php';
include_once 'classes/model/WebEntryEventPeer.php';
/**
* Base class that represents a row from the 'WEB_ENTRY_EVENT' table.
*
*
*
* @package workflow.classes.model.om
*/
abstract class BaseWebEntryEvent 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 WebEntryEventPeer
*/
protected static $peer;
/**
* The value for the wee_uid field.
* @var string
*/
protected $wee_uid;
/**
* The value for the prj_uid field.
* @var string
*/
protected $prj_uid;
/**
* The value for the evn_uid field.
* @var string
*/
protected $evn_uid;
/**
* The value for the act_uid field.
* @var string
*/
protected $act_uid;
/**
* The value for the dyn_uid field.
* @var string
*/
protected $dyn_uid;
/**
* The value for the usr_uid field.
* @var string
*/
protected $usr_uid;
/**
* The value for the wee_status field.
* @var string
*/
protected $wee_status = 'ENABLED';
/**
* The value for the wee_we_uid field.
* @var string
*/
protected $wee_we_uid = '';
/**
* The value for the wee_we_tas_uid field.
* @var string
*/
protected $wee_we_tas_uid = '';
/**
* 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 [wee_uid] column value.
*
* @return string
*/
public function getWeeUid()
{
return $this->wee_uid;
}
/**
* Get the [prj_uid] column value.
*
* @return string
*/
public function getPrjUid()
{
return $this->prj_uid;
}
/**
* Get the [evn_uid] column value.
*
* @return string
*/
public function getEvnUid()
{
return $this->evn_uid;
}
/**
* Get the [act_uid] column value.
*
* @return string
*/
public function getActUid()
{
return $this->act_uid;
}
/**
* Get the [dyn_uid] column value.
*
* @return string
*/
public function getDynUid()
{
return $this->dyn_uid;
}
/**
* Get the [usr_uid] column value.
*
* @return string
*/
public function getUsrUid()
{
return $this->usr_uid;
}
/**
* Get the [wee_status] column value.
*
* @return string
*/
public function getWeeStatus()
{
return $this->wee_status;
}
/**
* Get the [wee_we_uid] column value.
*
* @return string
*/
public function getWeeWeUid()
{
return $this->wee_we_uid;
}
/**
* Get the [wee_we_tas_uid] column value.
*
* @return string
*/
public function getWeeWeTasUid()
{
return $this->wee_we_tas_uid;
}
/**
* Set the value of [wee_uid] column.
*
* @param string $v new value
* @return void
*/
public function setWeeUid($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->wee_uid !== $v) {
$this->wee_uid = $v;
$this->modifiedColumns[] = WebEntryEventPeer::WEE_UID;
}
} // setWeeUid()
/**
* 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[] = WebEntryEventPeer::PRJ_UID;
}
} // setPrjUid()
/**
* Set the value of [evn_uid] column.
*
* @param string $v new value
* @return void
*/
public function setEvnUid($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->evn_uid !== $v) {
$this->evn_uid = $v;
$this->modifiedColumns[] = WebEntryEventPeer::EVN_UID;
}
} // setEvnUid()
/**
* Set the value of [act_uid] column.
*
* @param string $v new value
* @return void
*/
public function setActUid($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->act_uid !== $v) {
$this->act_uid = $v;
$this->modifiedColumns[] = WebEntryEventPeer::ACT_UID;
}
} // setActUid()
/**
* Set the value of [dyn_uid] column.
*
* @param string $v new value
* @return void
*/
public function setDynUid($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->dyn_uid !== $v) {
$this->dyn_uid = $v;
$this->modifiedColumns[] = WebEntryEventPeer::DYN_UID;
}
} // setDynUid()
/**
* Set the value of [usr_uid] column.
*
* @param string $v new value
* @return void
*/
public function setUsrUid($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->usr_uid !== $v) {
$this->usr_uid = $v;
$this->modifiedColumns[] = WebEntryEventPeer::USR_UID;
}
} // setUsrUid()
/**
* Set the value of [wee_status] column.
*
* @param string $v new value
* @return void
*/
public function setWeeStatus($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->wee_status !== $v || $v === 'ENABLED') {
$this->wee_status = $v;
$this->modifiedColumns[] = WebEntryEventPeer::WEE_STATUS;
}
} // setWeeStatus()
/**
* Set the value of [wee_we_uid] column.
*
* @param string $v new value
* @return void
*/
public function setWeeWeUid($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->wee_we_uid !== $v || $v === '') {
$this->wee_we_uid = $v;
$this->modifiedColumns[] = WebEntryEventPeer::WEE_WE_UID;
}
} // setWeeWeUid()
/**
* Set the value of [wee_we_tas_uid] column.
*
* @param string $v new value
* @return void
*/
public function setWeeWeTasUid($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->wee_we_tas_uid !== $v || $v === '') {
$this->wee_we_tas_uid = $v;
$this->modifiedColumns[] = WebEntryEventPeer::WEE_WE_TAS_UID;
}
} // setWeeWeTasUid()
/**
* 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->wee_uid = $rs->getString($startcol + 0);
$this->prj_uid = $rs->getString($startcol + 1);
$this->evn_uid = $rs->getString($startcol + 2);
$this->act_uid = $rs->getString($startcol + 3);
$this->dyn_uid = $rs->getString($startcol + 4);
$this->usr_uid = $rs->getString($startcol + 5);
$this->wee_status = $rs->getString($startcol + 6);
$this->wee_we_uid = $rs->getString($startcol + 7);
$this->wee_we_tas_uid = $rs->getString($startcol + 8);
$this->resetModified();
$this->setNew(false);
// FIXME - using NUM_COLUMNS may be clearer.
return $startcol + 9; // 9 = WebEntryEventPeer::NUM_COLUMNS - WebEntryEventPeer::NUM_LAZY_LOAD_COLUMNS).
} catch (Exception $e) {
throw new PropelException("Error populating WebEntryEvent 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(WebEntryEventPeer::DATABASE_NAME);
}
try {
$con->begin();
WebEntryEventPeer::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(WebEntryEventPeer::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 = WebEntryEventPeer::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 += WebEntryEventPeer::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 = WebEntryEventPeer::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 = WebEntryEventPeer::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->getWeeUid();
break;
case 1:
return $this->getPrjUid();
break;
case 2:
return $this->getEvnUid();
break;
case 3:
return $this->getActUid();
break;
case 4:
return $this->getDynUid();
break;
case 5:
return $this->getUsrUid();
break;
case 6:
return $this->getWeeStatus();
break;
case 7:
return $this->getWeeWeUid();
break;
case 8:
return $this->getWeeWeTasUid();
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 = WebEntryEventPeer::getFieldNames($keyType);
$result = array(
$keys[0] => $this->getWeeUid(),
$keys[1] => $this->getPrjUid(),
$keys[2] => $this->getEvnUid(),
$keys[3] => $this->getActUid(),
$keys[4] => $this->getDynUid(),
$keys[5] => $this->getUsrUid(),
$keys[6] => $this->getWeeStatus(),
$keys[7] => $this->getWeeWeUid(),
$keys[8] => $this->getWeeWeTasUid(),
);
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 = WebEntryEventPeer::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->setWeeUid($value);
break;
case 1:
$this->setPrjUid($value);
break;
case 2:
$this->setEvnUid($value);
break;
case 3:
$this->setActUid($value);
break;
case 4:
$this->setDynUid($value);
break;
case 5:
$this->setUsrUid($value);
break;
case 6:
$this->setWeeStatus($value);
break;
case 7:
$this->setWeeWeUid($value);
break;
case 8:
$this->setWeeWeTasUid($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 = WebEntryEventPeer::getFieldNames($keyType);
if (array_key_exists($keys[0], $arr)) {
$this->setWeeUid($arr[$keys[0]]);
}
if (array_key_exists($keys[1], $arr)) {
$this->setPrjUid($arr[$keys[1]]);
}
if (array_key_exists($keys[2], $arr)) {
$this->setEvnUid($arr[$keys[2]]);
}
if (array_key_exists($keys[3], $arr)) {
$this->setActUid($arr[$keys[3]]);
}
if (array_key_exists($keys[4], $arr)) {
$this->setDynUid($arr[$keys[4]]);
}
if (array_key_exists($keys[5], $arr)) {
$this->setUsrUid($arr[$keys[5]]);
}
if (array_key_exists($keys[6], $arr)) {
$this->setWeeStatus($arr[$keys[6]]);
}
if (array_key_exists($keys[7], $arr)) {
$this->setWeeWeUid($arr[$keys[7]]);
}
if (array_key_exists($keys[8], $arr)) {
$this->setWeeWeTasUid($arr[$keys[8]]);
}
}
/**
* 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(WebEntryEventPeer::DATABASE_NAME);
if ($this->isColumnModified(WebEntryEventPeer::WEE_UID)) {
$criteria->add(WebEntryEventPeer::WEE_UID, $this->wee_uid);
}
if ($this->isColumnModified(WebEntryEventPeer::PRJ_UID)) {
$criteria->add(WebEntryEventPeer::PRJ_UID, $this->prj_uid);
}
if ($this->isColumnModified(WebEntryEventPeer::EVN_UID)) {
$criteria->add(WebEntryEventPeer::EVN_UID, $this->evn_uid);
}
if ($this->isColumnModified(WebEntryEventPeer::ACT_UID)) {
$criteria->add(WebEntryEventPeer::ACT_UID, $this->act_uid);
}
if ($this->isColumnModified(WebEntryEventPeer::DYN_UID)) {
$criteria->add(WebEntryEventPeer::DYN_UID, $this->dyn_uid);
}
if ($this->isColumnModified(WebEntryEventPeer::USR_UID)) {
$criteria->add(WebEntryEventPeer::USR_UID, $this->usr_uid);
}
if ($this->isColumnModified(WebEntryEventPeer::WEE_STATUS)) {
$criteria->add(WebEntryEventPeer::WEE_STATUS, $this->wee_status);
}
if ($this->isColumnModified(WebEntryEventPeer::WEE_WE_UID)) {
$criteria->add(WebEntryEventPeer::WEE_WE_UID, $this->wee_we_uid);
}
if ($this->isColumnModified(WebEntryEventPeer::WEE_WE_TAS_UID)) {
$criteria->add(WebEntryEventPeer::WEE_WE_TAS_UID, $this->wee_we_tas_uid);
}
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(WebEntryEventPeer::DATABASE_NAME);
$criteria->add(WebEntryEventPeer::WEE_UID, $this->wee_uid);
return $criteria;
}
/**
* Returns the primary key for this object (row).
* @return string
*/
public function getPrimaryKey()
{
return $this->getWeeUid();
}
/**
* Generic method to set the primary key (wee_uid column).
*
* @param string $key Primary key.
* @return void
*/
public function setPrimaryKey($key)
{
$this->setWeeUid($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 WebEntryEvent (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->setEvnUid($this->evn_uid);
$copyObj->setActUid($this->act_uid);
$copyObj->setDynUid($this->dyn_uid);
$copyObj->setUsrUid($this->usr_uid);
$copyObj->setWeeStatus($this->wee_status);
$copyObj->setWeeWeUid($this->wee_we_uid);
$copyObj->setWeeWeTasUid($this->wee_we_tas_uid);
$copyObj->setNew(true);
$copyObj->setWeeUid(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 WebEntryEvent 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 WebEntryEventPeer
*/
public function getPeer()
{
if (self::$peer === null) {
self::$peer = new WebEntryEventPeer();
}
return self::$peer;
}
}

View File

@@ -0,0 +1,610 @@
<?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 WebEntryEventPeer::getOMClass()
include_once 'classes/model/WebEntryEvent.php';
/**
* Base static class for performing query and update operations on the 'WEB_ENTRY_EVENT' table.
*
*
*
* @package workflow.classes.model.om
*/
abstract class BaseWebEntryEventPeer
{
/** the default database name for this class */
const DATABASE_NAME = 'workflow';
/** the table name for this class */
const TABLE_NAME = 'WEB_ENTRY_EVENT';
/** A class that can be returned by this peer. */
const CLASS_DEFAULT = 'classes.model.WebEntryEvent';
/** The total number of columns. */
const NUM_COLUMNS = 9;
/** The number of lazy-loaded columns. */
const NUM_LAZY_LOAD_COLUMNS = 0;
/** the column name for the WEE_UID field */
const WEE_UID = 'WEB_ENTRY_EVENT.WEE_UID';
/** the column name for the PRJ_UID field */
const PRJ_UID = 'WEB_ENTRY_EVENT.PRJ_UID';
/** the column name for the EVN_UID field */
const EVN_UID = 'WEB_ENTRY_EVENT.EVN_UID';
/** the column name for the ACT_UID field */
const ACT_UID = 'WEB_ENTRY_EVENT.ACT_UID';
/** the column name for the DYN_UID field */
const DYN_UID = 'WEB_ENTRY_EVENT.DYN_UID';
/** the column name for the USR_UID field */
const USR_UID = 'WEB_ENTRY_EVENT.USR_UID';
/** the column name for the WEE_STATUS field */
const WEE_STATUS = 'WEB_ENTRY_EVENT.WEE_STATUS';
/** the column name for the WEE_WE_UID field */
const WEE_WE_UID = 'WEB_ENTRY_EVENT.WEE_WE_UID';
/** the column name for the WEE_WE_TAS_UID field */
const WEE_WE_TAS_UID = 'WEB_ENTRY_EVENT.WEE_WE_TAS_UID';
/** 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 ('WeeUid', 'PrjUid', 'EvnUid', 'ActUid', 'DynUid', 'UsrUid', 'WeeStatus', 'WeeWeUid', 'WeeWeTasUid', ),
BasePeer::TYPE_COLNAME => array (WebEntryEventPeer::WEE_UID, WebEntryEventPeer::PRJ_UID, WebEntryEventPeer::EVN_UID, WebEntryEventPeer::ACT_UID, WebEntryEventPeer::DYN_UID, WebEntryEventPeer::USR_UID, WebEntryEventPeer::WEE_STATUS, WebEntryEventPeer::WEE_WE_UID, WebEntryEventPeer::WEE_WE_TAS_UID, ),
BasePeer::TYPE_FIELDNAME => array ('WEE_UID', 'PRJ_UID', 'EVN_UID', 'ACT_UID', 'DYN_UID', 'USR_UID', 'WEE_STATUS', 'WEE_WE_UID', 'WEE_WE_TAS_UID', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
* 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 ('WeeUid' => 0, 'PrjUid' => 1, 'EvnUid' => 2, 'ActUid' => 3, 'DynUid' => 4, 'UsrUid' => 5, 'WeeStatus' => 6, 'WeeWeUid' => 7, 'WeeWeTasUid' => 8, ),
BasePeer::TYPE_COLNAME => array (WebEntryEventPeer::WEE_UID => 0, WebEntryEventPeer::PRJ_UID => 1, WebEntryEventPeer::EVN_UID => 2, WebEntryEventPeer::ACT_UID => 3, WebEntryEventPeer::DYN_UID => 4, WebEntryEventPeer::USR_UID => 5, WebEntryEventPeer::WEE_STATUS => 6, WebEntryEventPeer::WEE_WE_UID => 7, WebEntryEventPeer::WEE_WE_TAS_UID => 8, ),
BasePeer::TYPE_FIELDNAME => array ('WEE_UID' => 0, 'PRJ_UID' => 1, 'EVN_UID' => 2, 'ACT_UID' => 3, 'DYN_UID' => 4, 'USR_UID' => 5, 'WEE_STATUS' => 6, 'WEE_WE_UID' => 7, 'WEE_WE_TAS_UID' => 8, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, )
);
/**
* @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/WebEntryEventMapBuilder.php';
return BasePeer::getMapBuilder('classes.model.map.WebEntryEventMapBuilder');
}
/**
* 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 = WebEntryEventPeer::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. WebEntryEventPeer::COLUMN_NAME).
* @return string
*/
public static function alias($alias, $column)
{
return str_replace(WebEntryEventPeer::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(WebEntryEventPeer::WEE_UID);
$criteria->addSelectColumn(WebEntryEventPeer::PRJ_UID);
$criteria->addSelectColumn(WebEntryEventPeer::EVN_UID);
$criteria->addSelectColumn(WebEntryEventPeer::ACT_UID);
$criteria->addSelectColumn(WebEntryEventPeer::DYN_UID);
$criteria->addSelectColumn(WebEntryEventPeer::USR_UID);
$criteria->addSelectColumn(WebEntryEventPeer::WEE_STATUS);
$criteria->addSelectColumn(WebEntryEventPeer::WEE_WE_UID);
$criteria->addSelectColumn(WebEntryEventPeer::WEE_WE_TAS_UID);
}
const COUNT = 'COUNT(WEB_ENTRY_EVENT.WEE_UID)';
const COUNT_DISTINCT = 'COUNT(DISTINCT WEB_ENTRY_EVENT.WEE_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(WebEntryEventPeer::COUNT_DISTINCT);
} else {
$criteria->addSelectColumn(WebEntryEventPeer::COUNT);
}
// just in case we're grouping: add those columns to the select statement
foreach ($criteria->getGroupByColumns() as $column) {
$criteria->addSelectColumn($column);
}
$rs = WebEntryEventPeer::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 WebEntryEvent
* @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 = WebEntryEventPeer::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 WebEntryEventPeer::populateObjects(WebEntryEventPeer::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;
WebEntryEventPeer::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 = WebEntryEventPeer::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 WebEntryEventPeer::CLASS_DEFAULT;
}
/**
* Method perform an INSERT on the database, given a WebEntryEvent or Criteria object.
*
* @param mixed $values Criteria or WebEntryEvent 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 WebEntryEvent 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 WebEntryEvent or Criteria object.
*
* @param mixed $values Criteria or WebEntryEvent 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(WebEntryEventPeer::WEE_UID);
$selectCriteria->add(WebEntryEventPeer::WEE_UID, $criteria->remove(WebEntryEventPeer::WEE_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 WEB_ENTRY_EVENT 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(WebEntryEventPeer::TABLE_NAME, $con);
$con->commit();
return $affectedRows;
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
/**
* Method perform a DELETE on the database, given a WebEntryEvent or Criteria object OR a primary key value.
*
* @param mixed $values Criteria or WebEntryEvent 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(WebEntryEventPeer::DATABASE_NAME);
}
if ($values instanceof Criteria) {
$criteria = clone $values; // rename for clarity
} elseif ($values instanceof WebEntryEvent) {
$criteria = $values->buildPkeyCriteria();
} else {
// it must be the primary key
$criteria = new Criteria(self::DATABASE_NAME);
$criteria->add(WebEntryEventPeer::WEE_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 WebEntryEvent 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 WebEntryEvent $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(WebEntryEvent $obj, $cols = null)
{
$columns = array();
if ($cols) {
$dbMap = Propel::getDatabaseMap(WebEntryEventPeer::DATABASE_NAME);
$tableMap = $dbMap->getTable(WebEntryEventPeer::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 {
if ($obj->isNew() || $obj->isColumnModified(WebEntryEventPeer::WEE_STATUS))
$columns[WebEntryEventPeer::WEE_STATUS] = $obj->getWeeStatus();
}
return BasePeer::doValidate(WebEntryEventPeer::DATABASE_NAME, WebEntryEventPeer::TABLE_NAME, $columns);
}
/**
* Retrieve a single object by pkey.
*
* @param mixed $pk the primary key.
* @param Connection $con the connection to use
* @return WebEntryEvent
*/
public static function retrieveByPK($pk, $con = null)
{
if ($con === null) {
$con = Propel::getConnection(self::DATABASE_NAME);
}
$criteria = new Criteria(WebEntryEventPeer::DATABASE_NAME);
$criteria->add(WebEntryEventPeer::WEE_UID, $pk);
$v = WebEntryEventPeer::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(WebEntryEventPeer::WEE_UID, $pks, Criteria::IN);
$objs = WebEntryEventPeer::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 {
BaseWebEntryEventPeer::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/WebEntryEventMapBuilder.php';
Propel::registerMapBuilder('classes.model.map.WebEntryEventMapBuilder');
}

View File

@@ -1248,7 +1248,7 @@
<column name="TAS_SELFSERVICE_EXECUTION" type="VARCHAR" size="15" default="EVERY_TIME"/>
<validator column="TAS_TYPE">
<rule name="validValues" value="NORMAL|ADHOC|SUBPROCESS|HIDDEN|GATEWAYTOGATEWAY" message="Please enter a valid value for TAS_TYPE"/>
<rule name="validValues" value="NORMAL|ADHOC|SUBPROCESS|HIDDEN|GATEWAYTOGATEWAY|WEBENTRYEVENT" message="Please enter a valid value for TAS_TYPE"/>
</validator>
<validator column="TAS_TIMEUNIT">
<rule name="validValues" value="MINUTES|HOURS|DAYS|WEEKS|MONTHS" message="Please select a valid value for TAS_TIMEUNIT."/>
@@ -4209,5 +4209,32 @@
<column name="MAIL_TO" type="VARCHAR" size="256" required="true" default="" />
<column name="MESS_DEFAULT" type="INTEGER" required="true" default="0" />
</table>
<table name="WEB_ENTRY_EVENT">
<vendor type="mysql">
<parameter name="Name" value="WEB_ENTRY_EVENT" />
<parameter name="Engine" value="InnoDB" />
<parameter name="Version" value="10" />
<parameter name="Row_format" value="Dynamic" />
<parameter name="Data_free" value="0" />
<parameter name="Auto_increment" value="" />
<parameter name="Check_time" value="" />
<parameter name="Collation" value="utf8_general_ci" />
<parameter name="Checksum" value="" />
<parameter name="Create_options" value="" />
</vendor>
<column name="WEE_UID" type="VARCHAR" size="32" required="true" primaryKey="true" />
<column name="PRJ_UID" type="VARCHAR" size="32" required="true" />
<column name="EVN_UID" type="VARCHAR" size="32" required="true" />
<column name="ACT_UID" type="VARCHAR" size="32" required="true" />
<column name="DYN_UID" type="VARCHAR" size="32" required="true" />
<column name="USR_UID" type="VARCHAR" size="32" required="true" />
<column name="WEE_STATUS" type="VARCHAR" size="10" required="true" default="ENABLED" />
<column name="WEE_WE_UID" type="VARCHAR" size="32" required="true" default="" />
<column name="WEE_WE_TAS_UID" type="VARCHAR" size="32" required="true" default="" />
<validator column="WEE_STATUS">
<rule name="validValues" value="ENABLED|DISABLED" message="Please enter a valid value for WEE_STATUS" />
</validator>
</table>
</database>

View File

@@ -3357,3 +3357,48 @@ CREATE TABLE [MESSAGE_DETAIL]
[MD_NAME] VARCHAR(255) default '' NULL,
CONSTRAINT MESSAGE_DETAIL_PK PRIMARY KEY ([MD_UID])
);
/* --------------------------------------------------------------------------- */
/* WEB_ENTRY_EVENT */
/* --------------------------------------------------------------------------- */
IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'WEB_ENTRY_EVENT')
BEGIN
DECLARE @reftable_72 nvarchar(60), @constraintname_72 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 = 'WEB_ENTRY_EVENT'
OPEN refcursor
FETCH NEXT from refcursor into @reftable_72, @constraintname_72
while @@FETCH_STATUS = 0
BEGIN
exec ('alter table ' + @reftable_72 + ' drop constraint ' + @constraintname_72)
FETCH NEXT from refcursor into @reftable_72, @constraintname_72
END
CLOSE refcursor
DEALLOCATE refcursor
DROP TABLE [WEB_ENTRY_EVENT]
END
CREATE TABLE WEB_ENTRY_EVENT
(
WEE_UID VARCHAR(32) NOT NULL,
PRJ_UID VARCHAR(32) NOT NULL,
EVN_UID VARCHAR(32) NOT NULL,
ACT_UID VARCHAR(32) NOT NULL,
DYN_UID VARCHAR(32) NOT NULL,
USR_UID VARCHAR(32) NOT NULL,
WEE_STATUS VARCHAR(10) NOT NULL DEFAULT 'ENABLED',
WEE_WE_UID VARCHAR(32) NOT NULL DEFAULT '',
WEE_WE_TAS_UID VARCHAR(32) NOT NULL DEFAULT '',
CONSTRAINT WEB_ENTRY_EVENT_PK PRIMARY KEY (WEE_UID)
);

View File

@@ -2434,3 +2434,24 @@ CREATE TABLE `EMAIL_SERVER`
PRIMARY KEY (`MESS_UID`)
)ENGINE=InnoDB DEFAULT CHARSET='utf8';
#-----------------------------------------------------------------------------
#-- WEB_ENTRY_EVENT
#-----------------------------------------------------------------------------
DROP TABLE IF EXISTS WEB_ENTRY_EVENT;
CREATE TABLE WEB_ENTRY_EVENT
(
WEE_UID VARCHAR(32) NOT NULL,
PRJ_UID VARCHAR(32) NOT NULL,
EVN_UID VARCHAR(32) NOT NULL,
ACT_UID VARCHAR(32) NOT NULL,
DYN_UID VARCHAR(32) NOT NULL,
USR_UID VARCHAR(32) NOT NULL,
WEE_STATUS VARCHAR(10) NOT NULL DEFAULT 'ENABLED',
WEE_WE_UID VARCHAR(32) NOT NULL DEFAULT '',
WEE_WE_TAS_UID VARCHAR(32) NOT NULL DEFAULT '',
PRIMARY KEY (WEE_UID)
) ENGINE=InnoDB DEFAULT CHARSET='utf8';

View File

@@ -1889,3 +1889,27 @@ CREATE TABLE "MESSAGE_DETAIL"
ALTER TABLE "MESSAGE_DETAIL"
ADD CONSTRAINT "MESSAGE_DETAIL_PK"
PRIMARY KEY ("MD_UID");
/* -----------------------------------------------------------------------
WEB_ENTRY_EVENT
----------------------------------------------------------------------- */
DROP TABLE WEB_ENTRY_EVENT CASCADE CONSTRAINTS;
CREATE TABLE WEB_ENTRY_EVENT
(
WEE_UID VARCHAR2(32) NOT NULL,
PRJ_UID VARCHAR2(32) NOT NULL,
EVN_UID VARCHAR2(32) NOT NULL,
ACT_UID VARCHAR2(32) NOT NULL,
DYN_UID VARCHAR2(32) NOT NULL,
USR_UID VARCHAR2(32) NOT NULL,
WEE_STATUS VARCHAR2(10) NOT NULL DEFAULT 'ENABLED',
WEE_WE_UID VARCHAR2(32) NOT NULL DEFAULT '',
WEE_WE_TAS_UID VARCHAR2(32) NOT NULL DEFAULT ''
);
ALTER TABLE WEB_ENTRY_EVENT
ADD CONSTRAINT WEB_ENTRY_EVENT_PK
PRIMARY KEY (WEE_UID);

View File

@@ -22,7 +22,7 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Importer\XmlImporter;
use \ProcessMaker\Importer\XmlImporter;
ini_set("max_execution_time", 0);

View File

@@ -118,6 +118,24 @@ class WebEntry
return $newName;
}
/**
* Verify if exists the Web Entry
*
* @param string $webEntryUid Unique id of Web Entry
*
* return bool Return true if exists the Web Entry, false otherwise
*/
public function exists($webEntryUid)
{
try {
$obj = \WebEntryPeer::retrieveByPK($webEntryUid);
return (!is_null($obj))? true : false;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Verify if exists the title of a Web Entry
*
@@ -165,19 +183,17 @@ class WebEntry
}
/**
* Verify if does not exist the Web Entry in table WEB_ENTRY
* Verify if does not exists the Web Entry
*
* @param string $webEntryUid Unique id of Web Entry
* @param string $fieldNameForException Field name for the exception
*
* return void Throw exception if does not exist the Web Entry in table WEB_ENTRY
* return void Throw exception if does not exists the Web Entry
*/
public function throwExceptionIfNotExistsWebEntry($webEntryUid, $fieldNameForException)
{
try {
$obj = \WebEntryPeer::retrieveByPK($webEntryUid);
if (is_null($obj)) {
if (!$this->exists($webEntryUid)) {
throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_DOES_NOT_EXIST", array($fieldNameForException, $webEntryUid)));
}
} catch (\Exception $e) {
@@ -601,7 +617,7 @@ class WebEntry
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
}
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . "\n" . $msg);
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . (($msg != "")? "\n" . $msg : ""));
}
} catch (\Exception $e) {
$cnn->rollback();
@@ -686,7 +702,7 @@ class WebEntry
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
}
throw new \Exception(\G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . "\n" . $msg);
throw new \Exception(\G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . (($msg != "")? "\n" . $msg : ""));
}
} catch (\Exception $e) {
$cnn->rollback();

File diff suppressed because it is too large Load Diff

View File

@@ -369,13 +369,15 @@ abstract class Importer
$this->importWfFiles($arrayWorkflowFiles);
//Update
$workflow = Project\Workflow::load($projectUid);
$workflow = \ProcessMaker\Project\Workflow::load($projectUid);
foreach ($arrayWorkflowTables["tasks"] as $key => $value) {
$arrayTaskData = $value;
if (!in_array($arrayTaskData["TAS_TYPE"], array("GATEWAYTOGATEWAY", "WEBENTRYEVENT"))) {
$result = $workflow->updateTask($arrayTaskData["TAS_UID"], $arrayTaskData);
}
}
unset($arrayWorkflowTables["process"]["PRO_CREATE_USER"]);
unset($arrayWorkflowTables["process"]["PRO_CREATE_DATE"]);

View File

@@ -243,6 +243,9 @@ class BpmnWorkflow extends Project\Bpmn
}
$this->updateEventStartObjects($data["FLO_ELEMENT_ORIGIN"], $data["FLO_ELEMENT_DEST"]);
//WebEntry-Event - Update
$this->updateWebEntryEventByEvent($data["FLO_ELEMENT_ORIGIN"], array("ACT_UID" => $data["FLO_ELEMENT_DEST"]));
break;
}
break;
@@ -289,6 +292,9 @@ class BpmnWorkflow extends Project\Bpmn
$this->wp->setStartTask($flowCurrent->getFloElementDest());
$this->updateEventStartObjects($flowCurrent->getFloElementOrigin(), $flowCurrent->getFloElementDest());
//WebEntry-Event - Update
$this->updateWebEntryEventByEvent($flowCurrent->getFloElementOrigin(), array("ACT_UID" => $flowCurrent->getFloElementDest()));
}
}
@@ -342,16 +348,31 @@ class BpmnWorkflow extends Project\Bpmn
if ($flow->getFloElementOriginType() == "bpmnEvent" &&
$flow->getFloElementDestType() == "bpmnActivity"
) {
$bpmnFlow = \BpmnFlow::findOneBy(array(
\BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $flow->getFloElementOrigin(),
\BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => "bpmnEvent",
\BpmnFlowPeer::FLO_ELEMENT_DEST => $flow->getFloElementDest(),
\BpmnFlowPeer::FLO_ELEMENT_DEST_TYPE => "bpmnActivity"
));
if (is_null($bpmnFlow)) {
$event = \BpmnEventPeer::retrieveByPK($flow->getFloElementOrigin());
if (! is_null($event) && $event->getEvnType() == "START") {
if (!is_null($event) && $event->getEvnType() == "START") {
$activity = \BpmnActivityPeer::retrieveByPK($flow->getFloElementDest());
if (! is_null($activity)) {
if (!is_null($activity)) {
$this->wp->setStartTask($activity->getActUid(), false);
}
}
}
$this->updateEventStartObjects($flow->getFloElementOrigin(), "");
//WebEntry-Event - Update
if (is_null($bpmnFlow)) {
$this->updateWebEntryEventByEvent($flow->getFloElementOrigin(), array("WEE_STATUS" => "DISABLED"));
}
} elseif ($flow->getFloElementOriginType() == "bpmnActivity" &&
$flow->getFloElementDestType() == "bpmnEvent") {
// verify case: activity -> event(end)
@@ -403,22 +424,27 @@ class BpmnWorkflow extends Project\Bpmn
return $eventUid;
}
public function removeEvent($data)
public function removeEvent($eventUid)
{
$event = \BpmnEventPeer::retrieveByPK($data);
$event = \BpmnEventPeer::retrieveByPK($eventUid);
// delete case scheduler
if ($event && $event->getEvnMarker() == "TIMER" && $event->getEvnType() == "START") {
$this->wp->removeCaseScheduler($data);
$this->wp->removeCaseScheduler($eventUid);
}
// delete web entry
if ($event && $event->getEvnMarker() == "MESSAGE" && $event->getEvnType() == "START") {
$this->wp->removeWebEntry($data);
if (!is_null($event) && $event->getEvnType() == "START") {
$webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
if ($webEntryEvent->existsEvent($event->getPrjUid(), $eventUid)) {
$arrayWebEntryEventData = $webEntryEvent->getWebEntryEventByEvent($event->getPrjUid(), $eventUid, true);
$webEntryEvent->delete($arrayWebEntryEventData["WEE_UID"]);
}
}
parent::removeEvent($data);
parent::removeEvent($eventUid);
}
public function updateEventStartObjects($eventUid, $taskUid)
@@ -431,9 +457,9 @@ class BpmnWorkflow extends Project\Bpmn
}
//Update web entry
if (!is_null($event) && $event->getEvnType() == "START" && $event->getEvnMarker() == "MESSAGE") {
$this->wp->updateWebEntry($eventUid, array("TAS_UID" => $taskUid));
}
//if (!is_null($event) && $event->getEvnType() == "START" && $event->getEvnMarker() == "MESSAGE") {
// $this->wp->updateWebEntry($eventUid, array("TAS_UID" => $taskUid));
//}
}
public function mapBpmnGatewayToWorkflowRoutes($activityUid, $gatewayUid)
@@ -1302,5 +1328,27 @@ class BpmnWorkflow extends Project\Bpmn
parent::setDisabled($value);
$this->wp->setDisabled($value);
}
public function updateWebEntryEventByEvent($eventUid, array $arrayData)
{
try {
$bpmnEvent = \BpmnEventPeer::retrieveByPK($eventUid);
if (!is_null($bpmnEvent) && $bpmnEvent->getEvnType() == "START") {
$webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
if ($webEntryEvent->existsEvent($bpmnEvent->getPrjUid(), $bpmnEvent->getEvnUid())) {
$arrayWebEntryEventData = $webEntryEvent->getWebEntryEventByEvent($bpmnEvent->getPrjUid(), $bpmnEvent->getEvnUid(), true);
$bpmn = \ProcessMaker\Project\Bpmn::load($bpmnEvent->getPrjUid());
$bpmnProject = $bpmn->getProject("object");
$arrayResult = $webEntryEvent->update($arrayWebEntryEventData["WEE_UID"], $bpmnProject->getPrjAuthor(), $arrayData);
}
}
} catch (\Exception $e) {
throw $e;
}
}
}

View File

@@ -764,10 +764,11 @@ class Workflow extends Handler
$oCriteria->add(\CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
\ProcessUserPeer::doDelete($oCriteria);
//Delete Web Entries
//Delete WebEntries
$webEntry = new \ProcessMaker\BusinessModel\WebEntry();
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\WebEntryPeer::WE_UID);
$criteria->add(\WebEntryPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL);
@@ -780,6 +781,23 @@ class Workflow extends Handler
$webEntry->delete($row["WE_UID"]);
}
//Delete WebEntry-Events
$webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\WebEntryEventPeer::WEE_UID);
$criteria->add(\WebEntryEventPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
$rsCriteria = \WebEntryEventPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$webEntryEvent->delete($row["WEE_UID"]);
}
//Delete the process
try {
$oProcess->remove($sProcessUID);
@@ -1055,7 +1073,27 @@ class Workflow extends Handler
}
}
//Getting templates files
//Get public files to exclude
$arrayPublicFileToExclude = array("wsClient.php");
//WebEntry
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\WebEntryPeer::WE_DATA);
$criteria->add(\WebEntryPeer::PRO_UID, $processUid, \Criteria::EQUAL);
$criteria->add(\WebEntryPeer::WE_METHOD, "WS", \Criteria::EQUAL);
$rsCriteria = \WebEntryPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($rsCriteria->next()) {
$row = $rsCriteria->getRow();
$arrayPublicFileToExclude[] = $row["WE_DATA"];
$arrayPublicFileToExclude[] = preg_replace("/^(.+)\.php$/", "$1Post.php", $row["WE_DATA"]);
}
//Get templates and public files
$workspaceTargetDirs = array("TEMPLATES" => "mailTemplates", "PUBLIC" => "public");
$workspaceDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP;
@@ -1070,6 +1108,10 @@ class Workflow extends Handler
$filename = basename($templatesFile);
if ($target == "PUBLIC" && in_array($filename, $arrayPublicFileToExclude)) {
continue;
}
$workflowFile[$target][] = array(
"filename" => $filename,
"filepath" => $processUid . PATH_SEP . $filename,
@@ -1095,7 +1137,7 @@ class Workflow extends Handler
$processUidOld = $arrayUid[0]["old_uid"];
$processUid = $arrayUid[0]["new_uid"];
//Update TAS_UID
//Update TASK.TAS_UID
foreach ($arrayWorkflowData["tasks"] as $key => $value) {
$taskUid = $arrayWorkflowData["tasks"][$key]["TAS_UID"];
@@ -1110,6 +1152,20 @@ class Workflow extends Handler
}
}
//Update WEB_ENTRY_EVENT.EVN_UID
foreach ($arrayWorkflowData["webEntryEvent"] as $key => $value) {
$webEntryEventEventUid = $arrayWorkflowData["webEntryEvent"][$key]["EVN_UID"];
foreach ($arrayUid as $value2) {
$arrayItem = $value2;
if ($arrayItem["old_uid"] == $webEntryEventEventUid) {
$arrayWorkflowData["webEntryEvent"][$key]["EVN_UID"] = $arrayItem["new_uid"];
break;
}
}
}
//Workflow tables
$workflowData = (object)($arrayWorkflowData);

View File

@@ -0,0 +1,135 @@
<?php
namespace ProcessMaker\Services\Api\Project;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* Project\WebEntryEvent Api Controller
*
* @protected
*/
class WebEntryEvent extends Api
{
private $webEntryEvent;
/**
* Constructor of the class
*
* return void
*/
public function __construct()
{
try {
$this->webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
$this->webEntryEvent->setFormatFieldNameInUppercase(false);
$this->webEntryEvent->setArrayFieldNameForException(array("processUid" => "prj_uid"));
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url GET /:prj_uid/web-entry-events
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetWebEntryEvents($prj_uid)
{
try {
$response = $this->webEntryEvent->getWebEntryEvents($prj_uid);
return $response;
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url GET /:prj_uid/web-entry-event/:wee_uid
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $wee_uid {@min 32}{@max 32}
*/
public function doGetWebEntryEvent($prj_uid, $wee_uid)
{
try {
$response = $this->webEntryEvent->getWebEntryEvent($wee_uid);
return $response;
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url GET /:prj_uid/web-entry-event/event/:evn_uid
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $evn_uid {@min 32}{@max 32}
*/
public function doGetWebEntryEventEvent($prj_uid, $evn_uid)
{
try {
$response = $this->webEntryEvent->getWebEntryEventByEvent($prj_uid, $evn_uid);
return $response;
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url POST /:prj_uid/web-entry-event
*
* @param string $prj_uid {@min 32}{@max 32}
* @param array $request_data
*
* @status 201
*/
public function doPostWebEntryEvent($prj_uid, array $request_data)
{
try {
$arrayData = $this->webEntryEvent->create($prj_uid, $this->getUserId(), $request_data);
$response = $arrayData;
return $response;
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url PUT /:prj_uid/web-entry-event/:wee_uid
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $wee_uid {@min 32}{@max 32}
* @param array $request_data
*/
public function doPutWebEntryEvent($prj_uid, $wee_uid, array $request_data)
{
try {
$arrayData = $this->webEntryEvent->update($wee_uid, $this->getUserId(), $request_data);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url DELETE /:prj_uid/web-entry-event/:wee_uid
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $wee_uid {@min 32}{@max 32}
*/
public function doDeleteWebEntryEvent($prj_uid, $wee_uid)
{
try {
$this->webEntryEvent->delete($wee_uid);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
}

View File

@@ -38,6 +38,7 @@ debug = 1
category = "ProcessMaker\Services\Api\ProcessCategory"
process-variable = "ProcessMaker\Services\Api\Project\Variable"
message = "ProcessMaker\Services\Api\Project\Message"
web-entry-event = "ProcessMaker\Services\Api\Project\WebEntryEvent"
[alias: projects]
project = "ProcessMaker\Services\Api\Project"
@@ -94,3 +95,4 @@ debug = 1
[alias: emails]
email = "ProcessMaker\Services\Api\EmailServer"