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
@@ -0,0 +1,414 @@
|
||||
<?php
|
||||
namespace BusinessModel;
|
||||
|
||||
use \G;
|
||||
use \AdditionalTables;
|
||||
use \Fields;
|
||||
|
||||
class ReportTable
|
||||
{
|
||||
/**
|
||||
* List of ReportTables in process
|
||||
* @var string $sProcessUid. Uid for Process
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getReportTables($sProcessUid)
|
||||
{
|
||||
$oDBSource = new DbSource();
|
||||
$oCriteria = $oDBSource->getCriteriaDBSList($sProcessUid);
|
||||
|
||||
$rs = \DbSourcePeer::doSelectRS($oCriteria);
|
||||
$rs->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
|
||||
$rs->next();
|
||||
|
||||
$dbConnecions = array();
|
||||
while ($row = $rs->getRow()) {
|
||||
$row = array_change_key_case($row, CASE_LOWER);
|
||||
$dataDb = $this->getReportTable($sProcessUid, $row['dbs_uid']);
|
||||
$dbConnecions[] = array_change_key_case($dataDb, CASE_LOWER);
|
||||
$rs->next();
|
||||
}
|
||||
return $dbConnecions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data for ReportTable
|
||||
* @var string $sProcessUid. Uid for Process
|
||||
* @var string $dbConnecionUid. Uid for Data Base Connection
|
||||
*
|
||||
* return object
|
||||
*/
|
||||
public function getReportTable($sProcessUid, $dbConnecionUid)
|
||||
{
|
||||
try {
|
||||
G::LoadClass( 'dbConnections' );
|
||||
$dbs = new dbConnections($sProcessUid);
|
||||
$oDBConnection = new DbSource();
|
||||
$aFields = $oDBConnection->load($dbConnecionUid, $sProcessUid);
|
||||
if ($aFields['DBS_PORT'] == '0') {
|
||||
$aFields['DBS_PORT'] = '';
|
||||
}
|
||||
$aFields['DBS_PASSWORD'] = $dbs->getPassWithoutEncrypt($aFields);
|
||||
|
||||
$response = array_change_key_case($aFields, CASE_LOWER);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Data for ReportTable
|
||||
* @var string $processUid. Uid for Process
|
||||
* @var string $dataReportTable. Data for ReportTable
|
||||
* @var string $create. Create o Update ReportTable
|
||||
* @var string $sReportTableUid. Uid for ReportTable
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function createReportTable($processUid, $dataReportTable)
|
||||
{
|
||||
$dataValidate = array();
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$oFields = new Fields();
|
||||
|
||||
$dataValidate = array_change_key_case($dataReportTable, CASE_UPPER);
|
||||
|
||||
$dataValidate['PRO_UID'] = trim($processUid);
|
||||
$this->validateProUid($dataValidate['PRO_UID']);
|
||||
|
||||
$repTabClassName = $oAdditionalTables->getPHPName($dataValidate['REP_TAB_NAME']);
|
||||
$columns = $dataValidate['COLUMNS'];
|
||||
|
||||
|
||||
// Reserved Words Table, Field, Sql
|
||||
$reservedWords = array ('ALTER','CLOSE','COMMIT','CREATE','DECLARE','DELETE',
|
||||
'DROP','FETCH','FUNCTION','GRANT','INDEX','INSERT','OPEN','REVOKE','ROLLBACK',
|
||||
'SELECT','SYNONYM','TABLE','UPDATE','VIEW','APP_UID','ROW','PMTABLE');
|
||||
$reservedWordsPhp = array ('case','catch','cfunction','class','clone','const','continue',
|
||||
'declare','default','do','else','elseif','enddeclare','endfor','endforeach','endif',
|
||||
'endswitch','endwhile','extends','final','for','foreach','function','global','goto',
|
||||
'if','implements','interface','instanceof','private','namespace','new','old_function',
|
||||
'or','throw','protected','public','static','switch','xor','try','use','var','while');
|
||||
$reservedWordsSql = G::reservedWordsSql();
|
||||
|
||||
$defaultColumns = $this->getReportTableDefaultColumns($data['REP_TAB_TYPE']);
|
||||
$columns = array_merge( $defaultColumns, $columns );
|
||||
|
||||
// validations
|
||||
if (is_array( $oAdditionalTables->loadByName( $data['REP_TAB_NAME'] ) )) {
|
||||
throw new \Exception(G::loadTranslation('ID_PMTABLE_ALREADY_EXISTS', array($data['REP_TAB_NAME'])));
|
||||
}
|
||||
|
||||
if (in_array( strtoupper( $data["REP_TAB_NAME"] ), $reservedWords ) ||
|
||||
in_array( strtoupper( $data["REP_TAB_NAME"] ), $reservedWordsSql )) {
|
||||
throw (new \Exception(G::LoadTranslation("ID_PMTABLE_INVALID_NAME", array($data["REP_TAB_NAME"]))));
|
||||
}
|
||||
|
||||
|
||||
//backward compatility
|
||||
$columnsStd = array();
|
||||
foreach ($columns as $i => $column) {
|
||||
if (in_array(strtoupper($columns[$i]['field_name']), $reservedWordsSql) ||
|
||||
in_array( strtolower( $columns[$i]['field_name']), $reservedWordsPhp )) {
|
||||
throw (new \Exception(G::LoadTranslation("ID_PMTABLE_INVALID_FIELD_NAME", array($columns[$i]['field_name']))));
|
||||
}
|
||||
|
||||
switch ($column['field_type']) {
|
||||
case 'INT':
|
||||
$columns[$i]['field_type'] = 'INTEGER';
|
||||
break;
|
||||
case 'TEXT':
|
||||
$columns[$i]['field_type'] = 'LONGVARCHAR';
|
||||
break;
|
||||
// propel DATETIME equivalent is TIMESTAMP
|
||||
case 'DATETIME':
|
||||
$columns[$i]['field_type'] = 'TIMESTAMP';
|
||||
break;
|
||||
}
|
||||
|
||||
// VALIDATIONS
|
||||
if ($columns[$i]['field_autoincrement']) {
|
||||
$typeCol = $columns[$i]['field_type'];
|
||||
if (! ($typeCol === 'INTEGER' || $typeCol === 'TINYINT' || $typeCol === 'SMALLINT' || $typeCol === 'BIGINT')) {
|
||||
$columns[$i]['field_autoincrement'] = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$temp = new \stdClass();
|
||||
foreach ($column as $key => $valCol) {
|
||||
eval('$temp->' . $key . " = '" . $valCol . "';");
|
||||
}
|
||||
$temp->uid = (isset($temp->uid)) ? $temp->uid : '';
|
||||
$temp->_index = (isset($temp->_index)) ? $temp->_index : '';
|
||||
$temp->field_uid = (isset($temp->field_uid)) ? $temp->field_uid : '';
|
||||
$temp->field_dyn = (isset($temp->field_dyn)) ? $temp->field_dyn : '';
|
||||
$temp->field_filter = (isset($temp->field_filter)) ? $temp->field_filter : '';
|
||||
$temp->field_autoincrement = (isset($temp->field_autoincrement)) ? $temp->field_autoincrement : '';
|
||||
$columnsStd[$i] = $temp;
|
||||
}
|
||||
|
||||
G::LoadClass("pmTable");
|
||||
$pmTable = new \pmTable($dataValidate['REP_TAB_NAME']);
|
||||
$pmTable->setDataSource($dataValidate['REP_TAB_CONNECTION']);
|
||||
$pmTable->setColumns($columnsStd);
|
||||
$pmTable->setAlterTable(true);
|
||||
$pmTable->build();
|
||||
$buildResult = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
// Updating additional table struture information
|
||||
$addTabData = array(
|
||||
'ADD_TAB_UID' => $dataValidate['REP_TAB_UID'],
|
||||
'ADD_TAB_NAME' => $dataValidate['REP_TAB_NAME'],
|
||||
'ADD_TAB_CLASS_NAME' => $repTabClassName,
|
||||
'ADD_TAB_DESCRIPTION' => $dataValidate['REP_TAB_DSC'],
|
||||
'ADD_TAB_PLG_UID' => '',
|
||||
'DBS_UID' => ($dataValidate['REP_TAB_CONNECTION'] ? $dataValidate['REP_TAB_CONNECTION'] : 'workflow'),
|
||||
'PRO_UID' => $dataValidate['PRO_UID'],
|
||||
'ADD_TAB_TYPE' => $dataValidate['REP_TAB_TYPE'],
|
||||
'ADD_TAB_GRID' => $dataValidate['REP_TAB_GRID']
|
||||
);
|
||||
//new report table
|
||||
//create record
|
||||
$addTabUid = $oAdditionalTables->create( $addTabData );
|
||||
|
||||
// Updating pmtable fields
|
||||
foreach ($columnsStd as $i => $column) {
|
||||
$field = array (
|
||||
'FLD_UID' => $column['uid'],
|
||||
'FLD_INDEX' => $i,
|
||||
'ADD_TAB_UID' => $addTabUid,
|
||||
'FLD_NAME' => $column['field_name'],
|
||||
'FLD_DESCRIPTION' => $column['field_label'],
|
||||
'FLD_TYPE' => $column['field_type'],
|
||||
'FLD_SIZE' => $column['field_size'] == '' ? null : $column['field_size'],
|
||||
'FLD_NULL' => $column['field_null'] ? 1 : 0,
|
||||
'FLD_AUTO_INCREMENT' => $column['field_autoincrement'] ? 1 : 0,
|
||||
'FLD_KEY' => $column['field_key'] ? 1 : 0,
|
||||
'FLD_FOREIGN_KEY' => 0,
|
||||
'FLD_FOREIGN_KEY_TABLE' => '',
|
||||
'FLD_DYN_NAME' => $column['field_dyn'],
|
||||
'FLD_DYN_UID' => $column['field_uid'],
|
||||
'FLD_FILTER' => (isset($column['field_filter']) && $column['field_filter']) ? 1 : 0
|
||||
);
|
||||
$oFields->create( $field );
|
||||
}
|
||||
|
||||
try {
|
||||
$oAdditionalTables->populateReportTable(
|
||||
$data['REP_TAB_NAME'],
|
||||
$pmTable->getDataSource(),
|
||||
$data['REP_TAB_TYPE'],
|
||||
$data['PRO_UID'],
|
||||
$data['REP_TAB_GRID'],
|
||||
$addTabUid
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
$result->message = $result->msg = $e->getMessage();
|
||||
}
|
||||
die('funciona cochalo');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete ReportTable
|
||||
* @var string $sReportTableUID. Uid for ReportTable
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteReportTable($sProcessUid, $reportTableUid)
|
||||
{
|
||||
$at = new AdditionalTables();
|
||||
$table = $at->load( $reportTableUid );
|
||||
|
||||
if (! isset( $table )) {
|
||||
require_once 'classes/model/ReportTable.php';
|
||||
$rtOld = new ReportTable();
|
||||
$existReportTableOld = $rtOld->load( $reportTableUid );
|
||||
if (count($existReportTableOld) == 0) {
|
||||
throw new Exception( G::LoadTranslation('ID_TABLE_NOT_EXIST_SKIPPED') );
|
||||
}
|
||||
}
|
||||
$at->deleteAll( $reportTableUid );
|
||||
}
|
||||
|
||||
|
||||
public function testConnection($dataCon)
|
||||
{
|
||||
$resp = array();
|
||||
$resp['resp'] = false;
|
||||
|
||||
G::LoadClass( 'net' );
|
||||
$Server = new \NET($dataCon['DBS_SERVER']);
|
||||
|
||||
// STEP 1 : Resolving Host Name
|
||||
if ($Server->getErrno() != 0) {
|
||||
$resp['message'] = "Error Testting Connection: Resolving Host Name FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
|
||||
// STEP 2 : Checking port
|
||||
$Server->scannPort($dataCon['DBS_PORT']);
|
||||
if ($Server->getErrno() != 0) {
|
||||
$resp['message'] = "Error Testting Connection: Checking port FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
|
||||
// STEP 3 : Trying to connect to host
|
||||
$Server->loginDbServer($dataCon['DBS_USERNAME'], $dataCon['DBS_PASSWORD']);
|
||||
$Server->setDataBase($dataCon['DBS_DATABASE_NAME'], $dataCon['DBS_PORT']);
|
||||
if ($Server->errno == 0) {
|
||||
$response = $Server->tryConnectServer($dataCon['DBS_TYPE']);
|
||||
if ($response->status != 'SUCCESS') {
|
||||
$resp['message'] = "Error Testting Connection: Trying to connect to host FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
} else {
|
||||
$resp['message'] = "Error Testting Connection: Trying to connect to host FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
|
||||
// STEP 4 : Trying to open database
|
||||
$Server->loginDbServer($dataCon['DBS_USERNAME'], $dataCon['DBS_PASSWORD']);
|
||||
$Server->setDataBase($dataCon['DBS_DATABASE_NAME'], $dataCon['DBS_PORT']);
|
||||
if ($Server->errno == 0) {
|
||||
$response = $Server->tryConnectServer($dataCon['DBS_TYPE']);
|
||||
if ($response->status == 'SUCCESS') {
|
||||
$response = $Server->tryOpenDataBase($dataCon['DBS_TYPE']);
|
||||
if ($response->status != 'SUCCESS') {
|
||||
$resp['message'] = "Error Testting Connection: Trying to open database FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
} else {
|
||||
$resp['message'] = "Error Testting Connection: Trying to open database FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
} else {
|
||||
$resp['message'] = "Error Testting Connection: Trying to open database FAILED : " . $Server->error;
|
||||
return $resp;
|
||||
}
|
||||
|
||||
// CORRECT CONNECTION
|
||||
$resp['resp'] = true;
|
||||
return $resp;
|
||||
}
|
||||
|
||||
|
||||
protected function getReportTableDefaultColumns ($type = 'NORMAL')
|
||||
{
|
||||
$defaultColumns = array ();
|
||||
$application = array(
|
||||
'uid' => '',
|
||||
'field_dyn' => '',
|
||||
'field_uid' => '',
|
||||
'field_name' => 'APP_UID',
|
||||
'field_label' => 'APP_UID',
|
||||
'field_type' => 'VARCHAR',
|
||||
'field_size' => 32,
|
||||
'field_dyn' => '',
|
||||
'field_key' => 1,
|
||||
'field_null' => 0,
|
||||
'field_filter' => false,
|
||||
'field_autoincrement' => false
|
||||
); //APPLICATION KEY
|
||||
|
||||
array_push( $defaultColumns, $application );
|
||||
|
||||
$application = array(
|
||||
'uid' => '',
|
||||
'field_dyn' => '',
|
||||
'field_uid' => '',
|
||||
'field_name' => 'APP_NUMBER',
|
||||
'field_label' => 'APP_NUMBER',
|
||||
'field_type' => 'INTEGER',
|
||||
'field_size' => 11,
|
||||
'field_dyn' => '',
|
||||
'field_key' => 0,
|
||||
'field_null' => 0,
|
||||
'field_filter' => false,
|
||||
'field_autoincrement' => false
|
||||
); //APP_NUMBER
|
||||
|
||||
array_push( $defaultColumns, $application );
|
||||
|
||||
$application = array(
|
||||
'uid' => '',
|
||||
'field_dyn' => '',
|
||||
'field_uid' => '',
|
||||
'field_name' => 'APP_STATUS',
|
||||
'field_label' => 'APP_STATUS',
|
||||
'field_type' => 'VARCHAR',
|
||||
'field_size' => 10,
|
||||
'field_dyn' => '',
|
||||
'field_key' => 0,
|
||||
'field_null' => 0,
|
||||
'field_filter' => false,
|
||||
'field_autoincrement' => false
|
||||
); //APP_STATUS
|
||||
|
||||
array_push( $defaultColumns, $application );
|
||||
|
||||
//if it is a grid report table
|
||||
if ($type == 'GRID') {
|
||||
//GRID INDEX
|
||||
$gridIndex = array(
|
||||
'uid' => '',
|
||||
'field_dyn' => '',
|
||||
'field_uid' => '',
|
||||
'field_name' => 'ROW',
|
||||
'field_label' => 'ROW',
|
||||
'field_type' => 'INTEGER',
|
||||
'field_size' => '11',
|
||||
'field_dyn' => '',
|
||||
'field_key' => 1,
|
||||
'field_null' => 0,
|
||||
'field_filter' => false,
|
||||
'field_autoincrement' => false
|
||||
);
|
||||
array_push( $defaultColumns, $gridIndex );
|
||||
}
|
||||
|
||||
return $defaultColumns;
|
||||
}
|
||||
|
||||
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 arrayToObject($d) {
|
||||
if (is_array($d)) {
|
||||
/*
|
||||
* Return array converted to object
|
||||
* Using __FUNCTION__ (Magic constant)
|
||||
* for recursive call
|
||||
*/
|
||||
return (object) array_map(__FUNCTION__, $d);
|
||||
}
|
||||
else {
|
||||
// Return object
|
||||
return $d;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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