Adicion de POST y PUT en PROJECT
This commit is contained in:
@@ -808,6 +808,19 @@ class Process extends BaseProcess
|
|||||||
return $aProcesses;
|
return $aProcesses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCasesCountForProcess($pro_uid)
|
||||||
|
{
|
||||||
|
$oCriteria = new Criteria( 'workflow' );
|
||||||
|
$oCriteria->addSelectColumn( 'COUNT(*) AS TOTAL_CASES' );
|
||||||
|
$oCriteria->add( ApplicationPeer::PRO_UID, $pro_uid );
|
||||||
|
$oDataset = ApplicationPeer::doSelectRS( $oCriteria );
|
||||||
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
|
|
||||||
|
$oDataset->next();
|
||||||
|
$cases = $oDataset->getRow();
|
||||||
|
return (int)$cases['TOTAL_CASES'];
|
||||||
|
}
|
||||||
|
|
||||||
public function getAllProcessesByCategory ()
|
public function getAllProcessesByCategory ()
|
||||||
{
|
{
|
||||||
$oCriteria = new Criteria( 'workflow' );
|
$oCriteria = new Criteria( 'workflow' );
|
||||||
|
|||||||
@@ -158,6 +158,9 @@ class Bpmn extends Handler
|
|||||||
foreach ($this->getFlows() as $flow) {
|
foreach ($this->getFlows() as $flow) {
|
||||||
$this->removeFlow($flow["FLO_UID"]);
|
$this->removeFlow($flow["FLO_UID"]);
|
||||||
}
|
}
|
||||||
|
foreach ($this->getArtifacts() as $artifacts) {
|
||||||
|
$this->removeArtifact($artifacts["ART_UID"]);
|
||||||
|
}
|
||||||
|
|
||||||
if ($process = $this->getProcess("object")) {
|
if ($process = $this->getProcess("object")) {
|
||||||
$process->delete();
|
$process->delete();
|
||||||
@@ -213,9 +216,12 @@ class Bpmn extends Handler
|
|||||||
|
|
||||||
public function canRemove()
|
public function canRemove()
|
||||||
{
|
{
|
||||||
// TODO this must validate if the project can be deleted or not.
|
$totalCases = \Process::getCasesCountForProcess($this->prjUid);
|
||||||
// TODO the project can be deleted only if it has not any started cases
|
if ($totalCases == 0) {
|
||||||
return true;
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -54,11 +54,8 @@ class Project extends Api
|
|||||||
public function post($request_data)
|
public function post($request_data)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//TODO
|
return Adapter\BpmnWorkflow::createFromStruct($request_data);
|
||||||
} catch (\Exception $e) {
|
} 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());
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,10 +69,15 @@ class Project extends Api
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($prjUid)
|
/**
|
||||||
|
* @param string $prj_uid {@min 1}{@max 32}
|
||||||
|
* @url DELETE /:prj_uid
|
||||||
|
*/
|
||||||
|
public function delete($prj_uid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// TODO
|
$oBpmnWf = Adapter\BpmnWorkflow::load($prj_uid);
|
||||||
|
$oBpmnWf->remove();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user