MT-38
Import: Exceptions Handling
This commit is contained in:
@@ -183,35 +183,56 @@ if (isset($_FILES["PROCESS_FILENAME"]) &&
|
|||||||
"project_type_aux" => $proType
|
"project_type_aux" => $proType
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$groupsExists = ($e->getCode() == XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS)? 1 : 0;
|
switch (get_class($e)) {
|
||||||
if($groupsExists === 1) {
|
case 'ProcessMaker\BusinessModel\Migrator\ImportException':
|
||||||
$arrayGroups = XmlImporter::$affectedGroups;
|
$result = array(
|
||||||
if(sizeof($arrayGroups)) {
|
"success" => true,
|
||||||
foreach ($arrayGroups as $group) {
|
"catchMessage" => $e->getNameException() . ' ' . $e->getMessage(),
|
||||||
$affectedGroups[] = $group["GRP_TITLE"];
|
"ExistProcessInDatabase" => '',
|
||||||
|
"ExistGroupsInDatabase" => '',
|
||||||
|
"notExistProcessInDatabase" => '',
|
||||||
|
"affectedGroups" => '',
|
||||||
|
"sNewProUid" => '',
|
||||||
|
"project_type" => 'bpmn',
|
||||||
|
"isGranularImport" => false,
|
||||||
|
"objectGranularImport" => '',
|
||||||
|
"proFileName" => $_FILES["PROCESS_FILENAME"]["name"],
|
||||||
|
"groupBeforeAccion" => 'uploadFileNewProcess',
|
||||||
|
"importOption" => 0
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$groupsExists = ($e->getCode() == XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS) ? 1 : 0;
|
||||||
|
if ($groupsExists === 1) {
|
||||||
|
$arrayGroups = XmlImporter::$affectedGroups;
|
||||||
|
if (sizeof($arrayGroups)) {
|
||||||
|
foreach ($arrayGroups as $group) {
|
||||||
|
$affectedGroups[] = $group["GRP_TITLE"];
|
||||||
|
}
|
||||||
|
$affectedGroups = implode(', ', $affectedGroups);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$affectedGroups = implode(', ', $affectedGroups);
|
$result = array(
|
||||||
}
|
"success" => true,
|
||||||
|
"catchMessage" => (in_array($e->getCode(), array(
|
||||||
|
XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS,
|
||||||
|
XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS,
|
||||||
|
XmlImporter::IMPORTED_PROJECT_DOES_NOT_EXISTS
|
||||||
|
))) ? "" : $e->getMessage(),
|
||||||
|
"ExistProcessInDatabase" => ($e->getCode() == XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS) ? 1 : 0,
|
||||||
|
"ExistGroupsInDatabase" => $groupsExists,
|
||||||
|
"notExistProcessInDatabase" => ($e->getCode() == XmlImporter::IMPORTED_PROJECT_DOES_NOT_EXISTS) ? 1 : 0,
|
||||||
|
"affectedGroups" => !empty($affectedGroups) ? $affectedGroups : '',
|
||||||
|
"sNewProUid" => '',
|
||||||
|
"project_type" => 'bpmn',
|
||||||
|
"isGranularImport" => false,
|
||||||
|
"objectGranularImport" => '',
|
||||||
|
"proFileName" => $_FILES["PROCESS_FILENAME"]["name"],
|
||||||
|
"groupBeforeAccion" => 'uploadFileNewProcess',
|
||||||
|
"importOption" => 0
|
||||||
|
);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
$result = array(
|
|
||||||
"success" => true,
|
|
||||||
"catchMessage" => (in_array($e->getCode(), array(
|
|
||||||
XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS,
|
|
||||||
XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS,
|
|
||||||
XmlImporter::IMPORTED_PROJECT_DOES_NOT_EXISTS
|
|
||||||
)))? "" : $e->getMessage(),
|
|
||||||
"ExistProcessInDatabase" => ($e->getCode() == XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS)? 1 : 0,
|
|
||||||
"ExistGroupsInDatabase" => $groupsExists,
|
|
||||||
"notExistProcessInDatabase" => ($e->getCode() == XmlImporter::IMPORTED_PROJECT_DOES_NOT_EXISTS) ? 1 : 0,
|
|
||||||
"affectedGroups" => !empty($affectedGroups)? $affectedGroups : '',
|
|
||||||
"sNewProUid" => '',
|
|
||||||
"project_type" => 'bpmn',
|
|
||||||
"isGranularImport" => false,
|
|
||||||
"objectGranularImport" => '',
|
|
||||||
"proFileName" => $_FILES["PROCESS_FILENAME"]["name"],
|
|
||||||
"groupBeforeAccion" => 'uploadFileNewProcess',
|
|
||||||
"importOption" => 0
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo G::json_encode($result);
|
echo G::json_encode($result);
|
||||||
@@ -276,30 +297,50 @@ if (isset($_POST["PRO_FILENAME"]) &&
|
|||||||
"project_type_aux" => $proType
|
"project_type_aux" => $proType
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$groupsExists = ($e->getCode() == XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS)? 1 : 0;
|
switch (get_class($e)) {
|
||||||
if($groupsExists === 1) {
|
case 'ProcessMaker\BusinessModel\Migrator\ImportException':
|
||||||
$arrayGroups = XmlImporter::$affectedGroups;
|
$result = array(
|
||||||
if(sizeof($arrayGroups)) {
|
"success" => true,
|
||||||
foreach($arrayGroups as $group){
|
"catchMessage" => $e->getNameException() . ' ' . $e->getMessage(),
|
||||||
$affectedGroups[] = $group["GRP_TITLE"];
|
"ExistProcessInDatabase" => '',
|
||||||
|
"ExistGroupsInDatabase" => '',
|
||||||
|
"affectedGroups" => '',
|
||||||
|
"sNewProUid" => '',
|
||||||
|
"project_type" => 'bpmn',
|
||||||
|
"isGranularImport" => false,
|
||||||
|
"objectGranularImport" => '',
|
||||||
|
"proFileName" => $_POST["PRO_FILENAME"],
|
||||||
|
"groupBeforeAccion" => "uploadFileNewProcess",
|
||||||
|
"importOption" => (isset($_POST["IMPORT_OPTION"])) ? (int)($_POST["IMPORT_OPTION"]) : 0
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$groupsExists = ($e->getCode() == XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS) ? 1 : 0;
|
||||||
|
if ($groupsExists === 1) {
|
||||||
|
$arrayGroups = XmlImporter::$affectedGroups;
|
||||||
|
if (sizeof($arrayGroups)) {
|
||||||
|
foreach ($arrayGroups as $group) {
|
||||||
|
$affectedGroups[] = $group["GRP_TITLE"];
|
||||||
|
}
|
||||||
|
$affectedGroups = implode(', ', $affectedGroups);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$affectedGroups = implode(', ', $affectedGroups);
|
$result = array(
|
||||||
}
|
"success" => true,
|
||||||
|
"catchMessage" => (in_array($e->getCode(), array(XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS, XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS))) ? "" : $e->getMessage(),
|
||||||
|
"ExistProcessInDatabase" => ($e->getCode() == XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS) ? 1 : 0,
|
||||||
|
"ExistGroupsInDatabase" => $groupsExists,
|
||||||
|
"affectedGroups" => !empty($affectedGroups) ? $affectedGroups : '',
|
||||||
|
"sNewProUid" => '',
|
||||||
|
"project_type" => 'bpmn',
|
||||||
|
"isGranularImport" => false,
|
||||||
|
"objectGranularImport" => '',
|
||||||
|
"proFileName" => $_POST["PRO_FILENAME"],
|
||||||
|
"groupBeforeAccion" => "uploadFileNewProcess",
|
||||||
|
"importOption" => (isset($_POST["IMPORT_OPTION"])) ? (int)($_POST["IMPORT_OPTION"]) : 0
|
||||||
|
);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
$result = array(
|
|
||||||
"success" => true,
|
|
||||||
"catchMessage" => (in_array($e->getCode(), array(XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS, XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS)))? "" : $e->getMessage(),
|
|
||||||
"ExistProcessInDatabase" => ($e->getCode() == XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS)? 1 : 0,
|
|
||||||
"ExistGroupsInDatabase" => $groupsExists,
|
|
||||||
"affectedGroups" => !empty($affectedGroups)? $affectedGroups : '',
|
|
||||||
"sNewProUid" => '',
|
|
||||||
"project_type" => 'bpmn',
|
|
||||||
"isGranularImport" => false,
|
|
||||||
"objectGranularImport" => '',
|
|
||||||
"proFileName" => $_POST["PRO_FILENAME"],
|
|
||||||
"groupBeforeAccion" => "uploadFileNewProcess",
|
|
||||||
"importOption" => (isset($_POST["IMPORT_OPTION"]))? (int)($_POST["IMPORT_OPTION"]) : 0
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo G::json_encode($result);
|
echo G::json_encode($result);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ namespace ProcessMaker\BusinessModel\Migrator;
|
|||||||
class AssignmentRulesMigrator implements Importable, Exportable
|
class AssignmentRulesMigrator implements Importable, Exportable
|
||||||
{
|
{
|
||||||
protected $processes;
|
protected $processes;
|
||||||
|
protected $className;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AssignmentRulesMigrator constructor.
|
* AssignmentRulesMigrator constructor.
|
||||||
@@ -20,6 +21,7 @@ class AssignmentRulesMigrator implements Importable, Exportable
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->processes = new \Processes();
|
$this->processes = new \Processes();
|
||||||
|
$this->className = 'Assignment Rules';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeImport($data)
|
public function beforeImport($data)
|
||||||
@@ -46,8 +48,9 @@ class AssignmentRulesMigrator implements Importable, Exportable
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ImportException($e->getMessage());
|
||||||
throw new ImportException($e->getMessage());
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,8 +86,9 @@ class AssignmentRulesMigrator implements Importable, Exportable
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ExportException($e->getMessage());
|
||||||
throw new ExportException($e->getMessage());
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace ProcessMaker\BusinessModel\Migrator;
|
|||||||
class DBConnectionMigrator implements Importable, Exportable
|
class DBConnectionMigrator implements Importable, Exportable
|
||||||
{
|
{
|
||||||
protected $processes;
|
protected $processes;
|
||||||
|
protected $className;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DBConnectionMigrator constructor.
|
* DBConnectionMigrator constructor.
|
||||||
@@ -12,6 +13,7 @@ class DBConnectionMigrator implements Importable, Exportable
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->processes = new \Processes();
|
$this->processes = new \Processes();
|
||||||
|
$this->className = 'DB Connection';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeImport($data)
|
public function beforeImport($data)
|
||||||
@@ -22,6 +24,7 @@ class DBConnectionMigrator implements Importable, Exportable
|
|||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
* @param $replace
|
* @param $replace
|
||||||
|
* @throws ImportException
|
||||||
*/
|
*/
|
||||||
public function import($data, $replace)
|
public function import($data, $replace)
|
||||||
{
|
{
|
||||||
@@ -32,8 +35,9 @@ class DBConnectionMigrator implements Importable, Exportable
|
|||||||
$this->processes->addNewDBConnectionsRows($data);
|
$this->processes->addNewDBConnectionsRows($data);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ImportException($e->getMessage());
|
||||||
throwException(new ImportException($e->getMessage()));
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,8 +69,9 @@ class DBConnectionMigrator implements Importable, Exportable
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ExportException($e->getMessage());
|
||||||
throw new ExportException($e->getMessage());
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace ProcessMaker\BusinessModel\Migrator;
|
|||||||
class DynaformsMigrator implements Importable, Exportable
|
class DynaformsMigrator implements Importable, Exportable
|
||||||
{
|
{
|
||||||
protected $processes;
|
protected $processes;
|
||||||
|
protected $className;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DynaformsMigrator constructor.
|
* DynaformsMigrator constructor.
|
||||||
@@ -12,6 +13,7 @@ class DynaformsMigrator implements Importable, Exportable
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->processes = new \Processes();
|
$this->processes = new \Processes();
|
||||||
|
$this->className = 'Dynaforms';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeImport($data)
|
public function beforeImport($data)
|
||||||
@@ -22,18 +24,20 @@ class DynaformsMigrator implements Importable, Exportable
|
|||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
* @param $replace
|
* @param $replace
|
||||||
|
* @throws ImportException
|
||||||
*/
|
*/
|
||||||
public function import($data, $replace)
|
public function import($data, $replace)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if ($replace) {
|
if (!$replace) {
|
||||||
$this->processes->createDynaformRows($data);
|
$this->processes->createDynaformRows($data);
|
||||||
} else {
|
} else {
|
||||||
$this->processes->addNewDynaformRows($data);
|
$this->processes->addNewDynaformRows($data);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ImportException($e->getMessage());
|
||||||
throwException(new ImportException($e->getMessage()));
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,8 +68,9 @@ class DynaformsMigrator implements Importable, Exportable
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ExportException($e->getMessage());
|
||||||
throw new ExportException($e->getMessage());
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,5 +5,21 @@ namespace ProcessMaker\BusinessModel\Migrator;
|
|||||||
|
|
||||||
class ExportException extends \Exception
|
class ExportException extends \Exception
|
||||||
{
|
{
|
||||||
|
protected $nameException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getNameException()
|
||||||
|
{
|
||||||
|
return $this->nameException;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $nameException
|
||||||
|
*/
|
||||||
|
public function setNameException($nameException)
|
||||||
|
{
|
||||||
|
$this->nameException = $nameException;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,7 @@ use \ProcessMaker\BusinessModel\Migrator\FileHandler;
|
|||||||
class FilesMigrator implements Importable, Exportable
|
class FilesMigrator implements Importable, Exportable
|
||||||
{
|
{
|
||||||
protected $processes;
|
protected $processes;
|
||||||
|
protected $className;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FilesMigrator constructor.
|
* FilesMigrator constructor.
|
||||||
@@ -15,6 +16,7 @@ class FilesMigrator implements Importable, Exportable
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->processes = new \Processes();
|
$this->processes = new \Processes();
|
||||||
|
$this->className = 'Public Files';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeImport($data)
|
public function beforeImport($data)
|
||||||
@@ -64,8 +66,9 @@ class FilesMigrator implements Importable, Exportable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ImportException($e->getMessage());
|
||||||
throw new ImportException($e->getMessage());
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,8 +105,9 @@ class FilesMigrator implements Importable, Exportable
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ExportException($e->getMessage());
|
||||||
throw new ExportException($e->getMessage());
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -155,19 +155,14 @@ class GranularExporter
|
|||||||
protected function verifyConsistenceData($migratorData)
|
protected function verifyConsistenceData($migratorData)
|
||||||
{
|
{
|
||||||
//verifying data consistency group
|
//verifying data consistency group
|
||||||
switch (true) {
|
if (isset($migratorData['workflow-definition']['groupwfs'])) {
|
||||||
case $migratorData['workflow-definition']['groupwfs']:
|
foreach ($this->data['workflow-definition']['groupwfs'] as $rowGroup) {
|
||||||
foreach ($this->data['workflow-definition']['groupwfs'] as $rowGroup) {
|
foreach ($migratorData['workflow-definition']['groupwfs'] as $key => $row) {
|
||||||
foreach ($migratorData['workflow-definition']['groupwfs'] as $key => $row) {
|
if ($rowGroup['GRP_UID'] == $row['GRP_UID']) {
|
||||||
if ($rowGroup['GRP_UID'] == $row['GRP_UID']) {
|
array_splice($migratorData['workflow-definition']['groupwfs'], $key);
|
||||||
array_splice($migratorData['workflow-definition']['groupwfs'], $key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
default:
|
|
||||||
$migratorData = $migratorData;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return $migratorData;
|
return $migratorData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ class GranularImporter
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $objectList
|
* @param $objectList
|
||||||
* @return array
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function import($objectList)
|
public function import($objectList)
|
||||||
{
|
{
|
||||||
@@ -164,36 +164,33 @@ class GranularImporter
|
|||||||
$migratorData = $objClass->import($dataImport, $replace);
|
$migratorData = $objClass->import($dataImport, $replace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ExportException $e) {
|
} catch (\Exception $e) {
|
||||||
return array(
|
throw $e;
|
||||||
'success' => false,
|
|
||||||
'message' => $e->getMessage()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $objectList
|
* @param $objectList
|
||||||
* @param bool|false $generateUid
|
* @param bool $generateUid
|
||||||
* @return array|bool
|
* @return bool
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function validateImportData($objectList, $generateUid = false)
|
public function validateImportData($objectList, $generateUid = false)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if($generateUid){
|
if ($generateUid) {
|
||||||
foreach ($objectList as $rowObject) {
|
foreach ($objectList as $rowObject) {
|
||||||
if($rowObject['name'] === 'PROCESSDEFINITION' && $rowObject['value'] == "replace"){
|
if ($rowObject['name'] === 'PROCESSDEFINITION' && $rowObject['value'] == "replace") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
$exception = new ImportException();
|
||||||
|
$exception->setNameException('To create a new process needs PROCESSDEFINITION');
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (ExportException $e) {
|
} catch (\Exception $e) {
|
||||||
return array(
|
throw $e;
|
||||||
'success' => false,
|
|
||||||
'message' => $e->getMessage()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,5 +5,21 @@ namespace ProcessMaker\BusinessModel\Migrator;
|
|||||||
|
|
||||||
class ImportException extends \Exception
|
class ImportException extends \Exception
|
||||||
{
|
{
|
||||||
|
protected $nameException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function getNameException()
|
||||||
|
{
|
||||||
|
return $this->nameException;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $nameException
|
||||||
|
*/
|
||||||
|
public function setNameException($nameException)
|
||||||
|
{
|
||||||
|
$this->nameException = $nameException;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ namespace ProcessMaker\BusinessModel\Migrator;
|
|||||||
class InputDocumentsMigrator implements Importable, Exportable
|
class InputDocumentsMigrator implements Importable, Exportable
|
||||||
{
|
{
|
||||||
protected $processes;
|
protected $processes;
|
||||||
|
protected $className;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* InputDocumentsMigrator constructor.
|
* InputDocumentsMigrator constructor.
|
||||||
@@ -12,6 +13,7 @@ class InputDocumentsMigrator implements Importable, Exportable
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->processes = new \Processes();
|
$this->processes = new \Processes();
|
||||||
|
$this->className = 'InputDocument';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeImport($data)
|
public function beforeImport($data)
|
||||||
@@ -22,6 +24,7 @@ class InputDocumentsMigrator implements Importable, Exportable
|
|||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
* @param $replace
|
* @param $replace
|
||||||
|
* @throws ImportException
|
||||||
*/
|
*/
|
||||||
public function import($data, $replace)
|
public function import($data, $replace)
|
||||||
{
|
{
|
||||||
@@ -32,8 +35,9 @@ class InputDocumentsMigrator implements Importable, Exportable
|
|||||||
$this->processes->addNewInputRows($data);
|
$this->processes->addNewInputRows($data);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ImportException($e->getMessage());
|
||||||
throwException(new ImportException($e->getMessage()));
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,8 +69,9 @@ class InputDocumentsMigrator implements Importable, Exportable
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ExportException($e->getMessage());
|
||||||
throw new ExportException($e->getMessage());
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,10 @@
|
|||||||
|
|
||||||
namespace ProcessMaker\BusinessModel\Migrator;
|
namespace ProcessMaker\BusinessModel\Migrator;
|
||||||
|
|
||||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
|
||||||
|
|
||||||
class OutputDocumentsMigrator implements Importable, Exportable
|
class OutputDocumentsMigrator implements Importable, Exportable
|
||||||
{
|
{
|
||||||
protected $processes;
|
protected $processes;
|
||||||
|
protected $className;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OutputDocumentsMigrator constructor.
|
* OutputDocumentsMigrator constructor.
|
||||||
@@ -14,6 +13,7 @@ class OutputDocumentsMigrator implements Importable, Exportable
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->processes = new \Processes();
|
$this->processes = new \Processes();
|
||||||
|
$this->className = 'OutputDocument';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeImport($data)
|
public function beforeImport($data)
|
||||||
@@ -24,6 +24,7 @@ class OutputDocumentsMigrator implements Importable, Exportable
|
|||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
* @param $replace
|
* @param $replace
|
||||||
|
* @throws ImportException
|
||||||
*/
|
*/
|
||||||
public function import($data, $replace)
|
public function import($data, $replace)
|
||||||
{
|
{
|
||||||
@@ -34,8 +35,9 @@ class OutputDocumentsMigrator implements Importable, Exportable
|
|||||||
$this->processes->addNewOutputRows($data);
|
$this->processes->addNewOutputRows($data);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ImportException($e->getMessage());
|
||||||
throwException(new ImportException($e->getMessage()));
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,8 +69,9 @@ class OutputDocumentsMigrator implements Importable, Exportable
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ExportException($e->getMessage());
|
||||||
throw new ExportException($e->getMessage());
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ namespace ProcessMaker\BusinessModel\Migrator;
|
|||||||
class PermissionsMigrator implements Importable, Exportable
|
class PermissionsMigrator implements Importable, Exportable
|
||||||
{
|
{
|
||||||
protected $processes;
|
protected $processes;
|
||||||
|
protected $className;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PermissionsMigrator constructor.
|
* PermissionsMigrator constructor.
|
||||||
@@ -13,6 +14,7 @@ class PermissionsMigrator implements Importable, Exportable
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->processes = new \Processes();
|
$this->processes = new \Processes();
|
||||||
|
$this->className = 'Permissions';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeImport($data)
|
public function beforeImport($data)
|
||||||
@@ -23,6 +25,7 @@ class PermissionsMigrator implements Importable, Exportable
|
|||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
* @param $replace
|
* @param $replace
|
||||||
|
* @throws ImportException
|
||||||
*/
|
*/
|
||||||
public function import($data, $replace)
|
public function import($data, $replace)
|
||||||
{
|
{
|
||||||
@@ -35,8 +38,9 @@ class PermissionsMigrator implements Importable, Exportable
|
|||||||
$this->processes->addNewGroupRow($data['groupwfs']);
|
$this->processes->addNewGroupRow($data['groupwfs']);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ImportException($e->getMessage());
|
||||||
throwException(new ImportException($e->getMessage()));
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,8 +87,9 @@ class PermissionsMigrator implements Importable, Exportable
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ExportException($e->getMessage());
|
||||||
throw new ExportException($e->getMessage());
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class ProcessDefinitionMigrator implements Importable, Exportable
|
|||||||
{
|
{
|
||||||
protected $bpmn;
|
protected $bpmn;
|
||||||
protected $processes;
|
protected $processes;
|
||||||
|
protected $className;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ProcessDefinitionMigrator constructor.
|
* ProcessDefinitionMigrator constructor.
|
||||||
@@ -17,6 +18,7 @@ class ProcessDefinitionMigrator implements Importable, Exportable
|
|||||||
{
|
{
|
||||||
$this->bpmn = new Adapter\BpmnWorkflow();
|
$this->bpmn = new Adapter\BpmnWorkflow();
|
||||||
$this->processes = new \Processes();
|
$this->processes = new \Processes();
|
||||||
|
$this->className = 'ProcessDefinition';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeImport($data)
|
public function beforeImport($data)
|
||||||
@@ -24,6 +26,11 @@ class ProcessDefinitionMigrator implements Importable, Exportable
|
|||||||
// TODO: Implement beforeImport() method.
|
// TODO: Implement beforeImport() method.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $data
|
||||||
|
* @param $replace
|
||||||
|
* @throws ImportException
|
||||||
|
*/
|
||||||
public function import($data, $replace)
|
public function import($data, $replace)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -57,7 +64,9 @@ class ProcessDefinitionMigrator implements Importable, Exportable
|
|||||||
$this->processes->createActionsByEmail($data['workflow']['process']['PRO_UID'], $data['workflow']['abeConfiguration']);
|
$this->processes->createActionsByEmail($data['workflow']['process']['PRO_UID'], $data['workflow']['abeConfiguration']);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $e->getMessage();
|
$exception = new ImportException($e->getMessage());
|
||||||
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,6 +83,7 @@ class ProcessDefinitionMigrator implements Importable, Exportable
|
|||||||
/**
|
/**
|
||||||
* @param $prj_uid
|
* @param $prj_uid
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws ExportException
|
||||||
*/
|
*/
|
||||||
public function export($prj_uid)
|
public function export($prj_uid)
|
||||||
{
|
{
|
||||||
@@ -129,8 +139,9 @@ class ProcessDefinitionMigrator implements Importable, Exportable
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ExportException($e->getMessage());
|
||||||
throwException(new ExportException($e->getMessage()));
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace ProcessMaker\BusinessModel\Migrator;
|
|||||||
class ReportTablesMigrator implements Importable, Exportable
|
class ReportTablesMigrator implements Importable, Exportable
|
||||||
{
|
{
|
||||||
protected $processes;
|
protected $processes;
|
||||||
|
protected $className;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ReportTablesMigrator constructor.
|
* ReportTablesMigrator constructor.
|
||||||
@@ -12,6 +13,7 @@ class ReportTablesMigrator implements Importable, Exportable
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->processes = new \Processes();
|
$this->processes = new \Processes();
|
||||||
|
$this->className = 'ReportTables';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeImport($data)
|
public function beforeImport($data)
|
||||||
@@ -22,6 +24,7 @@ class ReportTablesMigrator implements Importable, Exportable
|
|||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
* @param $replace
|
* @param $replace
|
||||||
|
* @throws ImportException
|
||||||
*/
|
*/
|
||||||
public function import($data, $replace)
|
public function import($data, $replace)
|
||||||
{
|
{
|
||||||
@@ -33,8 +36,9 @@ class ReportTablesMigrator implements Importable, Exportable
|
|||||||
$this->processes->updateReportTables($data, $aReportTablesVars);
|
$this->processes->updateReportTables($data, $aReportTablesVars);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ImportException($e->getMessage());
|
||||||
throwException(new ImportException($e->getMessage()));
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,6 +55,7 @@ class ReportTablesMigrator implements Importable, Exportable
|
|||||||
/**
|
/**
|
||||||
* @param $prj_uid
|
* @param $prj_uid
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws ExportException
|
||||||
*/
|
*/
|
||||||
public function export($prj_uid)
|
public function export($prj_uid)
|
||||||
{
|
{
|
||||||
@@ -66,8 +71,9 @@ class ReportTablesMigrator implements Importable, Exportable
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ExportException($e->getMessage());
|
||||||
throwException(new ExportException($e->getMessage()));
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ namespace ProcessMaker\BusinessModel\Migrator;
|
|||||||
class SupervisorsMigrator implements Importable, Exportable
|
class SupervisorsMigrator implements Importable, Exportable
|
||||||
{
|
{
|
||||||
protected $processes;
|
protected $processes;
|
||||||
|
protected $className;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SupervisorsMigrator constructor.
|
* SupervisorsMigrator constructor.
|
||||||
@@ -13,6 +14,7 @@ class SupervisorsMigrator implements Importable, Exportable
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->processes = new \Processes();
|
$this->processes = new \Processes();
|
||||||
|
$this->className = 'Supervisor';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeImport($data)
|
public function beforeImport($data)
|
||||||
@@ -23,6 +25,7 @@ class SupervisorsMigrator implements Importable, Exportable
|
|||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
* @param $replace
|
* @param $replace
|
||||||
|
* @throws ImportException
|
||||||
*/
|
*/
|
||||||
public function import($data, $replace)
|
public function import($data, $replace)
|
||||||
{
|
{
|
||||||
@@ -35,8 +38,9 @@ class SupervisorsMigrator implements Importable, Exportable
|
|||||||
$this->processes->addNewGroupRow($data['groupwfs']);
|
$this->processes->addNewGroupRow($data['groupwfs']);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ImportException($e->getMessage());
|
||||||
throwException(new ImportException($e->getMessage()));
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,6 +57,7 @@ class SupervisorsMigrator implements Importable, Exportable
|
|||||||
/**
|
/**
|
||||||
* @param $prj_uid
|
* @param $prj_uid
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws ExportException
|
||||||
*/
|
*/
|
||||||
public function export($prj_uid)
|
public function export($prj_uid)
|
||||||
{
|
{
|
||||||
@@ -70,8 +75,9 @@ class SupervisorsMigrator implements Importable, Exportable
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ExportException($e->getMessage());
|
||||||
throwException(new ExportException($e->getMessage()));
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ namespace ProcessMaker\BusinessModel\Migrator;
|
|||||||
class SupervisorsObjectsMigrator implements Importable, Exportable
|
class SupervisorsObjectsMigrator implements Importable, Exportable
|
||||||
{
|
{
|
||||||
protected $processes;
|
protected $processes;
|
||||||
|
protected $className;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SupervisorsObjectsMigrator constructor.
|
* SupervisorsObjectsMigrator constructor.
|
||||||
@@ -13,6 +14,7 @@ class SupervisorsObjectsMigrator implements Importable, Exportable
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->processes = new \Processes();
|
$this->processes = new \Processes();
|
||||||
|
$this->className = 'Supervisor Object';
|
||||||
}
|
}
|
||||||
public function beforeImport($data)
|
public function beforeImport($data)
|
||||||
{
|
{
|
||||||
@@ -22,6 +24,7 @@ class SupervisorsObjectsMigrator implements Importable, Exportable
|
|||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
* @param $replace
|
* @param $replace
|
||||||
|
* @throws ImportException
|
||||||
*/
|
*/
|
||||||
public function import($data, $replace)
|
public function import($data, $replace)
|
||||||
{
|
{
|
||||||
@@ -32,8 +35,9 @@ class SupervisorsObjectsMigrator implements Importable, Exportable
|
|||||||
$this->processes->updateStepSupervisorRows($data);
|
$this->processes->updateStepSupervisorRows($data);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ImportException($e->getMessage());
|
||||||
throwException(new ImportException($e->getMessage()));
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,6 +54,7 @@ class SupervisorsObjectsMigrator implements Importable, Exportable
|
|||||||
/**
|
/**
|
||||||
* @param $prj_uid
|
* @param $prj_uid
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws ExportException
|
||||||
*/
|
*/
|
||||||
public function export($prj_uid)
|
public function export($prj_uid)
|
||||||
{
|
{
|
||||||
@@ -64,8 +69,9 @@ class SupervisorsObjectsMigrator implements Importable, Exportable
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ExportException($e->getMessage());
|
||||||
throwException(new ExportException($e->getMessage()));
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use ProcessMaker\BusinessModel\Util;
|
|||||||
class TemplatesMigrator implements Importable, Exportable
|
class TemplatesMigrator implements Importable, Exportable
|
||||||
{
|
{
|
||||||
protected $processes;
|
protected $processes;
|
||||||
|
protected $className;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TemplatesMigrator constructor.
|
* TemplatesMigrator constructor.
|
||||||
@@ -15,6 +16,7 @@ class TemplatesMigrator implements Importable, Exportable
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->processes = new \Processes();
|
$this->processes = new \Processes();
|
||||||
|
$this->className = 'Templates';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeImport($data)
|
public function beforeImport($data)
|
||||||
@@ -64,8 +66,9 @@ class TemplatesMigrator implements Importable, Exportable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ImportException($e->getMessage());
|
||||||
throw new ImportException($e->getMessage());
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -103,7 +106,6 @@ class TemplatesMigrator implements Importable, Exportable
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
|
||||||
throw new ExportException($e->getMessage());
|
throw new ExportException($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ use Symfony\Component\Config\Definition\Exception\Exception;
|
|||||||
class TriggersMigrator implements Importable, Exportable
|
class TriggersMigrator implements Importable, Exportable
|
||||||
{
|
{
|
||||||
protected $processes;
|
protected $processes;
|
||||||
|
protected $className;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TriggersMigrator constructor.
|
* TriggersMigrator constructor.
|
||||||
@@ -14,6 +15,7 @@ class TriggersMigrator implements Importable, Exportable
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->processes = new \Processes();
|
$this->processes = new \Processes();
|
||||||
|
$this->className = 'Triggers';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function beforeImport($data)
|
public function beforeImport($data)
|
||||||
@@ -24,6 +26,7 @@ class TriggersMigrator implements Importable, Exportable
|
|||||||
/**
|
/**
|
||||||
* @param $data
|
* @param $data
|
||||||
* @param $replace
|
* @param $replace
|
||||||
|
* @throws ImportException
|
||||||
*/
|
*/
|
||||||
public function import($data, $replace)
|
public function import($data, $replace)
|
||||||
{
|
{
|
||||||
@@ -34,8 +37,9 @@ class TriggersMigrator implements Importable, Exportable
|
|||||||
$this->processes->addNewTriggerRows($data);
|
$this->processes->addNewTriggerRows($data);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ImportException($e->getMessage());
|
||||||
throwException(new ImportException($e->getMessage()));
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,8 +71,9 @@ class TriggersMigrator implements Importable, Exportable
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ExportException($e->getMessage());
|
||||||
throw new ExportException($e->getMessage());
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ namespace ProcessMaker\BusinessModel\Migrator;
|
|||||||
class VariablesMigrator implements Importable, Exportable
|
class VariablesMigrator implements Importable, Exportable
|
||||||
{
|
{
|
||||||
protected $processes;
|
protected $processes;
|
||||||
|
protected $className;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* VariablesMigrator constructor.
|
* VariablesMigrator constructor.
|
||||||
@@ -17,6 +18,7 @@ class VariablesMigrator implements Importable, Exportable
|
|||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->processes = new \Processes();
|
$this->processes = new \Processes();
|
||||||
|
$this->className = 'Variables';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,8 +44,9 @@ class VariablesMigrator implements Importable, Exportable
|
|||||||
$this->processes->updateProcessVariables($data);
|
$this->processes->updateProcessVariables($data);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ImportException($e->getMessage());
|
||||||
throw new ImportException($e->getMessage());
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,8 +83,9 @@ class VariablesMigrator implements Importable, Exportable
|
|||||||
return $result;
|
return $result;
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
\Logger::log($e->getMessage());
|
$exception = new ExportException($e->getMessage());
|
||||||
throw new ExportException($e->getMessage());
|
$exception->setNameException($this->className);
|
||||||
|
throw($exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -217,22 +217,21 @@ abstract class Importer
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Granular Import
|
//Granular Import
|
||||||
if ($objectsToImport !== '') {
|
try {
|
||||||
$granularObj = new \ProcessMaker\BusinessModel\Migrator\GranularImporter();
|
if ($objectsToImport !== '') {
|
||||||
$objectList = $granularObj->loadObjectsListSelected($this->importData, $objectsToImport);
|
$granularObj = new \ProcessMaker\BusinessModel\Migrator\GranularImporter();
|
||||||
$processGranulate = $granularObj->validateImportData($objectList, $generateUid);
|
$objectList = $granularObj->loadObjectsListSelected($this->importData, $objectsToImport);
|
||||||
if (sizeof($objectList) > 0 && $processGranulate) {
|
$processGranulate = $granularObj->validateImportData($objectList, $generateUid);
|
||||||
$granularObj->import($objectList);
|
if (sizeof($objectList) > 0 && $processGranulate) {
|
||||||
return $this->importData['tables']['bpmn']["project"][0]["prj_uid"];
|
$granularObj->import($objectList);
|
||||||
}else{
|
return $this->importData['tables']['bpmn']["project"][0]["prj_uid"];
|
||||||
throw new \Exception('Select definition of process and replace option',
|
}
|
||||||
self::IMPORTED_PROJECT_DOES_NOT_EXISTS
|
|
||||||
);
|
|
||||||
return new \Exception();
|
|
||||||
}
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$result = $this->doImport($generateUid);
|
$result = $this->doImport($generateUid);
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
|
|||||||
Reference in New Issue
Block a user