Merge branch 'master' of bitbucket.org:colosa/processmaker

This commit is contained in:
Brayan Osmar Pereyra Suxo
2014-02-21 09:26:23 -04:00
13 changed files with 126 additions and 111 deletions

View File

@@ -79,7 +79,7 @@ class BpmnGatewayMapBuilder
$tMap->addColumn('GAT_INSTANTIATE', 'GatInstantiate', 'int', CreoleTypes::TINYINT, false, null);
$tMap->addColumn('GAT_EVENT_GATEWAT_TYPE', 'GatEventGatewatType', 'string', CreoleTypes::VARCHAR, false, 20);
$tMap->addColumn('GAT_EVENT_GATEWAY_TYPE', 'GatEventGatewayType', 'string', CreoleTypes::VARCHAR, false, 20);
$tMap->addColumn('GAT_ACTIVATION_COUNT', 'GatActivationCount', 'int', CreoleTypes::INTEGER, false, null);

View File

@@ -70,10 +70,10 @@ abstract class BaseBpmnGateway extends BaseObject implements Persistent
protected $gat_instantiate = 0;
/**
* The value for the gat_event_gatewat_type field.
* The value for the gat_event_gateway_type field.
* @var string
*/
protected $gat_event_gatewat_type = 'NONE';
protected $gat_event_gateway_type = 'NONE';
/**
* The value for the gat_activation_count field.
@@ -195,14 +195,14 @@ abstract class BaseBpmnGateway extends BaseObject implements Persistent
}
/**
* Get the [gat_event_gatewat_type] column value.
* Get the [gat_event_gateway_type] column value.
*
* @return string
*/
public function getGatEventGatewatType()
public function getGatEventGatewayType()
{
return $this->gat_event_gatewat_type;
return $this->gat_event_gateway_type;
}
/**
@@ -401,12 +401,12 @@ abstract class BaseBpmnGateway extends BaseObject implements Persistent
} // setGatInstantiate()
/**
* Set the value of [gat_event_gatewat_type] column.
* Set the value of [gat_event_gateway_type] column.
*
* @param string $v new value
* @return void
*/
public function setGatEventGatewatType($v)
public function setGatEventGatewayType($v)
{
// Since the native PHP type for this column is string,
@@ -415,12 +415,12 @@ abstract class BaseBpmnGateway extends BaseObject implements Persistent
$v = (string) $v;
}
if ($this->gat_event_gatewat_type !== $v || $v === 'NONE') {
$this->gat_event_gatewat_type = $v;
$this->modifiedColumns[] = BpmnGatewayPeer::GAT_EVENT_GATEWAT_TYPE;
if ($this->gat_event_gateway_type !== $v || $v === 'NONE') {
$this->gat_event_gateway_type = $v;
$this->modifiedColumns[] = BpmnGatewayPeer::GAT_EVENT_GATEWAY_TYPE;
}
} // setGatEventGatewatType()
} // setGatEventGatewayType()
/**
* Set the value of [gat_activation_count] column.
@@ -519,7 +519,7 @@ abstract class BaseBpmnGateway extends BaseObject implements Persistent
$this->gat_instantiate = $rs->getInt($startcol + 6);
$this->gat_event_gatewat_type = $rs->getString($startcol + 7);
$this->gat_event_gateway_type = $rs->getString($startcol + 7);
$this->gat_activation_count = $rs->getInt($startcol + 8);
@@ -796,7 +796,7 @@ abstract class BaseBpmnGateway extends BaseObject implements Persistent
return $this->getGatInstantiate();
break;
case 7:
return $this->getGatEventGatewatType();
return $this->getGatEventGatewayType();
break;
case 8:
return $this->getGatActivationCount();
@@ -834,7 +834,7 @@ abstract class BaseBpmnGateway extends BaseObject implements Persistent
$keys[4] => $this->getGatType(),
$keys[5] => $this->getGatDirection(),
$keys[6] => $this->getGatInstantiate(),
$keys[7] => $this->getGatEventGatewatType(),
$keys[7] => $this->getGatEventGatewayType(),
$keys[8] => $this->getGatActivationCount(),
$keys[9] => $this->getGatWaitingForStart(),
$keys[10] => $this->getGatDefaultFlow(),
@@ -891,7 +891,7 @@ abstract class BaseBpmnGateway extends BaseObject implements Persistent
$this->setGatInstantiate($value);
break;
case 7:
$this->setGatEventGatewatType($value);
$this->setGatEventGatewayType($value);
break;
case 8:
$this->setGatActivationCount($value);
@@ -954,7 +954,7 @@ abstract class BaseBpmnGateway extends BaseObject implements Persistent
}
if (array_key_exists($keys[7], $arr)) {
$this->setGatEventGatewatType($arr[$keys[7]]);
$this->setGatEventGatewayType($arr[$keys[7]]);
}
if (array_key_exists($keys[8], $arr)) {
@@ -1008,8 +1008,8 @@ abstract class BaseBpmnGateway extends BaseObject implements Persistent
$criteria->add(BpmnGatewayPeer::GAT_INSTANTIATE, $this->gat_instantiate);
}
if ($this->isColumnModified(BpmnGatewayPeer::GAT_EVENT_GATEWAT_TYPE)) {
$criteria->add(BpmnGatewayPeer::GAT_EVENT_GATEWAT_TYPE, $this->gat_event_gatewat_type);
if ($this->isColumnModified(BpmnGatewayPeer::GAT_EVENT_GATEWAY_TYPE)) {
$criteria->add(BpmnGatewayPeer::GAT_EVENT_GATEWAY_TYPE, $this->gat_event_gateway_type);
}
if ($this->isColumnModified(BpmnGatewayPeer::GAT_ACTIVATION_COUNT)) {
@@ -1090,7 +1090,7 @@ abstract class BaseBpmnGateway extends BaseObject implements Persistent
$copyObj->setGatInstantiate($this->gat_instantiate);
$copyObj->setGatEventGatewatType($this->gat_event_gatewat_type);
$copyObj->setGatEventGatewayType($this->gat_event_gateway_type);
$copyObj->setGatActivationCount($this->gat_activation_count);

View File

@@ -52,8 +52,8 @@ abstract class BaseBpmnGatewayPeer
/** the column name for the GAT_INSTANTIATE field */
const GAT_INSTANTIATE = 'BPMN_GATEWAY.GAT_INSTANTIATE';
/** the column name for the GAT_EVENT_GATEWAT_TYPE field */
const GAT_EVENT_GATEWAT_TYPE = 'BPMN_GATEWAY.GAT_EVENT_GATEWAT_TYPE';
/** the column name for the GAT_EVENT_GATEWAY_TYPE field */
const GAT_EVENT_GATEWAY_TYPE = 'BPMN_GATEWAY.GAT_EVENT_GATEWAY_TYPE';
/** the column name for the GAT_ACTIVATION_COUNT field */
const GAT_ACTIVATION_COUNT = 'BPMN_GATEWAY.GAT_ACTIVATION_COUNT';
@@ -75,9 +75,9 @@ abstract class BaseBpmnGatewayPeer
* e.g. self::$fieldNames[self::TYPE_PHPNAME][0] = 'Id'
*/
private static $fieldNames = array (
BasePeer::TYPE_PHPNAME => array ('GatUid', 'PrjUid', 'ProUid', 'GatName', 'GatType', 'GatDirection', 'GatInstantiate', 'GatEventGatewatType', 'GatActivationCount', 'GatWaitingForStart', 'GatDefaultFlow', ),
BasePeer::TYPE_COLNAME => array (BpmnGatewayPeer::GAT_UID, BpmnGatewayPeer::PRJ_UID, BpmnGatewayPeer::PRO_UID, BpmnGatewayPeer::GAT_NAME, BpmnGatewayPeer::GAT_TYPE, BpmnGatewayPeer::GAT_DIRECTION, BpmnGatewayPeer::GAT_INSTANTIATE, BpmnGatewayPeer::GAT_EVENT_GATEWAT_TYPE, BpmnGatewayPeer::GAT_ACTIVATION_COUNT, BpmnGatewayPeer::GAT_WAITING_FOR_START, BpmnGatewayPeer::GAT_DEFAULT_FLOW, ),
BasePeer::TYPE_FIELDNAME => array ('GAT_UID', 'PRJ_UID', 'PRO_UID', 'GAT_NAME', 'GAT_TYPE', 'GAT_DIRECTION', 'GAT_INSTANTIATE', 'GAT_EVENT_GATEWAT_TYPE', 'GAT_ACTIVATION_COUNT', 'GAT_WAITING_FOR_START', 'GAT_DEFAULT_FLOW', ),
BasePeer::TYPE_PHPNAME => array ('GatUid', 'PrjUid', 'ProUid', 'GatName', 'GatType', 'GatDirection', 'GatInstantiate', 'GatEventGatewayType', 'GatActivationCount', 'GatWaitingForStart', 'GatDefaultFlow', ),
BasePeer::TYPE_COLNAME => array (BpmnGatewayPeer::GAT_UID, BpmnGatewayPeer::PRJ_UID, BpmnGatewayPeer::PRO_UID, BpmnGatewayPeer::GAT_NAME, BpmnGatewayPeer::GAT_TYPE, BpmnGatewayPeer::GAT_DIRECTION, BpmnGatewayPeer::GAT_INSTANTIATE, BpmnGatewayPeer::GAT_EVENT_GATEWAY_TYPE, BpmnGatewayPeer::GAT_ACTIVATION_COUNT, BpmnGatewayPeer::GAT_WAITING_FOR_START, BpmnGatewayPeer::GAT_DEFAULT_FLOW, ),
BasePeer::TYPE_FIELDNAME => array ('GAT_UID', 'PRJ_UID', 'PRO_UID', 'GAT_NAME', 'GAT_TYPE', 'GAT_DIRECTION', 'GAT_INSTANTIATE', 'GAT_EVENT_GATEWAY_TYPE', 'GAT_ACTIVATION_COUNT', 'GAT_WAITING_FOR_START', 'GAT_DEFAULT_FLOW', ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
@@ -88,9 +88,9 @@ abstract class BaseBpmnGatewayPeer
* e.g. self::$fieldNames[BasePeer::TYPE_PHPNAME]['Id'] = 0
*/
private static $fieldKeys = array (
BasePeer::TYPE_PHPNAME => array ('GatUid' => 0, 'PrjUid' => 1, 'ProUid' => 2, 'GatName' => 3, 'GatType' => 4, 'GatDirection' => 5, 'GatInstantiate' => 6, 'GatEventGatewatType' => 7, 'GatActivationCount' => 8, 'GatWaitingForStart' => 9, 'GatDefaultFlow' => 10, ),
BasePeer::TYPE_COLNAME => array (BpmnGatewayPeer::GAT_UID => 0, BpmnGatewayPeer::PRJ_UID => 1, BpmnGatewayPeer::PRO_UID => 2, BpmnGatewayPeer::GAT_NAME => 3, BpmnGatewayPeer::GAT_TYPE => 4, BpmnGatewayPeer::GAT_DIRECTION => 5, BpmnGatewayPeer::GAT_INSTANTIATE => 6, BpmnGatewayPeer::GAT_EVENT_GATEWAT_TYPE => 7, BpmnGatewayPeer::GAT_ACTIVATION_COUNT => 8, BpmnGatewayPeer::GAT_WAITING_FOR_START => 9, BpmnGatewayPeer::GAT_DEFAULT_FLOW => 10, ),
BasePeer::TYPE_FIELDNAME => array ('GAT_UID' => 0, 'PRJ_UID' => 1, 'PRO_UID' => 2, 'GAT_NAME' => 3, 'GAT_TYPE' => 4, 'GAT_DIRECTION' => 5, 'GAT_INSTANTIATE' => 6, 'GAT_EVENT_GATEWAT_TYPE' => 7, 'GAT_ACTIVATION_COUNT' => 8, 'GAT_WAITING_FOR_START' => 9, 'GAT_DEFAULT_FLOW' => 10, ),
BasePeer::TYPE_PHPNAME => array ('GatUid' => 0, 'PrjUid' => 1, 'ProUid' => 2, 'GatName' => 3, 'GatType' => 4, 'GatDirection' => 5, 'GatInstantiate' => 6, 'GatEventGatewayType' => 7, 'GatActivationCount' => 8, 'GatWaitingForStart' => 9, 'GatDefaultFlow' => 10, ),
BasePeer::TYPE_COLNAME => array (BpmnGatewayPeer::GAT_UID => 0, BpmnGatewayPeer::PRJ_UID => 1, BpmnGatewayPeer::PRO_UID => 2, BpmnGatewayPeer::GAT_NAME => 3, BpmnGatewayPeer::GAT_TYPE => 4, BpmnGatewayPeer::GAT_DIRECTION => 5, BpmnGatewayPeer::GAT_INSTANTIATE => 6, BpmnGatewayPeer::GAT_EVENT_GATEWAY_TYPE => 7, BpmnGatewayPeer::GAT_ACTIVATION_COUNT => 8, BpmnGatewayPeer::GAT_WAITING_FOR_START => 9, BpmnGatewayPeer::GAT_DEFAULT_FLOW => 10, ),
BasePeer::TYPE_FIELDNAME => array ('GAT_UID' => 0, 'PRJ_UID' => 1, 'PRO_UID' => 2, 'GAT_NAME' => 3, 'GAT_TYPE' => 4, 'GAT_DIRECTION' => 5, 'GAT_INSTANTIATE' => 6, 'GAT_EVENT_GATEWAY_TYPE' => 7, 'GAT_ACTIVATION_COUNT' => 8, 'GAT_WAITING_FOR_START' => 9, 'GAT_DEFAULT_FLOW' => 10, ),
BasePeer::TYPE_NUM => array (0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, )
);
@@ -206,7 +206,7 @@ abstract class BaseBpmnGatewayPeer
$criteria->addSelectColumn(BpmnGatewayPeer::GAT_INSTANTIATE);
$criteria->addSelectColumn(BpmnGatewayPeer::GAT_EVENT_GATEWAT_TYPE);
$criteria->addSelectColumn(BpmnGatewayPeer::GAT_EVENT_GATEWAY_TYPE);
$criteria->addSelectColumn(BpmnGatewayPeer::GAT_ACTIVATION_COUNT);

View File

@@ -3369,7 +3369,7 @@
<column name="GAT_TYPE" type="VARCHAR" size="30" required="true" default=""/>
<column name="GAT_DIRECTION" type="VARCHAR" size="30" required="false" default="UNSPECIFIED"/>
<column name="GAT_INSTANTIATE" type="TINYINT" required="false" default="0"/>
<column name="GAT_EVENT_GATEWAT_TYPE" type="VARCHAR" size="20" required="false" default="NONE"/>
<column name="GAT_EVENT_GATEWAY_TYPE" type="VARCHAR" size="20" required="false" default="NONE"/>
<column name="GAT_ACTIVATION_COUNT" type="INTEGER" required="false" default="0"/>
<column name="GAT_WAITING_FOR_START" type="TINYINT" required="false" default="1"/>
<column name="GAT_DEFAULT_FLOW" type="VARCHAR" size="32" required="false" default=""/>

View File

@@ -1896,7 +1896,7 @@ CREATE TABLE `BPMN_GATEWAY`
`GAT_TYPE` VARCHAR(30) default '' NOT NULL,
`GAT_DIRECTION` VARCHAR(30) default 'UNSPECIFIED',
`GAT_INSTANTIATE` TINYINT default 0,
`GAT_EVENT_GATEWAT_TYPE` VARCHAR(20) default 'NONE',
`GAT_EVENT_GATEWAY_TYPE` VARCHAR(20) default 'NONE',
`GAT_ACTIVATION_COUNT` INTEGER default 0,
`GAT_WAITING_FOR_START` TINYINT default 1,
`GAT_DEFAULT_FLOW` VARCHAR(32) default '',

View File

@@ -68,6 +68,8 @@ if ($dynaform->exists( $DYN_UID )) {
//creating SESSION for redirecting to new bpmn editor after closing Dynaform
if (isset( $_GET['bpmn'] ) && $_GET['bpmn'] == '1') {
$_SESSION['dynaform_editor'] = 'bpmn';
} elseif (isset( $_GET['processMap3'] )) {
$_SESSION['dynaform_editor'] = 'processMap3';
} elseif (! isset( $_GET['bpmn'] )) {
$_SESSION['dynaform_editor'] = 'processmap';
}

View File

@@ -226,11 +226,6 @@ class BpmnWorkflow extends Project\Bpmn
parent::addEvent($data);
}
public function updateEvent($evnUid, $data)
{
parent::updateEvent($evnUid, $data);
}
public function removeEvent($evnUid)
{
// $event = \BpmnEventPeer::retrieveByPK($evnUid);
@@ -332,8 +327,6 @@ class BpmnWorkflow extends Project\Bpmn
break;
case 'bpmnEvent':
$evnUid = $flow['FLO_ELEMENT_DEST'];
self::log('=======++++++++=========>', $evnUid, "EVN_UID", $events);
$events = self::findInArray($evnUid, "EVN_UID", $events);

View File

@@ -64,6 +64,9 @@ class Bpmn extends Handler
"PRJ_UID", "PRO_UID", "BOU_ELEMENT", "BOU_ELEMENT_TYPE", "BOU_REL_POSITION",
"BOU_SIZE_IDENTICAL", "DIA_UID", "BOU_UID", "ELEMENT_UID", "EVN_ATTACHED_TO", "EVN_CONDITION"
),
"gateway" => array("BOU_ELEMENT", "BOU_ELEMENT_TYPE", "BOU_REL_POSITION", "BOU_SIZE_IDENTICAL", "BOU_UID",
"DIA_UID", "ELEMENT_UID", "PRJ_UID", "PRO_UID"
),
"flow" => array("PRJ_UID", "DIA_UID", "FLO_ELEMENT_DEST_PORT", "FLO_ELEMENT_ORIGIN_PORT")
);
@@ -386,13 +389,13 @@ class Bpmn extends Handler
public function updateEvent($evnUid, $data)
{
if (array_key_exists("EVN_CANCEL_ACTIVITY", $data)) {
/*if (array_key_exists("EVN_CANCEL_ACTIVITY", $data)) {
$data["EVN_CANCEL_ACTIVITY"] = $data["EVN_CANCEL_ACTIVITY"] ? 1 : 0;
}
if (array_key_exists("EVN_WAIT_FOR_COMPLETION", $data)) {
$data["EVN_WAIT_FOR_COMPLETION"] = $data["EVN_WAIT_FOR_COMPLETION"] ? 1 : 0;
}
}*/
try {
self::log("Update Event: $evnUid", "With data: ", $data);
@@ -468,6 +471,7 @@ class Bpmn extends Handler
if ($retType != "object" && ! empty($gateway)) {
$gateway = $gateway->toArray();
$gateway = self::filterArrayKeys($gateway, self::$excludeFields["gateway"]);
}
return $gateway;
@@ -479,7 +483,13 @@ class Bpmn extends Handler
extract($start);
}
return Gateway::getAll($this->getUid(), $start, $limit, $filter, $changeCaseTo);
//return Gateway::getAll($this->getUid(), $start, $limit, $filter, $changeCaseTo);
$filter = $changeCaseTo != CASE_UPPER ? array_map("strtolower", self::$excludeFields["gateway"]) : self::$excludeFields["gateway"];
return self::filterCollectionArrayKeys(
Gateway::getAll($this->getUid(), $start, $limit, $filter, $changeCaseTo),
$filter
);
}
public function removeGateway($gatUid)

View File

@@ -92,11 +92,8 @@ abstract class Handler
public static function isEquals($array, $arrayCompare)
{
ksort($array);
ksort($arrayCompare);
self::log($array, $arrayCompare);
//$ret = array_diff_assoc($array, $arrayCompare);
//self::log("ONE: ", $array, "TWO: ", $arrayCompare);
//$ret = array_diff_assoc("ONE: ", $array, "TWO: ", $arrayCompare);
return (self::getChecksum($array) === self::getChecksum($arrayCompare));
}

View File

@@ -0,0 +1,16 @@
<?php
namespace ProcessMaker\Util;
class ArrayUtil
{
public static function boolToIntValues($array)
{
array_walk($array, function (&$v) {
if ($v === false) $v = 0;
elseif ($v === true) $v = 1;
elseif ($v === null) $v = 0;
});
return $array;
}
}

View File

@@ -4,8 +4,8 @@ namespace Services\Api\ProcessMaker;
use Luracast\Restler\RestException;
use ProcessMaker\Services\Api;
use ProcessMaker\Adapter\Bpmn\Model as BpmnModel;
use ProcessMaker\Util\Hash;
use ProcessMaker\Util\Logger;
use \ProcessMaker\Project\Adapter;
use \ProcessMaker\Util;
/**
* Class Project
@@ -24,10 +24,9 @@ class Project extends Api
$limit = null;
$filter = "";
$projects = \ProcessMaker\Project\Adapter\BpmnWorkflow::getList($start, $limit, $filter, CASE_LOWER);
$projects = Adapter\BpmnWorkflow::getList($start, $limit, $filter, CASE_LOWER);
return $projects;
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
@@ -36,9 +35,7 @@ class Project extends Api
public function get($prjUid)
{
try {
//return \ProcessMaker\Adapter\Bpmn\Model::loadProject($prjUid);
$bwp = \ProcessMaker\Project\Adapter\BpmnWorkflow::load($prjUid);
$bwp = Adapter\BpmnWorkflow::load($prjUid);
$project = array_change_key_case($bwp->getProject(), CASE_LOWER);
$diagram = $bwp->getDiagram();
@@ -106,12 +103,9 @@ class Project extends Api
{
try {
$projectData = $request_data;
$prjUid = $projectData["prj_uid"];
$diagram = isset($request_data["diagrams"]) && isset($request_data["diagrams"][0]) ? $request_data["diagrams"][0] : array();
$bwp = \ProcessMaker\Project\Adapter\BpmnWorkflow::load($prjUid);
$diagram = isset($projectData["diagrams"]) && isset($projectData["diagrams"][0]) ? $projectData["diagrams"][0] : array();
$result = array();
$bwp = Adapter\BpmnWorkflow::load($prjUid);
/*
* Diagram's Activities Handling
@@ -119,19 +113,19 @@ class Project extends Api
$whiteList = array();
foreach ($diagram["activities"] as $i => $activityData) {
$activityData = array_change_key_case($activityData, CASE_UPPER);
unset($activityData["_EXTENDED"]);
unset($activityData["BOU_ELEMENT_ID"]);
unset($activityData["_EXTENDED"], $activityData["BOU_ELEMENT_ID"]);
$activityData = Util\ArrayUtil::boolToIntValues($activityData);
$activity = $bwp->getActivity($activityData["ACT_UID"]);
if (is_null($activity)) {
$oldActUid = $activityData["ACT_UID"];
$activityData["ACT_UID"] = Hash::generateUID();
$activityData["ACT_UID"] = Util\Hash::generateUID();
$bwp->addActivity($activityData);
$result[] = array("object" => "activity", "new_uid" => $activityData["ACT_UID"], "old_uid" => $oldActUid);
} elseif (! $bwp->isEquals($activity, $activityData)) {
$bwp->updateActivity($activityData["ACT_UID"], $activityData);
} else {
Logger::log("Update Activity ({$activityData["ACT_UID"]}) Skipped - No changes required");
Util\Logger::log("Update Activity ({$activityData["ACT_UID"]}) Skipped - No changes required");
}
$diagram["activities"][$i] = $activityData;
@@ -143,7 +137,6 @@ class Project extends Api
// looking for removed elements
foreach ($activities as $activityData) {
if (! in_array($activityData["ACT_UID"], $whiteList)) {
// If it is not in the white list so, then remove them
$bwp->removeActivity($activityData["ACT_UID"]);
}
}
@@ -155,19 +148,18 @@ class Project extends Api
$whiteList = array();
foreach ($diagram["gateways"] as $i => $gatewayData) {
$gatewayData = array_change_key_case($gatewayData, CASE_UPPER);
unset($gatewayData["_EXTENDED"]);
// gateway exists ?
if ($gateway = $bwp->getGateway($gatewayData["GAT_UID"])) {
// then update activity
$gateway = $bwp->getGateway($gatewayData["GAT_UID"]);
if (is_null($gateway)) {
$oldActUid = $gatewayData["GAT_UID"];
$gatewayData["GAT_UID"] = Util\Hash::generateUID();
$bwp->addGateway($gatewayData);
$result[] = array("object" => "gateway", "new_uid" => $gatewayData["GAT_UID"], "old_uid" => $oldActUid);
} elseif (! $bwp->isEquals($gateway, $gatewayData)) {
$bwp->updateGateway($gatewayData["GAT_UID"], $gatewayData);
} else {
// if not exists then create it
$oldActUid = $gatewayData["GAT_UID"];
$gatewayData["GAT_UID"] = Hash::generateUID();
$bwp->addGateway($gatewayData);
$result[] = array("object" => "gateway", "new_uid" => $gatewayData["GAT_UID"], "old_uid" => $oldActUid);
Util\Logger::log("Update Gateway ({$gatewayData["GAT_UID"]}) Skipped - No changes required");
}
$diagram["gateways"][$i] = $gatewayData;
@@ -179,7 +171,6 @@ class Project extends Api
// looking for removed elements
foreach ($gateways as $gatewayData) {
if (! in_array($gatewayData["GAT_UID"], $whiteList)) {
// If it is not in the white list so, then remove them
$bwp->removeGateway($gatewayData["GAT_UID"]);
}
}
@@ -191,25 +182,23 @@ class Project extends Api
foreach ($diagram["events"] as $i => $eventData) {
$eventData = array_change_key_case($eventData, CASE_UPPER);
unset($eventData["_EXTENDED"]);
if (array_key_exists("EVN_CANCEL_ACTIVITY", $eventData)) {
$eventData["EVN_CANCEL_ACTIVITY"] = $eventData["EVN_CANCEL_ACTIVITY"] ? 1 : 0;
}
if (array_key_exists("EVN_WAIT_FOR_COMPLETION", $eventData)) {
$eventData["EVN_WAIT_FOR_COMPLETION"] = $eventData["EVN_WAIT_FOR_COMPLETION"] ? 1 : 0;
}
// gateway exists ?
$event = $bwp->getEvent($eventData["EVN_UID"]);
if (is_null($event)) {
$oldActUid = $eventData["EVN_UID"];
$eventData["EVN_UID"] = Hash::generateUID();
$eventData["EVN_UID"] = Util\Hash::generateUID();
$bwp->addEvent($eventData);
$result[] = array("object" => "event", "new_uid" => $eventData["EVN_UID"], "old_uid" => $oldActUid);
} elseif (! $bwp->isEquals($event, $eventData)) {
if (array_key_exists("EVN_CANCEL_ACTIVITY", $eventData)) {
$eventData["EVN_CANCEL_ACTIVITY"] = $eventData["EVN_CANCEL_ACTIVITY"] ? 1 : 0;
}
if (array_key_exists("EVN_WAIT_FOR_COMPLETION", $eventData)) {
$eventData["EVN_WAIT_FOR_COMPLETION"] = $eventData["EVN_WAIT_FOR_COMPLETION"] ? 1 : 0;
}
$bwp->updateEvent($eventData["EVN_UID"], $eventData);
} else {
Logger::log("Update Event ({$eventData["EVN_UID"]}) Skipped - No changes required");
Util\Logger::log("Update Event ({$eventData["EVN_UID"]}) Skipped - No changes required");
}
$diagram["events"][$i] = $eventData;
@@ -238,7 +227,7 @@ class Project extends Api
// if it is a new flow record
if (! \BpmnFlow::exists($flowData["FLO_UID"])) {
$oldFloUid = $flowData["FLO_UID"];
$flowData["FLO_UID"] = Hash::generateUID();
$flowData["FLO_UID"] = Util\Hash::generateUID();
$mappedUid = self::mapUid($flowData["FLO_ELEMENT_ORIGIN"], $result);
if ($mappedUid !== false) {
@@ -258,13 +247,13 @@ class Project extends Api
}
foreach ($diagram["flows"] as $flowData) {
// flow exists ?
if ($bwp->flowExists($flowData["FLO_UID"])) {
// then update activity
$flow = $bwp->getFlow($flowData["FLO_UID"]);
if (is_null($flow)) {
$bwp->addFlow($flowData, $diagram["flows"], $diagram["gateways"], $diagram["events"]);
} elseif (! $bwp->isEquals($flow, $flowData)) {
$bwp->updateFlow($flowData["FLO_UID"], $flowData);
} else {
// if not exists then create it
$bwp->addFlow($flowData, $diagram["flows"], $diagram["gateways"], $diagram["events"]);
Util\Logger::log("Update Flow ({$flowData["FLO_UID"]}) Skipped - No changes required");
}
}
@@ -273,12 +262,10 @@ class Project extends Api
// looking for removed elements
foreach ($flows as $flowData) {
if (! in_array($flowData["FLO_UID"], $whiteList)) {
// If it is not in the white list so, then remove them
$bwp->removeFlow($flowData["FLO_UID"]);
}
}
return $result;
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());

View File

@@ -1,19 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="dynaforms_Editor" type="xmlform" width="100%" enableTemplate="1">
<toolbar type="toolbar" xmlfile="dynaforms/dynaforms_Toolbar"/>
<URL type="phpvariable"/>
<DYN_UID type="phpvariable"/>
<PRO_UID type="phpvariable"/>
<DYN_EDITOR type="phpvariable"/>
<DYNAFORM_NAME type="phpvariable" defaultValue=""/>
<title type="title" enableHTML="1">
<en><![CDATA[<table cellpadding="0" cellspacing="0" width="100%" style="background-color:transparent"> <tr> <td class=\'FormTitle\'>Preview</td> <td align="right"></td> </tr> </table>]]></en>
</title>
<dynaforms_Preview type="private" defaultValue="../dynaforms/dynaforms_Preview"/>
<dynaforms_Ajax type="private" defaultValue="../dynaforms/dynaforms_Ajax"/>
<processMap type="private" defaultValue="../processes/processes_Map"/>
<processBpmnMap type="private" defaultValue="../bpmn/processmap"/>
<SCRIPT type="javascript" replaceTags="1"><![CDATA[
<toolbar type="toolbar" xmlfile="dynaforms/dynaforms_Toolbar"/>
<URL type="phpvariable"/>
<DYN_UID type="phpvariable"/>
<PRO_UID type="phpvariable"/>
<DYN_EDITOR type="phpvariable"/>
<DYNAFORM_NAME type="phpvariable" defaultValue=""/>
<title type="title" enableHTML="1">
<en><![CDATA[<table cellpadding="0" cellspacing="0" width="100%" style="background-color:transparent"> <tr> <td class='FormTitle'>Preview</td> <td align="right"></td> </tr> </table>]]></en>
</title>
<dynaforms_Preview type="private" defaultValue="../dynaforms/dynaforms_Preview"/>
<dynaforms_Ajax type="private" defaultValue="../dynaforms/dynaforms_Ajax"/>
<processMap type="private" defaultValue="../processes/processes_Map"/>
<processMap3 type="private" defaultValue="../designer"/>
<processBpmnMap type="private" defaultValue="../bpmn/processmap"/>
<SCRIPT type="javascript" replaceTags="1"><![CDATA[
function loadEditor()
{
@@ -43,6 +44,11 @@ function loadEditor()
window.location.href="@G::encryptLink(@#processMap)?PRO_UID=@%PRO_UID";
return true;
}
else if(dynEditorType == 'processMap3')
{
window.location.href="@G::encryptLink(@#processMap3)?pro_uid=@%PRO_UID";
return true;
}
else if(dynEditorType == 'bpmn')
{
window.location.href="@G::encryptLink(@#processBpmnMap)?PRO_UID=@%PRO_UID";
@@ -263,4 +269,4 @@ function saveProperties(){
}
*/
]]></SCRIPT>
</dynaForm>
</dynaForm>

View File

@@ -132,9 +132,13 @@ if (file_exists($requestFile)) {
$ext_file = "application/octet-stream";
} elseif ($ext_file == "tar") {
$ext_file = "application/x-tar";
} elseif ($ext_file == "woff") {
$ext_file = "application/font-woff";
} elseif ($ext_file == "js") {
$ext_file = "text/javascript";
} elseif ($ext_file=="css") {
//may this line be innecesary, all the .css are been generated at run time
$ext_file = 'css/'.$ext_file;
$ext_file = 'text/css';
} else {
$ext_file = "application/octet-stream";
}
@@ -273,7 +277,7 @@ define( 'PML_DOWNLOAD_URL', PML_SERVER . '/syspmLibrary/en/green/services/downlo
try {
Bootstrap::initVendors();
$config = Bootstrap::getSystemConfiguration();
// starting session
if (isset($config['session.gc_maxlifetime'])) {
$timelife = $config['session.gc_maxlifetime'];
@@ -1026,7 +1030,7 @@ try {
//transactionLog($restConfig.PATH_DATA_SITE.SYS_TARGET); // ====> ??? this concat is very rare
$RBAC->initRBAC();
Bootstrap::dispatchApiService(SYS_TARGET, API_VERSION);
} else {
//NewRelic Snippet - By JHL
@@ -1048,7 +1052,7 @@ try {
} catch (Exception $e) {
//g::pr($e->getTrace()); die;
Bootstrap::renderTemplate('error.tpl', array(
'title' => 'ProcessMaker Bootstrap Exception',
'title' => 'ProcessMaker Bootstrap Exception',
'message' => nl2br($e->getMessage()),
'exceptionClass' => get_class($e),
'trace' => $e->getTrace()