Merge branch 'master' of bitbucket.org:colosa/processmaker

This commit is contained in:
Freddy Daniel Rojas Valda
2014-02-17 09:09:41 -04:00
11 changed files with 919 additions and 29 deletions

View File

@@ -99,6 +99,33 @@ class Pmtable extends Api
}
}
/**
* @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 \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}
*
@@ -125,6 +152,32 @@ class Pmtable extends Api
}
}
/**
* @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 \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}
*
@@ -144,5 +197,41 @@ class Pmtable extends Api
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 \BusinessModel\Table();
$response = $oReportTable->deleteTableData($pmt_uid, $rows);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}

View File

@@ -399,5 +399,47 @@ class Project extends Api
return false;
}
/**
* @url GET /:prj_uid/variables
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetVariables($prj_uid)
{
try {
$process = new \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 doGetGridVariablesByGridUid($prj_uid, $grid_uid = "")
{
try {
$process = new \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()));
}
}
}

View File

@@ -58,12 +58,12 @@ class DataBaseConnection extends Api
* @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_type {@from body} {@min 1}
* @param string $dbs_server {@from body} {@min 1}
* @param string $dbs_database_name {@from body} {@min 1}
* @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_encode {@from body} {@min 1}
* @param string $dbs_password {@from body}
* @param string $dbs_description {@from body}
* @return array
@@ -99,12 +99,12 @@ class DataBaseConnection extends Api
* @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_type {@from body} {@min 1}
* @param string $dbs_server {@from body} {@min 1}
* @param string $dbs_database_name {@from body} {@min 1}
* @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_encode {@from body} {@min 1}
* @param string $dbs_password {@from body}
* @param string $dbs_description {@from body}
* @return array

View File

@@ -0,0 +1,33 @@
<?php
namespace Services\Api\ProcessMaker;
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 \BusinessModel\DataBaseConnection();
$response = $oDBConnection->getDbEngines();
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}