242 lines
5.8 KiB
PHP
242 lines
5.8 KiB
PHP
<?php
|
|
namespace Services\Api\ProcessMaker\Project;
|
|
|
|
use \ProcessMaker\Services\Api;
|
|
use \Luracast\Restler\RestException;
|
|
|
|
/**
|
|
* Project\CaseScheduler Api Controller
|
|
*
|
|
* @protected
|
|
*/
|
|
class CaseScheduler extends Api
|
|
{
|
|
/**
|
|
* @param string $prjUid {@min 32} {@max 32}
|
|
*
|
|
* @url GET /:prjUid/case-schedulers
|
|
*/
|
|
public function doGetProjectCaseSchedulers($prjUid)
|
|
{
|
|
try {
|
|
$caseScheduler = new \BusinessModel\CaseScheduler();
|
|
$arrayData = $caseScheduler->getCaseSchedulers($prjUid);
|
|
//Response
|
|
$response = $arrayData;
|
|
} catch (\Exception $e) {
|
|
//response
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
}
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* @param string $prjUid {@min 32} {@max 32}
|
|
* @param string $caseSchedulerUid {@min 32} {@max 32}
|
|
*
|
|
* @url GET /:prjUid/case-scheduler/:caseSchedulerUid
|
|
*/
|
|
public function doGetProjectCaseScheduler($prjUid, $caseSchedulerUid)
|
|
{
|
|
try {
|
|
$caseScheduler = new \BusinessModel\CaseScheduler();
|
|
$objectData = $caseScheduler->getCaseScheduler($prjUid, $caseSchedulerUid);
|
|
//Response
|
|
$response = $objectData;
|
|
} catch (\Exception $e) {
|
|
//response
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
}
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* @param string $prjUid {@min 32} {@max 32}
|
|
* @param CaseSchedulerStructure $request_data
|
|
*
|
|
* @url POST /:prjUid/case-scheduler
|
|
*
|
|
* @status 201
|
|
*/
|
|
public function doPostProjectCaseScheduler($prjUid, CaseSchedulerStructure $request_data = null)
|
|
{
|
|
try {
|
|
$userUid = $this->getUserId();
|
|
$request_data = (array)($request_data);
|
|
$caseScheduler = new \BusinessModel\CaseScheduler();
|
|
$objectData = $caseScheduler->addCaseScheduler($prjUid, $request_data, $userUid);
|
|
//Response
|
|
$response = $objectData;
|
|
} catch (\Exception $e) {
|
|
//response
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
}
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* @url PUT /:prjUid/case-scheduler/:schUid
|
|
*
|
|
* @param string $prjUid {@min 32} {@max 32}
|
|
* @param string $schUid {@min 32} {@max 32}
|
|
* @param CaseSchedulerStructure $request_data
|
|
*
|
|
*/
|
|
public function doPutProjectCaseScheduler($prjUid, $schUid, CaseSchedulerStructure $request_data)
|
|
{
|
|
try {
|
|
$userUid = $this->getUserId();
|
|
$request_data = (array)($request_data);
|
|
$caseScheduler = new \BusinessModel\CaseScheduler();
|
|
$objectData = $caseScheduler->updateCaseScheduler($prjUid, $schUid, $request_data, $userUid);
|
|
//Response
|
|
$response = $objectData;
|
|
} catch (\Exception $e) {
|
|
//response
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
}
|
|
return $response;
|
|
}
|
|
|
|
/**
|
|
* @url DELETE /:prjUid/case-scheduler/:schUid
|
|
* @param string $prjUid {@min 32} {@max 32}
|
|
* @param string $schUid {@min 32} {@max 32}
|
|
*
|
|
*/
|
|
public function doDeleteProjectCaseScheduler($prjUid, $schUid)
|
|
{
|
|
try {
|
|
$caseScheduler = new \BusinessModel\CaseScheduler();
|
|
$caseScheduler->deleteCaseScheduler($prjUid, $schUid);
|
|
} catch (\Exception $e) {
|
|
//response
|
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
|
}
|
|
return $response;
|
|
}
|
|
|
|
}
|
|
|
|
class CaseSchedulerStructure
|
|
{ /**
|
|
* @var string {@from body} {@min 0} {@max 100}
|
|
*/
|
|
public $sch_name;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 0} {@max 100}
|
|
*/
|
|
public $sch_del_user_name;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 0} {@max 100}
|
|
*/
|
|
public $sch_del_user_pass;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 0} {@max 100}
|
|
*/
|
|
public $sch_del_user_uid;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 32} {@max 32}
|
|
*/
|
|
public $pro_uid;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 32} {@max 32}
|
|
*/
|
|
public $tas_uid;
|
|
|
|
/**
|
|
* @var string {@from body}
|
|
*/
|
|
public $sch_time_next_run;
|
|
|
|
/**
|
|
* @var string {@from body}
|
|
*/
|
|
public $sch_last_run_time;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 0} {@max 15}
|
|
*/
|
|
public $sch_state;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 0} {@max 15}
|
|
*/
|
|
public $sch_last_state;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 32} {@max 32}
|
|
*/
|
|
public $usr_uid;
|
|
|
|
/**
|
|
* @var string {@from body}
|
|
*/
|
|
public $sch_option;
|
|
|
|
/**
|
|
* @var string {@from body}
|
|
*/
|
|
public $sch_start_time;
|
|
|
|
/**
|
|
* @var string {@from body}
|
|
*/
|
|
public $sch_start_date;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 0} {@max 5}
|
|
*/
|
|
public $sch_days_perform_task;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 0} {@max 4}
|
|
*/
|
|
public $sch_every_days;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 0} {@max 14}
|
|
*/
|
|
public $sch_week_days;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 0} {@max 6}
|
|
*/
|
|
public $sch_start_day;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 0} {@max 24}
|
|
*/
|
|
public $sch_months;
|
|
|
|
/**
|
|
* @var string {@from body}
|
|
*/
|
|
public $sch_end_date;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 0} {@max 15}
|
|
*/
|
|
public $sch_repeat_every;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 0} {@max 15}
|
|
*/
|
|
public $sch_repeat_until;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 0} {@max 4}
|
|
*/
|
|
public $sch_repeat_stop_if_running;
|
|
|
|
/**
|
|
* @var string {@from body} {@min 0} {@max 100}
|
|
*/
|
|
public $case_sh_plugin_uid;
|
|
}
|
|
|