Correccion events y Activity.. Post de ReportTable
This commit is contained in:
414
workflow/engine/src/BusinessModel/ReportTable.php
Normal file
414
workflow/engine/src/BusinessModel/ReportTable.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -101,6 +101,7 @@ class Task
|
||||
|
||||
$task = new \Task();
|
||||
|
||||
$this->validateTask($taskUid);
|
||||
$arrayDataAux = $task->load($taskUid);
|
||||
|
||||
//$arrayDataAux["INDEX"] = 0;
|
||||
@@ -233,17 +234,18 @@ class Task
|
||||
}
|
||||
$arrayProperty["TAS_UID"] = $taskUid;
|
||||
$arrayProperty["PRO_UID"] = $processUid;
|
||||
$this->validateProUid($arrayProperty["PRO_UID"]);
|
||||
$this->validateTask($arrayProperty["TAS_UID"]);
|
||||
|
||||
$task = new \Task();
|
||||
$aTaskInfo = $task->load($arrayProperty["TAS_UID"]);
|
||||
|
||||
$arrayResult = array();
|
||||
|
||||
/**
|
||||
* routine to replace @amp@ by &
|
||||
* that why the char "&" can't be passed by XmlHttpRequest directly
|
||||
* @autor erik <erik@colosa.com>
|
||||
*/
|
||||
if ($arrayProperty["TAS_SELFSERVICE_TIMEOUT"] == "1") {
|
||||
if (!is_numeric($arrayProperty["TAS_SELFSERVICE_TIME"]) || $arrayProperty["TAS_SELFSERVICE_TIME"]=='') {
|
||||
throw (new \Exception("Invalid value specified for 'tas_selfservice_time'"));
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($arrayProperty as $k => $v) {
|
||||
$arrayProperty[$k] = str_replace("@amp@", "&", $v);
|
||||
@@ -288,8 +290,6 @@ class Task
|
||||
if (trim($arrayProperty["TAS_GROUP_VARIABLE"]) == "") {
|
||||
$arrayProperty["TAS_GROUP_VARIABLE"] = "@@SYS_GROUP_TO_BE_ASSIGNED";
|
||||
}
|
||||
} else {
|
||||
$arrayProperty["TAS_GROUP_VARIABLE"] = "";
|
||||
}
|
||||
|
||||
$result = $task->update($arrayProperty);
|
||||
@@ -1585,5 +1585,33 @@ class Task
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function validateProUid ($proUid) {
|
||||
$proUid = trim($proUid);
|
||||
if ($proUid == '') {
|
||||
throw (new \Exception('This process doesn\'t exist!'));
|
||||
}
|
||||
|
||||
$oProcess = new \Process();
|
||||
if (!($oProcess->processExists($proUid))) {
|
||||
throw (new \Exception('This process doesn\'t exist!'));
|
||||
}
|
||||
|
||||
return $proUid;
|
||||
}
|
||||
|
||||
public function validateTask($taskUid) {
|
||||
$taskUid = trim($taskUid);
|
||||
if ($taskUid == '') {
|
||||
throw (new \Exception('This task doesn\'t exist!'));
|
||||
}
|
||||
|
||||
$oTask = new \Task();
|
||||
if (!($oTask->taskExists($taskUid))) {
|
||||
throw (new \Exception('This task doesn\'t exist!'));
|
||||
}
|
||||
|
||||
return $taskUid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,8 +56,6 @@ class Activity extends Api
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 32} {@max 32}
|
||||
* @param string $activityUid {@min 32} {@max 32}
|
||||
|
||||
@@ -85,7 +85,7 @@ class Event extends Api
|
||||
* @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_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}
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
namespace Services\Api\ProcessMaker\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 $projectUid {@min 1} {@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:projectUid/report-tables
|
||||
*/
|
||||
public function doGetReportTables($projectUid)
|
||||
{
|
||||
try {
|
||||
$oReportTable = new \BusinessModel\ReportTable();
|
||||
$response = $oReportTable->getReportTables($projectUid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $rp_uid {@min 1} {@max 32}
|
||||
* @return array
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /:projectUid/report-table/:rp_uid
|
||||
*/
|
||||
public function doGetReportTable($projectUid, $rp_uid)
|
||||
{
|
||||
try {
|
||||
$oReportTable = new \BusinessModel\ReportTable();
|
||||
$response = $oReportTable->getReportTable($projectUid, $rp_uid);
|
||||
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 $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}
|
||||
* @param string $rep_tab_grid {@from body}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url POST /:projectUid/report-table
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostReportTable(
|
||||
$projectUid,
|
||||
$request_data,
|
||||
$rep_tab_name,
|
||||
$rep_tab_dsc,
|
||||
$rep_tab_connection,
|
||||
$rep_tab_type,
|
||||
$rep_tab_grid = ''
|
||||
) {
|
||||
try {
|
||||
$oReportTable = new \BusinessModel\ReportTable();
|
||||
$response = $oReportTable->createReportTable($projectUid, $request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $rp_uid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @param string $dbs_type {@from body}
|
||||
* @param string $dbs_server {@from body}
|
||||
* @param string $dbs_database_name {@from body}
|
||||
* @param string $dbs_username {@from body}
|
||||
* @param string $dbs_port {@from body}
|
||||
* @param string $dbs_encode {@from body}
|
||||
* @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 /:projectUid/report-table/:rp_uid
|
||||
*/
|
||||
public function doPutReportTable(
|
||||
$projectUid,
|
||||
$rp_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'] = $rp_uid;
|
||||
$oReportTable = new \BusinessModel\ReportTable();
|
||||
$response = $oReportTable->saveReportTable($projectUid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $rp_uid {@min 1} {@max 32}
|
||||
* @return void
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url DELETE /:projectUid/report-table/:rp_uid
|
||||
*/
|
||||
public function doDeleteReportTable($projectUid, $rp_uid)
|
||||
{
|
||||
try {
|
||||
$oReportTable = new \BusinessModel\ReportTable();
|
||||
$response = $oReportTable->deleteReportTable($projectUid, $rp_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user