Selective Import/Export - Add license key to include it only in enterprise/enterprise edition

MT-115 addons feature

MT-115
This commit is contained in:
dheeyi
2016-04-08 12:36:01 -04:00
parent 5b2ee5e7aa
commit e4bb4ba86e
4 changed files with 61 additions and 24 deletions

View File

@@ -31,20 +31,25 @@ class GranularExporter
public function export($objectList)
{
try {
$exportObject = new ExportObjects();
$objectList = $exportObject->mapObjectList($objectList);
$this->beforeExport($objectList);
foreach ($objectList as $data) {
$migrator = $this->factory->create($data);
$migratorData = $migrator->export($this->prjuid);
$this->mergeData($migratorData);
if (\PMLicensedFeatures::getSingleton()->verifyfeature
("jXsSi94bkRUcVZyRStNVExlTXhEclVadGRRcG9xbjNvTWVFQUF3cklKQVBiVT0=")
) {
$exportObject = new ExportObjects();
$objectList = $exportObject->mapObjectList($objectList);
$this->beforeExport($objectList);
foreach ($objectList as $data) {
$migrator = $this->factory->create($data);
$migratorData = $migrator->export($this->prjuid);
$this->mergeData($migratorData);
}
return $this->publish();
} else {
$exception = new ExportException();
$exception->setNameException(\G::LoadTranslation('ID_NO_LICENSE_SELECTIVEIMPORTEXPORT_ENABLED'));
throw($exception);
}
return $this->publish();
} catch (ExportException $e) {
return array(
'success' => false,
'message' => $e->getMessage()
);
} catch (\Exception $e) {
throw $e;
}
}

View File

@@ -161,26 +161,39 @@ class GranularImporter
public function import($objectList)
{
try {
$objectList = $this->reorderImportOrder($objectList);
foreach ($objectList as $data) {
$objClass = $this->factory->create($data['name']);
if (is_object($objClass)) {
$dataImport = $data['data'][$data['name']];
$replace = ($data['value'] == 'replace') ? true : false;
$migratorData = $objClass->import($dataImport, $replace);
if (\PMLicensedFeatures::getSingleton()->verifyfeature
("jXsSi94bkRUcVZyRStNVExlTXhEclVadGRRcG9xbjNvTWVFQUF3cklKQVBiVT0=")
) {
$objectList = $this->reorderImportOrder($objectList);
foreach ($objectList as $data) {
$objClass = $this->factory->create($data['name']);
if (is_object($objClass)) {
$dataImport = $data['data'][$data['name']];
$replace = ($data['value'] == 'replace') ? true : false;
$migratorData = $objClass->import($dataImport, $replace);
}
}
} else {
$exception = new ImportException();
$exception->setNameException(\G::LoadTranslation('ID_NO_LICENSE_SELECTIVEIMPORTEXPORT_ENABLED'));
throw($exception);
}
} catch (\Exception $e) {
$exception = new ImportException('Please review your current process definition
if (get_class($e) === 'ProcessMaker\BusinessModel\Migrator\ImportException') {
throw $e;
} else {
$exception = new ImportException('Please review your current process definition
for missing elements, it\'s recommended that a new process should be exported
with all the elements.');
throw $exception;
throw $exception;
}
}
}
/**
* @param $objectList
* @param bool $generateUid
* @param $option
* @return bool
* @throws \Exception
*/