Adding new project type (bpmn) creation button and loading fe a be and some changes for method PUT /project/{prj_uid} (still not functional)

This commit is contained in:
Erik Amaru Ortiz
2014-01-23 21:29:03 -04:00
parent 0f234df1db
commit d850d666b6
8 changed files with 432 additions and 176 deletions

View File

@@ -33,18 +33,31 @@ class Project extends Api
function post($request_data)
{
try {
$bpmnModel = new BpmnModel();
$uids = $bpmnModel->createProject($request_data);
$config = array();
$config['project'] = array('replace_uids' => true);
$wfProcess = Workflow::loadFromBpmnProject($uids[0]['new_uid']);
$bpmnModel = new BpmnModel();
$result = $bpmnModel->createProject($request_data, $config['project']['replace_uids']);
if (array_key_exists('prj_uid', $result)) {
$prjUid = $result['prj_uid'];
} else {
$prjUid = $result[0]['new_uid'];
}
$wfProcess = Workflow::loadFromBpmnProject($prjUid);
$process = new \BusinessModel\Process();
$userUid = $this->getUserId();
$data = array('process' => $wfProcess);
$process->createProcess($userUid, $data);
return $uids;
return $result;
} catch (\Exception $e) {
// TODO in case that $process->createProcess($userUid, $data); fails maybe the BPMN project was created successfully
// so, we need remove it or change the creation order.
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}