Adicion en importacion

This commit is contained in:
Brayan Osmar Pereyra Suxo
2014-07-22 16:57:24 -04:00
parent 23e1529459
commit e472b6846d
4 changed files with 106 additions and 2 deletions

View File

@@ -1588,6 +1588,31 @@ class Processes
}
}
/**
* Create "Process Variables" records
*
* @param array $arrayData Data to create
*
* return void
*/
public function createProcessVariables(array $arrayData)
{
try {
foreach ($arrayData as $value) {
$processVariables = new ProcessVariables();
$record = $value;
if ($processVariables->Exists($record["VAR_UID"])) {
$result = $processVariables->remove($record["VAR_UID"]);
}
$result = $processVariables->create($record);
}
} catch (Exception $e) {
throw $e;
}
}
/**
* Gets Input Documents Rows from aProcess.
*
@@ -2597,6 +2622,32 @@ class Processes
}
}
/**
* Get "Process Variables" records of a Process Variables
*
* @param string $processUid Unique id of Process
*
* return array Return an array with all "Process Variables"
*/
public function getProcessVariables ($sProUid)
{
try {
$aVars = array ();
$oCriteria = new Criteria( 'workflow' );
$oCriteria->add( ProcessVariablesPeer::PRJ_UID, $sProUid );
$oDataset = ProcessVariablesPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aVars[] = $aRow;
$oDataset->next();
}
return $aVars;
} catch (Exception $oError) {
throw $oError;
}
}
/**
* Get "Process User" (Groups) records of a Process
*
@@ -2965,6 +3016,7 @@ class Processes
$oData->processCategory = $this->getProcessCategoryRow( $sProUid );
$oData->taskExtraProperties = $this->getTaskExtraPropertiesRows( $sProUid );
$oData->processUser = $this->getProcessUser($sProUid);
$oData->processVariables = $this->getProcessVariables($sProUid);
$oData->groupwfs = $this->groupwfsMerge($oData->groupwfs, $oData->processUser, "USR_UID");
@@ -4007,6 +4059,8 @@ class Processes
$this->createTaskExtraPropertiesRows( isset( $oData->taskExtraProperties ) ? $oData->taskExtraProperties : array () );
$this->createProcessUser((isset($oData->processUser))? $oData->processUser : array());
$this->createProcessVariables((isset($oData->processVariables))? $oData->processVariables : array());
}

View File

@@ -16,4 +16,52 @@ require_once 'classes/model/om/BaseProcessVariables.php';
*/
class ProcessVariables extends BaseProcessVariables {
public function create ($aData)
{
$con = Propel::getConnection( ProcessVariablesPeer::DATABASE_NAME );
try {
$this->fromArray( $aData, BasePeer::TYPE_FIELDNAME );
if ($this->validate()) {
$result = $this->save();
} else {
$e = new Exception( "Failed Validation in class " . get_class( $this ) . "." );
$e->aValidationFailures = $this->getValidationFailures();
throw ($e);
}
$con->commit();
return $result;
} catch (Exception $e) {
$con->rollback();
throw ($e);
}
}
public function remove($sVarUid)
{
$oConnection = Propel::getConnection(ProcessVariablesPeer::DATABASE_NAME);
try {
$oProcessVariables = ProcessVariablesPeer::retrieveByPK($sVarUid);
if (!is_null($oProcessVariables)) {
$oConnection->begin();
$iResult = $oProcessVariables->delete();
$oConnection->commit();
return $iResult;
} else {
throw(new Exception('This row doesn\'t exist!'));
}
} catch (Exception $oError) {
$oConnection->rollback();
throw($oError);
}
}
public function Exists ($sVarUid)
{
try {
$oObj = ProcessVariablesPeer::retrieveByPk($sVarUid);
return (is_object($oObj) && get_class($oObj) == 'ProcessVariables');
} catch (Exception $oError) {
throw($oError);
}
}
} // ProcessVariables

View File

@@ -98,7 +98,7 @@ abstract class Exporter
$bpmnStruct["ACTIVITY"] = \BpmnActivity::getAll($this->prjUid);
$bpmnStruct["ARTIFACT"] = \BpmnArtifact::getAll($this->prjUid);
$bpmnStruct["BOUND"] = \BpmnBound::getAll($this->prjUid);
$bpmnStruct["DATA"] = array();
$bpmnStruct["DATA"] = \BpmnData::getAll($this->prjUid);
$bpmnStruct["DIAGRAM"] = \BpmnDiagram::getAll($this->prjUid);
$bpmnStruct["DOCUMENTATION"] = array();
$bpmnStruct["EVENT"] = \BpmnEvent::getAll($this->prjUid);
@@ -107,7 +107,7 @@ abstract class Exporter
$bpmnStruct["GATEWAY"] = \BpmnGateway::getAll($this->prjUid);
$bpmnStruct["LANE"] = array();
$bpmnStruct["LANESET"] = array();
$bpmnStruct["PARTICIPANT"] = array();
$bpmnStruct["PARTICIPANT"] = \BpmnParticipant::getAll($this->prjUid);
$bpmnStruct["PROCESS"] = \BpmnProcess::getAll($this->prjUid);
$bpmnStruct["PROJECT"] = array(\BpmnProjectPeer::retrieveByPK($this->prjUid)->toArray());

View File

@@ -315,6 +315,8 @@ abstract class Importer
$diagram["events"] = $tables["event"];
$diagram["flows"] = $tables["flow"];
$diagram["gateways"] = $tables["gateway"];
$diagram["data"] = $tables["data"];
$diagram["participants"] = $tables["participant"];
$diagram["lanes"] = array();
$diagram["laneset"] = array();
$project["diagrams"] = array($diagram);