Merge branch 'master' of bitbucket.org:colosa/processmaker
This commit is contained in:
110
workflow/engine/src/ProcessMaker/Services/Api/Calendar.php
Normal file
110
workflow/engine/src/ProcessMaker/Services/Api/Calendar.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Group Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Calendar extends Api
|
||||
{
|
||||
private $formatFieldNameInUppercase = false;
|
||||
|
||||
/**
|
||||
* @url GET
|
||||
*/
|
||||
public function index($filter = null, $start = null, $limit = null)
|
||||
{
|
||||
try {
|
||||
$calendar = new \ProcessMaker\BusinessModel\Calendar();
|
||||
$calendar->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
|
||||
$response = $calendar->getCalendars(array("filter" => $filter), null, null, $start, $limit);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:cal_uid
|
||||
*
|
||||
* @param string $cal_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGet($cal_uid)
|
||||
{
|
||||
try {
|
||||
$calendar = new \ProcessMaker\BusinessModel\Calendar();
|
||||
$calendar->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
|
||||
$response = $calendar->getCalendar($cal_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST
|
||||
*
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPost($request_data)
|
||||
{
|
||||
try {
|
||||
$calendar = new \ProcessMaker\BusinessModel\Calendar();
|
||||
$calendar->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
|
||||
$arrayData = $calendar->create($request_data);
|
||||
|
||||
$response = $arrayData;
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:cal_uid
|
||||
*
|
||||
* @param string $cal_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*/
|
||||
public function doPut($cal_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$calendar = new \ProcessMaker\BusinessModel\Calendar();
|
||||
$calendar->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
|
||||
$arrayData = $calendar->update($cal_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:cal_uid
|
||||
*
|
||||
* @param string $cal_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDelete($cal_uid)
|
||||
{
|
||||
try {
|
||||
$calendar = new \ProcessMaker\BusinessModel\Calendar();
|
||||
$calendar->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
|
||||
$calendar->delete($cal_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
992
workflow/engine/src/ProcessMaker/Services/Api/Cases.php
Normal file
992
workflow/engine/src/ProcessMaker/Services/Api/Cases.php
Normal file
@@ -0,0 +1,992 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
|
||||
/**
|
||||
* Cases Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Cases extends Api
|
||||
{
|
||||
/**
|
||||
* Get list Cases To Do
|
||||
*
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET
|
||||
*/
|
||||
public function doGetCasesListToDo(
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = ''
|
||||
)
|
||||
{
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['action'] = 'todo';
|
||||
$dataList['paged'] = false;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases To Do with paged
|
||||
*
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /paged
|
||||
*/
|
||||
public function doGetCasesListToDoPaged(
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = ''
|
||||
)
|
||||
{
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['action'] = 'todo';
|
||||
$dataList['paged'] = true;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases Draft
|
||||
*
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /draft
|
||||
*/
|
||||
public function doGetCasesListDraft(
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = ''
|
||||
)
|
||||
{
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['action'] = 'draft';
|
||||
$dataList['paged'] = false;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases Draft with paged
|
||||
*
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /draft/paged
|
||||
*/
|
||||
public function doGetCasesListDraftPaged(
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = ''
|
||||
)
|
||||
{
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['action'] = 'draft';
|
||||
$dataList['paged'] = true;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases Participated
|
||||
*
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /participated
|
||||
*/
|
||||
public function doGetCasesListParticipated(
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = ''
|
||||
)
|
||||
{
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['action'] = 'sent';
|
||||
$dataList['paged'] = false;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases Participated with paged
|
||||
*
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /participated/paged
|
||||
*/
|
||||
public function doGetCasesListParticipatedPaged(
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = ''
|
||||
)
|
||||
{
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['action'] = 'sent';
|
||||
$dataList['paged'] = true;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases Unassigned
|
||||
*
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /unassigned
|
||||
*/
|
||||
public function doGetCasesListUnassigned(
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = ''
|
||||
)
|
||||
{
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['action'] = 'unassigned';
|
||||
$dataList['paged'] = false;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases Unassigned with paged
|
||||
*
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /unassigned/paged
|
||||
*/
|
||||
public function doGetCasesListUnassignedPaged(
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = ''
|
||||
)
|
||||
{
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['action'] = 'unassigned';
|
||||
$dataList['paged'] = true;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases Paused
|
||||
*
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /paused
|
||||
*/
|
||||
public function doGetCasesListPaused(
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = ''
|
||||
)
|
||||
{
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['action'] = 'paused';
|
||||
$dataList['paged'] = false;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases Paused with paged
|
||||
*
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /paused/paged
|
||||
*/
|
||||
public function doGetCasesListPausedPaged(
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$search = ''
|
||||
)
|
||||
{
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['action'] = 'paused';
|
||||
$dataList['paged'] = false;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases Advanced Search
|
||||
*
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $app_status {@from path}
|
||||
* @param string $user {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /advanced-search
|
||||
*/
|
||||
public function doGetCasesListAdvancedSearch(
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$app_status = '',
|
||||
$user = '',
|
||||
$date_from = '',
|
||||
$date_to = '',
|
||||
$search = ''
|
||||
)
|
||||
{
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['action'] = 'search';
|
||||
$dataList['paged'] = false;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['status'] = $app_status;
|
||||
$dataList['user'] = $user;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list Cases Advanced Search with Paged
|
||||
*
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $cat_uid {@from path}
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $app_status {@from path}
|
||||
* @param string $usr_uid {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /advanced-search/paged
|
||||
*/
|
||||
public function doGetCasesListAdvancedSearchPaged(
|
||||
$start = 0,
|
||||
$limit = 0,
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$dir = 'DESC',
|
||||
$cat_uid = '',
|
||||
$pro_uid = '',
|
||||
$app_status = '',
|
||||
$usr_uid = '',
|
||||
$date_from = '',
|
||||
$date_to = '',
|
||||
$search = ''
|
||||
)
|
||||
{
|
||||
try {
|
||||
$dataList['userId'] = $this->getUserId();
|
||||
$dataList['action'] = 'search';
|
||||
$dataList['paged'] = true;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['status'] = $app_status;
|
||||
$dataList['user'] = $usr_uid;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:app_uid
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetCaseInfo($app_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oData = $cases->getCaseInfo($app_uid, $userUid);
|
||||
return $oData;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:app_uid/current-task
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetTaskCase($app_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oData = $cases->getTaskCase($app_uid, $userUid);
|
||||
return $oData;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST
|
||||
*
|
||||
* @param string $pro_uid {@from body} {@min 32}{@max 32}
|
||||
* @param string $tas_uid {@from body} {@min 32}{@max 32}
|
||||
* @param array $variables {@from body}
|
||||
*
|
||||
*/
|
||||
public function doPostCase($pro_uid, $tas_uid, $variables=null)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oData = $cases->addCase($pro_uid, $tas_uid, $userUid, $variables);
|
||||
return $oData;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /impersonate
|
||||
*
|
||||
* @param string $pro_uid {@from body} {@min 32}{@max 32}
|
||||
* @param string $usr_uid {@from body} {@min 32}{@max 32}
|
||||
* @param string $tas_uid {@from body} {@min 32}{@max 32}
|
||||
* @param array $variables {@from body}
|
||||
*
|
||||
*/
|
||||
public function doPostCaseImpersonate($pro_uid, $usr_uid, $tas_uid, $variables=null)
|
||||
{
|
||||
try {
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oData = $cases->addCaseImpersonate($pro_uid, $usr_uid, $tas_uid, $variables);
|
||||
return $oData;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:app_uid/reassign-case
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
* @param string $usr_uid_source {@from body} {@min 32}{@max 32}
|
||||
* @param string $usr_uid_target {@from body} {@min 32}{@max 32}
|
||||
* @param string $del_index {@from body}
|
||||
*/
|
||||
public function doPutReassignCase($app_uid, $usr_uid_source, $usr_uid_target, $del_index = null)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases->updateReassignCase($app_uid, $userUid, $del_index, $usr_uid_source, $usr_uid_target);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:app_uid/route-case
|
||||
*
|
||||
* @param string $app_uid {@from body} {@min 32}{@max 32}
|
||||
* @param string $del_index {@from body}
|
||||
*/
|
||||
public function doPutRouteCase($app_uid, $del_index = null)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases->updateRouteCase($app_uid, $userUid, $del_index);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel Case
|
||||
*
|
||||
* @param string $cas_uid {@min 1}{@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:cas_uid/cancel
|
||||
*/
|
||||
public function doPutCancelCase($cas_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases->putCancelCase($cas_uid, $userUid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pause Case
|
||||
*
|
||||
* @param string $cas_uid {@min 1}{@max 32}
|
||||
* @param string $unpaused_date {@from body}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:cas_uid/pause
|
||||
*/
|
||||
public function doPutPauseCase($cas_uid, $unpaused_date = null)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
if ($unpaused_date == null) {
|
||||
$cases->putPauseCase($cas_uid, $userUid);
|
||||
} else {
|
||||
$cases->putPauseCase($cas_uid, $userUid, false, $unpaused_date);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpause Case
|
||||
*
|
||||
* @param string $cas_uid {@min 1}{@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:cas_uid/unpause
|
||||
*/
|
||||
public function doPutUnpauseCase($cas_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases->putUnpauseCase($cas_uid, $userUid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpause Case
|
||||
*
|
||||
* @param string $cas_uid {@min 1}{@max 32}
|
||||
* @param string $tri_uid {@min 1}{@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:cas_uid/execute-trigger/:tri_uid
|
||||
*/
|
||||
public function doPutExecuteTriggerCase($cas_uid, $tri_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases->putExecuteTriggerCase($cas_uid, $tri_uid, $userUid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Case
|
||||
*
|
||||
* @param string $cas_uid {@min 1}{@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url DELETE /:cas_uid
|
||||
*/
|
||||
public function doDeleteCase($cas_uid)
|
||||
{
|
||||
try {
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases->deleteCase($cas_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Case Variables
|
||||
*
|
||||
* @param string $app_uid {@min 1}{@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /:app_uid/variables
|
||||
*/
|
||||
public function doGetCaseVariables($app_uid)
|
||||
{
|
||||
try {
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $cases->getCaseVariables($app_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Put Case Variables
|
||||
*
|
||||
* @param string $app_uid {@min 1}{@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:app_uid/variable
|
||||
*/
|
||||
public function doPutCaseVariables($app_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases->setCaseVariables($app_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Case Notes
|
||||
*
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $usr_uid {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /:app_uid/notes
|
||||
*/
|
||||
public function doGetCaseNotes(
|
||||
$app_uid,
|
||||
$start = 0,
|
||||
$limit = 25,
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$dir = 'DESC',
|
||||
$usr_uid = '',
|
||||
$date_from = '',
|
||||
$date_to = '',
|
||||
$search = ''
|
||||
)
|
||||
{
|
||||
try {
|
||||
$dataList['paged'] = false;
|
||||
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
$dataList['user'] = $usr_uid;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
$dataList['search'] = $search;
|
||||
|
||||
$usr_uid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $cases->getCaseNotes($app_uid, $usr_uid, $dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Case Notes with Paged
|
||||
*
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $sort {@from path}
|
||||
* @param string $dir {@from path}
|
||||
* @param string $usr_uid {@from path}
|
||||
* @param string $date_from {@from path}
|
||||
* @param string $date_to {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /:app_uid/notes/paged
|
||||
*/
|
||||
public function doGetCaseNotesPaged(
|
||||
$app_uid,
|
||||
$start = 0,
|
||||
$limit = 25,
|
||||
$sort = 'APP_CACHE_VIEW.APP_NUMBER',
|
||||
$dir = 'DESC',
|
||||
$usr_uid = '',
|
||||
$date_from = '',
|
||||
$date_to = '',
|
||||
$search = ''
|
||||
)
|
||||
{
|
||||
try {
|
||||
$dataList['start'] = $start;
|
||||
$dataList['limit'] = $limit;
|
||||
$dataList['sort'] = $sort;
|
||||
$dataList['dir'] = $dir;
|
||||
$dataList['user'] = $usr_uid;
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
$dataList['search'] = $search;
|
||||
|
||||
$usr_uid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$response = $cases->getCaseNotes($app_uid, $usr_uid, $dataList);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Put Case Variables
|
||||
*
|
||||
* @param string $app_uid {@min 1}{@max 32}
|
||||
* @param string $note_content {@min 1}{@max 500}
|
||||
* @param int $send_mail {@choice 1,0}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url POST /:app_uid/note
|
||||
*/
|
||||
public function doPostCaseNote($app_uid, $note_content, $send_mail = 0)
|
||||
{
|
||||
try {
|
||||
$usr_uid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$send_mail = ($send_mail == 0) ? false : true;
|
||||
$cases->saveCaseNote($app_uid, $usr_uid, $note_content, $send_mail);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Cases;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Cases\InputDocument Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class InputDocument extends Api
|
||||
{
|
||||
/**
|
||||
* @url GET /:app_uid/input-documents
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetInputDocuments($app_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
|
||||
$response = $inputDocument->getCasesInputDocuments($app_uid, $userUid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:app_uid/input-document/:inp_doc_uid
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
* @param string $inp_doc_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetInputDocument($app_uid, $inp_doc_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
|
||||
$response = $inputDocument->getCasesInputDocument($app_uid, $userUid, $inp_doc_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:app_uid/input-document/:inp_doc_uid
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
* @param string $inp_doc_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDeleteInputDocument($app_uid, $inp_doc_uid)
|
||||
{
|
||||
try {
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
|
||||
$inputDocument->removeInputDocument($inp_doc_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @url POST /:app_uid/input-document
|
||||
*
|
||||
* @param string $app_uid { @min 32}{@max 32}
|
||||
* @param string $tas_uid {@min 32}{@max 32}
|
||||
* @param string $app_doc_comment
|
||||
* @param string $inp_doc_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doPostInputDocument($app_uid, $tas_uid, $app_doc_comment, $inp_doc_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
|
||||
$response = $inputDocument->addCasesInputDocument($app_uid, $tas_uid, $app_doc_comment, $inp_doc_uid, $userUid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Cases;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Cases\OutputDocument Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class OutputDocument extends Api
|
||||
{
|
||||
/**
|
||||
* @url GET /:app_uid/output-documents
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetOutputDocuments($app_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$outputDocument = new \ProcessMaker\BusinessModel\Cases\OutputDocument();
|
||||
$response = $outputDocument->getCasesOutputDocuments($app_uid, $userUid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:app_uid/output-document/:app_doc_uid
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
* @param string $app_doc_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetOutputDocument($app_uid, $app_doc_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$outputDocument = new \ProcessMaker\BusinessModel\Cases\OutputDocument();
|
||||
$response = $outputDocument->getCasesOutputDocument($app_uid, $userUid, $app_doc_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:app_uid/output-document/:app_doc_uid
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
* @param string $app_doc_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDeleteOutputDocument($app_uid, $app_doc_uid)
|
||||
{
|
||||
try {
|
||||
$outputDocument = new \ProcessMaker\BusinessModel\Cases\OutputDocument();
|
||||
$outputDocument->removeOutputDocument($app_doc_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @url POST /:app_uid/output-document
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
* @param string $out_doc_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doPostOutputDocument($app_uid, $out_doc_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$outputDocument = new \ProcessMaker\BusinessModel\Cases\OutputDocument();
|
||||
$response = $outputDocument->addCasesOutputDocument($app_uid, $out_doc_uid, $userUid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
130
workflow/engine/src/ProcessMaker/Services/Api/Department.php
Normal file
130
workflow/engine/src/ProcessMaker/Services/Api/Department.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
|
||||
/**
|
||||
* Department Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Department extends Api
|
||||
{
|
||||
/**
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url GET
|
||||
*/
|
||||
public function doGetDepartments()
|
||||
{
|
||||
try {
|
||||
$oDepartment = new \ProcessMaker\BusinessModel\Department();
|
||||
$response = $oDepartment->getDepartments();
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $dep_uid {@min 1}{@max 32}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:dep_uid
|
||||
*/
|
||||
public function doGetDepartment($dep_uid)
|
||||
{
|
||||
try {
|
||||
$oDepartment = new \ProcessMaker\BusinessModel\Department();
|
||||
$response = $oDepartment->getDepartment($dep_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $request_data
|
||||
* @param string $dep_title {@from body} {@min 1}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url POST
|
||||
* @status 201
|
||||
*/
|
||||
public function doPost($request_data, $dep_title)
|
||||
{
|
||||
try {
|
||||
$oDepartment = new \ProcessMaker\BusinessModel\Department();
|
||||
$response = $oDepartment->saveDepartment($request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $dep_uid {@min 1}{@max 32}
|
||||
*
|
||||
* @param array $request_data
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url PUT /:dep_uid
|
||||
*/
|
||||
public function doPut($dep_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$request_data['dep_uid'] = $dep_uid;
|
||||
$oDepartment = new \ProcessMaker\BusinessModel\Department();
|
||||
$response = $oDepartment->saveDepartment($request_data, false);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $dep_uid {@min 1}{@max 32}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url DELETE /:dep_uid
|
||||
*/
|
||||
public function doDelete($dep_uid)
|
||||
{
|
||||
try {
|
||||
$oDepartment = new \ProcessMaker\BusinessModel\Department();
|
||||
$oDepartment->deleteDepartment($dep_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
146
workflow/engine/src/ProcessMaker/Services/Api/Group.php
Normal file
146
workflow/engine/src/ProcessMaker/Services/Api/Group.php
Normal file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Group Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Group extends Api
|
||||
{
|
||||
/**
|
||||
* @url GET
|
||||
*/
|
||||
public function index($filter = null, $start = null, $limit = null)
|
||||
{
|
||||
try {
|
||||
$group = new \ProcessMaker\BusinessModel\Group();
|
||||
$group->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$response = $group->getGroups(array("filter" => $filter), null, null, $start, $limit);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:grp_uid
|
||||
*
|
||||
* @param string $grp_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGet($grp_uid)
|
||||
{
|
||||
try {
|
||||
$group = new \ProcessMaker\BusinessModel\Group();
|
||||
$group->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$response = $group->getGroup($grp_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST
|
||||
*
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPost($request_data)
|
||||
{
|
||||
try {
|
||||
$group = new \ProcessMaker\BusinessModel\Group();
|
||||
$group->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$arrayData = $group->create($request_data);
|
||||
|
||||
$response = $arrayData;
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:grp_uid
|
||||
*
|
||||
* @param string $grp_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*/
|
||||
public function doPut($grp_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$group = new \ProcessMaker\BusinessModel\Group();
|
||||
$group->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$arrayData = $group->update($grp_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:grp_uid
|
||||
*
|
||||
* @param string $grp_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDelete($grp_uid)
|
||||
{
|
||||
try {
|
||||
$group = new \ProcessMaker\BusinessModel\Group();
|
||||
$group->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$group->delete($grp_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:grp_uid/users
|
||||
*
|
||||
* @param string $grp_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetUsers($grp_uid, $filter = null, $start = null, $limit = null)
|
||||
{
|
||||
try {
|
||||
$group = new \ProcessMaker\BusinessModel\Group();
|
||||
$group->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$response = $group->getUsers("USERS", $grp_uid, array("filter" => $filter), null, null, $start, $limit);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:grp_uid/available-users
|
||||
*
|
||||
* @param string $grp_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetAvailableUsers($grp_uid, $filter = null, $start = null, $limit = null)
|
||||
{
|
||||
try {
|
||||
$group = new \ProcessMaker\BusinessModel\Group();
|
||||
$group->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$response = $group->getUsers("AVAILABLE-USERS", $grp_uid, array("filter" => $filter), null, null, $start, $limit);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
52
workflow/engine/src/ProcessMaker/Services/Api/Group/User.php
Normal file
52
workflow/engine/src/ProcessMaker/Services/Api/Group/User.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Group;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Group\User Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class User extends Api
|
||||
{
|
||||
/**
|
||||
* @url POST /:grp_uid/user
|
||||
*
|
||||
* @param string $grp_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostUser($grp_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$groupUser = new \ProcessMaker\BusinessModel\Group\User();
|
||||
$groupUser->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$arrayData = $groupUser->create($grp_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:grp_uid/user/:usr_uid
|
||||
*
|
||||
* @param string $grp_uid {@min 32}{@max 32}
|
||||
* @param string $usr_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDeleteUser($grp_uid, $usr_uid)
|
||||
{
|
||||
try {
|
||||
$groupUser = new \ProcessMaker\BusinessModel\Group\User();
|
||||
$groupUser->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$groupUser->delete($grp_uid, $usr_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
237
workflow/engine/src/ProcessMaker/Services/Api/Pmtable.php
Normal file
237
workflow/engine/src/ProcessMaker/Services/Api/Pmtable.php
Normal file
@@ -0,0 +1,237 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Pmtable Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Pmtable extends Api
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET
|
||||
*/
|
||||
public function doGetPmTables()
|
||||
{
|
||||
try {
|
||||
$oPmTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oPmTable->getTables();
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pmt_uid {@min 1} {@max 32}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /:pmt_uid
|
||||
*/
|
||||
public function doGetPmTable($pmt_uid)
|
||||
{
|
||||
try {
|
||||
$oPmTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oPmTable->getTable($pmt_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pmt_uid {@min 1} {@max 32}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /:pmt_uid/data
|
||||
*/
|
||||
public function doGetPmTableData($pmt_uid)
|
||||
{
|
||||
try {
|
||||
$oPmTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oPmTable->getTableData($pmt_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $request_data
|
||||
* @param string $pmt_tab_name {@from body}
|
||||
* @param string $pmt_tab_dsc {@from body}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url POST
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostPmTable(
|
||||
$request_data,
|
||||
$pmt_tab_name,
|
||||
$pmt_tab_dsc = ''
|
||||
) {
|
||||
try {
|
||||
$oReportTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oReportTable->saveTable($request_data);
|
||||
if (isset($response['pro_uid'])) {
|
||||
unset($response['pro_uid']);
|
||||
}
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pmt_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @param array $request_data
|
||||
* @param array $pmt_rows {@from body} {@required true}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url POST /:pmt_uid/data
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostPmTableData(
|
||||
$pmt_uid,
|
||||
$request_data,
|
||||
$pmt_rows = ''
|
||||
) {
|
||||
try {
|
||||
$oReportTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oReportTable->saveTableData($pmt_uid, $request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pmt_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @param array $request_data
|
||||
* @param string $pmt_tab_dsc {@from body}
|
||||
* @return void
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:pmt_uid
|
||||
*/
|
||||
public function doPutPmTable(
|
||||
$pmt_uid,
|
||||
$request_data,
|
||||
$pmt_tab_dsc = ''
|
||||
) {
|
||||
try {
|
||||
$request_data['pmt_uid'] = $pmt_uid;
|
||||
$oReportTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oReportTable->updateTable($request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pmt_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @param array $request_data
|
||||
* @param array $pmt_rows {@from body} {@required true}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:pmt_uid/data
|
||||
*/
|
||||
public function doPutPmTableData(
|
||||
$pmt_uid,
|
||||
$request_data,
|
||||
$pmt_rows = ''
|
||||
) {
|
||||
try {
|
||||
$oReportTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oReportTable->updateTableData($pmt_uid, $request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pmt_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url DELETE /:pmt_uid
|
||||
*/
|
||||
public function doDeletePmTable($pmt_uid)
|
||||
{
|
||||
try {
|
||||
$oReportTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oReportTable->deleteTable($pmt_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $pmt_uid {@min 1} {@max 32}
|
||||
* @param string $key1 {@min 1}
|
||||
* @param string $value1 {@min 1}
|
||||
* @param string $key2
|
||||
* @param string $value2
|
||||
* @param string $key3
|
||||
* @param string $value3
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url DELETE /:pmt_uid/data/:key1/:value1
|
||||
* @url DELETE /:pmt_uid/data/:key1/:value1/:key2/:value2
|
||||
* @url DELETE /:pmt_uid/data/:key1/:value1/:key2/:value2/:key3/:value3
|
||||
*/
|
||||
public function doDeletePmTableData($pmt_uid, $key1, $value1, $key2 = '', $value2 = '', $key3 = '', $value3 = '')
|
||||
{
|
||||
try {
|
||||
$rows = array($key1 => $value1);
|
||||
if ($key2 != '') {
|
||||
$rows[$key2] = $value2;
|
||||
}
|
||||
if ($key3 != '') {
|
||||
$rows[$key3] = $value3;
|
||||
}
|
||||
$oReportTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oReportTable->deleteTableData($pmt_uid, $rows);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
262
workflow/engine/src/ProcessMaker/Services/Api/Process.php
Normal file
262
workflow/engine/src/ProcessMaker/Services/Api/Process.php
Normal file
@@ -0,0 +1,262 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
//TODO we need Refactor this class
|
||||
|
||||
/**
|
||||
*
|
||||
* Process Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Process extends Api
|
||||
{
|
||||
public function index($proTitle = "", $proCategory = "", $start = 0, $limit = 25)
|
||||
{
|
||||
try {
|
||||
$arrayFilterData = array();
|
||||
|
||||
if ($proTitle != "") {
|
||||
$arrayFilterData["processName"] = $proTitle;
|
||||
}
|
||||
|
||||
if ($proCategory != "") {
|
||||
$arrayFilterData["category"] = $proCategory;
|
||||
}
|
||||
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
$data = $process->loadAllProcess($arrayFilterData, $start, $limit);
|
||||
|
||||
// Composing Response
|
||||
$response = array(
|
||||
'processes' => $data['data'],
|
||||
'totalCount' => $data['totalCount']
|
||||
);
|
||||
|
||||
return $response;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function get($processUid)
|
||||
{
|
||||
$response = array();
|
||||
|
||||
try {
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$data = $process->loadProcess($processUid);
|
||||
|
||||
//Response
|
||||
$response["success"] = true;
|
||||
$response["message"] = "Process load successfully";
|
||||
$response["data"] = $data;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function post($request_data = null)
|
||||
{
|
||||
defined('SYS_LANG') || define("SYS_LANG", $request_data["lang"]);
|
||||
|
||||
try {
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
$userUid = $this->getUserId();
|
||||
|
||||
return $process->createProcess($userUid, $request_data);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function put($processUid, $request_data = null)
|
||||
{
|
||||
$response = array();
|
||||
|
||||
try {
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
$userUid = $this->getUserId();
|
||||
|
||||
$data = $process->updateProcess($processUid, $userUid, $request_data);
|
||||
|
||||
//Response
|
||||
$response["success"] = true;
|
||||
$response["message"] = "Process updated successfully";
|
||||
$response["data"] = $data;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function delete($processUid, $checkCases = 1)
|
||||
{
|
||||
$response = array();
|
||||
|
||||
try {
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$result = $process->deleteProcess($processUid, (($checkCases && $checkCases == 1)? true : false));
|
||||
|
||||
//Response
|
||||
$response["success"] = true;
|
||||
$response["message"] = "Process was deleted successfully";
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @url GET /:processUid/activity/:activityUid
|
||||
*/
|
||||
public function getActivity($activityUid, $processUid)
|
||||
{
|
||||
$response = array();
|
||||
|
||||
try {
|
||||
$task1 = new \Task();
|
||||
$task2 = new \ProcessMaker\BusinessModel\Task();
|
||||
|
||||
$arrayData = $task1->load($activityUid);
|
||||
|
||||
$arrayData = array(
|
||||
//"tas_uid" => $activityUid,
|
||||
"tas_title" => $arrayData["TAS_TITLE"],
|
||||
"tas_description" => $arrayData["TAS_DESCRIPTION"],
|
||||
"tas_posx" => $arrayData["TAS_POSX"],
|
||||
"tas_posy" => $arrayData["TAS_POSY"],
|
||||
"tas_start" => $arrayData["TAS_START"],
|
||||
"_extended" => array(
|
||||
"properties" => $task2->getProperties($activityUid, true),
|
||||
"steps" => array(
|
||||
"steps" => $task2->getSteps($activityUid, true),
|
||||
"conditions" => "...", //lo mismo que steps //$task->getSteps()
|
||||
"triggers" => $task2->getTriggers($activityUid, true),
|
||||
"users" => $task2->getUsers($activityUid, 1, true),
|
||||
"users_adhoc" => $task2->getUsers($activityUid, 2, true)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
//Response
|
||||
$response["success"] = true;
|
||||
$response["message"] = "Properties loaded successfully";
|
||||
$response["data"] = array("activity" => $arrayData);
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
$response["success"] = false;
|
||||
$response["message"] = $e->getMessage();
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:processUid/activity/:activityUid/properties
|
||||
*/
|
||||
public function getActivityProperties($activityUid, $processUid)
|
||||
{
|
||||
$response = array();
|
||||
|
||||
try {
|
||||
$task1 = new \Task();
|
||||
|
||||
$arrayData = $task1->load($activityUid);
|
||||
|
||||
$arrayData = array(
|
||||
//"tas_uid" => $activityUid,
|
||||
"tas_title" => $arrayData["TAS_TITLE"],
|
||||
"tas_description" => $arrayData["TAS_DESCRIPTION"],
|
||||
"tas_posx" => $arrayData["TAS_POSX"],
|
||||
"tas_posy" => $arrayData["TAS_POSY"],
|
||||
"tas_start" => $arrayData["TAS_START"]
|
||||
);
|
||||
|
||||
//Response
|
||||
$response["success"] = true;
|
||||
$response["message"] = "Properties loaded successfully";
|
||||
$response["data"] = array("activity" => $arrayData);
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
$response["success"] = false;
|
||||
$response["message"] = $e->getMessage();
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:processUid/activity/:activityUid/extended
|
||||
*/
|
||||
public function getActivityExtended($activityUid, $processUid)
|
||||
{
|
||||
$response = array();
|
||||
|
||||
try {
|
||||
$task2 = new \ProcessMaker\BusinessModel\Task();
|
||||
|
||||
$arrayData = array(
|
||||
"_extended" => array(
|
||||
"properties" => $task2->getProperties($activityUid, true),
|
||||
"steps" => array(
|
||||
"steps" => $task2->getSteps($activityUid, true),
|
||||
"conditions" => "...", //lo mismo que steps //$task->getSteps()
|
||||
"triggers" => $task2->getTriggers($activityUid, true),
|
||||
"users" => $task2->getUsers($activityUid, 1, true),
|
||||
"users_adhoc" => $task2->getUsers($activityUid, 2, true)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
//Response
|
||||
$response["success"] = true;
|
||||
$response["message"] = "Extended loaded successfully";
|
||||
$response["data"] = array("activity" => $arrayData);
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
$response["success"] = false;
|
||||
$response["message"] = $e->getMessage();
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:processUid/activity/:activityUid/steps/list
|
||||
*/
|
||||
public function getActivityStepsList($activityUid, $processUid, $start = 0, $limit = 10)
|
||||
{
|
||||
$response = array();
|
||||
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
|
||||
$data = $task->getStepsList($activityUid, $processUid, false, $start, $limit);
|
||||
|
||||
//Response
|
||||
$response["success"] = true;
|
||||
$response["message"] = "Steps loaded successfully";
|
||||
$response["data"] = $data;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
$response["success"] = false;
|
||||
$response["message"] = $e->getMessage();
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Group Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class ProcessCategory extends Api
|
||||
{
|
||||
private $formatFieldNameInUppercase = false;
|
||||
|
||||
/**
|
||||
* @url GET
|
||||
*/
|
||||
public function doGetCategories($filter = null, $start = null, $limit = null)
|
||||
{
|
||||
try {
|
||||
$processCategory = new \ProcessMaker\BusinessModel\ProcessCategory();
|
||||
$processCategory->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
|
||||
$response = $processCategory->getCategories(array("filter" => $filter), null, null, $start, $limit);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:cat_uid
|
||||
*
|
||||
* @param string $cat_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetCategory($cat_uid)
|
||||
{
|
||||
try {
|
||||
$processCategory = new \ProcessMaker\BusinessModel\ProcessCategory();
|
||||
$processCategory->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
|
||||
$response = $processCategory->getCategory($cat_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST
|
||||
*
|
||||
* @param string $cat_name
|
||||
*
|
||||
*/
|
||||
public function doPostCategory($cat_name)
|
||||
{
|
||||
try {
|
||||
$processCategory = new \ProcessMaker\BusinessModel\ProcessCategory();
|
||||
$response = $processCategory->addCategory($cat_name);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:cat_uid
|
||||
*
|
||||
* @param string $cat_uid {@min 32}{@max 32}
|
||||
* @param string $cat_name
|
||||
*
|
||||
*/
|
||||
public function doPutCategory($cat_uid, $cat_name)
|
||||
{
|
||||
try {
|
||||
$processCategory = new \ProcessMaker\BusinessModel\ProcessCategory();
|
||||
$response = $processCategory->updateCategory($cat_uid, $cat_name);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:cat_uid
|
||||
*
|
||||
* @param string $cat_uid {@min 32}{@max 32}
|
||||
*
|
||||
*/
|
||||
public function doDeleteCategory($cat_uid)
|
||||
{
|
||||
try {
|
||||
$processCategory = new \ProcessMaker\BusinessModel\ProcessCategory();
|
||||
$processCategory->deleteCategory($cat_uid);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
260
workflow/engine/src/ProcessMaker/Services/Api/Project.php
Normal file
260
workflow/engine/src/ProcessMaker/Services/Api/Project.php
Normal file
@@ -0,0 +1,260 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use Luracast\Restler\RestException;
|
||||
use ProcessMaker\Services\Api;
|
||||
use \ProcessMaker\Project\Adapter;
|
||||
use \ProcessMaker\Util;
|
||||
|
||||
/**
|
||||
* Class Project
|
||||
*
|
||||
* @package Services\Api\ProcessMaker
|
||||
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Project extends Api
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
try {
|
||||
$start = null;
|
||||
$limit = null;
|
||||
$filter = "";
|
||||
|
||||
$projects = Adapter\BpmnWorkflow::getList($start, $limit, $filter, CASE_LOWER);
|
||||
|
||||
return $projects;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function get($prjUid)
|
||||
{
|
||||
try {
|
||||
return Adapter\BpmnWorkflow::getStruct($prjUid);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @status 201
|
||||
*/
|
||||
public function post($request_data)
|
||||
{
|
||||
try {
|
||||
//TODO
|
||||
} 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());
|
||||
}
|
||||
}
|
||||
|
||||
public function put($prjUid, $request_data)
|
||||
{
|
||||
try {
|
||||
return Adapter\BpmnWorkflow::updateFromStruct($prjUid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function delete($prjUid)
|
||||
{
|
||||
try {
|
||||
// TODO
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/export
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function export($prj_uid)
|
||||
{
|
||||
$exporter = new \ProcessMaker\Exporter\XmlExporter($prj_uid);
|
||||
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $exporter->getProjectName() . "-*.pmx") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", $exporter->getProjectName(), $version, "pmx");
|
||||
|
||||
$exporter->saveExport($outputFilename);
|
||||
|
||||
$httpStream = new \ProcessMaker\Util\IO\HttpStream();
|
||||
$fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION);
|
||||
|
||||
$httpStream->loadFromFile($outputFilename);
|
||||
$httpStream->setHeader("Content-Type", "application/$fileExtension");
|
||||
$httpStream->send();
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/process
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetProcess($prj_uid)
|
||||
{
|
||||
try {
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
$process->setFormatFieldNameInUppercase(false);
|
||||
$process->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$response = $process->getProcess($prj_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:prj_uid/process
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*/
|
||||
public function doPutProcess($prj_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
$process->setFormatFieldNameInUppercase(false);
|
||||
$process->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$arrayData = $process->update($prj_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/dynaforms
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetDynaForms($prj_uid)
|
||||
{
|
||||
try {
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
$process->setFormatFieldNameInUppercase(false);
|
||||
$process->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$response = $process->getDynaForms($prj_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/input-documents
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetInputDocuments($prj_uid)
|
||||
{
|
||||
try {
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
$process->setFormatFieldNameInUppercase(false);
|
||||
$process->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$response = $process->getInputDocuments($prj_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/web-entries
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetWebEntries($prj_uid)
|
||||
{
|
||||
try {
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
$process->setFormatFieldNameInUppercase(false);
|
||||
$process->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$response = $process->getWebEntries($prj_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/variables
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetVariables($prj_uid)
|
||||
{
|
||||
try {
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
$process->setFormatFieldNameInUppercase(false);
|
||||
$process->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$response = $process->getVariables("ALL", $prj_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/grid/variables
|
||||
* @url GET /:prj_uid/grid/:grid_uid/variables
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $grid_uid
|
||||
*/
|
||||
public function doGetGridVariables($prj_uid, $grid_uid = "")
|
||||
{
|
||||
try {
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
$process->setFormatFieldNameInUppercase(false);
|
||||
$process->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$response = ($grid_uid == "")? $process->getVariables("GRID", $prj_uid) : $process->getVariables("GRIDVARS", $prj_uid, $grid_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/trigger-wizards
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetTriggerWizards($prj_uid)
|
||||
{
|
||||
try {
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
$process->setFormatFieldNameInUppercase(false);
|
||||
$process->setArrayFieldNameForException(array("processUid" => "prj_uid", "libraryName" => "lib_name", "methodName" => "fn_name"));
|
||||
|
||||
$response = $process->getLibraries($prj_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\Activity Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Activity extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param string $act_uid {@min 32} {@max 32}
|
||||
* @param string $filter {@choice definition,,properties}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:prj_uid/activity/:act_uid
|
||||
*/
|
||||
public function doGetProjectActivity($prj_uid, $act_uid, $filter = '')
|
||||
{
|
||||
try {
|
||||
$hiddenFields = array('tas_start', 'pro_uid', 'tas_uid', 'tas_delay_type', 'tas_temporizer', 'tas_alert',
|
||||
'tas_mi_instance_variable', 'tas_mi_complete_variable', 'tas_assign_location',
|
||||
'tas_assign_location_adhoc', 'tas_last_assigned', 'tas_user', 'tas_can_upload', 'tas_view_upload',
|
||||
'tas_view_additional_documentation', 'tas_can_cancel', 'tas_owner_app', 'tas_can_pause',
|
||||
'tas_can_send_message', 'tas_can_delete_docs', 'tas_self_service', 'tas_to_last_user',
|
||||
'tas_derivation', 'tas_posx', 'tas_posy', 'tas_width', 'tas_height', 'tas_color', 'tas_evn_uid',
|
||||
'tas_boundary', 'tas_def_proc_code', 'stg_uid'
|
||||
);
|
||||
$definition = array();
|
||||
$properties = array();
|
||||
|
||||
if ($filter == '' || $filter == 'definition') {
|
||||
// DEFINITION
|
||||
$definition = array();
|
||||
$response['definition'] = $definition;
|
||||
}
|
||||
|
||||
if ($filter == '' || $filter == 'properties') {
|
||||
// PROPERTIES
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$properties = $task->getProperties($prj_uid, $act_uid, true, false);
|
||||
foreach ($properties as $key => $value) {
|
||||
if (in_array($key, $hiddenFields)) {
|
||||
unset($properties[$key]);
|
||||
}
|
||||
}
|
||||
$response['properties'] = $properties;
|
||||
}
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param string $act_uid {@min 32} {@max 32}
|
||||
* @param ActivityPropertiesStructure $properties {@from body}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @return array
|
||||
*
|
||||
* @url PUT /:prj_uid/activity/:act_uid
|
||||
*/
|
||||
public function doPutProjectActivity($prj_uid, $act_uid, ActivityPropertiesStructure $properties, $request_data = array())
|
||||
{
|
||||
try {
|
||||
if (isset($request_data['properties']['tas_start'])) {
|
||||
unset($request_data['properties']['tas_start']);
|
||||
}
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$properties = $task->updateProperties($prj_uid, $act_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param string $act_uid {@min 32} {@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @return array
|
||||
*
|
||||
* @url DELETE /:prj_uid/activity/:act_uid
|
||||
*/
|
||||
public function doDeleteProjectActivity($prj_uid, $act_uid)
|
||||
{
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$task->deleteTask($prj_uid, $act_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/activity/:act_uid/steps
|
||||
*
|
||||
* @param string $act_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetActivitySteps($act_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$task->setFormatFieldNameInUppercase(false);
|
||||
$task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid"));
|
||||
|
||||
$response = $task->getSteps($act_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/activity/:act_uid/available-steps
|
||||
*
|
||||
* @param string $act_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetActivityAvailableSteps($act_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$task->setFormatFieldNameInUppercase(false);
|
||||
$task->setArrayParamException(array("taskUid" => "act_uid"));
|
||||
|
||||
$response = $task->getAvailableSteps($act_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ActivityPropertiesStructure
|
||||
{
|
||||
/**
|
||||
* @var string {@from body} {@min 1} {@max 200}
|
||||
*/
|
||||
public $tas_title;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $tas_description;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $tas_priority_variable;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $tas_derivation_screen_tpl;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@choice TRUE,FALSE}
|
||||
*/
|
||||
public $tas_start;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@choice BALANCED,MANUAL,EVALUATE,REPORT_TO,SELF_SERVICE,SELF_SERVICE_EVALUATE}
|
||||
*/
|
||||
public $tas_assign_type;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $tas_assign_variable;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $tas_group_variable;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $tas_selfservice_time;
|
||||
|
||||
/**
|
||||
* @var int {@from body} {@choice 1,0}
|
||||
*/
|
||||
public $tas_selfservice_timeout;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@choice DAYS,,HOURS}
|
||||
*/
|
||||
public $tas_selfservice_time_unit;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@min 0} {@max 32}
|
||||
*/
|
||||
public $tas_selfservice_trigger_uid;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@choice TRUE,FALSE}
|
||||
*/
|
||||
public $tas_transfer_fly;
|
||||
|
||||
/**
|
||||
* @var int {@from body}
|
||||
*/
|
||||
public $tas_duration;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $tas_timeunit;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $tas_type_day;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $tas_calendar;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@choice NORMAL,ADHOC}
|
||||
*/
|
||||
public $tas_type;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $tas_def_title;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $tas_def_description;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@choice TRUE,FALSE}
|
||||
*/
|
||||
public $tas_send_last_email;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $tas_def_subject_message;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $tas_def_message_type;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $tas_def_message;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $tas_def_message_template;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,296 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project\Activity;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\Activity\Assignee Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Assignee extends Api
|
||||
{
|
||||
/**
|
||||
* @url GET /:prjUid/activity/:actUid/assignee
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $actUid {@min 32} {@max 32}
|
||||
* @param string $filter
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
* @param string $type
|
||||
*
|
||||
*/
|
||||
public function doGetActivityAssignees($prjUid, $actUid, $filter = '', $start = null, $limit = null, $type = '')
|
||||
{
|
||||
$response = array();
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$arrayData = $task->getTaskAssignees($prjUid, $actUid, $filter, $start, $limit, $type);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prjUid/activity/:actUid/available-assignee
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $actUid {@min 32} {@max 32}
|
||||
* @param string $filter
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
* @param string $type
|
||||
*
|
||||
*/
|
||||
public function doGetActivityAvailableAssignee($prjUid, $actUid, $filter = '', $start = null, $limit = null, $type = '')
|
||||
{
|
||||
$response = array();
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$arrayData = $task->getTaskAvailableAssignee($prjUid, $actUid, $filter, $start, $limit, $type);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prjUid/activity/:actUid/assignee/:aasUid
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $actUid {@min 32} {@max 32}
|
||||
* @param string $aasUid {@min 32} {@max 32}
|
||||
*
|
||||
*/
|
||||
public function doGetActivityAssignee($prjUid, $actUid, $aasUid)
|
||||
{
|
||||
$response = array();
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$objectData = $task->getTaskAssignee($prjUid, $actUid, $aasUid);
|
||||
//Response
|
||||
$response = $objectData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prjUid/activity/:actUid/assignee
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $actUid {@min 32} {@max 32}
|
||||
* @param string $aas_uid {@min 32} {@max 32}
|
||||
* @param string $aas_type {@choice user,group}
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostActivityAssignee($prjUid, $actUid, $aas_uid, $aas_type)
|
||||
{
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$task->addTaskAssignee($prjUid, $actUid, $aas_uid, $aas_type);
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prjUid/activity/:actUid/assignee/:aasUid
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $actUid {@min 32} {@max 32}
|
||||
* @param string $aasUid {@min 32} {@max 32}
|
||||
*
|
||||
*/
|
||||
public function doDeleteActivityAssignee($prjUid, $actUid, $aasUid)
|
||||
{
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$task->removeTaskAssignee($prjUid, $actUid, $aasUid);
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prjUid/activity/:actUid/adhoc-assignee
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $actUid {@min 32} {@max 32}
|
||||
* @param string $filter
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
* @param string $type
|
||||
*
|
||||
*/
|
||||
public function doGetActivityAdhocAssignees($prjUid, $actUid, $filter = '', $start = null, $limit = null, $type = '')
|
||||
{
|
||||
$response = array();
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$arrayData = $task->getTaskAdhocAssignees($prjUid, $actUid, $filter, $start, $limit, $type);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prjUid/activity/:actUid/adhoc-available-assignee
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $actUid {@min 32} {@max 32}
|
||||
* @param string $filter
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
* @param string $type
|
||||
*
|
||||
*/
|
||||
public function doGetActivityAvailableAdhocAssignee($prjUid, $actUid, $filter = '', $start = null, $limit = null, $type = '')
|
||||
{
|
||||
$response = array();
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$arrayData = $task->getTaskAvailableAdhocAssignee($prjUid, $actUid, $filter, $start, $limit, $type);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prjUid/activity/:actUid/adhoc-assignee/:aasUid
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $actUid {@min 32} {@max 32}
|
||||
* @param string $assUid {@min 32} {@max 32}
|
||||
*
|
||||
*/
|
||||
public function doGetActivityAdhocAssignee($prjUid, $actUid, $aasUid)
|
||||
{
|
||||
$response = array();
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$objectData = $task->getTaskAdhocAssignee($prjUid, $actUid, $aasUid);
|
||||
//Response
|
||||
$response = $objectData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prjUid/activity/:actUid/adhoc-assignee
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $actUid {@min 32} {@max 32}
|
||||
* @param string $ada_uid {@min 32} {@max 32}
|
||||
* @param string $ada_type {@choice user,group}
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostActivityAdhocAssignee($prjUid, $actUid, $ada_uid, $ada_type)
|
||||
{
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$task->addTaskAdhocAssignee($prjUid, $actUid, $ada_uid, $ada_type);
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prjUid/activity/:actUid/adhoc-assignee/:adaUid
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $actUid {@min 32} {@max 32}
|
||||
* @param string $adaUid {@min 32} {@max 32}
|
||||
*
|
||||
*/
|
||||
public function doDeleteActivityAdhocAssignee($prjUid, $actUid, $adaUid)
|
||||
{
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$task->removeTaskAdhocAssignee($prjUid, $actUid, $adaUid);
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prjUid/activity/:actUid/assignee/all
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $actUid {@min 32} {@max 32}
|
||||
* @param string $filter
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
* @param string $type
|
||||
*
|
||||
*/
|
||||
public function doGetActivityAssigneesAll($prjUid, $actUid, $filter = '', $start = null, $limit = null, $type = '')
|
||||
{
|
||||
$response = array();
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$arrayData = $task->getTaskAssigneesAll($prjUid, $actUid, $filter, $start, $limit, $type);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prjUid/activity/:actUid/adhoc-assignee/all
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $actUid {@min 32} {@max 32}
|
||||
* @param string $filter
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
* @param string $type
|
||||
*
|
||||
*/
|
||||
public function doGetActivityAdhocAssigneesAll($prjUid, $actUid, $filter = '', $start = null, $limit = null, $type = '')
|
||||
{
|
||||
$response = array();
|
||||
try {
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$arrayData = $task->getTaskAdhocAssigneesAll($prjUid, $actUid, $filter, $start, $limit, $type);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project\Activity;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\Activity\Step Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Step extends Api
|
||||
{
|
||||
/**
|
||||
* @url GET /:prj_uid/activity/:act_uid/step/:step_uid
|
||||
*
|
||||
* @param string $step_uid {@min 32}{@max 32}
|
||||
* @param string $act_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetActivityStep($step_uid, $act_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$step = new \ProcessMaker\BusinessModel\Step();
|
||||
$step->setFormatFieldNameInUppercase(false);
|
||||
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
|
||||
|
||||
$response = $step->getStep($step_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prj_uid/activity/:act_uid/step
|
||||
*
|
||||
* @param string $act_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
* @param string $step_type_obj {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT,EXTERNAL}{@required true}
|
||||
* @param string $step_uid_obj {@from body}{@min 32}{@max 32}{@required true}
|
||||
* @param string $step_condition {@from body}
|
||||
* @param int $step_position {@from body}{@min 1}
|
||||
* @param string $step_mode {@from body}{@choice EDIT,VIEW}{@required true}
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostActivityStep(
|
||||
$act_uid,
|
||||
$prj_uid,
|
||||
$request_data,
|
||||
$step_type_obj = "DYNAFORM",
|
||||
$step_uid_obj = "00000000000000000000000000000000",
|
||||
$step_condition = "",
|
||||
$step_position = 1,
|
||||
$step_mode = "EDIT"
|
||||
) {
|
||||
try {
|
||||
$step = new \ProcessMaker\BusinessModel\Step();
|
||||
$step->setFormatFieldNameInUppercase(false);
|
||||
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
|
||||
|
||||
$arrayData = $step->create($act_uid, $prj_uid, $request_data);
|
||||
|
||||
$response = $arrayData;
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:prj_uid/activity/:act_uid/step/:step_uid
|
||||
*
|
||||
* @param string $step_uid {@min 32}{@max 32}
|
||||
* @param string $act_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
* @param string $step_type_obj {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT,EXTERNAL}
|
||||
* @param string $step_uid_obj {@from body}{@min 32}{@max 32}
|
||||
* @param string $step_condition {@from body}
|
||||
* @param int $step_position {@from body}{@min 1}
|
||||
* @param string $step_mode {@from body}{@choice EDIT,VIEW}
|
||||
*/
|
||||
public function doPutActivityStep(
|
||||
$step_uid,
|
||||
$act_uid,
|
||||
$prj_uid,
|
||||
$request_data,
|
||||
$step_type_obj = "DYNAFORM",
|
||||
$step_uid_obj = "00000000000000000000000000000000",
|
||||
$step_condition = "",
|
||||
$step_position = 1,
|
||||
$step_mode = "EDIT"
|
||||
) {
|
||||
try {
|
||||
$step = new \ProcessMaker\BusinessModel\Step();
|
||||
$step->setFormatFieldNameInUppercase(false);
|
||||
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
|
||||
|
||||
$arrayData = $step->update($step_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prj_uid/activity/:act_uid/step/:step_uid
|
||||
*
|
||||
* @param string $step_uid {@min 32}{@max 32}
|
||||
* @param string $act_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDeleteActivityStep($step_uid, $act_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$step = new \ProcessMaker\BusinessModel\Step();
|
||||
$step->setFormatFieldNameInUppercase(false);
|
||||
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
|
||||
|
||||
$step->delete($step_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/activity/:act_uid/step/:step_uid/triggers
|
||||
*
|
||||
* @param string $step_uid {@min 32}{@max 32}
|
||||
* @param string $act_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetActivityStepTriggers($step_uid, $act_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$step = new \ProcessMaker\BusinessModel\Step();
|
||||
$step->setFormatFieldNameInUppercase(false);
|
||||
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
|
||||
|
||||
$response = $step->getTriggers($step_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/activity/:act_uid/step/:step_uid/available-triggers/:type
|
||||
*
|
||||
* @param string $step_uid {@min 32}{@max 32}
|
||||
* @param string $act_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $type {@choice before,after}
|
||||
*/
|
||||
public function doGetActivityStepAvailableTriggers($step_uid, $act_uid, $prj_uid, $type)
|
||||
{
|
||||
try {
|
||||
$step = new \ProcessMaker\BusinessModel\Step();
|
||||
$step->setFormatFieldNameInUppercase(false);
|
||||
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
|
||||
|
||||
$response = $step->getAvailableTriggers($step_uid, strtoupper($type));
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
//Step "Assign Task"
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/activity/:act_uid/step/triggers
|
||||
*
|
||||
* @param string $act_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetActivityStepAssignTaskTriggers($act_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$step = new \ProcessMaker\BusinessModel\Step();
|
||||
$step->setFormatFieldNameInUppercase(false);
|
||||
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
|
||||
|
||||
$response = $step->getTriggers("", $act_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/activity/:act_uid/step/available-triggers/:type
|
||||
*
|
||||
* @param string $act_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $type {@choice before-assignment,before-routing,after-routing}
|
||||
*/
|
||||
public function doGetActivityStepAssignTaskAvailableTriggers($act_uid, $prj_uid, $type)
|
||||
{
|
||||
try {
|
||||
$step = new \ProcessMaker\BusinessModel\Step();
|
||||
$step->setFormatFieldNameInUppercase(false);
|
||||
$step->setArrayParamException(array("stepUid" => "step_uid", "taskUid" => "act_uid", "processUid" => "prj_uid"));
|
||||
|
||||
$response = $step->getAvailableTriggers("", strtoupper(str_replace("-", "_", $type)), $act_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,268 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\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/:type
|
||||
*
|
||||
* @param string $triggerUid
|
||||
* @param string $stepUid
|
||||
* @param string $activityUid
|
||||
* @param string $projectUid
|
||||
* @param string $type {@from body}{@choice before,after}
|
||||
*/
|
||||
public function doGetActivityStepTrigger($triggerUid, $stepUid, $activityUid, $projectUid, $type)
|
||||
{
|
||||
try {
|
||||
$stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger();
|
||||
|
||||
$response = $stepTrigger->getTrigger($stepUid, strtoupper($type), $activityUid, $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 StepTriggerPostStructure $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostActivityStepTrigger($stepUid, $activityUid, $projectUid, StepTriggerPostStructure $request_data = null)
|
||||
{
|
||||
try {
|
||||
$request_data = (array)($request_data);
|
||||
|
||||
$stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger();
|
||||
|
||||
$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()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:projectUid/activity/:activityUid/step/:stepUid/trigger/:triggerUid
|
||||
*
|
||||
* @param string $triggerUid
|
||||
* @param string $stepUid
|
||||
* @param string $activityUid
|
||||
* @param string $projectUid
|
||||
* @param StepTriggerPutStructure $request_data
|
||||
*/
|
||||
public function doPutActivityStepTrigger($triggerUid, $stepUid, $activityUid, $projectUid, StepTriggerPutStructure $request_data = null)
|
||||
{
|
||||
try {
|
||||
$request_data = (array)($request_data);
|
||||
|
||||
$stepTrigger = new \ProcessMaker\BusinessModel\Step\Trigger();
|
||||
|
||||
$arrayData = $stepTrigger->update($stepUid, $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/: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 \ProcessMaker\BusinessModel\Step\Trigger();
|
||||
|
||||
$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 \ProcessMaker\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 \ProcessMaker\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 \ProcessMaker\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 \ProcessMaker\BusinessModel\Step\Trigger();
|
||||
|
||||
$stepTrigger->delete("", strtoupper(str_replace("-", "_", $type)), $activityUid, $triggerUid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class StepTriggerPostStructure
|
||||
{
|
||||
/**
|
||||
* @var string {@from body}{@choice BEFORE,AFTER}{@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 StepTriggerPutStructure
|
||||
{
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\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 \ProcessMaker\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 \ProcessMaker\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 \ProcessMaker\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 \ProcessMaker\BusinessModel\CaseScheduler();
|
||||
$objectData = $caseScheduler->updateCaseScheduler($prjUid, $request_data, $userUid, $schUid);
|
||||
//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 \ProcessMaker\BusinessModel\CaseScheduler();
|
||||
$caseScheduler->deleteCaseScheduler($schUid);
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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_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} {@choice ACTIVE,INACTIVE}
|
||||
*/
|
||||
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} {@choice 1,2,3,4,5}
|
||||
*/
|
||||
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} {@choice 1,2,}
|
||||
*/
|
||||
public $sch_start_day;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $sch_start_day_opt_1;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@max 3}
|
||||
*/
|
||||
public $sch_start_day_opt_2;
|
||||
/**
|
||||
* @var string {@from body} {@min 0} {@max 32}
|
||||
*/
|
||||
public $sch_months;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $sch_end_date;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@min 0} {@max 15}
|
||||
*/
|
||||
public $sch_repeat_every;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\CaseTracker Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class CaseTracker extends Api
|
||||
{
|
||||
/**
|
||||
* @url GET /:prj_uid/case-tracker/property
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetCaseTrackerProperty($prj_uid)
|
||||
{
|
||||
try {
|
||||
$caseTracker = new \ProcessMaker\BusinessModel\CaseTracker();
|
||||
|
||||
$response = $caseTracker->getCaseTracker($prj_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:prj_uid/case-tracker/property
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
* @param string $map_type {@from body}{@choice NONE,PROCESSMAP,STAGES}
|
||||
* @param int $routing_history {@from body}{@choice 0,1}
|
||||
* @param int $message_history {@from body}{@choice 0,1}
|
||||
*/
|
||||
public function doPutCaseTracker(
|
||||
$prj_uid,
|
||||
$request_data,
|
||||
$map_type = "NONE",
|
||||
$routing_history = 0,
|
||||
$message_history = 0
|
||||
) {
|
||||
try {
|
||||
$caseTracker = new \ProcessMaker\BusinessModel\CaseTracker();
|
||||
|
||||
$arrayData = $caseTracker->update($prj_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/case-tracker/objects
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetCaseTrackerObjects($prj_uid)
|
||||
{
|
||||
try {
|
||||
$caseTracker = new \ProcessMaker\BusinessModel\CaseTracker();
|
||||
|
||||
$response = $caseTracker->getCaseTrackerObjects($prj_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/case-tracker/available-objects
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetCaseTrackerAvailableObjects($prj_uid)
|
||||
{
|
||||
try {
|
||||
$caseTracker = new \ProcessMaker\BusinessModel\CaseTracker();
|
||||
|
||||
$response = $caseTracker->getAvailableCaseTrackerObjects($prj_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\CaseTrackerObject Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class CaseTrackerObject extends Api
|
||||
{
|
||||
/**
|
||||
* @url GET /:prj_uid/case-tracker/object/:cto_uid
|
||||
*
|
||||
* @param string $cto_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetCaseTrackerObject($cto_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$caseTrackerObject = new \ProcessMaker\BusinessModel\CaseTrackerObject();
|
||||
|
||||
$response = $caseTrackerObject->getCaseTrackerObject($cto_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prj_uid/case-tracker/object
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
* @param string $cto_type_obj {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT}{@required true}
|
||||
* @param string $cto_uid_obj {@from body}{@min 32}{@max 32}{@required true}
|
||||
* @param string $cto_condition {@from body}
|
||||
* @param int $cto_position {@from body}{@min 1}
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostCaseTrackerObject(
|
||||
$prj_uid,
|
||||
$request_data,
|
||||
$cto_type_obj = "DYNAFORM",
|
||||
$cto_uid_obj = "00000000000000000000000000000000",
|
||||
$cto_condition = "",
|
||||
$cto_position = 1
|
||||
) {
|
||||
try {
|
||||
$caseTrackerObject = new \ProcessMaker\BusinessModel\CaseTrackerObject();
|
||||
|
||||
$arrayData = $caseTrackerObject->create($prj_uid, $request_data);
|
||||
|
||||
$response = $arrayData;
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:prj_uid/case-tracker/object/:cto_uid
|
||||
*
|
||||
* @param string $cto_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
* @param string $cto_type_obj {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT}
|
||||
* @param string $cto_uid_obj {@from body}{@min 32}{@max 32}
|
||||
* @param string $cto_condition {@from body}
|
||||
* @param int $cto_position {@from body}{@min 1}
|
||||
*/
|
||||
public function doPutCaseTrackerObject(
|
||||
$cto_uid,
|
||||
$prj_uid,
|
||||
$request_data,
|
||||
$cto_type_obj = "DYNAFORM",
|
||||
$cto_uid_obj = "00000000000000000000000000000000",
|
||||
$cto_condition = "",
|
||||
$cto_position = 1
|
||||
) {
|
||||
try {
|
||||
$caseTrackerObject = new \ProcessMaker\BusinessModel\CaseTrackerObject();
|
||||
|
||||
$arrayData = $caseTrackerObject->update($cto_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prj_uid/case-tracker/object/:cto_uid
|
||||
*
|
||||
* @param string $cto_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDeleteCaseTrackerObject($cto_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$caseTrackerObject = new \ProcessMaker\BusinessModel\CaseTrackerObject();
|
||||
|
||||
$caseTrackerObject->delete($cto_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\DataBaseConnection Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class DataBaseConnection extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:prj_uid/database-connections
|
||||
*/
|
||||
public function doGetDataBaseConnections($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oDBConnection = new \ProcessMaker\BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->getDataBaseConnections($prj_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $dbs_uid {@min 1} {@max 32}
|
||||
* @return array
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /:prj_uid/database-connection/:dbs_uid
|
||||
*/
|
||||
public function doGetDataBaseConnection($prj_uid, $dbs_uid)
|
||||
{
|
||||
try {
|
||||
$oDBConnection = new \ProcessMaker\BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->getDataBaseConnection($prj_uid, $dbs_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @param string $dbs_type {@from body} {@required true}
|
||||
* @param string $dbs_server {@from body} {@required true}
|
||||
* @param string $dbs_database_name {@from body} {@required true}
|
||||
* @param string $dbs_username {@from body}
|
||||
* @param string $dbs_port {@from body} {@type float}
|
||||
* @param string $dbs_encode {@from body} {@required true}
|
||||
* @param string $dbs_password {@from body}
|
||||
* @param string $dbs_description {@from body}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url POST /:prj_uid/database-connection/test
|
||||
*/
|
||||
public function doPostTestDataBaseConnection(
|
||||
$prj_uid,
|
||||
$request_data,
|
||||
$dbs_type,
|
||||
$dbs_server,
|
||||
$dbs_database_name,
|
||||
$dbs_username,
|
||||
$dbs_port,
|
||||
$dbs_encode,
|
||||
$dbs_password = '',
|
||||
$dbs_description = ''
|
||||
) {
|
||||
try {
|
||||
$oDBConnection = new \ProcessMaker\BusinessModel\DataBaseConnection();
|
||||
$request_data['pro_uid'] = $prj_uid;
|
||||
$response = $oDBConnection->testConnection($request_data, true);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @param string $dbs_type {@from body} {@required true}
|
||||
* @param string $dbs_server {@from body} {@required true}
|
||||
* @param string $dbs_database_name {@from body} {@required true}
|
||||
* @param string $dbs_username {@from body}
|
||||
* @param string $dbs_port {@from body} {@type float}
|
||||
* @param string $dbs_encode {@from body} {@required true}
|
||||
* @param string $dbs_password {@from body}
|
||||
* @param string $dbs_description {@from body}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url POST /:prj_uid/database-connection
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostDataBaseConnection(
|
||||
$prj_uid,
|
||||
$request_data,
|
||||
$dbs_type,
|
||||
$dbs_server,
|
||||
$dbs_database_name,
|
||||
$dbs_username,
|
||||
$dbs_port,
|
||||
$dbs_encode,
|
||||
$dbs_password = '',
|
||||
$dbs_description = ''
|
||||
) {
|
||||
try {
|
||||
$oDBConnection = new \ProcessMaker\BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->saveDataBaseConnection($prj_uid, $request_data, true);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $dbs_uid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @param string $dbs_type {@from body} {@required true}
|
||||
* @param string $dbs_server {@from body} {@required true}
|
||||
* @param string $dbs_database_name {@from body} {@required true}
|
||||
* @param string $dbs_username {@from body}
|
||||
* @param string $dbs_port {@from body} {@type float}
|
||||
* @param string $dbs_encode {@from body} {@required true}
|
||||
* @param string $dbs_password {@from body}
|
||||
* @param string $dbs_description {@from body}
|
||||
* @return void
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:prj_uid/database-connection/:dbs_uid
|
||||
*/
|
||||
public function doPutDataBaseConnection(
|
||||
$prj_uid,
|
||||
$dbs_uid,
|
||||
$request_data,
|
||||
$dbs_type,
|
||||
$dbs_server,
|
||||
$dbs_database_name,
|
||||
$dbs_username,
|
||||
$dbs_port,
|
||||
$dbs_encode,
|
||||
$dbs_password = '',
|
||||
$dbs_description = ''
|
||||
) {
|
||||
try {
|
||||
$request_data['dbs_uid'] = $dbs_uid;
|
||||
$oDBConnection = new \ProcessMaker\BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->saveDataBaseConnection($prj_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $dbs_uid {@min 1} {@max 32}
|
||||
* @return void
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url DELETE /:prj_uid/database-connection/:dbs_uid
|
||||
*/
|
||||
public function doDeleteDataBaseConnection($prj_uid, $dbs_uid)
|
||||
{
|
||||
try {
|
||||
$oDBConnection = new \ProcessMaker\BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->deleteDataBaseConnection($prj_uid, $dbs_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\DynaForm Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class DynaForm extends Api
|
||||
{
|
||||
/**
|
||||
* @url GET /:prj_uid/dynaform/:dyn_uid
|
||||
*
|
||||
* @param string $dyn_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetDynaForm($dyn_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||
$dynaForm->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$response = $dynaForm->getDynaForm($dyn_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prj_uid/dynaform
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostDynaForm($prj_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||
$dynaForm->setFormatFieldNameInUppercase(false);
|
||||
$dynaForm->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$arrayData = $dynaForm->executeCreate($prj_uid, $request_data);
|
||||
|
||||
$response = $arrayData;
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:prj_uid/dynaform/:dyn_uid
|
||||
*
|
||||
* @param string $dyn_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*/
|
||||
public function doPutDynaForm($dyn_uid, $prj_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||
$dynaForm->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$arrayData = $dynaForm->update($dyn_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prj_uid/dynaform/:dyn_uid
|
||||
*
|
||||
* @param string $dyn_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDeleteDynaForm($dyn_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||
$dynaForm->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$dynaForm->delete($dyn_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
226
workflow/engine/src/ProcessMaker/Services/Api/Project/Event.php
Normal file
226
workflow/engine/src/ProcessMaker/Services/Api/Project/Event.php
Normal file
@@ -0,0 +1,226 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\Event Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Event extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $filter {@choice message,conditional,,multiple}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:prj_uid/events
|
||||
*/
|
||||
public function doGetEvents($prj_uid, $filter = '')
|
||||
{
|
||||
try {
|
||||
$hiddenFields = array('pro_uid', 'evn_action_parameters',
|
||||
'evn_posx', 'evn_posy', 'evn_type', 'tas_evn_uid', 'evn_max_attempts'
|
||||
);
|
||||
$event = new \ProcessMaker\BusinessModel\Event();
|
||||
$response = $event->getEvents($prj_uid, $filter);
|
||||
foreach ($response as &$eventData) {
|
||||
foreach ($eventData as $key => $value) {
|
||||
if (in_array($key, $hiddenFields)) {
|
||||
unset($eventData[$key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $evn_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:prj_uid/event/:evn_uid
|
||||
*/
|
||||
public function doGetEvent($prj_uid, $evn_uid)
|
||||
{
|
||||
try {
|
||||
$hiddenFields = array('pro_uid', 'evn_action_parameters',
|
||||
'evn_posx', 'evn_posy', 'evn_type', 'tas_evn_uid', 'evn_max_attempts'
|
||||
);
|
||||
$event = new \ProcessMaker\BusinessModel\Event();
|
||||
$response = $event->getEvents($prj_uid, '', $evn_uid);
|
||||
foreach ($response as $key => $eventData) {
|
||||
if (in_array($key, $hiddenFields)) {
|
||||
unset($response[$key]);
|
||||
}
|
||||
}
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
* @param string $evn_description {@from body} {@min 1}
|
||||
* @param string $evn_status {@from body} {@choice ACTIVE,INACTIVE}
|
||||
* @param string $evn_action {@from body} {@choice SEND_MESSAGE,EXECUTE_CONDITIONAL_TRIGGER,EXECUTE_TRIGGER}
|
||||
* @param string $evn_related_to {@from body} {@choice SINGLE,MULTIPLE}
|
||||
* @param string $evn_tas_estimated_duration {@from body} {@type float}
|
||||
* @param string $evn_time_unit {@from body} {@choice DAYS,HOURS}
|
||||
* @param string $evn_when {@from body} {@type float}
|
||||
* @param string $evn_when_occurs {@from body} {@choice AFTER_TIME,TASK_STARTED}
|
||||
* @param string $tri_uid {@from body} {@min 1}
|
||||
* @param string $tas_uid {@from body}
|
||||
* @param string $evn_tas_uid_from {@from body}
|
||||
* @param string $evn_tas_uid_to {@from body}
|
||||
* @param string $evn_conditions {@from body}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url POST /:prj_uid/event
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostEvent(
|
||||
$prj_uid,
|
||||
$request_data,
|
||||
$evn_description,
|
||||
$evn_status,
|
||||
$evn_action,
|
||||
$evn_related_to,
|
||||
$evn_tas_estimated_duration,
|
||||
$evn_time_unit,
|
||||
$evn_when,
|
||||
$evn_when_occurs,
|
||||
$tri_uid,
|
||||
$tas_uid = '',
|
||||
$evn_tas_uid_from = '',
|
||||
$evn_tas_uid_to = '',
|
||||
$evn_conditions = ''
|
||||
) {
|
||||
try {
|
||||
$hiddenFields = array('pro_uid', 'evn_action_parameters',
|
||||
'evn_posx', 'evn_posy', 'evn_type', 'tas_evn_uid', 'evn_max_attempts'
|
||||
);
|
||||
$event = new \ProcessMaker\BusinessModel\Event();
|
||||
$response = $event->saveEvents($prj_uid, $request_data, true);
|
||||
foreach ($response as $key => $eventData) {
|
||||
if (in_array($key, $hiddenFields)) {
|
||||
unset($response[$key]);
|
||||
}
|
||||
}
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $evn_uid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
* @param string $evn_description {@from body} {@min 1}
|
||||
* @param string $evn_status {@from body} {@choice ACTIVE,INACTIVE}
|
||||
* @param string $evn_action {@from body} {@choice SEND_MESSAGE,EXECUTE_CONDITIONAL_TRIGGER,EXECUTE_TRIGGER}
|
||||
* @param string $evn_related_to {@from body} {@choice SINGLE,MULTIPLE}
|
||||
* @param string $evn_tas_estimated_duration {@from body} {@min 1}
|
||||
* @param string $evn_time_unit {@from body} {@choice DAYS,HOURS}
|
||||
* @param string $evn_when {@from body} {@type float}
|
||||
* @param string $evn_when_occurs {@from body} {@choice AFTER_TIME,TASK_STARTED}
|
||||
* @param string $tri_uid {@from body} {@min 1}
|
||||
* @param string $tas_uid {@from body}
|
||||
* @param string $evn_tas_uid_from {@from body}
|
||||
* @param string $evn_tas_uid_to {@from body}
|
||||
* @param string $evn_conditions {@from body}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @url PUT /:prj_uid/event/:evn_uid
|
||||
*/
|
||||
public function doPutEvent (
|
||||
$prj_uid,
|
||||
$evn_uid,
|
||||
$request_data,
|
||||
$evn_description,
|
||||
$evn_status,
|
||||
$evn_action,
|
||||
$evn_related_to,
|
||||
$evn_tas_estimated_duration,
|
||||
$evn_time_unit,
|
||||
$evn_when,
|
||||
$evn_when_occurs,
|
||||
$tri_uid,
|
||||
$tas_uid = '',
|
||||
$evn_tas_uid_from = '',
|
||||
$evn_tas_uid_to = '',
|
||||
$evn_conditions = ''
|
||||
) {
|
||||
try {
|
||||
$hiddenFields = array(
|
||||
'pro_uid',
|
||||
'evn_action_parameters',
|
||||
'evn_posx',
|
||||
'evn_posy',
|
||||
'evn_type',
|
||||
'tas_evn_uid',
|
||||
'evn_max_attempts'
|
||||
);
|
||||
$request_data['evn_uid'] = $evn_uid;
|
||||
$event = new \ProcessMaker\BusinessModel\Event();
|
||||
$event->saveEvents($prj_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $evn_uid {@min 1} {@max 32}
|
||||
* @return void
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @url DELETE /:prj_uid/event/:evn_uid
|
||||
*/
|
||||
public function doDeleteEvent($prj_uid, $evn_uid)
|
||||
{
|
||||
try {
|
||||
$event = new \ProcessMaker\BusinessModel\Event();
|
||||
$response = $event->deleteEvent($prj_uid, $evn_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\ProjectUsers Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class FilesManager extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param string $path
|
||||
*
|
||||
* @url GET /:prj_uid/file-manager
|
||||
*/
|
||||
public function doGetProcessFilesManager($prj_uid, $path = '')
|
||||
{
|
||||
try {
|
||||
$filesManager = new \ProcessMaker\BusinessModel\FilesManager();
|
||||
if ($path != '') {
|
||||
$arrayData = $filesManager->getProcessFilesManagerPath($prj_uid, $path);
|
||||
} else {
|
||||
$arrayData = $filesManager->getProcessFilesManager($prj_uid);
|
||||
}
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param ProcessFilesManagerStructurePost $request_data
|
||||
* @param string $prf_content
|
||||
*
|
||||
* @url POST /:prj_uid/file-manager
|
||||
*/
|
||||
public function doPostProcessFilesManager($prj_uid, ProcessFilesManagerStructurePost $request_data, $prf_content=null)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$request_data = (array)($request_data);
|
||||
$request_data = array_merge(array('prf_content' => $prf_content ), $request_data);
|
||||
$filesManager = new \ProcessMaker\BusinessModel\FilesManager();
|
||||
$arrayData = $filesManager->addProcessFilesManager($prj_uid, $userUid, $request_data);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param string $prf_uid {@min 32} {@max 32}
|
||||
*
|
||||
* @url POST /:prj_uid/file-manager/:prf_uid/upload
|
||||
*/
|
||||
public function doPostProcessFilesManagerUpload($prj_uid, $prf_uid)
|
||||
{
|
||||
try {
|
||||
$filesManager = new \ProcessMaker\BusinessModel\FilesManager();
|
||||
$sData = $filesManager->uploadProcessFilesManager($prj_uid, $prf_uid);
|
||||
//Response
|
||||
$response = $sData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param ProcessFilesManagerStructure $request_data
|
||||
* @param string $prf_uid {@min 32} {@max 32}
|
||||
*
|
||||
* @url PUT /:prj_uid/file-manager/:prf_uid
|
||||
*/
|
||||
public function doPutProcessFilesManager($prj_uid, ProcessFilesManagerStructure $request_data, $prf_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$request_data = (array)($request_data);
|
||||
$filesManager = new \ProcessMaker\BusinessModel\FilesManager();
|
||||
$arrayData = $filesManager->updateProcessFilesManager($prj_uid, $userUid, $request_data, $prf_uid);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param string $prf_uid {@min 32} {@max 32}
|
||||
*
|
||||
* @url DELETE /:prj_uid/file-manager/:prf_uid
|
||||
*/
|
||||
public function doDeleteProcessFilesManager($prj_uid, $prf_uid)
|
||||
{
|
||||
try {
|
||||
$filesManager = new \ProcessMaker\BusinessModel\FilesManager();
|
||||
$filesManager->deleteProcessFilesManager($prj_uid, $prf_uid);
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param string $prf_uid {@min 32} {@max 32}
|
||||
*
|
||||
* @url GET /:prj_uid/file-manager/:prf_uid/download
|
||||
*/
|
||||
public function doGetProcessFilesManagerDownload($prj_uid, $prf_uid)
|
||||
{
|
||||
try {
|
||||
$filesManager = new \ProcessMaker\BusinessModel\FilesManager();
|
||||
$filesManager->downloadProcessFilesManager($prj_uid, $prf_uid);
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param string $path
|
||||
*
|
||||
* @url DELETE /:prj_uid/file-manager/folder
|
||||
*/
|
||||
public function doDeleteFolderProcessFilesManager($prj_uid, $path)
|
||||
{
|
||||
try {
|
||||
$filesManager = new \ProcessMaker\BusinessModel\FilesManager();
|
||||
$filesManager->deleteFolderProcessFilesManager($prj_uid, $path);
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param string $prf_uid {@min 32} {@max 32}
|
||||
*
|
||||
* @url GET /:prj_uid/file-manager/:prf_uid
|
||||
*
|
||||
*/
|
||||
public function doGetProcessFileManager($prj_uid, $prf_uid)
|
||||
{
|
||||
try {
|
||||
$filesManager = new \ProcessMaker\BusinessModel\FilesManager();
|
||||
$response = $filesManager->getProcessFileManager($prj_uid, $prf_uid);
|
||||
//response
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ProcessFilesManagerStructurePost
|
||||
{ /**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $prf_filename;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $prf_path;
|
||||
}
|
||||
|
||||
class ProcessFilesManagerStructure
|
||||
{
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $prf_filename;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $prf_path;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $prf_content;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\InputDocument Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class InputDocument extends Api
|
||||
{
|
||||
/**
|
||||
* @url GET /:prj_uid/input-document/:inp_doc_uid
|
||||
*
|
||||
* @param string $inp_doc_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetInputDocument($inp_doc_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\InputDocument();
|
||||
$inputDocument->setFormatFieldNameInUppercase(false);
|
||||
$inputDocument->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$response = $inputDocument->getInputDocument($inp_doc_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prj_uid/input-document
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostInputDocument($prj_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\InputDocument();
|
||||
$inputDocument->setFormatFieldNameInUppercase(false);
|
||||
$inputDocument->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$arrayData = $inputDocument->create($prj_uid, $request_data);
|
||||
|
||||
$response = $arrayData;
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:prj_uid/input-document/:inp_doc_uid
|
||||
*
|
||||
* @param string $inp_doc_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*/
|
||||
public function doPutInputDocument($inp_doc_uid, $prj_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\InputDocument();
|
||||
$inputDocument->setFormatFieldNameInUppercase(false);
|
||||
$inputDocument->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$arrayData = $inputDocument->update($inp_doc_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prj_uid/input-document/:inp_doc_uid
|
||||
*
|
||||
* @param string $inp_doc_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDeleteInputDocument($inp_doc_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\InputDocument();
|
||||
$inputDocument->setFormatFieldNameInUppercase(false);
|
||||
$inputDocument->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$inputDocument->delete($inp_doc_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\OutputDocuments Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class OutputDocuments extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
*
|
||||
* @url GET /:prjUid/output-documents
|
||||
*/
|
||||
public function doGetProjectOutputDocuments($prjUid)
|
||||
{
|
||||
try {
|
||||
$outputDocument = new \ProcessMaker\BusinessModel\OutputDocument();
|
||||
$arrayData = $outputDocument->getOutputDocuments($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 $outputDocumentUid {@min 32} {@max 32}
|
||||
*
|
||||
* @url GET /:prjUid/output-document/:outputDocumentUid
|
||||
*/
|
||||
public function doGetProjectOutputDocument($prjUid, $outputDocumentUid)
|
||||
{
|
||||
try {
|
||||
$outputDocument = new \ProcessMaker\BusinessModel\OutputDocument();
|
||||
$objectData = $outputDocument->getOutputDocument($prjUid, $outputDocumentUid);
|
||||
//Response
|
||||
$response = $objectData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prjUid/output-document
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param OutputDocumentStructure $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostProjectOutputDocument($prjUid, OutputDocumentStructure $request_data = null)
|
||||
{
|
||||
try {
|
||||
$request_data = (array)($request_data);
|
||||
$outputDocument = new \ProcessMaker\BusinessModel\OutputDocument();
|
||||
$arrayData = $outputDocument->addOutputDocument($prjUid, $request_data);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:prjUid/output-document/:outputDocumentUid
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $outputDocumentUid {@min 32} {@max 32}
|
||||
* @param OutputDocumentStructure $request_data
|
||||
*
|
||||
*/
|
||||
public function doPutProjectOutputDocument($prjUid, $outputDocumentUid, OutputDocumentStructure $request_data)
|
||||
{
|
||||
try {
|
||||
$request_data = (array)($request_data);
|
||||
$outputDocument = new \ProcessMaker\BusinessModel\OutputDocument();
|
||||
$arrayData = $outputDocument->updateOutputDocument($prjUid, $request_data, $outputDocumentUid, 0);
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prjUid/output-document/:outputDocumentUid
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $outputDocumentUid {@min 32} {@max 32}
|
||||
*
|
||||
*/
|
||||
public function doDeleteProjectOutputDocument($prjUid, $outputDocumentUid)
|
||||
{
|
||||
try {
|
||||
$outputDocument = new \ProcessMaker\BusinessModel\OutputDocument();
|
||||
$outputDocument->deleteOutputDocument($prjUid, $outputDocumentUid);
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class OutputDocumentStructure
|
||||
{
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_title;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_description;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_filename;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_template;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@choice TCPDF,HTML2PDF}
|
||||
*/
|
||||
public $out_doc_report_generator;
|
||||
|
||||
/**
|
||||
* @var int {@from body} {@choice 0,1}
|
||||
*/
|
||||
public $out_doc_landscape;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@min 0} {@max 10}
|
||||
*/
|
||||
public $out_doc_media;
|
||||
|
||||
/**
|
||||
* @var int {@from body}
|
||||
*/
|
||||
public $out_doc_left_margin;
|
||||
|
||||
/**
|
||||
* @var int {@from body}
|
||||
*/
|
||||
public $out_doc_right_margin;
|
||||
|
||||
/**
|
||||
* @var int {@from body}
|
||||
*/
|
||||
public $out_doc_top_margin;
|
||||
|
||||
/**
|
||||
* @var int {@from body}
|
||||
*/
|
||||
public $out_doc_bottom_margin;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@choice PDF,DOC,BOTH}
|
||||
*/
|
||||
public $out_doc_generate;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@min 0} {@max 32}
|
||||
*/
|
||||
public $out_doc_type;
|
||||
|
||||
/**
|
||||
* @var int {@from body}
|
||||
*/
|
||||
public $out_doc_current_revision;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_field_mapping;
|
||||
|
||||
/**
|
||||
* @var int {@from body}
|
||||
*/
|
||||
public $out_doc_versioning;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_destination_path;
|
||||
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $out_doc_tags;
|
||||
|
||||
/**
|
||||
* @var int {@from body} {@choice 0,1}
|
||||
*/
|
||||
public $out_doc_pdf_security_enabled;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@min 0} {@max 32}
|
||||
*/
|
||||
public $out_doc_pdf_security_open_password;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@min 0} {@max 32}
|
||||
*/
|
||||
public $out_doc_pdf_security_owner_password;
|
||||
|
||||
/**
|
||||
* @var string {@from body} {@min 0} {@max 150}
|
||||
*/
|
||||
public $out_doc_pdf_security_permissions;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\ProcessPermissions Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class ProcessPermissions extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:prj_uid/process-permissions
|
||||
*/
|
||||
public function doGetProcessPermissions($prj_uid)
|
||||
{
|
||||
try {
|
||||
$processPermissions = new \ProcessMaker\BusinessModel\ProcessPermissions();
|
||||
$response = $processPermissions->getProcessPermissions($prj_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $ob_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:prj_uid/process-permission/:ob_uid
|
||||
*/
|
||||
public function doGetProcessPermission($prj_uid, $ob_uid)
|
||||
{
|
||||
try {
|
||||
$processPermissions = new \ProcessMaker\BusinessModel\ProcessPermissions();
|
||||
$response = $processPermissions->getProcessPermissions($prj_uid, $ob_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @param string $usr_uid {@from body} {@min 1} {@max 32}
|
||||
* @param string $op_user_relation {@from body} {@choice 1,2}
|
||||
* @param string $op_case_status {@from body} {@choice ALL,DRAFT,TO_DO,PAUSED,COMPLETED}
|
||||
* @param string $op_participate {@from body} {@choice 0,1}
|
||||
* @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY}
|
||||
* @param string $op_action {@from body} {@choice VIEW,BLOCK,DELETE}
|
||||
* @param string $tas_uid {@from body}
|
||||
* @param string $op_task_source {@from body}
|
||||
* @param string $dynaforms {@from body}
|
||||
* @param string $inputs {@from body}
|
||||
* @param string $outputs {@from body}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url POST /:prj_uid/process-permission/
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostProcessPermission(
|
||||
$prj_uid,
|
||||
$request_data,
|
||||
$usr_uid,
|
||||
$op_user_relation,
|
||||
$op_case_status,
|
||||
$op_participate,
|
||||
$op_obj_type,
|
||||
$op_action,
|
||||
$tas_uid = '',
|
||||
$op_task_source = '',
|
||||
$dynaforms = '',
|
||||
$inputs = '',
|
||||
$outputs = ''
|
||||
) {
|
||||
try {
|
||||
$hiddenFields = array('task_target', 'group_user', 'task_source',
|
||||
'object_type', 'object', 'participated', 'action'
|
||||
);
|
||||
$request_data['pro_uid'] = $prj_uid;
|
||||
$processPermissions = new \ProcessMaker\BusinessModel\ProcessPermissions();
|
||||
$response = $processPermissions->saveProcessPermission($request_data);
|
||||
foreach ($response as $key => $eventData) {
|
||||
if (in_array($key, $hiddenFields)) {
|
||||
unset($response[$key]);
|
||||
}
|
||||
}
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $ob_uid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @param string $usr_uid {@from body} {@min 1} {@max 32}
|
||||
* @param string $op_user_relation {@from body} {@choice 1,2}
|
||||
* @param string $op_case_status {@from body} {@choice ALL,DRAFT,TO_DO,PAUSED,COMPLETED}
|
||||
* @param string $op_participate {@from body} {@choice 0,1}
|
||||
* @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY}
|
||||
* @param string $op_action {@from body} {@choice VIEW,BLOCK,DELETE}
|
||||
* @param string $tas_uid {@from body}
|
||||
* @param string $op_task_source {@from body}
|
||||
* @param string $dynaforms {@from body}
|
||||
* @param string $inputs {@from body}
|
||||
* @param string $outputs {@from body}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url PUT /:prj_uid/process-permission/:ob_uid
|
||||
*/
|
||||
public function doPutProcessPermission(
|
||||
$prj_uid,
|
||||
$ob_uid,
|
||||
$request_data,
|
||||
$usr_uid,
|
||||
$op_user_relation,
|
||||
$op_case_status,
|
||||
$op_participate,
|
||||
$op_obj_type,
|
||||
$op_action,
|
||||
$tas_uid = '',
|
||||
$op_task_source = '',
|
||||
$dynaforms = '',
|
||||
$inputs = '',
|
||||
$outputs = ''
|
||||
) {
|
||||
try {
|
||||
$request_data['pro_uid'] = $prj_uid;
|
||||
$processPermissions = new \ProcessMaker\BusinessModel\ProcessPermissions();
|
||||
$response = $processPermissions->saveProcessPermission($request_data, $ob_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $ob_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @url DELETE /:prj_uid/process-permission/:ob_uid
|
||||
*/
|
||||
public function doDeleteProcessPermission($prj_uid, $ob_uid)
|
||||
{
|
||||
try {
|
||||
$processPermissions = new \ProcessMaker\BusinessModel\ProcessPermissions();
|
||||
$response = $processPermissions->deleteProcessPermission($ob_uid, $prj_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,361 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\ProcessSupervisors Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class ProcessSupervisors extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
*
|
||||
* @url GET /:prjUid/process-supervisors
|
||||
*/
|
||||
public function doGetProcessSupervisors($prjUid)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$arrayData = $supervisor->getProcessSupervisors($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 $puUid {@min 32} {@max 32}
|
||||
*
|
||||
* @url GET /:prjUid/process-supervisor/:puUid
|
||||
*/
|
||||
public function doGetProcessSupervisor($prjUid, $puUid)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$objectData = $supervisor->getProcessSupervisor($prjUid, $puUid);
|
||||
//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 string $obj_type
|
||||
*
|
||||
* @url GET /:prjUid/available-process-supervisors
|
||||
*/
|
||||
public function doGetAvailableSupervisors($prjUid, $obj_type = '')
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$arrayData = $supervisor->getAvailableProcessSupervisors($obj_type, $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}
|
||||
*
|
||||
* @url GET /:prjUid/process-supervisor/dynaforms
|
||||
*/
|
||||
public function doGetProcessSupervisorDynaforms($prjUid)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$arrayData = $supervisor->getProcessSupervisorDynaforms($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 $pudUid {@min 32} {@max 32}
|
||||
*
|
||||
* @url GET /:prjUid/process-supervisor/dynaform/:pudUid
|
||||
*/
|
||||
public function doGetProcessSupervisorDynaform($prjUid, $pudUid)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$objectData = $supervisor->getProcessSupervisorDynaform($prjUid, $pudUid);
|
||||
//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}
|
||||
*
|
||||
* @url GET /:prjUid/process-supervisor/available-dynaforms
|
||||
*/
|
||||
public function doGetAvailableProcessSupervisorDynaform($prjUid)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$arrayData = $supervisor->getAvailableProcessSupervisorDynaform($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}
|
||||
*
|
||||
* @url GET /:prjUid/process-supervisor/input-documents
|
||||
*/
|
||||
public function doGetProcessSupervisorInputDocuments($prjUid)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$arrayData = $supervisor->getProcessSupervisorInputDocuments($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 $puiUid {@min 32} {@max 32}
|
||||
*
|
||||
* @url GET /:prjUid/process-supervisor/input-document/:puiUid
|
||||
*/
|
||||
public function doGetProcessSupervisorInputDocument($prjUid, $puiUid)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$objectData = $supervisor->getProcessSupervisorInputDocument($prjUid, $puiUid);
|
||||
//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}
|
||||
*
|
||||
* @url GET /:prjUid/process-supervisor/available-input-documents
|
||||
*/
|
||||
public function doGetAvailableProcessSupervisorInputDocument($prjUid)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$arrayData = $supervisor->getAvailableProcessSupervisorInputDocument($prjUid);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prjUid/process-supervisor
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $usr_uid {@min 32} {@max 32}
|
||||
* @param string $pu_type {@choice SUPERVISOR,GROUP_SUPERVISOR}
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostProcessSupervisor($prjUid, $usr_uid, $pu_type)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$objectData = $supervisor->addProcessSupervisor($prjUid, $usr_uid, $pu_type);
|
||||
//Response
|
||||
$response = $objectData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prjUid/process-supervisor/dynaform
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $dyn_uid {@min 32} {@max 32}
|
||||
* @param int $pud_position
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostProcessSupervisorDynaform($prjUid, $dyn_uid, $pud_position=null)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$objectData = $supervisor->addProcessSupervisorDynaform($prjUid, $dyn_uid, $pud_position);
|
||||
//Response
|
||||
$response = $objectData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prjUid/process-supervisor/input-document
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $inp_doc_uid {@min 32} {@max 32}
|
||||
* @param int $pui_position
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostProcessSupervisorInputDocument($prjUid, $inp_doc_uid, $pui_position=null)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$objectData = $supervisor->addProcessSupervisorInputDocument($prjUid, $inp_doc_uid, $pui_position);
|
||||
//Response
|
||||
$response = $objectData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prjUid/process-supervisor/:puUid
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $puUid {@min 32} {@max 32}
|
||||
*
|
||||
*/
|
||||
public function doDeleteSupervisor($prjUid, $puUid)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$supervisor->removeProcessSupervisor($prjUid, $puUid);
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prjUid/process-supervisor/dynaform/:pudUid
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $pudUid {@min 32} {@max 32}
|
||||
*
|
||||
*/
|
||||
public function doDeleteDynaformSupervisor($prjUid, $pudUid)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$supervisor->removeDynaformSupervisor($prjUid, $pudUid);
|
||||
ob_end_clean();
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prjUid/process-supervisor/input-document/:puiUid
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $puiUid {@min 32} {@max 32}
|
||||
*
|
||||
*/
|
||||
public function doDeleteInputDocumentSupervisor($prjUid, $puiUid)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$supervisor->removeInputDocumentSupervisor($prjUid, $puiUid);
|
||||
ob_end_clean();
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:prjUid/process-supervisor/dynaform/:pud_uid
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $pud_uid {@min 32} {@max 32}
|
||||
* @param int $pud_position
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPutProcessSupervisorDynaform($prjUid, $pud_uid, $pud_position = null)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$objectData = $supervisor->updateProcessSupervisorDynaform($prjUid, $pud_uid, $pud_position);
|
||||
//Response
|
||||
$response = $objectData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:prjUid/process-supervisor/input-document/:pui_uid
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $pui_uid {@min 32} {@max 32}
|
||||
* @param int $pui_position
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPutProcessSupervisorInputDocument($prjUid, $pui_uid, $pui_position = null)
|
||||
{
|
||||
try {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$objectData = $supervisor->updateProcessSupervisorInputDocument($prjUid, $pui_uid, $pui_position);
|
||||
//Response
|
||||
$response = $objectData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\ProjectUsers Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class ProjectUsers extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
*
|
||||
* @url GET /:prj_uid/users
|
||||
*/
|
||||
public function doGetProjectUsers($prj_uid)
|
||||
{
|
||||
try {
|
||||
$users = new \ProcessMaker\BusinessModel\ProjectUser();
|
||||
$arrayData = $users->getProjectUsers($prj_uid);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
*
|
||||
* @url GET /:prj_uid/starting-tasks
|
||||
*/
|
||||
public function doGetProjectStartingTasks($prj_uid)
|
||||
{
|
||||
try {
|
||||
$startingTasks = new \ProcessMaker\BusinessModel\ProjectUser();
|
||||
$arrayData = $startingTasks->getProjectStartingTasks($prj_uid);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param string $usr_uid {@min 32} {@max 32}
|
||||
*
|
||||
* @url GET /:prj_uid/user/:usr_uid/starting-tasks
|
||||
*/
|
||||
public function doGetProjectStartingTaskUsers($prj_uid, $usr_uid)
|
||||
{
|
||||
try {
|
||||
$startingTasks = new \ProcessMaker\BusinessModel\ProjectUser();
|
||||
$arrayData = $startingTasks->getProjectStartingTaskUsers($prj_uid, $usr_uid);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param string $act_uid {@min 32} {@max 32}
|
||||
* @param wsUserCanStartTaskStructure $request_data
|
||||
*
|
||||
* @url POST /:prj_uid/ws/user/can-start-task
|
||||
*/
|
||||
public function doPostProjectWsUserCanStartTask($prj_uid, $act_uid = null, wsUserCanStartTaskStructure $request_data = null)
|
||||
{
|
||||
try {
|
||||
$request_data = (array)($request_data);
|
||||
$user = new \ProcessMaker\BusinessModel\ProjectUser();
|
||||
$objectData = $user->postProjectWsUserCanStartTask($prj_uid, $act_uid, $request_data);
|
||||
//Response
|
||||
$response = $objectData;
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
class wsUserCanStartTaskStructure
|
||||
{
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $username;
|
||||
/**
|
||||
* @var string {@from body}
|
||||
*/
|
||||
public $password;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\ReportTable Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class ReportTable extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:prj_uid/report-tables
|
||||
*/
|
||||
public function doGetReportTables($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oReportTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oReportTable->getTables($prj_uid, true);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $rep_uid {@min 1} {@max 32}
|
||||
* @return array
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /:prj_uid/report-table/:rep_uid
|
||||
*/
|
||||
public function doGetReportTable($prj_uid, $rep_uid)
|
||||
{
|
||||
try {
|
||||
$oReportTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oReportTable->getTable($rep_uid, $prj_uid, true);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $rep_uid {@min 1} {@max 32}
|
||||
* @return array
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /:prj_uid/report-table/:rep_uid/populate
|
||||
*/
|
||||
public function doGetPopulateReportTable($prj_uid, $rep_uid)
|
||||
{
|
||||
try {
|
||||
$oReportTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oReportTable->generateDataReport($prj_uid, $rep_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $rep_uid {@min 1} {@max 32}
|
||||
* @return array
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /:prj_uid/report-table/:rep_uid/data
|
||||
*/
|
||||
public function doGetReportTableData($prj_uid, $rep_uid)
|
||||
{
|
||||
try {
|
||||
$oReportTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oReportTable->getTableData($rep_uid, $prj_uid, true);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @param string $rep_tab_name {@from body}
|
||||
* @param string $rep_tab_dsc {@from body}
|
||||
* @param string $rep_tab_connection {@from body}
|
||||
* @param string $rep_tab_type {@from body} {@choice NORMAL,GRID}
|
||||
* @param string $rep_tab_grid {@from body}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url POST /:prj_uid/report-table
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostReportTable(
|
||||
$prj_uid,
|
||||
$request_data,
|
||||
$rep_tab_name,
|
||||
$rep_tab_dsc,
|
||||
$rep_tab_connection,
|
||||
$rep_tab_type,
|
||||
$rep_tab_grid = ''
|
||||
) {
|
||||
try {
|
||||
$oReportTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oReportTable->saveTable($request_data, $prj_uid, true);
|
||||
if (isset($response['pro_uid'])) {
|
||||
unset($response['pro_uid']);
|
||||
}
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $rep_uid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @param string $rep_tab_dsc {@from body}
|
||||
* @return void
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:prj_uid/report-table/:rep_uid
|
||||
*/
|
||||
public function doPutReportTable(
|
||||
$prj_uid,
|
||||
$rep_uid,
|
||||
$request_data,
|
||||
$rep_tab_dsc = ''
|
||||
) {
|
||||
try {
|
||||
$request_data['rep_uid'] = $rep_uid;
|
||||
$oReportTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oReportTable->updateTable($request_data, $prj_uid, true);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $rep_uid {@min 1} {@max 32}
|
||||
* @return void
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url DELETE /:prj_uid/report-table/:rep_uid
|
||||
*/
|
||||
public function doDeleteReportTable($prj_uid, $rep_uid)
|
||||
{
|
||||
try {
|
||||
$oReportTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oReportTable->deleteTable($rep_uid, $prj_uid, true);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\Subprocess Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Subprocess extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $tas_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:prj_uid/subprocess/:tas_uid
|
||||
*/
|
||||
public function doGetSubprocesss($prj_uid, $tas_uid)
|
||||
{
|
||||
try {
|
||||
$hiddenFields = array('spr_uid', 'spr_pro_parent', 'spr_tas_parent');
|
||||
$oSubProcess = new \ProcessMaker\BusinessModel\Subprocess();
|
||||
$response = $oSubProcess->getSubprocesss($prj_uid, $tas_uid);
|
||||
foreach ($response as $key => $value) {
|
||||
if (in_array($key, $hiddenFields)) {
|
||||
unset($response[$key]);
|
||||
}
|
||||
}
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $tas_uid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @url PUT /:prj_uid/subprocess/:tas_uid
|
||||
*/
|
||||
public function doPutSubprocess($prj_uid, $tas_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$oSubProcess = new \ProcessMaker\BusinessModel\Subprocess();
|
||||
$oSubProcess->putSubprocesss($prj_uid, $tas_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\Trigger Api Controller
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Trigger extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:projectUid/triggers
|
||||
*/
|
||||
public function doGetTriggers($projectUid)
|
||||
{
|
||||
try {
|
||||
$trigger = new \ProcessMaker\BusinessModel\Trigger();
|
||||
$response = $trigger->getTriggers($projectUid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $triggerUid {@min 1} {@max 32}
|
||||
* @return array
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /:projectUid/trigger/:triggerUid
|
||||
*/
|
||||
public function doGetTrigger($projectUid, $triggerUid)
|
||||
{
|
||||
try {
|
||||
$trigger = new \ProcessMaker\BusinessModel\Trigger();
|
||||
$response = $trigger->getDataTrigger($triggerUid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
* @param string $tri_title {@from body} {@min 1}
|
||||
* @param string $tri_description {@from body}
|
||||
* @param string $tri_type {@from body}
|
||||
* @param string $tri_webbot {@from body}
|
||||
* @param string $tri_param {@from body}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url POST /:projectUid/trigger
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostTrigger($projectUid, $request_data, $tri_title, $tri_description = '', $tri_type = 'SCRIPT', $tri_webbot = '', $tri_param = '')
|
||||
{
|
||||
try {
|
||||
$trigger = new \ProcessMaker\BusinessModel\Trigger();
|
||||
$response = $trigger->saveTrigger($projectUid, $request_data, true);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $triggerUid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
* @param string $tri_title {@from body}
|
||||
* @param string $tri_description {@from body}
|
||||
* @param string $tri_type {@from body}
|
||||
* @param string $tri_webbot {@from body}
|
||||
* @param string $tri_param {@from body}
|
||||
* @return void
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:projectUid/trigger/:triggerUid
|
||||
*/
|
||||
public function doPutTrigger($projectUid, $triggerUid, $request_data, $tri_title = '', $tri_description = '', $tri_type = 'SCRIPT', $tri_webbot = '', $tri_param = '')
|
||||
{
|
||||
try {
|
||||
$request_data['tri_uid'] = $triggerUid;
|
||||
$trigger = new \ProcessMaker\BusinessModel\Trigger();
|
||||
$trigger->saveTrigger($projectUid, $request_data, false, $triggerUid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $triggerUid {@min 1} {@max 32}
|
||||
* @return void
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url DELETE /:projectUid/trigger/:triggerUid
|
||||
*/
|
||||
public function doDeleteTrigger($projectUid, $triggerUid)
|
||||
{
|
||||
try {
|
||||
$trigger = new \ProcessMaker\BusinessModel\Trigger();
|
||||
$response = $trigger->deleteTrigger($triggerUid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\TriggerWizard Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class TriggerWizard extends Api
|
||||
{
|
||||
private $formatFieldNameInUppercase = false;
|
||||
|
||||
private $arrayFieldNameForException = array(
|
||||
"processUid" => "prj_uid",
|
||||
"libraryName" => "lib_name",
|
||||
"methodName" => "fn_name"
|
||||
);
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/trigger-wizard/:lib_name
|
||||
* @url GET /:prj_uid/trigger-wizard/:lib_name/:fn_name
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $lib_name
|
||||
* @param string $fn_name
|
||||
*/
|
||||
public function doGetTriggerWizard($prj_uid, $lib_name, $fn_name = "")
|
||||
{
|
||||
try {
|
||||
$triggerWizard = new \ProcessMaker\BusinessModel\TriggerWizard();
|
||||
$triggerWizard->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
$triggerWizard->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||
|
||||
$response = ($fn_name == "")? $triggerWizard->getLibrary($lib_name) : $triggerWizard->getMethod($lib_name, $fn_name);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prj_uid/trigger-wizard/:lib_name/:fn_name/:tri_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $lib_name
|
||||
* @param string $fn_name
|
||||
* @param string $tri_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetTriggerWizardTrigger($prj_uid, $lib_name, $fn_name, $tri_uid)
|
||||
{
|
||||
try {
|
||||
$triggerWizard = new \ProcessMaker\BusinessModel\TriggerWizard();
|
||||
$triggerWizard->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
$triggerWizard->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||
|
||||
$response = $triggerWizard->getTrigger($lib_name, $fn_name, $tri_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prj_uid/trigger-wizard/:lib_name/:fn_name
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $lib_name
|
||||
* @param string $fn_name
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostTriggerWizard($prj_uid, $lib_name, $fn_name, $request_data)
|
||||
{
|
||||
try {
|
||||
$triggerWizard = new \ProcessMaker\BusinessModel\TriggerWizard();
|
||||
$triggerWizard->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
$triggerWizard->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||
|
||||
$arrayData = $triggerWizard->create($lib_name, $fn_name, $prj_uid, $request_data);
|
||||
|
||||
$response = $arrayData;
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:prj_uid/trigger-wizard/:lib_name/:fn_name/:tri_uid
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param string $lib_name
|
||||
* @param string $fn_name
|
||||
* @param string $tri_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*/
|
||||
public function doPutTriggerWizard($prj_uid, $lib_name, $fn_name, $tri_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$triggerWizard = new \ProcessMaker\BusinessModel\TriggerWizard();
|
||||
$triggerWizard->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
|
||||
$triggerWizard->setArrayFieldNameForException($this->arrayFieldNameForException);
|
||||
|
||||
$arrayData = $triggerWizard->update($lib_name, $fn_name, $tri_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Project\WebEntry Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class WebEntry extends Api
|
||||
{
|
||||
/**
|
||||
* @url GET /:prj_uid/web-entry/:tas_uid/:dyn_uid
|
||||
*
|
||||
* @param string $dyn_uid {@min 32}{@max 32}
|
||||
* @param string $tas_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetWebEntry($dyn_uid, $tas_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$webEntry = new \ProcessMaker\BusinessModel\WebEntry();
|
||||
$webEntry->setFormatFieldNameInUppercase(false);
|
||||
$webEntry->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$response = $webEntry->getWebEntry($prj_uid, $tas_uid, $dyn_uid);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:prj_uid/web-entry
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostWebEntry($prj_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$webEntry = new \ProcessMaker\BusinessModel\WebEntry();
|
||||
$webEntry->setFormatFieldNameInUppercase(false);
|
||||
$webEntry->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$arrayData = $webEntry->create($prj_uid, $request_data);
|
||||
|
||||
$response = $arrayData;
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:prj_uid/web-entry/:tas_uid/:dyn_uid
|
||||
*
|
||||
* @param string $dyn_uid {@min 32}{@max 32}
|
||||
* @param string $tas_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDeleteWebEntry($dyn_uid, $tas_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$webEntry = new \ProcessMaker\BusinessModel\WebEntry();
|
||||
$webEntry->setFormatFieldNameInUppercase(false);
|
||||
$webEntry->setArrayFieldNameForException(array("processUid" => "prj_uid"));
|
||||
|
||||
$webEntry->delete($prj_uid, $tas_uid, $dyn_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
33
workflow/engine/src/ProcessMaker/Services/Api/System.php
Normal file
33
workflow/engine/src/ProcessMaker/Services/Api/System.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Pmtable Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class System extends Api
|
||||
{
|
||||
/**
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /db-engines
|
||||
*/
|
||||
public function doGetDataBaseEngines()
|
||||
{
|
||||
try {
|
||||
$oDBConnection = new \ProcessMaker\BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->getDbEngines();
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
109
workflow/engine/src/ProcessMaker/Services/Api/Test.php
Normal file
109
workflow/engine/src/ProcessMaker/Services/Api/Test.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
class Test extends Api
|
||||
{
|
||||
protected $data = array();
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
if (! isset($_SESSION['__rest_tmp__'])) {
|
||||
$this->data[1] = array(
|
||||
'id' => '1',
|
||||
'name' => 'John',
|
||||
'lastname' => 'Doe',
|
||||
'age' => '27'
|
||||
);
|
||||
$this->saveData();
|
||||
} else {
|
||||
$this->loadData();
|
||||
}
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return array_values($this->data);
|
||||
}
|
||||
|
||||
public function get($id)
|
||||
{
|
||||
if (array_key_exists($id, $this->data)) {
|
||||
return $this->data[$id];
|
||||
}
|
||||
|
||||
throw new RestException(400, "GET: Record not found. Record with id: $id does not exist!");
|
||||
}
|
||||
|
||||
public function post($request_data = null)
|
||||
{
|
||||
$id = count($this->data) + 1;
|
||||
$this->data[$id] = array(
|
||||
'id' => $id,
|
||||
'name' => '',
|
||||
'lastname' => '',
|
||||
'age' => ''
|
||||
);
|
||||
|
||||
if (array_key_exists('name', $request_data)) {
|
||||
$this->data[$id]['name'] = $request_data['name'];
|
||||
}
|
||||
if (array_key_exists('lastname', $request_data)) {
|
||||
$this->data[$id]['lastname'] = $request_data['lastname'];
|
||||
}
|
||||
if (array_key_exists('age', $request_data)) {
|
||||
$this->data[$id]['age'] = $request_data['age'];
|
||||
}
|
||||
|
||||
$this->saveData();
|
||||
|
||||
return $this->data[$id];
|
||||
}
|
||||
|
||||
public function put($id, $request_data = null)
|
||||
{
|
||||
if (array_key_exists($id, $this->data)) {
|
||||
if (array_key_exists('name', $request_data)) {
|
||||
$this->data[$id]['name'] = $request_data['name'];
|
||||
}
|
||||
if (array_key_exists('lastname', $request_data)) {
|
||||
$this->data[$id]['lastname'] = $request_data['lastname'];
|
||||
}
|
||||
if (array_key_exists('age', $request_data)) {
|
||||
$this->data[$id]['age'] = $request_data['age'];
|
||||
}
|
||||
$this->saveData();
|
||||
|
||||
return $this->data[$id];
|
||||
} else {
|
||||
throw new RestException(400, "PUT: Record not found. Record with id: $id does not exist!");
|
||||
}
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
if (array_key_exists($id, $this->data)) {
|
||||
$row = $this->data[$id];
|
||||
unset($this->data[$id]);
|
||||
$this->saveData();
|
||||
|
||||
return $row;
|
||||
} else {
|
||||
throw new RestException(400, "DELETE: Record not found. Record with id: $id does not exist!");
|
||||
}
|
||||
}
|
||||
|
||||
/* Private methods */
|
||||
private function loadData()
|
||||
{
|
||||
$this->data = $_SESSION['__rest_tmp__'];
|
||||
}
|
||||
|
||||
private function saveData()
|
||||
{
|
||||
$_SESSION['__rest_tmp__'] = $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
31
workflow/engine/src/ProcessMaker/Services/Api/Test2.php
Normal file
31
workflow/engine/src/ProcessMaker/Services/Api/Test2.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
class Test2 extends Api
|
||||
{
|
||||
|
||||
public function hello2()
|
||||
{
|
||||
return 'Hello #2';
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /getHello
|
||||
*/
|
||||
public function helloworld($param = '')
|
||||
{
|
||||
return 'Greetings, from a overridden url ' . $param;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /sample/other/large/:name
|
||||
*/
|
||||
public function sampleOther($name)
|
||||
{
|
||||
return 'Name: ' . $name;
|
||||
}
|
||||
}
|
||||
|
||||
23
workflow/engine/src/ProcessMaker/Services/Api/Test3.php
Normal file
23
workflow/engine/src/ProcessMaker/Services/Api/Test3.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
class Test3 extends Api
|
||||
{
|
||||
|
||||
public function hello3()
|
||||
{
|
||||
return 'Hello #3';
|
||||
}
|
||||
|
||||
/**
|
||||
* @status 201
|
||||
*/
|
||||
public function post2()
|
||||
{
|
||||
return array('success' => true);
|
||||
}
|
||||
}
|
||||
|
||||
213
workflow/engine/src/ProcessMaker/Services/Api/Type.php
Normal file
213
workflow/engine/src/ProcessMaker/Services/Api/Type.php
Normal file
@@ -0,0 +1,213 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
class Type
|
||||
{
|
||||
/**
|
||||
* Email validation
|
||||
*
|
||||
* @param string $email {@from body}{@type email}
|
||||
*/
|
||||
public function postEmail($email)
|
||||
{
|
||||
return $email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Date validation
|
||||
*
|
||||
* @param string $date {@from body}{@type date}
|
||||
*/
|
||||
public function postDate($date)
|
||||
{
|
||||
return $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* DateTime validation
|
||||
*
|
||||
* @param string $datetime {@from body}{@type datetime}
|
||||
*/
|
||||
public function postDatetime($datetime)
|
||||
{
|
||||
return $datetime;
|
||||
}
|
||||
|
||||
/**
|
||||
* time validation
|
||||
*
|
||||
* @param string $time {@from body}{@type time}
|
||||
*/
|
||||
public function postTime($time)
|
||||
{
|
||||
return $time;
|
||||
}
|
||||
|
||||
/**
|
||||
* time validation in 12 hour format
|
||||
*
|
||||
* @param string $time {@from body}{@type time12}
|
||||
*/
|
||||
public function postTime12($time12)
|
||||
{
|
||||
return $time12;
|
||||
}
|
||||
|
||||
/**
|
||||
* Timestamp validation
|
||||
*
|
||||
* @param string $timestamp {@from body}{@type timestamp}
|
||||
*/
|
||||
public function postTimestamp($timestamp)
|
||||
{
|
||||
return $timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Integer validation
|
||||
*
|
||||
* @param array $integers {@type int}
|
||||
*/
|
||||
public function postIntegers(array $integers)
|
||||
{
|
||||
return $integers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of numbers
|
||||
*
|
||||
* @param array $numbers {@type float}
|
||||
*/
|
||||
public function postNumbers(array $numbers)
|
||||
{
|
||||
return $numbers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of time strings
|
||||
*
|
||||
* @param array $timestamp {@from body}{@type time}
|
||||
*/
|
||||
public function postTimes(array $timestamps)
|
||||
{
|
||||
return $timestamps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of timestamps
|
||||
*
|
||||
* @param array $timestamp {@from body}{@type timestamp}
|
||||
*/
|
||||
public function postTimestamps(array $timestamps)
|
||||
{
|
||||
return $timestamps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom class parameter
|
||||
*
|
||||
* @param array $definition
|
||||
* @param StructProperties $properties
|
||||
*
|
||||
* @return Author
|
||||
*/
|
||||
public function postAuthor(Author $author)
|
||||
{
|
||||
return $author;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of authors
|
||||
*
|
||||
* @param array $authors {@type Author}
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function postAuthors(array $authors)
|
||||
{
|
||||
return $authors;
|
||||
}
|
||||
|
||||
/**
|
||||
* An associative array
|
||||
*
|
||||
* @param array $object {@type associative}
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function postObject(array $object)
|
||||
{
|
||||
return $object;
|
||||
}
|
||||
|
||||
/**
|
||||
* An indexed array
|
||||
*
|
||||
* @param array $array {@type indexed}
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function postArray(array $array)
|
||||
{
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* An array indexed or associative
|
||||
*
|
||||
* @param array $array
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function postArrayOrObject(array $array)
|
||||
{
|
||||
return $array;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $gender {@from body}{@choice male,female}
|
||||
*/
|
||||
public function postChoise($gender)
|
||||
{
|
||||
return $gender;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name $name 3 to 10 characters in length {@from body}{@min 3}{@max 10}
|
||||
*/
|
||||
public function postMinmax($name)
|
||||
{
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name $name 3 to 10 characters in length {@from body}{@min 3}{@max 10}{@fix true}
|
||||
*/
|
||||
public function postMinmaxfix($name)
|
||||
{
|
||||
return $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param integer $age {@choise 1,2}
|
||||
*/
|
||||
public function postInt($age = '')
|
||||
{
|
||||
return $age;
|
||||
}
|
||||
}
|
||||
|
||||
class Author
|
||||
{
|
||||
/**
|
||||
* @var string {@from body} {@min 3}{@max 100}
|
||||
* name of the Author {@required true}
|
||||
*/
|
||||
public $name = 'Name';
|
||||
/**
|
||||
* @var string {@type email} {@from body}
|
||||
* email id of the Author
|
||||
*/
|
||||
public $email = 'name@domain.com';
|
||||
}
|
||||
|
||||
116
workflow/engine/src/ProcessMaker/Services/Api/User.php
Normal file
116
workflow/engine/src/ProcessMaker/Services/Api/User.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* User Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class User extends Api
|
||||
{
|
||||
/**
|
||||
* @url GET
|
||||
* @param string $filter
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
*/
|
||||
public function doGetUsers($filter = '', $start = null, $limit = null)
|
||||
{
|
||||
try {
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$response = $user->getUsers($filter, $start, $limit);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:usr_uid
|
||||
*
|
||||
* @param string $usr_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetUser($usr_uid)
|
||||
{
|
||||
try {
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$response = $user->getUser($usr_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST
|
||||
*
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostUser($request_data)
|
||||
{
|
||||
try {
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$arrayData = $user->create($request_data);
|
||||
$response = $arrayData;
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:usr_uid
|
||||
*
|
||||
* @param string $usr_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*/
|
||||
public function doPutUser($usr_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$userLoggedUid = $this->getUserId();
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$arrayData = $user->update($usr_uid, $request_data, $userLoggedUid);
|
||||
$response = $arrayData;
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:usr_uid
|
||||
*
|
||||
* @param string $usr_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDeleteUser($usr_uid)
|
||||
{
|
||||
try {
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$user->delete($usr_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $usr_uid {@min 32} {@max 32}
|
||||
*
|
||||
* @url POST /:usr_uid/image-upload
|
||||
*/
|
||||
public function doPostUserImageUpload($usr_uid)
|
||||
{
|
||||
try {
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$user->uploadImage($usr_uid);
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
248
workflow/engine/src/ProcessMaker/Services/OAuth2/PmPdo.php
Normal file
248
workflow/engine/src/ProcessMaker/Services/OAuth2/PmPdo.php
Normal file
@@ -0,0 +1,248 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Services\OAuth2;
|
||||
|
||||
/**
|
||||
* Simple PmPDO storage for all storage types
|
||||
* based on \OAuth2\Storage\Pdo
|
||||
*
|
||||
* @author Erik Amaru Ortiz <aortiz.erik at gmail dot com>
|
||||
*/
|
||||
class PmPdo implements \OAuth2\Storage\AuthorizationCodeInterface,
|
||||
\OAuth2\Storage\AccessTokenInterface,
|
||||
\OAuth2\Storage\ClientCredentialsInterface,
|
||||
\OAuth2\Storage\UserCredentialsInterface,
|
||||
\OAuth2\Storage\RefreshTokenInterface,
|
||||
\OAuth2\Storage\JwtBearerInterface
|
||||
{
|
||||
|
||||
protected $db;
|
||||
protected $config;
|
||||
|
||||
public function __construct($connection, $config = array())
|
||||
{
|
||||
if (!$connection instanceof \PDO) {
|
||||
if (!is_array($connection)) {
|
||||
throw new \InvalidArgumentException('First argument to OAuth2\Storage\Pdo must be an instance of PDO or a configuration array');
|
||||
}
|
||||
if (!isset($connection['dsn'])) {
|
||||
throw new \InvalidArgumentException('configuration array must contain "dsn"');
|
||||
}
|
||||
// merge optional parameters
|
||||
$connection = array_merge(array(
|
||||
'username' => null,
|
||||
'password' => null,
|
||||
), $connection);
|
||||
$connection = new \PDO($connection['dsn'], $connection['username'], $connection['password']);
|
||||
}
|
||||
$this->db = $connection;
|
||||
|
||||
// debugging
|
||||
$connection->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$this->config = array_merge(array(
|
||||
'client_table' => 'OAUTH_CLIENTS',
|
||||
'access_token_table' => 'OAUTH_ACCESS_TOKENS',
|
||||
'refresh_token_table' => 'OAUTH_REFRESH_TOKENS',
|
||||
'code_table' => 'OAUTH_AUTHORIZATION_CODES',
|
||||
'user_table' => 'OAUTH_USERS',
|
||||
'jwt_table' => 'OAUTH_JWT',
|
||||
), $config);
|
||||
}
|
||||
|
||||
/* OAuth2_Storage_ClientCredentialsInterface */
|
||||
public function checkClientCredentials($client_id, $client_secret = null)
|
||||
{
|
||||
$stmt = $this->db->prepare(sprintf('SELECT * from %s WHERE CLIENT_ID = :client_id', $this->config['client_table']));
|
||||
$stmt->execute(compact('client_id'));
|
||||
$result = self::expandCase($stmt->fetch());
|
||||
|
||||
// make this extensible
|
||||
return $result['client_secret'] == $client_secret;
|
||||
}
|
||||
|
||||
public function getClientDetails($client_id)
|
||||
{
|
||||
$stmt = $this->db->prepare(sprintf('SELECT * from %s WHERE CLIENT_ID = :client_id', $this->config['client_table']));
|
||||
$stmt->execute(compact('client_id'));
|
||||
|
||||
return self::expandCase($stmt->fetch());
|
||||
}
|
||||
|
||||
public function checkRestrictedGrantType($client_id, $grant_type)
|
||||
{
|
||||
$details = $this->getClientDetails($client_id);
|
||||
if (isset($details['grant_types'])) {
|
||||
$grant_types = explode(' ', $details['grant_types']);
|
||||
|
||||
return in_array($grant_type, (array) $grant_types);
|
||||
}
|
||||
|
||||
// if grant_types are not defined, then none are restricted
|
||||
return true;
|
||||
}
|
||||
|
||||
/* OAuth2_Storage_AccessTokenInterface */
|
||||
public function getAccessToken($access_token)
|
||||
{
|
||||
$stmt = $this->db->prepare(sprintf('SELECT * from %s WHERE ACCESS_TOKEN = :access_token', $this->config['access_token_table']));
|
||||
|
||||
$token = $stmt->execute(compact('access_token'));
|
||||
if ($token = self::expandCase($stmt->fetch())) {
|
||||
// convert date string back to timestamp
|
||||
$token['expires'] = strtotime($token['expires']);
|
||||
}
|
||||
|
||||
return $token;
|
||||
}
|
||||
|
||||
public function setAccessToken($access_token, $client_id, $user_id, $expires, $scope = null)
|
||||
{
|
||||
// convert expires to datestring
|
||||
$expires = date('Y-m-d H:i:s', $expires);
|
||||
|
||||
// if it exists, update it.
|
||||
if ($this->getAccessToken($access_token)) {
|
||||
$stmt = $this->db->prepare(sprintf('UPDATE %s SET CLIENT_ID=:client_id, EXPIRES=:expires, USER_ID=:user_id, SCOPE=:scope WHERE ACCESS_TOKEN=:access_token', $this->config['access_token_table']));
|
||||
} else {
|
||||
$stmt = $this->db->prepare(sprintf('INSERT INTO %s (ACCESS_TOKEN, CLIENT_ID, EXPIRES, USER_ID, SCOPE) VALUES (:access_token, :client_id, :expires, :user_id, :scope)', $this->config['access_token_table']));
|
||||
}
|
||||
return $stmt->execute(compact('access_token', 'client_id', 'user_id', 'expires', 'scope'));
|
||||
}
|
||||
|
||||
/* OAuth2_Storage_AuthorizationCodeInterface */
|
||||
public function getAuthorizationCode($code)
|
||||
{
|
||||
$stmt = $this->db->prepare(sprintf('SELECT * FROM %s WHERE AUTHORIZATION_CODE = :code', $this->config['code_table']));
|
||||
$stmt->execute(compact('code'));
|
||||
|
||||
if ($code = self::expandCase($stmt->fetch())) {
|
||||
// convert date string back to timestamp
|
||||
$code['expires'] = strtotime($code['expires']);
|
||||
}
|
||||
|
||||
return $code;
|
||||
}
|
||||
|
||||
public function setAuthorizationCode($code, $client_id, $user_id, $redirect_uri, $expires, $scope = null)
|
||||
{
|
||||
// convert expires to datestring
|
||||
$expires = date('Y-m-d H:i:s', $expires);
|
||||
|
||||
// if it exists, update it.
|
||||
if ($this->getAuthorizationCode($code)) {
|
||||
$stmt = $this->db->prepare($sql = sprintf('UPDATE %s SET CLIENT_ID=:client_id, USER_ID=:user_id, REDIRECT_URI=:redirect_uri, EXPIRES=:expires, SCOPE=:scope where AUTHORIZATION_CODE=:code', $this->config['code_table']));
|
||||
} else {
|
||||
$stmt = $this->db->prepare(sprintf('INSERT INTO %s (AUTHORIZATION_CODE, CLIENT_ID, USER_ID, REDIRECT_URI, EXPIRES, SCOPE) VALUES (:code, :client_id, :user_id, :redirect_uri, :expires, :scope)', $this->config['code_table']));
|
||||
}
|
||||
return $stmt->execute(compact('code', 'client_id', 'user_id', 'redirect_uri', 'expires', 'scope'));
|
||||
}
|
||||
|
||||
public function expireAuthorizationCode($code)
|
||||
{
|
||||
$stmt = $this->db->prepare(sprintf('DELETE FROM %s WHERE AUTHORIZATION_CODE = :code', $this->config['code_table']));
|
||||
|
||||
return $stmt->execute(compact('code'));
|
||||
}
|
||||
|
||||
/* OAuth2_Storage_UserCredentialsInterface */
|
||||
public function checkUserCredentials($username, $password)
|
||||
{
|
||||
if ($user = $this->getUser($username)) {
|
||||
return $this->checkPassword($user, $password);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getUserDetails($username)
|
||||
{
|
||||
return $this->getUser($username);
|
||||
}
|
||||
|
||||
/* OAuth2_Storage_RefreshTokenInterface */
|
||||
public function getRefreshToken($refresh_token)
|
||||
{
|
||||
$stmt = $this->db->prepare(sprintf('SELECT * FROM %s WHERE REFRESH_TOKEN = :refresh_token', $this->config['refresh_token_table']));
|
||||
|
||||
$token = $stmt->execute(compact('refresh_token'));
|
||||
if ($token = self::expandCase($stmt->fetch())) {
|
||||
// convert expires to epoch time
|
||||
$token['expires'] = strtotime($token['expires']);
|
||||
}
|
||||
|
||||
return $token;
|
||||
}
|
||||
|
||||
public function setRefreshToken($refresh_token, $client_id, $user_id, $expires, $scope = null)
|
||||
{
|
||||
// convert expires to datestring
|
||||
$expires = date('Y-m-d H:i:s', $expires);
|
||||
|
||||
$stmt = $this->db->prepare(sprintf('INSERT INTO %s (REFRESH_TOKEN, CLIENT_ID, USER_ID, EXPIRES, SCOPE) VALUES (:refresh_token, :client_id, :user_id, :expires, :scope)', $this->config['refresh_token_table']));
|
||||
|
||||
return $stmt->execute(compact('refresh_token', 'client_id', 'user_id', 'expires', 'scope'));
|
||||
}
|
||||
|
||||
public function unsetRefreshToken($refresh_token)
|
||||
{
|
||||
$stmt = $this->db->prepare(sprintf('DELETE FROM %s WHERE REFRESH_TOKEN = :refresh_token', $this->config['refresh_token_table']));
|
||||
|
||||
return $stmt->execute(compact('refresh_token'));
|
||||
}
|
||||
|
||||
// plaintext passwords are bad! Override this for your application
|
||||
protected function checkPassword($user, $password)
|
||||
{
|
||||
return $user['password'] == sha1($password);
|
||||
}
|
||||
|
||||
public function getUser($username)
|
||||
{
|
||||
$stmt = $this->db->prepare($sql = sprintf('SELECT * FROM %s WHERE USERNAME=:username', $this->config['user_table']));
|
||||
$stmt->execute(array('username' => $username));
|
||||
|
||||
if (!$userInfo = $stmt->fetch()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$userInfo = self::expandCase($userInfo);
|
||||
|
||||
// the default behavior is to use "username" as the user_id
|
||||
return array_merge(array(
|
||||
'user_id' => $username
|
||||
), $userInfo);
|
||||
}
|
||||
|
||||
public function setUser($username, $password, $firstName = null, $lastName = null)
|
||||
{
|
||||
// do not store in plaintext
|
||||
$password = sha1($password);
|
||||
|
||||
// if it exists, update it.
|
||||
if ($this->getUser($username)) {
|
||||
$stmt = $this->db->prepare($sql = sprintf('UPDATE %s SET PASSWORD=:password, FIRST_NAME=:firstName, LAST_NAME=:lastName WHERE USERNAME=:username', $this->config['user_table']));
|
||||
} else {
|
||||
$stmt = $this->db->prepare(sprintf('INSERT INTO %s (USERNAME, PASSWORD, FIRST_NAME, LAST_NAME) VALUES (:username, :password, :firstName, :lastName)', $this->config['user_table']));
|
||||
}
|
||||
return $stmt->execute(compact('username', 'password', 'firstName', 'lastName'));
|
||||
}
|
||||
|
||||
/* OAuth2_Storage_JWTBearerInterface */
|
||||
public function getClientKey($client_id, $subject)
|
||||
{
|
||||
$stmt = $this->db->prepare($sql = sprintf('SELECT PUBLIC_KEY from %s WHERE CLIENT_ID=:client_id AND SUBJECT=:subject', $this->config['jwt_table']));
|
||||
|
||||
$stmt->execute(array('client_id' => $client_id, 'subject' => $subject));
|
||||
return self::expandCase($stmt->fetch());
|
||||
}
|
||||
|
||||
protected static function expandCase($a, $case = CASE_LOWER)
|
||||
{
|
||||
if (! is_array($a)) {
|
||||
return $a;
|
||||
}
|
||||
|
||||
return array_merge($a, array_change_key_case($a, $case));
|
||||
}
|
||||
}
|
||||
|
||||
239
workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php
Normal file
239
workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php
Normal file
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\OAuth2;
|
||||
|
||||
use Luracast\Restler\iAuthenticate;
|
||||
|
||||
|
||||
/**
|
||||
* Class Server
|
||||
*
|
||||
* @package OAuth2
|
||||
* @author Erik Amaru Ortiz <aortiz.erik at gmail dot com>
|
||||
*
|
||||
*/
|
||||
class Server implements iAuthenticate
|
||||
{
|
||||
/**
|
||||
* @var OAuth2_Server
|
||||
*/
|
||||
protected $server;
|
||||
/**
|
||||
* @var OAuth2_Storage_Pdo
|
||||
*/
|
||||
protected $storage;
|
||||
protected $scope = array();
|
||||
|
||||
protected static $pmClientId;
|
||||
protected static $userId;
|
||||
protected static $dbUser;
|
||||
protected static $dbPassword;
|
||||
protected static $dsn;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
require_once 'PmPdo.php';
|
||||
|
||||
$this->scope = array(
|
||||
'view_processes' => 'View Processes',
|
||||
'edit_processes' => 'Edit Processes'
|
||||
);
|
||||
|
||||
// $dsn is the Data Source Name for your database, for exmaple "mysql:dbname=my_oauth2_db;host=localhost"
|
||||
$config = array('dsn' => self::$dsn, 'username' => self::$dbUser, 'password' => self::$dbPassword);
|
||||
//var_dump($config); die;
|
||||
$this->storage = new PmPdo($config);
|
||||
|
||||
// Pass a storage object or array of storage objects to the OAuth2 server class
|
||||
$this->server = new \OAuth2\Server($this->storage);
|
||||
|
||||
$this->server->setConfig('enforce_state', false);
|
||||
|
||||
// Add the "Authorization Code" grant type (this is where the oauth magic happens)
|
||||
$this->server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($this->storage));
|
||||
|
||||
// Add the "Client Credentials" grant type (it is the simplest of the grant types)
|
||||
//$this->server->addGrantType(new \OAuth2\GrantType\ClientCredentials($this->storage));
|
||||
|
||||
// Add the "Refresh token" grant type
|
||||
$this->server->addGrantType(new \OAuth2\GrantType\RefreshToken($this->storage));
|
||||
|
||||
$scope = new \OAuth2\Scope(array(
|
||||
'supported_scopes' => array_keys($this->scope)
|
||||
));
|
||||
$this->server->setScopeUtil($scope);
|
||||
}
|
||||
|
||||
public static function setDatabaseSource($user, $password = '', $dsn = '')
|
||||
{
|
||||
if (is_array($user)) {
|
||||
self::$dbUser = $user['username'];
|
||||
self::$dbPassword = $user['password'];
|
||||
self::$dsn = $user['dsn'];
|
||||
} else {
|
||||
self::$dbUser = $user;
|
||||
self::$dbPassword = $password;
|
||||
self::$dsn = $dsn;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @view oauth2/server/register.php
|
||||
* @format HtmlFormat
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
static::$server->getResponse(\OAuth2\Request::createFromGlobals());
|
||||
return array('queryString' => $_SERVER['QUERY_STRING']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stage 1: Client sends the user to this page
|
||||
*
|
||||
* User responds by accepting or denying
|
||||
*
|
||||
* @view oauth2/server/authorize.php
|
||||
* @format HtmlFormat
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
$clientId = \OAuth2\Request::createFromGlobals()->query('client_id', '');
|
||||
$requestedScope = \OAuth2\Request::createFromGlobals()->query('scope', '');
|
||||
$requestedScope = empty($requestedScope) ? array() : explode(' ', $requestedScope);
|
||||
|
||||
if (! empty($clientId)) {
|
||||
$clientDetails = $this->storage->getClientDetails(\OAuth2\Request::createFromGlobals()->query('client_id'));
|
||||
}
|
||||
|
||||
return array(
|
||||
'client_details' => $clientDetails,
|
||||
'query_string' => $_SERVER['QUERY_STRING'],
|
||||
'supportedScope' => $this->scope,
|
||||
'requestedScope' => $requestedScope
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stage 2: User response is captured here
|
||||
*
|
||||
* Success or failure is communicated back to the Client using the redirect
|
||||
* url provided by the client
|
||||
*
|
||||
* On success authorization code is sent along
|
||||
*
|
||||
*
|
||||
* @param bool $authorize
|
||||
* @param string $userId optional user id
|
||||
* @param bool $returnResponse optional flag to specify if the function should return the Response object
|
||||
* @return \OAuth2\ResponseInterface
|
||||
* @format JsonFormat,UploadFormat
|
||||
*/
|
||||
public function postAuthorize($authorize = false, $userId = null, $returnResponse = false)
|
||||
{
|
||||
$request = \OAuth2\Request::createFromGlobals();
|
||||
$response = new \OAuth2\Response();
|
||||
|
||||
$response = $this->server->handleAuthorizeRequest(
|
||||
$request,
|
||||
$response,
|
||||
(bool)$authorize,
|
||||
$userId
|
||||
);
|
||||
|
||||
if ($returnResponse) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
die($response->send());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stage 3: Client directly calls this api to exchange access token
|
||||
*
|
||||
* It can then use this access token to make calls to protected api
|
||||
*
|
||||
* @format JsonFormat,UploadFormat
|
||||
*/
|
||||
public function postToken()
|
||||
{
|
||||
// Handle a request for an OAuth2.0 Access Token and send the response to the client
|
||||
$request = \OAuth2\Request::createFromGlobals();
|
||||
$response = $this->server->handleTokenRequest($request);
|
||||
|
||||
/* DEPREACATED
|
||||
$token = $response->getParameters();
|
||||
if (array_key_exists('access_token', $token)) {
|
||||
$data = $this->storage->getAccessToken($token['access_token']);
|
||||
|
||||
// verify if the client is our local PM Designer client
|
||||
if ($data['client_id'] == self::getPmClientId()) {
|
||||
error_log('do stuff - is a request from local pm client');
|
||||
require_once "classes/model/PmoauthUserAccessTokens.php";
|
||||
|
||||
$userToken = new \PmoauthUserAccessTokens();
|
||||
$userToken->setAccessToken($token['access_token']);
|
||||
$userToken->setRefreshToken($token['refresh_token']);
|
||||
$userToken->setUserId($data['user_id']);
|
||||
$userToken->setSessionId(session_id());
|
||||
|
||||
$userToken->save();
|
||||
}
|
||||
}*/
|
||||
|
||||
$response->send();
|
||||
}
|
||||
|
||||
/**
|
||||
* Access verification method.
|
||||
*
|
||||
* API access will be denied when this method returns false
|
||||
*
|
||||
* @return boolean true when api access is allowed; false otherwise
|
||||
*/
|
||||
public function __isAllowed()
|
||||
{
|
||||
$request = \OAuth2\Request::createFromGlobals();
|
||||
$allowed = $this->server->verifyResourceRequest($request);
|
||||
$token = $this->server->getAccessTokenData($request);
|
||||
|
||||
self::$userId = $token['user_id'];
|
||||
|
||||
// verify if the client is not our local PM Designer client
|
||||
if ($token['client_id'] != self::getPmClientId()) {
|
||||
//return $allowed;
|
||||
}
|
||||
|
||||
// making a local session verification for PM Web Designer Client
|
||||
if (! isset($_SESSION) || ! array_key_exists('USER_LOGGED', $_SESSION)) {
|
||||
//return false;
|
||||
}
|
||||
|
||||
return $allowed;
|
||||
}
|
||||
|
||||
public static function setPmClientId($clientId)
|
||||
{
|
||||
self::$pmClientId = $clientId;
|
||||
}
|
||||
|
||||
public static function getPmClientId()
|
||||
{
|
||||
return self::$pmClientId;
|
||||
}
|
||||
|
||||
public function getServer()
|
||||
{
|
||||
return $this->server;
|
||||
}
|
||||
|
||||
public function getUserId()
|
||||
{
|
||||
return self::$userId;
|
||||
}
|
||||
|
||||
public function getScope()
|
||||
{
|
||||
return array_keys($this->scope);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user