Adding factory class and completing migrator schema
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: gustav
|
||||
* Date: 3/18/16
|
||||
* Time: 10:30 AM
|
||||
*/
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
|
||||
class AssignmentRulesMigrator implements Importable
|
||||
{
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
public function import($data)
|
||||
{
|
||||
// TODO: Implement import() method.
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: gustav
|
||||
* Date: 3/18/16
|
||||
* Time: 10:14 AM
|
||||
*/
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
|
||||
class GranularExporter
|
||||
{
|
||||
|
||||
protected $factory;
|
||||
protected $data;
|
||||
/**
|
||||
* GranularExporter constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->factory = new MigratorFactory();
|
||||
}
|
||||
|
||||
public function export($objectList)
|
||||
{
|
||||
foreach ($objectList as $key => $data) {
|
||||
$migrator = $this->factory->create($key);
|
||||
$migratorData = $migrator->export($data);
|
||||
$this->prepareData($migratorData);
|
||||
}
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
protected function prepareData($migratorData)
|
||||
{
|
||||
$this->data = $this->data . $migratorData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: gustav
|
||||
* Date: 3/18/16
|
||||
* Time: 10:34 AM
|
||||
*/
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
|
||||
use Illuminate\Support\Facades\Input;
|
||||
|
||||
class MigratorFactory
|
||||
{
|
||||
public function create($classname)
|
||||
{
|
||||
$class = new NullMigrator();
|
||||
switch(strtoupper($classname)) {
|
||||
case 'ASSIGNMENTRULES':
|
||||
$class = new AssignmentRulesMigrator();
|
||||
break;
|
||||
case 'FILES':
|
||||
$class = new FilesMigrator();
|
||||
break;
|
||||
case 'DBCONNECTIONS':
|
||||
$class = new DBConnectionMigrator();
|
||||
break;
|
||||
case 'DYNAFORMS':
|
||||
$class = new DynaformsMigrator();
|
||||
break;
|
||||
case 'INPUTDOCUMENTS':
|
||||
$class = new InputDocumentsMigrator();
|
||||
break;
|
||||
case 'OUTPUTDOCUMENTS':
|
||||
$class = new OutputDocumentsMigrator();
|
||||
break;
|
||||
case 'PROCESSDEFINITION':
|
||||
$class = new ProcessDefinitionMigrator();
|
||||
break;
|
||||
case 'REPORTTABLES':
|
||||
$class = new ReportTablesMigrator();
|
||||
break;
|
||||
case 'SUPERVISORS':
|
||||
$class = new SupervisorsMigrator();
|
||||
break;
|
||||
case 'SUPERVISORSOBJECTS':
|
||||
$class = new SupervisorsObjectsMigrator();
|
||||
break;
|
||||
case 'TEMPLATES':
|
||||
$class = new TemplatesMigrator();
|
||||
break;
|
||||
case 'TRIGGERS':
|
||||
$class = new TriggersMigrator();
|
||||
break;
|
||||
case 'VARIABLES':
|
||||
$class = new VariablesMigrator();
|
||||
break;
|
||||
return $class;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: gustav
|
||||
* Date: 3/18/16
|
||||
* Time: 10:36 AM
|
||||
*/
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
|
||||
class NullMigrator implements Importable, Exportable
|
||||
{
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
public function export()
|
||||
{
|
||||
// TODO: Implement export() method.
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
public function import($data)
|
||||
{
|
||||
// TODO: Implement import() method.
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: gustav
|
||||
* Date: 3/18/16
|
||||
* Time: 10:28 AM
|
||||
*/
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
|
||||
class ProcessDefinitionMigrator implements Importable
|
||||
{
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
public function import($data)
|
||||
{
|
||||
// TODO: Implement import() method.
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user