Merge assignees y triggers

This commit is contained in:
Freddy Daniel Rojas Valda
2013-12-06 11:12:48 -04:00
8 changed files with 573 additions and 8 deletions

View File

@@ -109,7 +109,7 @@ class Activity extends Api
try {
$task = new \BusinessModel\Task();
$response = $task->getAvailableSteps($activityUid, $projectUid);
$response = $task->getAvailableSteps($activityUid);
return $response;
} catch (\Exception $e) {

View File

@@ -87,6 +87,43 @@ class Step extends Api
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:projectUid/activity/:activityUid/step/:stepUid/triggers
*/
public function doGetActivityStepTriggers($stepUid, $activityUid, $projectUid)
{
try {
$step = new \BusinessModel\Step();
$response = $step->getTriggers($stepUid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:projectUid/activity/:activityUid/step/:stepUid/available-triggers/:type
*
* @param string $stepUid
* @param string $activityUid
* @param string $projectUid
* @param string $type {@from body}{@choice before,after}
*/
public function doGetActivityStepAvailableTriggers($stepUid, $activityUid, $projectUid, $type)
{
try {
$step = new \BusinessModel\Step();
$response = $step->getAvailableTriggers($stepUid, strtoupper($type));
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}
class StepStructure
@@ -120,4 +157,5 @@ class StepStructure
* @var string {@from body}{@choice EDIT,VIEW}
*/
public $step_mode;
}
}

View File

@@ -0,0 +1,118 @@
<?php
namespace Services\Api\ProcessMaker\Project\Activity\Step;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* Project\Activity\Step\Trigger Api Controller
*
* @protected
*/
class Trigger extends Api
{
/**
* @url GET /:projectUid/activity/:activityUid/step/:stepUid/trigger/:triggerUid
*/
public function doGetActivityStepTrigger($triggerUid, $stepUid, $activityUid, $projectUid)
{
try {
$trigger = new \BusinessModel\Trigger();
$response = $trigger->getTrigger($triggerUid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url POST /:projectUid/activity/:activityUid/step/:stepUid/trigger
*
* @param string $stepUid
* @param string $activityUid
* @param string $projectUid
* @param StepTriggerStructure $request_data
*
* @status 201
*/
public function doPostActivityStepTrigger($stepUid, $activityUid, $projectUid, StepTriggerStructure $request_data = null)
{
try {
$request_data = (array)($request_data);
$stepTrigger = new \BusinessModel\Step\Trigger();
$stepTrigger->create($stepUid, $request_data["tri_uid"], $request_data["st_type"], $request_data);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url PUT /:projectUid/activity/:activityUid/step/:stepUid/trigger/:triggerUid
*
* @param string $triggerUid
* @param string $stepUid
* @param string $activityUid
* @param string $projectUid
* @param StepTriggerStructure $request_data
*/
public function doPutActivityStepTrigger($triggerUid, $stepUid, $activityUid, $projectUid, StepTriggerStructure $request_data = null)
{
try {
$request_data = (array)($request_data);
$stepTrigger = new \BusinessModel\Step\Trigger();
$stepTrigger->update($stepUid, $triggerUid, $request_data["st_type"], $request_data);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url DELETE /:projectUid/activity/:activityUid/step/:stepUid/trigger/:triggerUid/:type
*
* @param string $triggerUid
* @param string $stepUid
* @param string $activityUid
* @param string $projectUid
* @param string $type {@from body}{@choice before,after}
*/
public function doDeleteActivityStepTrigger($triggerUid, $stepUid, $activityUid, $projectUid, $type)
{
try {
$stepTrigger = new \BusinessModel\Step\Trigger();
$stepTrigger->delete($stepUid, $triggerUid, strtoupper($type));
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}
class StepTriggerStructure
{
/**
* @var string {@from body}{@min 32}{@max 32}
*/
public $tri_uid;
/**
* @var string {@from body}{@choice BEFORE,AFTER}{@required true}
*/
public $st_type;
/**
* @var string
*/
public $st_condition;
/**
* @var int {@from body}{@min 1}
*/
public $st_position;
}

View File

@@ -15,5 +15,5 @@ debug = 1
[alias: project]
activity = "Services\Api\ProcessMaker\Project\Activity"
step = "Services\Api\ProcessMaker\Project\Activity\Step"
trigger = "Services\Api\ProcessMaker\Project\Activity\Step\Trigger"
assignee = "Services\Api\ProcessMaker\Project\Activity\Assignee"