Merge branch 'MT-10' of bitbucket.org:colosa/processmaker into MT-10
This commit is contained in:
@@ -7,7 +7,7 @@ class ExportObjects
|
||||
* @var array
|
||||
*/
|
||||
protected $objectsList = array(
|
||||
'Process Definition / Diagram',
|
||||
'Process Definition',
|
||||
'Assignment Rules',
|
||||
'Variables',
|
||||
'Dynaforms',
|
||||
@@ -26,7 +26,6 @@ class ExportObjects
|
||||
/**
|
||||
* @param string $pro_uid
|
||||
* @return mixed|string
|
||||
* @throws Exception
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function objectList($pro_uid = '')
|
||||
@@ -41,7 +40,30 @@ class ExportObjects
|
||||
$r->data = $grid;
|
||||
|
||||
return \G::json_encode($r);
|
||||
} catch (Exception $e) {
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $objects
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function mapObjectList($objects)
|
||||
{
|
||||
try {
|
||||
$mapObjectList = array();
|
||||
foreach ($this->objectsList as $key => $val) {
|
||||
if(isset($objects[$key])){
|
||||
if(($key+1) === $objects[$key]){
|
||||
array_push($mapObjectList, strtoupper(str_replace(' ', '', $val)));
|
||||
}
|
||||
}
|
||||
$key++;
|
||||
}
|
||||
return $mapObjectList;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,13 +29,14 @@ class GranularExporter
|
||||
public function export($objectList)
|
||||
{
|
||||
$this->beforeExport();
|
||||
$exportObject = new ExportObjects();
|
||||
$objectList = $exportObject->mapObjectList($objectList);
|
||||
foreach ($objectList as $data) {
|
||||
$migrator = $this->factory->create($data);
|
||||
$migratorData = $migrator->export($this->prjuid);
|
||||
$this->mergeData($migratorData);
|
||||
}
|
||||
return $this->publish();
|
||||
|
||||
}
|
||||
|
||||
protected function beforeExport()
|
||||
|
||||
@@ -49,21 +49,21 @@ class ProcessDefinitionMigrator implements Importable, Exportable
|
||||
|
||||
public function export($prj_uid)
|
||||
{
|
||||
$bpmnStruct["ACTIVITY"] = \BpmnActivity::getAll($this->$prj_uid);
|
||||
$bpmnStruct["ARTIFACT"] = \BpmnArtifact::getAll($this->$prj_uid);
|
||||
$bpmnStruct["BOUND"] = \BpmnBound::getAll($this->$prj_uid);
|
||||
$bpmnStruct["DATA"] = \BpmnData::getAll($this->$prj_uid);
|
||||
$bpmnStruct["DIAGRAM"] = \BpmnDiagram::getAll($this->$prj_uid);
|
||||
$bpmnStruct["ACTIVITY"] = \BpmnActivity::getAll($prj_uid);
|
||||
$bpmnStruct["ARTIFACT"] = \BpmnArtifact::getAll($prj_uid);
|
||||
$bpmnStruct["BOUND"] = \BpmnBound::getAll($prj_uid);
|
||||
$bpmnStruct["DATA"] = \BpmnData::getAll($prj_uid);
|
||||
$bpmnStruct["DIAGRAM"] = \BpmnDiagram::getAll($prj_uid);
|
||||
$bpmnStruct["DOCUMENTATION"] = array();
|
||||
$bpmnStruct["EVENT"] = \BpmnEvent::getAll($this->$prj_uid);
|
||||
$bpmnStruct["EVENT"] = \BpmnEvent::getAll($prj_uid);
|
||||
$bpmnStruct["EXTENSION"] = array();
|
||||
$bpmnStruct["FLOW"] = \BpmnFlow::getAll($this->$prj_uid, null, null, "", CASE_UPPER, false);
|
||||
$bpmnStruct["GATEWAY"] = \BpmnGateway::getAll($this->$prj_uid);
|
||||
$bpmnStruct["LANE"] = \BpmnLane::getAll($this->$prj_uid);
|
||||
$bpmnStruct["LANESET"] = \BpmnLaneset::getAll($this->$prj_uid);
|
||||
$bpmnStruct["PARTICIPANT"] = \BpmnParticipant::getAll($this->$prj_uid);
|
||||
$bpmnStruct["PROCESS"] = \BpmnProcess::getAll($this->$prj_uid);
|
||||
$bpmnStruct["PROJECT"] = array(\BpmnProjectPeer::retrieveByPK($this->$prj_uid)->toArray());
|
||||
$bpmnStruct["FLOW"] = \BpmnFlow::getAll($prj_uid, null, null, "", CASE_UPPER, false);
|
||||
$bpmnStruct["GATEWAY"] = \BpmnGateway::getAll($prj_uid);
|
||||
$bpmnStruct["LANE"] = \BpmnLane::getAll($prj_uid);
|
||||
$bpmnStruct["LANESET"] = \BpmnLaneset::getAll($prj_uid);
|
||||
$bpmnStruct["PARTICIPANT"] = \BpmnParticipant::getAll($prj_uid);
|
||||
$bpmnStruct["PROCESS"] = \BpmnProcess::getAll($prj_uid);
|
||||
$bpmnStruct["PROJECT"] = array(\BpmnProjectPeer::retrieveByPK($prj_uid)->toArray());
|
||||
|
||||
$oProcess = new \Processes();
|
||||
$oData = new \StdClass();
|
||||
|
||||
@@ -143,8 +143,9 @@ class Project extends Api
|
||||
*/
|
||||
public function exportGranular($prj_uid, $objects)
|
||||
{
|
||||
$objects = \G::json_decode($objects);
|
||||
$granularExporter = new GranularExporter($prj_uid);
|
||||
$outputFilename = $granularExporter->export($objects);
|
||||
$outputFilename = $granularExporter->export($objects->objectList);
|
||||
|
||||
$httpStream = new HttpStream();
|
||||
$fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION);
|
||||
|
||||
Reference in New Issue
Block a user