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