ProcessMaker-MA "Project Properties - Step R. - Assign Task (endpoints & behat)"

- Se han implementado los siguientes Endpoints y sus correspondientes features (behat):
    GET    /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/triggers
    GET    /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/available-triggers/{type}
    GET    /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}/{type}
    POST   /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger
    PUT    /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}
    DELETE /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/step/trigger/{tri_uid}/{type}
This commit is contained in:
Victor Saisa Lopez
2014-01-10 16:18:46 -04:00
parent a883b5bdf6
commit 20ad79e725
5 changed files with 518 additions and 54 deletions

View File

@@ -124,6 +124,44 @@ class Step extends Api
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
//Step "Assign Task"
/**
* @url GET /:projectUid/activity/:activityUid/step/triggers
*/
public function doGetActivityStepAssignTaskTriggers($activityUid, $projectUid)
{
try {
$step = new \BusinessModel\Step();
$response = $step->getTriggers("", $activityUid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:projectUid/activity/:activityUid/step/available-triggers/:type
*
* @param string $activityUid
* @param string $projectUid
* @param string $type {@from body}{@choice before-assignment,before-routing,after-routing}
*/
public function doGetActivityStepAssignTaskAvailableTriggers($activityUid, $projectUid, $type)
{
try {
$step = new \BusinessModel\Step();
$response = $step->getAvailableTriggers("", strtoupper(str_replace("-", "_", $type)), $activityUid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}
class StepPostStructure

View File

@@ -25,7 +25,7 @@ class Trigger extends Api
try {
$stepTrigger = new \BusinessModel\Step\Trigger();
$response = $stepTrigger->getTrigger($stepUid, strtoupper($type), $triggerUid);
$response = $stepTrigger->getTrigger($stepUid, strtoupper($type), $activityUid, $triggerUid);
return $response;
} catch (\Exception $e) {
@@ -50,7 +50,7 @@ class Trigger extends Api
$stepTrigger = new \BusinessModel\Step\Trigger();
$arrayData = $stepTrigger->create($stepUid, $request_data["st_type"], $request_data["tri_uid"], $request_data);
$arrayData = $stepTrigger->create($stepUid, $request_data["st_type"], $activityUid, $request_data["tri_uid"], $request_data);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
@@ -72,7 +72,7 @@ class Trigger extends Api
$stepTrigger = new \BusinessModel\Step\Trigger();
$arrayData = $stepTrigger->update($stepUid, $request_data["st_type"], $triggerUid, $request_data);
$arrayData = $stepTrigger->update($stepUid, $request_data["st_type"], $activityUid, $triggerUid, $request_data);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
@@ -92,7 +92,92 @@ class Trigger extends Api
try {
$stepTrigger = new \BusinessModel\Step\Trigger();
$stepTrigger->delete($stepUid, strtoupper($type), $triggerUid);
$stepTrigger->delete($stepUid, strtoupper($type), $activityUid, $triggerUid);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
//Step "Assign Task"
/**
* @url GET /:projectUid/activity/:activityUid/step/trigger/:triggerUid/:type
*
* @param string $triggerUid
* @param string $activityUid
* @param string $projectUid
* @param string $type {@from body}{@choice before-assignment,before-routing,after-routing}
*/
public function doGetActivityStepAssignTaskTrigger($triggerUid, $activityUid, $projectUid, $type)
{
try {
$stepTrigger = new \BusinessModel\Step\Trigger();
$response = $stepTrigger->getTrigger("", strtoupper(str_replace("-", "_", $type)), $activityUid, $triggerUid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url POST /:projectUid/activity/:activityUid/step/trigger
*
* @param string $activityUid
* @param string $projectUid
* @param StepAssignTaskTriggerPostStructure $request_data
*
* @status 201
*/
public function doPostActivityStepAssignTaskTrigger($activityUid, $projectUid, StepAssignTaskTriggerPostStructure $request_data = null)
{
try {
$request_data = (array)($request_data);
$stepTrigger = new \BusinessModel\Step\Trigger();
$arrayData = $stepTrigger->create("", $request_data["st_type"], $activityUid, $request_data["tri_uid"], $request_data);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url PUT /:projectUid/activity/:activityUid/step/trigger/:triggerUid
*
* @param string $triggerUid
* @param string $activityUid
* @param string $projectUid
* @param StepAssignTaskTriggerPutStructure $request_data
*/
public function doPutActivityStepAssignTaskTrigger($triggerUid, $activityUid, $projectUid, StepAssignTaskTriggerPutStructure $request_data = null)
{
try {
$request_data = (array)($request_data);
$stepTrigger = new \BusinessModel\Step\Trigger();
$arrayData = $stepTrigger->update("", $request_data["st_type"], $activityUid, $triggerUid, $request_data);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url DELETE /:projectUid/activity/:activityUid/step/trigger/:triggerUid/:type
*
* @param string $triggerUid
* @param string $activityUid
* @param string $projectUid
* @param string $type {@from body}{@choice before-assignment,before-routing,after-routing}
*/
public function doDeleteActivityStepAssignTaskTrigger($triggerUid, $activityUid, $projectUid, $type)
{
try {
$stepTrigger = new \BusinessModel\Step\Trigger();
$stepTrigger->delete("", strtoupper(str_replace("-", "_", $type)), $activityUid, $triggerUid);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
@@ -140,3 +225,44 @@ class StepTriggerPutStructure
public $st_position;
}
class StepAssignTaskTriggerPostStructure
{
/**
* @var string {@from body}{@choice BEFORE_ASSIGNMENT,BEFORE_ROUTING,AFTER_ROUTING}{@required true}
*/
public $st_type;
/**
* @var string {@from body}{@min 32}{@max 32}{@required true}
*/
public $tri_uid;
/**
* @var string
*/
public $st_condition;
/**
* @var int {@from body}{@min 1}
*/
public $st_position;
}
class StepAssignTaskTriggerPutStructure
{
/**
* @var string {@from body}{@choice BEFORE_ASSIGNMENT,BEFORE_ROUTING,AFTER_ROUTING}{@required true}
*/
public $st_type;
/**
* @var string
*/
public $st_condition;
/**
* @var int {@from body}{@min 1}
*/
public $st_position;
}