Merged colosa/processmaker into master
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -359,9 +359,11 @@ class WebEntryEvent
|
||||
//Task
|
||||
$task = new \Task();
|
||||
|
||||
$prefix = "wee-";
|
||||
|
||||
$this->webEntryEventWebEntryTaskUid = $task->create(
|
||||
array(
|
||||
"TAS_UID" => \ProcessMaker\Util\Common::generateUID(),
|
||||
"TAS_UID" => $prefix . substr(\ProcessMaker\Util\Common::generateUID(), (32 - strlen($prefix)) * -1),
|
||||
"PRO_UID" => $projectUid,
|
||||
"TAS_TYPE" => "WEBENTRYEVENT",
|
||||
"TAS_TITLE" => "WEBENTRYEVENT",
|
||||
@@ -765,6 +767,8 @@ class WebEntryEvent
|
||||
throw new \Exception(\G::LoadTranslation("ID_REGISTRY_CANNOT_BE_UPDATED") . (($msg != "")? "\n" . $msg : ""));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$cnn->rollback();
|
||||
|
||||
$this->deleteWebEntry($this->webEntryEventWebEntryUid, $this->webEntryEventWebEntryTaskUid);
|
||||
|
||||
throw $e;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -625,12 +625,53 @@ class Bpmn extends Handler
|
||||
}
|
||||
}
|
||||
|
||||
public function throwExceptionFlowIfIsAnInvalidMessageFlow(array $bpmnFlow)
|
||||
{
|
||||
try {
|
||||
if ($bpmnFlow["FLO_TYPE"] == "MESSAGE" &&
|
||||
$bpmnFlow["FLO_ELEMENT_ORIGIN_TYPE"] == "bpmnEvent" && $bpmnFlow["FLO_ELEMENT_DEST_TYPE"] == "bpmnEvent"
|
||||
) {
|
||||
$flagValid = true;
|
||||
|
||||
$arrayEventType = array("START", "END", "INTERMEDIATE");
|
||||
|
||||
$arrayAux = array(
|
||||
array("eventUid" => $bpmnFlow["FLO_ELEMENT_ORIGIN"], "eventMarker" => "MESSAGETHROW"),
|
||||
array("eventUid" => $bpmnFlow["FLO_ELEMENT_DEST"], "eventMarker" => "MESSAGECATCH")
|
||||
);
|
||||
|
||||
foreach ($arrayAux as $value) {
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\BpmnEventPeer::EVN_UID);
|
||||
$criteria->add(\BpmnEventPeer::EVN_UID, $value["eventUid"], \Criteria::EQUAL);
|
||||
$criteria->add(\BpmnEventPeer::EVN_TYPE, $arrayEventType, \Criteria::IN);
|
||||
$criteria->add(\BpmnEventPeer::EVN_MARKER, $value["eventMarker"], \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \BpmnEventPeer::doSelectRS($criteria);
|
||||
|
||||
if (!$rsCriteria->next()) {
|
||||
$flagValid = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$flagValid) {
|
||||
throw new \RuntimeException("Invalid Message Flow.");
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function addFlow($data)
|
||||
{
|
||||
self::log("Add Flow with data: ", $data);
|
||||
|
||||
// setting defaults
|
||||
$data['FLO_UID'] = array_key_exists('FLO_UID', $data) ? $data['FLO_UID'] : Common::generateUID();
|
||||
|
||||
if (array_key_exists('FLO_STATE', $data)) {
|
||||
$data['FLO_STATE'] = is_array($data['FLO_STATE']) ? json_encode($data['FLO_STATE']) : $data['FLO_STATE'];
|
||||
}
|
||||
@@ -680,17 +721,23 @@ class Bpmn extends Handler
|
||||
));
|
||||
}
|
||||
|
||||
//Check and validate Message Flow
|
||||
$this->throwExceptionFlowIfIsAnInvalidMessageFlow($data);
|
||||
|
||||
//Create
|
||||
$flow = new Flow();
|
||||
$flow->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
$flow->setPrjUid($this->getUid());
|
||||
$flow->setDiaUid($this->getDiagram("object")->getDiaUid());
|
||||
$flow->setFloPosition($this->getFlowNextPosition($data["FLO_UID"], $data["FLO_TYPE"], $data["FLO_ELEMENT_ORIGIN"]));
|
||||
$flow->save();
|
||||
|
||||
self::log("Add Flow Success!");
|
||||
|
||||
return $flow->getFloUid();
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
@@ -703,7 +750,12 @@ class Bpmn extends Handler
|
||||
if (array_key_exists('FLO_STATE', $data)) {
|
||||
$data['FLO_STATE'] = is_array($data['FLO_STATE']) ? json_encode($data['FLO_STATE']) : $data['FLO_STATE'];
|
||||
}
|
||||
|
||||
try {
|
||||
//Check and validate Message Flow
|
||||
$this->throwExceptionFlowIfIsAnInvalidMessageFlow($data);
|
||||
|
||||
//Update
|
||||
$flow = FlowPeer::retrieveByPk($floUid);
|
||||
$flow->fromArray($data);
|
||||
$flow->save();
|
||||
|
||||
@@ -1236,7 +1236,7 @@ class Workflow extends Handler
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteTaskGatewayToGateway($processUid)
|
||||
public function deleteTaskByArrayType($processUid, array $arrayTaskType)
|
||||
{
|
||||
try {
|
||||
$task = new \Tasks();
|
||||
@@ -1245,7 +1245,7 @@ class Workflow extends Handler
|
||||
|
||||
$criteria->addSelectColumn(\TaskPeer::TAS_UID);
|
||||
$criteria->add(\TaskPeer::PRO_UID, $processUid, \Criteria::EQUAL);
|
||||
$criteria->add(\TaskPeer::TAS_TYPE, "GATEWAYTOGATEWAY", \Criteria::EQUAL);
|
||||
$criteria->add(\TaskPeer::TAS_TYPE, $arrayTaskType, \Criteria::IN);
|
||||
|
||||
$rsCriteria = \TaskPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\MessageEventDefinition Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class MessageEventDefinition extends Api
|
||||
{
|
||||
private $messageEventDefinition;
|
||||
|
||||
/**
|
||||
* Constructor of the class
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
$this->messageEventDefinition = new \ProcessMaker\BusinessModel\MessageEventDefinition();
|
||||
|
||||
$this->messageEventDefinition->setFormatFieldNameInUppercase(false);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/message-event-definitions
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetMessageEventDefinitions($prj_uid)
|
||||
{
|
||||
try {
|
||||
$response = $this->messageEventDefinition->getMessageEventDefinitions($prj_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/message-event-definition/:msged_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $msged_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetMessageEventDefinition($prj_uid, $msged_uid)
|
||||
{
|
||||
try {
|
||||
$response = $this->messageEventDefinition->getMessageEventDefinition($msged_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/message-event-definition/event/:evn_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $evn_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetMessageEventDefinitionEvent($prj_uid, $evn_uid)
|
||||
{
|
||||
try {
|
||||
$response = $this->messageEventDefinition->getMessageEventDefinitionByEvent($prj_uid, $evn_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prj_uid/message-event-definition
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostMessageEventDefinition($prj_uid, array $request_data)
|
||||
{
|
||||
try {
|
||||
$arrayData = $this->messageEventDefinition->create($prj_uid, $request_data);
|
||||
|
||||
$response = $arrayData;
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:prj_uid/message-event-definition/:msged_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $msged_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*/
|
||||
public function doPutMessageEventDefinition($prj_uid, $msged_uid, array $request_data)
|
||||
{
|
||||
try {
|
||||
$arrayData = $this->messageEventDefinition->update($msged_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prj_uid/message-event-definition/:msged_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $msged_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDeleteMessageEventDefinition($prj_uid, $msged_uid)
|
||||
{
|
||||
try {
|
||||
$this->messageEventDefinition->delete($msged_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,8 @@ debug = 1
|
||||
process-variable = "ProcessMaker\Services\Api\Project\Variable"
|
||||
message-type = "ProcessMaker\Services\Api\Project\MessageType"
|
||||
message-type-variable = "ProcessMaker\Services\Api\Project\MessageType\Variable"
|
||||
web-entry-event = "ProcessMaker\Services\Api\Project\WebEntryEvent"
|
||||
web-entry-event = "ProcessMaker\Services\Api\Project\WebEntryEvent"
|
||||
message-event-definition = "ProcessMaker\Services\Api\Project\MessageEventDefinition"
|
||||
|
||||
[alias: projects]
|
||||
project = "ProcessMaker\Services\Api\Project"
|
||||
|
||||
Reference in New Issue
Block a user