Adding merge support for the Process Definition, Variables, Dynaforms, Input and output documents.

This commit is contained in:
Gustavo Adolfo Cruz Laura
2016-03-22 15:38:11 -04:00
parent 9a87be404d
commit f6a7d11109
5 changed files with 78 additions and 16 deletions

View File

@@ -5,6 +5,6 @@ namespace ProcessMaker\BusinessModel\Migrator;
interface Importable
{
public function beforeImport($data);
public function import($data);
public function import($data, $replace);
public function afterImport($data);
}

View File

@@ -30,10 +30,14 @@ class ProcessDefinitionMigrator implements Importable, Exportable
// TODO: Implement beforeImport() method.
}
public function import($data)
public function import($data, $replace)
{
try {
$this->bpmn->createFromStruct($data, false);
if ($replace) {
$this->bpmn->createFromStruct($data, false);
} else {
$this->bpmn->updateFromStruct($data['PRJ_UID'], $data, false);
}
} catch (\Exception $e) {
return $e->getMessage();
}

View File

@@ -32,10 +32,14 @@ class VariablesMigrator implements Importable, Exportable
* Imports the process variables
* @param $data
*/
public function import($data)
public function import($data, $replace)
{
try {
$this->processes->createProcessVariables($data);
if ($replace) {
$this->processes->createProcessVariables($data);
} else {
$this->processes->updateProcessVariables($data);
}
} catch (\Exception $e) {
\Logger::log($e->getMessage());
throw new ImportException($e->getMessage());