Correcion de mensajes de validacion en DATABASE CONNECTION y ACTIVITYS
This commit is contained in:
@@ -9,17 +9,19 @@ class DataBaseConnection
|
||||
{
|
||||
/**
|
||||
* List of DataBaseConnections in process
|
||||
* @var string $sProcessUid. Uid for Process
|
||||
* @var string $pro_uid. Uid for Process
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDataBaseConnections($sProcessUid)
|
||||
public function getDataBaseConnections($pro_uid)
|
||||
{
|
||||
$pro_uid = $this->validateProUid($pro_uid);
|
||||
|
||||
$oDBSource = new DbSource();
|
||||
$oCriteria = $oDBSource->getCriteriaDBSList($sProcessUid);
|
||||
$oCriteria = $oDBSource->getCriteriaDBSList($pro_uid);
|
||||
|
||||
$rs = \DbSourcePeer::doSelectRS($oCriteria);
|
||||
$rs->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
|
||||
@@ -28,7 +30,7 @@ class DataBaseConnection
|
||||
$dbConnecions = array();
|
||||
while ($row = $rs->getRow()) {
|
||||
$row = array_change_key_case($row, CASE_LOWER);
|
||||
$dataDb = $this->getDataBaseConnection($sProcessUid, $row['dbs_uid']);
|
||||
$dataDb = $this->getDataBaseConnection($pro_uid, $row['dbs_uid'], false);
|
||||
$dbConnecions[] = array_change_key_case($dataDb, CASE_LOWER);
|
||||
$rs->next();
|
||||
}
|
||||
@@ -37,18 +39,26 @@ class DataBaseConnection
|
||||
|
||||
/**
|
||||
* Get data for DataBaseConnection
|
||||
* @var string $sProcessUid. Uid for Process
|
||||
* @var string $dbConnecionUid. Uid for Data Base Connection
|
||||
* @var string $pro_uid. Uid for Process
|
||||
* @var string $dbs_uid. Uid for Data Base Connection
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* return object
|
||||
*/
|
||||
public function getDataBaseConnection($sProcessUid, $dbConnecionUid)
|
||||
public function getDataBaseConnection($pro_uid, $dbs_uid, $validate = true)
|
||||
{
|
||||
try {
|
||||
if ($validate) {
|
||||
$pro_uid = $this->validateProUid($pro_uid);
|
||||
$dbs_uid = $this->validateDbsUid($dbs_uid, $pro_uid);
|
||||
}
|
||||
|
||||
G::LoadClass( 'dbConnections' );
|
||||
$dbs = new dbConnections($sProcessUid);
|
||||
$dbs = new dbConnections($pro_uid);
|
||||
$oDBConnection = new DbSource();
|
||||
$aFields = $oDBConnection->load($dbConnecionUid, $sProcessUid);
|
||||
$aFields = $oDBConnection->load($dbs_uid, $pro_uid);
|
||||
if ($aFields['DBS_PORT'] == '0') {
|
||||
$aFields['DBS_PORT'] = '';
|
||||
}
|
||||
@@ -63,7 +73,7 @@ class DataBaseConnection
|
||||
|
||||
/**
|
||||
* Save Data for DataBaseConnection
|
||||
* @var string $sProcessUid. Uid for Process
|
||||
* @var string $pro_uid. Uid for Process
|
||||
* @var string $dataDataBaseConnection. Data for DataBaseConnection
|
||||
* @var string $create. Create o Update DataBaseConnection
|
||||
* @var string $sDataBaseConnectionUid. Uid for DataBaseConnection
|
||||
@@ -73,19 +83,25 @@ class DataBaseConnection
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function saveDataBaseConnection($sProcessUid = '', $dataDBConnection = array(), $create = false)
|
||||
public function saveDataBaseConnection($pro_uid = '', $dataDBConnection = array(), $create = false)
|
||||
{
|
||||
$pro_uid = $this->validateProUid($pro_uid);
|
||||
if (!$create) {
|
||||
$dbs_uid = $dataDBConnection['dbs_uid'];
|
||||
$dbs_uid = $this->validateDbsUid($dbs_uid, $pro_uid);
|
||||
}
|
||||
|
||||
G::LoadClass('dbConnections');
|
||||
$oDBSource = new DbSource();
|
||||
$oContent = new \Content();
|
||||
$dataDBConnection = array_change_key_case($dataDBConnection, CASE_UPPER);
|
||||
|
||||
$dataDBConnection['PRO_UID'] = $sProcessUid;
|
||||
$dataDBConnection['PRO_UID'] = $pro_uid;
|
||||
|
||||
if (isset($dataDBConnection['DBS_TYPE'])) {
|
||||
$typesExists = array();
|
||||
G::LoadClass( 'dbConnections' );
|
||||
$dbs = new dbConnections($sProcessUid);
|
||||
$dbs = new dbConnections($pro_uid);
|
||||
$dbServices = $dbs->getDbServicesAvailables();
|
||||
foreach ($dbServices as $value) {
|
||||
$typesExists[] = $value['id'];
|
||||
@@ -98,7 +114,7 @@ class DataBaseConnection
|
||||
if (isset($dataDBConnection['DBS_TYPE'])) {
|
||||
$typesExists = array();
|
||||
|
||||
$dbs = new dbConnections($sProcessUid);
|
||||
$dbs = new dbConnections($pro_uid);
|
||||
$dbServices = $dbs->getDbServicesAvailables();
|
||||
foreach ($dbServices as $value) {
|
||||
$typesExists[] = $value['id'];
|
||||
@@ -142,12 +158,12 @@ class DataBaseConnection
|
||||
$newDBConnectionUid = $oDBSource->create($dataDBConnection);
|
||||
$oContent->addContent('DBS_DESCRIPTION', '', $newDBConnectionUid,
|
||||
SYS_LANG, $dataDBConnection['DBS_DESCRIPTION'] );
|
||||
$newDataDBConnection = $this->getDataBaseConnection($sProcessUid, $newDBConnectionUid);
|
||||
$newDataDBConnection = $this->getDataBaseConnection($pro_uid, $newDBConnectionUid);
|
||||
$newDataDBConnection = array_change_key_case($newDataDBConnection, CASE_LOWER);
|
||||
return $newDataDBConnection;
|
||||
} else {
|
||||
// TEST CONNECTION
|
||||
$allData = $this->getDataBaseConnection($sProcessUid, $dataDBConnection['DBS_UID']);
|
||||
$allData = $this->getDataBaseConnection($pro_uid, $dataDBConnection['DBS_UID']);
|
||||
$dataTest = array_merge($allData, $dataDBConnection);
|
||||
$resTest = $this->testConnection($dataTest);
|
||||
if (!$resTest['resp']) {
|
||||
@@ -164,22 +180,36 @@ class DataBaseConnection
|
||||
|
||||
/**
|
||||
* Delete DataBaseConnection
|
||||
* @var string $sDataBaseConnectionUID. Uid for DataBaseConnection
|
||||
* @var string $pro_uid. Uid for Process
|
||||
* @var string $dbs_uid. Uid for DataBase Connection
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteDataBaseConnection($sProcessUid, $dbConnecionUid)
|
||||
public function deleteDataBaseConnection($pro_uid, $dbs_uid)
|
||||
{
|
||||
$pro_uid = $this->validateProUid($pro_uid);
|
||||
$dbs_uid = $this->validateDbsUid($dbs_uid, $pro_uid);
|
||||
|
||||
$oDBSource = new DbSource();
|
||||
$oContent = new \Content();
|
||||
|
||||
$oDBSource->remove($dbConnecionUid, $sProcessUid);
|
||||
$oContent->removeContent( 'DBS_DESCRIPTION', "", $dbConnecionUid );
|
||||
$oDBSource->remove($dbs_uid, $pro_uid);
|
||||
$oContent->removeContent( 'DBS_DESCRIPTION', "", $dbs_uid );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test DataBase Connection
|
||||
* @var string $dataCon. Data for DataBase Connection
|
||||
* @var string $returnArray. Flag for url
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConnection($dataCon, $returnArray = false)
|
||||
{
|
||||
$resp = array();
|
||||
@@ -282,5 +312,48 @@ class DataBaseConnection
|
||||
return $resp;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate Process Uid
|
||||
* @var string $pro_uid. Uid for process
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function validateProUid ($pro_uid) {
|
||||
$pro_uid = trim($pro_uid);
|
||||
if ($pro_uid == '') {
|
||||
throw (new \Exception("The project with prj_uid: '', does not exist."));
|
||||
}
|
||||
$oProcess = new \Process();
|
||||
if (!($oProcess->processExists($pro_uid))) {
|
||||
throw (new \Exception("The project with prj_uid: '$pro_uid', does not exist."));
|
||||
}
|
||||
return $pro_uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate DataBase Connection Uid
|
||||
* @var string $pro_uid. Uid for process
|
||||
* @var string $dbs_uid. Uid for process
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function validateDbsUid ($dbs_uid, $pro_uid) {
|
||||
$dbs_uid = trim($dbs_uid);
|
||||
if ($dbs_uid == '') {
|
||||
throw (new \Exception("The database connection with dbs_uid: '', does not exist."));
|
||||
}
|
||||
$oDBSource = new DbSource();
|
||||
if (!($oDBSource->Exists($dbs_uid, $pro_uid))) {
|
||||
throw (new \Exception("The database connection with dbs_uid: '$dbs_uid', does not exist."));
|
||||
}
|
||||
return $dbs_uid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -85,23 +85,24 @@ class Task
|
||||
|
||||
/**
|
||||
* Get all properties of an Task
|
||||
* @var string $prj_uid. Uid for Process
|
||||
* @var string $act_uid. Uid for Activity
|
||||
* @var boolean $keyCaseToLower. Flag for case lower
|
||||
*
|
||||
* @param string $taskUid
|
||||
* @param bool $keyCaseToLower
|
||||
*
|
||||
* return array Return data array with all properties of an Task
|
||||
*
|
||||
* @access public
|
||||
* return object
|
||||
*/
|
||||
public function getProperties($taskUid, $keyCaseToLower = false, $groupData = true)
|
||||
public function getProperties($prj_uid, $act_uid, $keyCaseToLower = false, $groupData = true)
|
||||
{
|
||||
try {
|
||||
$prj_uid = $this->validateProUid($prj_uid);
|
||||
$act_uid = $this->validateActUid($prj_uid, $act_uid);
|
||||
|
||||
//G::LoadClass("configuration");
|
||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "class.configuration.php");
|
||||
|
||||
$task = new \Task();
|
||||
|
||||
$this->validateTask($taskUid);
|
||||
$this->validateActUid($taskUid);
|
||||
$arrayDataAux = $task->load($taskUid);
|
||||
|
||||
//$arrayDataAux["INDEX"] = 0;
|
||||
@@ -216,26 +217,26 @@ class Task
|
||||
|
||||
/**
|
||||
* Update properties of an Task
|
||||
* @var string $prj_uid. Uid for Process
|
||||
* @var string $act_uid. Uid for Activity
|
||||
* @var array $arrayProperty. Data for properties of Activity
|
||||
*
|
||||
* @param string $taskUid
|
||||
* @param string $processUid
|
||||
* @param array $arrayProperty
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* return array
|
||||
*
|
||||
* @access public
|
||||
* return object
|
||||
*/
|
||||
public function updateProperties($taskUid, $processUid, $arrayProperty)
|
||||
public function updateProperties($prj_uid, $act_uid, $arrayProperty)
|
||||
{
|
||||
//Copy of processmaker/workflow/engine/methods/tasks/tasks_Ajax.php //case "saveTaskData":
|
||||
try {
|
||||
if (isset($arrayProperty['properties'])) {
|
||||
$arrayProperty = array_change_key_case($arrayProperty['properties'], CASE_UPPER);
|
||||
}
|
||||
$arrayProperty["TAS_UID"] = $taskUid;
|
||||
$arrayProperty["PRO_UID"] = $processUid;
|
||||
$this->validateProUid($arrayProperty["PRO_UID"]);
|
||||
$this->validateTask($arrayProperty["TAS_UID"]);
|
||||
$prj_uid = $this->validateProUid($prj_uid);
|
||||
$act_uid = $this->validateActUid($prj_uid, $act_uid);
|
||||
$arrayProperty["TAS_UID"] = $act_uid;
|
||||
$arrayProperty["PRO_UID"] = $prj_uid;
|
||||
|
||||
$task = new \Task();
|
||||
$aTaskInfo = $task->load($arrayProperty["TAS_UID"]);
|
||||
@@ -306,20 +307,24 @@ class Task
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a Task
|
||||
* Delete Activity
|
||||
* @var string $prj_uid. Uid for Process
|
||||
* @var string $act_uid. Uid for Activity
|
||||
*
|
||||
* @param string $taskUid
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* return void
|
||||
*
|
||||
* @access public
|
||||
* return object
|
||||
*/
|
||||
public function deleteTask($taskUid)
|
||||
public function deleteTask($prj_uid, $act_uid)
|
||||
{
|
||||
try {
|
||||
$prj_uid = $this->validateProUid($prj_uid);
|
||||
$act_uid = $this->validateActUid($prj_uid, $act_uid);
|
||||
|
||||
G::LoadClass('tasks');
|
||||
$tasks = new \Tasks();
|
||||
$tasks->deleteTask($taskUid);
|
||||
$tasks->deleteTask($act_uid);
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
@@ -1738,32 +1743,46 @@ class Task
|
||||
}
|
||||
}
|
||||
|
||||
public function validateProUid ($proUid) {
|
||||
$proUid = trim($proUid);
|
||||
if ($proUid == '') {
|
||||
throw (new \Exception('This process doesn\'t exist!'));
|
||||
/**
|
||||
* Validate Process Uid
|
||||
* @var string $pro_uid. Uid for process
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function validateProUid ($pro_uid) {
|
||||
$pro_uid = trim($pro_uid);
|
||||
if ($pro_uid == '') {
|
||||
throw (new \Exception("The project with prj_uid: '', does not exist."));
|
||||
}
|
||||
|
||||
$oProcess = new \Process();
|
||||
if (!($oProcess->processExists($proUid))) {
|
||||
throw (new \Exception('This process doesn\'t exist!'));
|
||||
if (!($oProcess->processExists($pro_uid))) {
|
||||
throw (new \Exception("The project with prj_uid: '$pro_uid', does not exist."));
|
||||
}
|
||||
|
||||
return $proUid;
|
||||
return $pro_uid;
|
||||
}
|
||||
|
||||
public function validateTask($taskUid) {
|
||||
$taskUid = trim($taskUid);
|
||||
if ($taskUid == '') {
|
||||
throw (new \Exception('This task doesn\'t exist!'));
|
||||
/**
|
||||
* Validate Task Uid
|
||||
* @var string $act_uid. Uid for task
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function validateActUid($act_uid) {
|
||||
$act_uid = trim($act_uid);
|
||||
if ($act_uid == '') {
|
||||
throw (new \Exception("The project with act_uid: '', does not exist."));
|
||||
}
|
||||
|
||||
$oTask = new \Task();
|
||||
if (!($oTask->taskExists($taskUid))) {
|
||||
throw (new \Exception('This task doesn\'t exist!'));
|
||||
if (!($oTask->taskExists($act_uid))) {
|
||||
throw (new \Exception("The project with act_uid: '$act_uid', does not exist."));
|
||||
}
|
||||
|
||||
return $taskUid;
|
||||
return $act_uid;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,13 +12,13 @@ use \Luracast\Restler\RestException;
|
||||
class Activity extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $projectUid {@min 32} {@max 32}
|
||||
* @param string $activityUid {@min 32} {@max 32}
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param string $act_uid {@min 32} {@max 32}
|
||||
* @param string $filter {@choice definition,,properties}
|
||||
*
|
||||
* @url GET /:projectUid/activity/:activityUid
|
||||
* @url GET /:prj_uid/activity/:act_uid
|
||||
*/
|
||||
public function doGetProjectActivity($projectUid, $activityUid, $filter = '')
|
||||
public function doGetProjectActivity($prj_uid, $act_uid, $filter = '')
|
||||
{
|
||||
try {
|
||||
$hiddenFields = array('tas_start', 'pro_uid', 'tas_uid', 'tas_delay_type', 'tas_temporizer', 'tas_alert',
|
||||
@@ -41,7 +41,7 @@ class Activity extends Api
|
||||
if ($filter == '' || $filter == 'properties') {
|
||||
// PROPERTIES
|
||||
$task = new \BusinessModel\Task();
|
||||
$properties = $task->getProperties($activityUid, true, false);
|
||||
$properties = $task->getProperties($prj_uid, $act_uid, true, false);
|
||||
foreach ($properties as $key => $value) {
|
||||
if (in_array($key, $hiddenFields)) {
|
||||
unset($properties[$key]);
|
||||
@@ -57,20 +57,20 @@ class Activity extends Api
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 32} {@max 32}
|
||||
* @param string $activityUid {@min 32} {@max 32}
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param string $act_uid {@min 32} {@max 32}
|
||||
* @param ActivityPropertiesStructure $properties {@from body}
|
||||
*
|
||||
* @url PUT /:projectUid/activity/:activityUid
|
||||
* @url PUT /:prj_uid/activity/:act_uid
|
||||
*/
|
||||
public function doPutProjectActivity($projectUid, $activityUid, ActivityPropertiesStructure $properties, $request_data = array())
|
||||
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 \BusinessModel\Task();
|
||||
$properties = $task->updateProperties($activityUid, $projectUid, $request_data);
|
||||
$properties = $task->updateProperties($prj_uid, $act_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
@@ -79,16 +79,16 @@ class Activity extends Api
|
||||
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 32} {@max 32}
|
||||
* @param string $activityUid {@min 32} {@max 32}
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param string $act_uid {@min 32} {@max 32}
|
||||
*
|
||||
* @url DELETE /:projectUid/activity/:activityUid
|
||||
* @url DELETE /:prj_uid/activity/:act_uid
|
||||
*/
|
||||
public function doDeleteProjectActivity($projectUid, $activityUid)
|
||||
public function doDeleteProjectActivity($prj_uid, $act_uid)
|
||||
{
|
||||
try {
|
||||
$task = new \BusinessModel\Task();
|
||||
$task->deleteTask($activityUid);
|
||||
$task->deleteTask($prj_uid, $act_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
|
||||
@@ -15,19 +15,19 @@ use \Luracast\Restler\RestException;
|
||||
class DataBaseConnection extends Api
|
||||
{
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:projectUid/database-connections
|
||||
* @url GET /:prj_uid/database-connections
|
||||
*/
|
||||
public function doGetDataBaseConnections($projectUid)
|
||||
public function doGetDataBaseConnections($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oDBConnection = new \BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->getDataBaseConnections($projectUid);
|
||||
$response = $oDBConnection->getDataBaseConnections($prj_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
@@ -35,19 +35,19 @@ class DataBaseConnection extends Api
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $dbConnecionUid {@min 1} {@max 32}
|
||||
* @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 /:projectUid/database-connection/:dbConnecionUid
|
||||
* @url GET /:prj_uid/database-connection/:dbs_uid
|
||||
*/
|
||||
public function doGetDataBaseConnection($projectUid, $dbConnecionUid)
|
||||
public function doGetDataBaseConnection($prj_uid, $dbs_uid)
|
||||
{
|
||||
try {
|
||||
$oDBConnection = new \BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->getDataBaseConnection($projectUid, $dbConnecionUid);
|
||||
$response = $oDBConnection->getDataBaseConnection($prj_uid, $dbs_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
@@ -55,7 +55,7 @@ class DataBaseConnection extends Api
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @param string $dbs_type {@from body}
|
||||
@@ -71,10 +71,10 @@ class DataBaseConnection extends Api
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url POST /:projectUid/database-connection/test
|
||||
* @url POST /:prj_uid/database-connection/test
|
||||
*/
|
||||
public function doPostTestDataBaseConnection(
|
||||
$projectUid,
|
||||
$prj_uid,
|
||||
$request_data,
|
||||
$dbs_type,
|
||||
$dbs_server,
|
||||
@@ -87,7 +87,7 @@ class DataBaseConnection extends Api
|
||||
) {
|
||||
try {
|
||||
$oDBConnection = new \BusinessModel\DataBaseConnection();
|
||||
$request_data['pro_uid'] = $projectUid;
|
||||
$request_data['pro_uid'] = $prj_uid;
|
||||
$response = $oDBConnection->testConnection($request_data, true);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
@@ -96,7 +96,7 @@ class DataBaseConnection extends Api
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @param string $dbs_type {@from body}
|
||||
@@ -112,11 +112,11 @@ class DataBaseConnection extends Api
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url POST /:projectUid/database-connection
|
||||
* @url POST /:prj_uid/database-connection
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostDataBaseConnection(
|
||||
$projectUid,
|
||||
$prj_uid,
|
||||
$request_data,
|
||||
$dbs_type,
|
||||
$dbs_server,
|
||||
@@ -129,7 +129,7 @@ class DataBaseConnection extends Api
|
||||
) {
|
||||
try {
|
||||
$oDBConnection = new \BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->saveDataBaseConnection($projectUid, $request_data, true);
|
||||
$response = $oDBConnection->saveDataBaseConnection($prj_uid, $request_data, true);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
@@ -137,8 +137,8 @@ class DataBaseConnection extends Api
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $dbConnecionUid {@min 1} {@max 32}
|
||||
* @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}
|
||||
@@ -154,11 +154,11 @@ class DataBaseConnection extends Api
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url PUT /:projectUid/database-connection/:dbConnecionUid
|
||||
* @url PUT /:prj_uid/database-connection/:dbs_uid
|
||||
*/
|
||||
public function doPutDataBaseConnection(
|
||||
$projectUid,
|
||||
$dbConnecionUid,
|
||||
$prj_uid,
|
||||
$dbs_uid,
|
||||
$request_data,
|
||||
$dbs_type,
|
||||
$dbs_server,
|
||||
@@ -170,29 +170,29 @@ class DataBaseConnection extends Api
|
||||
$dbs_description = ''
|
||||
) {
|
||||
try {
|
||||
$request_data['dbs_uid'] = $dbConnecionUid;
|
||||
$request_data['dbs_uid'] = $dbs_uid;
|
||||
$oDBConnection = new \BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->saveDataBaseConnection($projectUid, $request_data);
|
||||
$response = $oDBConnection->saveDataBaseConnection($prj_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $projectUid {@min 1} {@max 32}
|
||||
* @param string $dbConnecionUid {@min 1} {@max 32}
|
||||
* @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 /:projectUid/database-connection/:dbConnecionUid
|
||||
* @url DELETE /:prj_uid/database-connection/:dbs_uid
|
||||
*/
|
||||
public function doDeleteDataBaseConnection($projectUid, $dbConnecionUid)
|
||||
public function doDeleteDataBaseConnection($prj_uid, $dbs_uid)
|
||||
{
|
||||
try {
|
||||
$oDBConnection = new \BusinessModel\DataBaseConnection();
|
||||
$response = $oDBConnection->deleteDataBaseConnection($projectUid, $dbConnecionUid);
|
||||
$response = $oDBConnection->deleteDataBaseConnection($prj_uid, $dbs_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user