ProcessMaker-BE "BPMN Import"
- Cambio de nombre en la variable $flagInsert -> $forceInsert - unset para "BOU_UID" - Restableciendo el orden de los parametros del metodo "updateFromStruct"
This commit is contained in:
@@ -520,7 +520,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
$bwp->addProcess($processData);
|
||||
|
||||
$mappedUid = array_merge($result, self::updateFromStruct($bwp->prjUid, $projectData, true, $generateUid));
|
||||
$mappedUid = array_merge($result, self::updateFromStruct($bwp->prjUid, $projectData, $generateUid, true));
|
||||
|
||||
return $generateUid ? $mappedUid : $bwp->getUid();
|
||||
}
|
||||
@@ -619,7 +619,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
* @param $projectData
|
||||
* @return array
|
||||
*/
|
||||
public static function updateFromStruct($prjUid, $projectData, $flagInsert = false, $generateUid = true)
|
||||
public static function updateFromStruct($prjUid, $projectData, $generateUid = true, $forceInsert = false)
|
||||
{
|
||||
$diagram = isset($projectData["diagrams"]) && isset($projectData["diagrams"][0]) ? $projectData["diagrams"][0] : array();
|
||||
$result = array();
|
||||
@@ -639,9 +639,11 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
$activity = $bwp->getActivity($activityData["ACT_UID"]);
|
||||
|
||||
if ($flagInsert || is_null($activity)) {
|
||||
if ($forceInsert || is_null($activity)) {
|
||||
if ($generateUid) {
|
||||
//Activity
|
||||
unset($activityData["BOU_UID"]);
|
||||
|
||||
$uidOld = $activityData["ACT_UID"];
|
||||
$activityData["ACT_UID"] = Util\Common::generateUID();
|
||||
|
||||
@@ -650,18 +652,6 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
"old_uid" => $uidOld,
|
||||
"new_uid" => $activityData["ACT_UID"]
|
||||
);
|
||||
|
||||
//Bound
|
||||
if (isset($activityData["BOU_UID"])) {
|
||||
$uidOld = $activityData["BOU_UID"];
|
||||
$activityData["BOU_UID"] = Util\Common::generateUID();
|
||||
|
||||
$result[] = array(
|
||||
"object" => "bound",
|
||||
"old_uid" => $uidOld,
|
||||
"new_uid" => $activityData["BOU_UID"]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$bwp->addActivity($activityData);
|
||||
@@ -694,7 +684,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
$artifact = $bwp->getArtifact($artifactData["ART_UID"]);
|
||||
|
||||
if ($flagInsert || is_null($artifact)) {
|
||||
if ($forceInsert || is_null($artifact)) {
|
||||
if ($generateUid) {
|
||||
$oldArtUid = $artifactData["ART_UID"];
|
||||
|
||||
@@ -731,9 +721,11 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
$gateway = $bwp->getGateway($gatewayData["GAT_UID"]);
|
||||
|
||||
if ($flagInsert || is_null($gateway)) {
|
||||
if ($forceInsert || is_null($gateway)) {
|
||||
if ($generateUid) {
|
||||
//Gateway
|
||||
unset($gatewayData["BOU_UID"]);
|
||||
|
||||
$uidOld = $gatewayData["GAT_UID"];
|
||||
$gatewayData["GAT_UID"] = Util\Common::generateUID();
|
||||
|
||||
@@ -742,18 +734,6 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
"old_uid" => $uidOld,
|
||||
"new_uid" => $gatewayData["GAT_UID"]
|
||||
);
|
||||
|
||||
//Bound
|
||||
if (isset($gatewayData["BOU_UID"])) {
|
||||
$uidOld = $gatewayData["BOU_UID"];
|
||||
$gatewayData["BOU_UID"] = Util\Common::generateUID();
|
||||
|
||||
$result[] = array(
|
||||
"object" => "bound",
|
||||
"old_uid" => $uidOld,
|
||||
"new_uid" => $gatewayData["BOU_UID"]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$bwp->addGateway($gatewayData);
|
||||
@@ -792,9 +772,11 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
$event = $bwp->getEvent($eventData["EVN_UID"]);
|
||||
|
||||
if ($flagInsert || is_null($event)) {
|
||||
if ($forceInsert || is_null($event)) {
|
||||
if ($generateUid) {
|
||||
//Event
|
||||
unset($eventData["BOU_UID"]);
|
||||
|
||||
$uidOld = $eventData["EVN_UID"];
|
||||
$eventData["EVN_UID"] = Util\Common::generateUID();
|
||||
|
||||
@@ -803,18 +785,6 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
"old_uid" => $uidOld,
|
||||
"new_uid" => $eventData["EVN_UID"]
|
||||
);
|
||||
|
||||
//Bound
|
||||
if (isset($eventData["BOU_UID"])) {
|
||||
$uidOld = $eventData["BOU_UID"];
|
||||
$eventData["BOU_UID"] = Util\Common::generateUID();
|
||||
|
||||
$result[] = array(
|
||||
"object" => "bound",
|
||||
"old_uid" => $uidOld,
|
||||
"new_uid" => $eventData["BOU_UID"]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$bwp->addEvent($eventData);
|
||||
@@ -848,7 +818,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$flowData = array_change_key_case($flowData, CASE_UPPER);
|
||||
|
||||
// if it is a new flow record
|
||||
if ($flagInsert || ($generateUid && !\BpmnFlow::exists($flowData["FLO_UID"]))) {
|
||||
if ($forceInsert || ($generateUid && !\BpmnFlow::exists($flowData["FLO_UID"]))) {
|
||||
$oldFloUid = $flowData["FLO_UID"];
|
||||
$flowData["FLO_UID"] = Util\Common::generateUID();
|
||||
$result[] = array("object" => "flow", "new_uid" => $flowData["FLO_UID"], "old_uid" => $oldFloUid);
|
||||
@@ -870,7 +840,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
foreach ($diagram["flows"] as $flowData) {
|
||||
$flow = $bwp->getFlow($flowData["FLO_UID"]);
|
||||
if ($flagInsert || is_null($flow)) {
|
||||
if ($forceInsert || is_null($flow)) {
|
||||
$bwp->addFlow($flowData);
|
||||
} elseif (! $bwp->isEquals($flow, $flowData)) {
|
||||
$bwp->updateFlow($flowData["FLO_UID"], $flowData, $diagram["flows"]);
|
||||
|
||||
Reference in New Issue
Block a user