I add new UnitTest for REST Services
This commit is contained in:
176
tests/unit/backend/services/CalendarDefinitionTest.php
Normal file
176
tests/unit/backend/services/CalendarDefinitionTest.php
Normal file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
if (!defined('PATH_SEP')) {
|
||||
define('PATH_SEP', '/');
|
||||
}
|
||||
|
||||
require_once PATH_HOME . 'engine/services/rest/crud/CalendarDefinition.php';
|
||||
require_once("Rest/JsonMessage.php");
|
||||
require_once("Rest/XmlMessage.php");
|
||||
require_once("Rest/RestMessage.php");
|
||||
|
||||
class CalendarDefinitionTest extends PHPUnit_Extensions_Database_TestCase
|
||||
{
|
||||
public function setup()
|
||||
{
|
||||
}
|
||||
|
||||
protected function getTearDownOperation()
|
||||
{
|
||||
return PHPUnit_Extensions_Database_Operation_Factory::DELETE_ALL();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
|
||||
*/
|
||||
|
||||
// only instantiate pdo once for test clean-up/fixture load
|
||||
static private $pdo = null;
|
||||
// only instantiate PHPUnit_Extensions_Database_DB_IDatabaseConnection once per test
|
||||
private $conn = null;
|
||||
|
||||
public function getConnection()
|
||||
{
|
||||
if ($this->conn === null) {
|
||||
$dsn = 'mysql:dbname=' . $_SERVER['PM_UNIT_DB_NAME'] . ';host='. $_SERVER['PM_UNIT_DB_HOST'];
|
||||
if (self::$pdo == null) {
|
||||
self::$pdo = new PDO(
|
||||
$dsn,
|
||||
$_SERVER['PM_UNIT_DB_USER'],
|
||||
$_SERVER['PM_UNIT_DB_PASS'] );
|
||||
}
|
||||
$this->conn = $this->createDefaultDBConnection(self::$pdo, $_SERVER['PM_UNIT_DB_NAME']);
|
||||
}
|
||||
return $this->conn;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return PHPUnit_Extensions_Database_DataSet_IDataSet
|
||||
*/
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet('tests/unit/backend/services/Rest/fixtures/application.xml');
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "00000000000000000000000000000001" );
|
||||
$table = "CalendarDefinition";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$resp = $rest->sendGET($table,$key);
|
||||
|
||||
$key1 = array( "942663514792946220");
|
||||
$rest->sendGET($table,$key1);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'CALENDAR_DEFINITION', 'SELECT * FROM CALENDAR_DEFINITION WHERE CALENDAR_UID = "00000000000000000000000000000001"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($resp, $queryTable, "ERROR getting data");
|
||||
|
||||
}
|
||||
|
||||
public function testPost()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method,$msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "00000000000000000000000000000002", "Calendario Diario", "2012-09-17 13:00:04", "2012-09-17 13:01:06", "1", "horarios", "ACTIVE");
|
||||
//$table = "CALENDAR_DEFINITION";
|
||||
$table = "CalendarDefinition";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendPOST($table,$key);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$key1 = array("00000000000000000000000000000002");
|
||||
$resp = $rest->sendGET($table,$key1);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'CALENDAR_DEFINITION', 'SELECT * FROM CALENDAR_DEFINITION WHERE CALENDAR_UID = "00000000000000000000000000000002"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($queryTable, $resp, "ERROR inserting data");
|
||||
}
|
||||
|
||||
public function testPut()
|
||||
{
|
||||
/* $msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "9426635155057479305aa11012946220", "Calendario Empleados", "2012-09-17 12:00:04", "2012-09-17 12:01:06", "1|2|3|4|5", "Horarios laborales", "ACTIVE");
|
||||
$table = "CALENDAR_DEFINITION";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendPUT($table,$key);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$key1 = array("9426635155057479305aa11012946220");
|
||||
$resp = $rest->sendGET($table,$key1);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'CALENDAR_DEFINITION', 'SELECT * FROM CALENDAR_DEFINITION WHERE CALENDAR_UID = "66666635155057479305ab1101111111"'
|
||||
);
|
||||
|
||||
$this->assertEquals($queryTable, $resp, "ERROR updating data");*/
|
||||
}
|
||||
|
||||
public function testDelete()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array("00000000000000000000000000000002");
|
||||
$table = "CalendarDefinition";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendDELETE($table,$key);
|
||||
//$rest->displayResponse();
|
||||
$resp = $rest->sendGET($table,$key);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'CALENDAR_DEFINITION', 'SELECT * FROM CALENDAR_DEFINITION WHERE CALENDAR_UID = "00000000000000000000000000000002"'
|
||||
);
|
||||
|
||||
$this->assertEquals($queryTable, $resp, "ERROR deleting data");
|
||||
}
|
||||
}
|
||||
|
||||
174
tests/unit/backend/services/ContentTest.php
Normal file
174
tests/unit/backend/services/ContentTest.php
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
if (!defined('PATH_SEP')) {
|
||||
define('PATH_SEP', '/');
|
||||
}
|
||||
|
||||
require_once PATH_HOME . 'engine/services/rest/crud/Content.php';
|
||||
require_once("Rest/JsonMessage.php");
|
||||
require_once("Rest/XmlMessage.php");
|
||||
require_once("Rest/RestMessage.php");
|
||||
|
||||
class ContentTest extends PHPUnit_Extensions_Database_TestCase
|
||||
{
|
||||
public function setup()
|
||||
{
|
||||
}
|
||||
|
||||
protected function getTearDownOperation()
|
||||
{
|
||||
return PHPUnit_Extensions_Database_Operation_Factory::DELETE_ALL();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
|
||||
*/
|
||||
|
||||
// only instantiate pdo once for test clean-up/fixture load
|
||||
static private $pdo = null;
|
||||
// only instantiate PHPUnit_Extensions_Database_DB_IDatabaseConnection once per test
|
||||
private $conn = null;
|
||||
|
||||
public function getConnection()
|
||||
{
|
||||
if ($this->conn === null) {
|
||||
$dsn = 'mysql:dbname=' . $_SERVER['PM_UNIT_DB_NAME'] . ';host='. $_SERVER['PM_UNIT_DB_HOST'];
|
||||
if (self::$pdo == null) {
|
||||
self::$pdo = new PDO(
|
||||
$dsn,
|
||||
$_SERVER['PM_UNIT_DB_USER'],
|
||||
$_SERVER['PM_UNIT_DB_PASS'] );
|
||||
}
|
||||
$this->conn = $this->createDefaultDBConnection(self::$pdo, $_SERVER['PM_UNIT_DB_NAME']);
|
||||
}
|
||||
return $this->conn;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return PHPUnit_Extensions_Database_DataSet_IDataSet
|
||||
*/
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet('tests/unit/backend/services/Rest/fixtures/application.xml');
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "PRO_TITLE", "", "6548800755065a63d67f727063273525", "en");
|
||||
$key1 = array( "PRO_DESCRIPTION", "", "4880075", "en");
|
||||
$table = "CONTENT";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$resp = $rest->sendGET($table,$key);
|
||||
$rest->sendGET($table,$key1);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'CONTENT', 'SELECT * FROM CONTENT WHERE CON_CATEGORY = "PRO_TITLE" AND CON_ID = "6548800755065a63d67f727063273525"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($resp, $queryTable, "ERROR getting data");
|
||||
|
||||
}
|
||||
|
||||
public function testPost()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "PRO_TITLE", "", "6666000755065a63d67f727063273222", "en", "SAMPLE");
|
||||
$table = "CONTENT";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendPOST($table,$key);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$key1 = array("PRO_TITLE", "", "6666000755065a63d67f727063273222", "en");
|
||||
$resp = $rest->sendGET($table,$key1);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'CONTENT', 'SELECT * FROM CONTENT WHERE CON_CATEGORY = "PRO_TITLE" AND CON_ID = "6666000755065a63d67f727063273222"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($queryTable, $resp, "ERROR inserting data");
|
||||
}
|
||||
|
||||
public function testPut()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "PRO_TITLE", "", "6666000755065a63d67f727063273222", "en", "XAMPLE");
|
||||
$table = "CONTENT";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendPUT($table,$key);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$key1 = array("PRO_TITLE", "", "6666000755065a63d67f727063273222", "en");
|
||||
$resp = $rest->sendGET($table,$key1);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'CONTENT', 'SELECT * FROM CONTENT WHERE CON_CATEGORY = "PRO_TITLE" AND CON_ID = "6666000755065a63d67f727063273222"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($queryTable, $resp, "ERROR updating data");
|
||||
}
|
||||
|
||||
public function testDelete()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "PRO_TITLE", "", "6666000755065a63d67f727063273222", "en");
|
||||
$table = "CONTENT";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendDELETE($table,$key);
|
||||
//$rest->displayResponse();
|
||||
$resp = $rest->sendGET($table,$key);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'CONTENT', 'SELECT * FROM CONTENT WHERE CON_CATEGORY = "PRO_TITLE" AND CON_ID = "6666000755065a63d67f727063273222"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($queryTable, $resp, "ERROR deleting data");
|
||||
}
|
||||
}
|
||||
|
||||
173
tests/unit/backend/services/ProcessTest.php
Normal file
173
tests/unit/backend/services/ProcessTest.php
Normal file
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
|
||||
if (!defined('PATH_SEP')) {
|
||||
define('PATH_SEP', '/');
|
||||
}
|
||||
|
||||
require_once PATH_HOME . 'engine/services/rest/crud/Process.php';
|
||||
require_once("Rest/JsonMessage.php");
|
||||
require_once("Rest/XmlMessage.php");
|
||||
require_once("Rest/RestMessage.php");
|
||||
|
||||
class ProcessTest extends PHPUnit_Extensions_Database_TestCase
|
||||
{
|
||||
public function setup()
|
||||
{
|
||||
}
|
||||
|
||||
protected function getTearDownOperation()
|
||||
{
|
||||
return PHPUnit_Extensions_Database_Operation_Factory::DELETE_ALL();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
|
||||
*/
|
||||
|
||||
// only instantiate pdo once for test clean-up/fixture load
|
||||
static private $pdo = null;
|
||||
// only instantiate PHPUnit_Extensions_Database_DB_IDatabaseConnection once per test
|
||||
private $conn = null;
|
||||
|
||||
public function getConnection()
|
||||
{
|
||||
if ($this->conn === null) {
|
||||
$dsn = 'mysql:dbname=' . $_SERVER['PM_UNIT_DB_NAME'] . ';host='. $_SERVER['PM_UNIT_DB_HOST'];
|
||||
if (self::$pdo == null) {
|
||||
self::$pdo = new PDO(
|
||||
$dsn,
|
||||
$_SERVER['PM_UNIT_DB_USER'],
|
||||
$_SERVER['PM_UNIT_DB_PASS'] );
|
||||
}
|
||||
$this->conn = $this->createDefaultDBConnection(self::$pdo, $_SERVER['PM_UNIT_DB_NAME']);
|
||||
}
|
||||
return $this->conn;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return PHPUnit_Extensions_Database_DataSet_IDataSet
|
||||
*/
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet('tests/unit/backend/services/Rest/fixtures/application.xml');
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "6548800755065a63d67f727063273525");
|
||||
$key1 = array( "8421281685065a");
|
||||
$table = "PROCESS";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$resp = $rest->sendGET($table,$key);
|
||||
$rest->sendGET($table,$key1);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'PROCESS', 'SELECT * FROM PROCESS WHERE PRO_UID = "6548800755065a63d67f727063273525"'
|
||||
);
|
||||
|
||||
$this->assertEquals($resp, $queryTable, "ERROR getting data");
|
||||
|
||||
}
|
||||
|
||||
public function testPost()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "6548800755065a63d67f727063255555", "6548800755065a63d67f727063666665", "5", "HOURS", "ACTIVE", "0", "NORMAL", "FALSE", "1", "1", "1", "0", " ", " ", "1", "2012-09-28 09:29:33", "2012-09-28 09:29:33", "00000000000000000000000000000001", "5000", "10000", "0", "6", "0", " ", " " );
|
||||
$table = "PROCESS";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendPOST($table,$key);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$key1 = array("6548800755065a63d67f727063255555");
|
||||
$resp = $rest->sendGET($table,$key1);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'PROCESS', 'SELECT * FROM PROCESS WHERE PRO_UID = "6548800755065a63d67f727063255555"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($queryTable, $resp, "ERROR inserting data");
|
||||
}
|
||||
|
||||
public function testPut()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "6548800755065a63d67f727063255555", "6548800755065a63d67f727063666665", "2", "DAYS", "ACTIVE", "0", "NORMAL", "FALSE", "1", "1", "1", "0", " ", " ", "1", "2012-09-28 09:29:33", "2012-09-28 09:29:33", "00000000000000000000000000000001", "5000", "10000", "0", "6", "0", " ", " " );
|
||||
$table = "PROCESS";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendPUT($table,$key);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$key1 = array("6548800755065a63d67f727063255555");
|
||||
$resp = $rest->sendGET($table,$key1);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'PROCESS', 'SELECT * FROM PROCESS WHERE PRO_UID = "6548800755065a63d67f727063255555"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($queryTable, $resp, "ERROR updating data");
|
||||
}
|
||||
|
||||
public function testDelete()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array("6548800755065a63d67f727063255555");
|
||||
$table = "PROCESS";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendDELETE($table,$key);
|
||||
//$rest->displayResponse();
|
||||
$resp = $rest->sendGET($table,$key);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'PROCESS', 'SELECT * FROM PROCESS WHERE PRO_UID = "6548800755065a63d67f727063255555"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($queryTable, $resp, "ERROR deleting data");
|
||||
}
|
||||
}
|
||||
173
tests/unit/backend/services/SessionTest.php
Normal file
173
tests/unit/backend/services/SessionTest.php
Normal file
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
|
||||
if (!defined('PATH_SEP')) {
|
||||
define('PATH_SEP', '/');
|
||||
}
|
||||
|
||||
require_once PATH_HOME . 'engine/services/rest/crud/Session.php';
|
||||
require_once("Rest/JsonMessage.php");
|
||||
require_once("Rest/XmlMessage.php");
|
||||
require_once("Rest/RestMessage.php");
|
||||
|
||||
class SessionTest extends PHPUnit_Extensions_Database_TestCase
|
||||
{
|
||||
public function setup()
|
||||
{
|
||||
}
|
||||
|
||||
protected function getTearDownOperation()
|
||||
{
|
||||
return PHPUnit_Extensions_Database_Operation_Factory::DELETE_ALL();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
|
||||
*/
|
||||
|
||||
// only instantiate pdo once for test clean-up/fixture load
|
||||
static private $pdo = null;
|
||||
// only instantiate PHPUnit_Extensions_Database_DB_IDatabaseConnection once per test
|
||||
private $conn = null;
|
||||
|
||||
public function getConnection()
|
||||
{
|
||||
if ($this->conn === null) {
|
||||
$dsn = 'mysql:dbname=' . $_SERVER['PM_UNIT_DB_NAME'] . ';host='. $_SERVER['PM_UNIT_DB_HOST'];
|
||||
if (self::$pdo == null) {
|
||||
self::$pdo = new PDO(
|
||||
$dsn,
|
||||
$_SERVER['PM_UNIT_DB_USER'],
|
||||
$_SERVER['PM_UNIT_DB_PASS'] );
|
||||
}
|
||||
$this->conn = $this->createDefaultDBConnection(self::$pdo, $_SERVER['PM_UNIT_DB_NAME']);
|
||||
}
|
||||
return $this->conn;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return PHPUnit_Extensions_Database_DataSet_IDataSet
|
||||
*/
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet('tests/unit/backend/services/Rest/fixtures/application.xml');
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "8421281685065aec01a7643096730466");
|
||||
$key1 = array( "8421281685065a");
|
||||
$table = "SESSION";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$resp = $rest->sendGET($table,$key);
|
||||
$rest->sendGET($table,$key1);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'SESSION', 'SELECT * FROM SESSION WHERE SES_UID = "8421281685065aec01a7643096730466"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($resp, $queryTable, "ERROR getting data");
|
||||
|
||||
}
|
||||
|
||||
public function testPost()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "2252443815002e3c2422675066811111", "ACTIVE", "00000000000000000000000000000001", "192.168.11.21", "2012-10-09 10:05:52", "2012-10-09 10:20:52", "");
|
||||
$table = "SESSION";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendPOST($table,$key);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$key1 = array("2252443815002e3c2422675066811111");
|
||||
$resp = $rest->sendGET($table,$key1);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'SESSION', 'SELECT * FROM SESSION WHERE SES_UID = "2252443815002e3c2422675066811111"'
|
||||
);
|
||||
|
||||
$this->assertEquals($queryTable, $resp, "ERROR inserting data");
|
||||
}
|
||||
|
||||
public function testPut()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "2252443815002e3c2422675066811111", "XAMPLE", "00000000000000000000000000000001", "192.168.11.21", "2012-10-09 10:05:52", "2012-10-09 10:20:52", "");
|
||||
$table = "SESSION";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendPUT($table,$key);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$key1 = array("2252443815002e3c2422675066811111");
|
||||
$resp = $rest->sendGET($table,$key1);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'SESSION', 'SELECT * FROM SESSION WHERE SES_UID = "2252443815002e3c2422675066811111"'
|
||||
);
|
||||
|
||||
$this->assertEquals($queryTable, $resp, "ERROR updating data");
|
||||
}
|
||||
|
||||
public function testDelete()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array("2252443815002e3c2422675066811111");
|
||||
$table = "SESSION";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendDELETE($table,$key);
|
||||
//$rest->displayResponse();
|
||||
$resp = $rest->sendGET($table,$key);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'SESSION', 'SELECT * FROM SESSION WHERE SES_UID = "2252443815002e3c2422675066811111"'
|
||||
);
|
||||
|
||||
$this->assertEquals($queryTable, $resp, "ERROR deleting data");
|
||||
}
|
||||
}
|
||||
171
tests/unit/backend/services/StepTest.php
Normal file
171
tests/unit/backend/services/StepTest.php
Normal file
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
if (!defined('PATH_SEP')) {
|
||||
define('PATH_SEP', '/');
|
||||
}
|
||||
|
||||
require_once PATH_HOME . 'engine/services/rest/crud/Step.php';
|
||||
require_once("Rest/JsonMessage.php");
|
||||
require_once("Rest/XmlMessage.php");
|
||||
require_once("Rest/RestMessage.php");
|
||||
|
||||
class StepTest extends PHPUnit_Extensions_Database_TestCase
|
||||
{
|
||||
public function setup()
|
||||
{
|
||||
}
|
||||
|
||||
protected function getTearDownOperation()
|
||||
{
|
||||
return PHPUnit_Extensions_Database_Operation_Factory::DELETE_ALL();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
|
||||
*/
|
||||
|
||||
// only instantiate pdo once for test clean-up/fixture load
|
||||
static private $pdo = null;
|
||||
// only instantiate PHPUnit_Extensions_Database_DB_IDatabaseConnection once per test
|
||||
private $conn = null;
|
||||
|
||||
public function getConnection()
|
||||
{
|
||||
if ($this->conn === null) {
|
||||
$dsn = 'mysql:dbname=' . $_SERVER['PM_UNIT_DB_NAME'] . ';host='. $_SERVER['PM_UNIT_DB_HOST'];
|
||||
if (self::$pdo == null) {
|
||||
self::$pdo = new PDO(
|
||||
$dsn,
|
||||
$_SERVER['PM_UNIT_DB_USER'],
|
||||
$_SERVER['PM_UNIT_DB_PASS'] );
|
||||
}
|
||||
$this->conn = $this->createDefaultDBConnection(self::$pdo, $_SERVER['PM_UNIT_DB_NAME']);
|
||||
}
|
||||
return $this->conn;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return PHPUnit_Extensions_Database_DataSet_IDataSet
|
||||
*/
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet('tests/unit/backend/services/Rest/fixtures/application.xml');
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "440848627503b77c71a9637072432170");
|
||||
$table = "STEP";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$resp = $rest->sendGET($table,$key);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'STEP', 'SELECT * FROM STEP WHERE STEP_UID = "440848627503b77c71a9637072432170"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($resp, $queryTable, "ERROR getting data");
|
||||
}
|
||||
|
||||
public function testPost()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "440848627503b77c71a9637074444444", "359728002502a792a568a54012111111", "499115418502a795a0cfb43043666666", "SAMPLE", "913768259503b76894536b2095222222", "", "1", "EDIT");
|
||||
$table = "STEP";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendPOST($table,$key);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$key1 = array("440848627503b77c71a9637074444444");
|
||||
$resp = $rest->sendGET($table,$key1);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'STEP', 'SELECT * FROM STEP WHERE STEP_UID = "440848627503b77c71a9637074444444"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($queryTable, $resp, "ERROR inserting data");
|
||||
}
|
||||
|
||||
public function testPut()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "440848627503b77c71a9637074444444", "359728002502a792a568a54012111111", "499115418502a795a0cfb43043666666", "XAMPLE", "913768259503b76894536b2095222222", "", "1", "VIEW");
|
||||
$table = "STEP";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendPUT($table,$key);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$key1 = array("440848627503b77c71a9637074444444");
|
||||
$resp = $rest->sendGET($table,$key1);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'STEP', 'SELECT * FROM STEP WHERE STEP_UID = "440848627503b77c71a9637074444444"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($queryTable, $resp, "ERROR updating data");
|
||||
}
|
||||
|
||||
public function testDelete()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array("440848627503b77c71a9637074444444");
|
||||
$table = "STEP";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendDELETE($table,$key);
|
||||
//$rest->displayResponse();
|
||||
$resp = $rest->sendGET($table,$key);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'STEP', 'SELECT * FROM STEP WHERE STEP_UID = "440848627503b77c71a9637074444444"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($queryTable, $resp, "ERROR getting data");
|
||||
}
|
||||
}
|
||||
|
||||
177
tests/unit/backend/services/UsersTest.php
Normal file
177
tests/unit/backend/services/UsersTest.php
Normal file
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
|
||||
if (!defined('PATH_SEP')) {
|
||||
define('PATH_SEP', '/');
|
||||
}
|
||||
|
||||
require_once PATH_HOME . 'engine/services/rest/crud/Users.php';
|
||||
require_once("Rest/JsonMessage.php");
|
||||
require_once("Rest/XmlMessage.php");
|
||||
require_once("Rest/RestMessage.php");
|
||||
|
||||
class UsersTest extends PHPUnit_Extensions_Database_TestCase
|
||||
{
|
||||
public function setup()
|
||||
{
|
||||
}
|
||||
|
||||
protected function getTearDownOperation()
|
||||
{
|
||||
return PHPUnit_Extensions_Database_Operation_Factory::DELETE_ALL();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PHPUnit_Extensions_Database_DB_IDatabaseConnection
|
||||
*/
|
||||
|
||||
// only instantiate pdo once for test clean-up/fixture load
|
||||
static private $pdo = null;
|
||||
// only instantiate PHPUnit_Extensions_Database_DB_IDatabaseConnection once per test
|
||||
private $conn = null;
|
||||
|
||||
public function getConnection()
|
||||
{
|
||||
if ($this->conn === null) {
|
||||
$dsn = 'mysql:dbname=' . $_SERVER['PM_UNIT_DB_NAME'] . ';host='. $_SERVER['PM_UNIT_DB_HOST'];
|
||||
if (self::$pdo == null) {
|
||||
self::$pdo = new PDO(
|
||||
$dsn,
|
||||
$_SERVER['PM_UNIT_DB_USER'],
|
||||
$_SERVER['PM_UNIT_DB_PASS'] );
|
||||
}
|
||||
$this->conn = $this->createDefaultDBConnection(self::$pdo, $_SERVER['PM_UNIT_DB_NAME']);
|
||||
}
|
||||
return $this->conn;
|
||||
}
|
||||
|
||||
/**
|
||||
*@return PHPUnit_Extensions_Database_DataSet_IDataSet
|
||||
*/
|
||||
|
||||
public function getDataSet()
|
||||
{
|
||||
return $this->createXMLDataSet('tests/unit/backend/services/Rest/fixtures/application.xml');
|
||||
}
|
||||
|
||||
public function testGet()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "00000000000000000000000000000001" );
|
||||
$table = "USERS";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$resp = $rest->sendGET($table,$key);
|
||||
|
||||
$key1 = array( "942663514792946220");
|
||||
$rest->sendGET($table,$key1);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'USERS', 'SELECT * FROM USERS WHERE USR_UID = "00000000000000000000000000000001"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($resp, $queryTable, "ERROR getting data");
|
||||
}
|
||||
|
||||
public function testPost()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method,$msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "00000000000000000000000000000002", "admin", "21232f297a57a5a743894a0e4a801fc3",
|
||||
"Administrator", "Adminn", "admin@processmaker.com", "2020-01-01", "1999-11-30 00:00:00",
|
||||
"2008-05-23 18:36:19", "ACTIVE", "US", "FL", "MMK", "Miraflores", "2240448", "1-305-402-0282",
|
||||
"1-305-675-1400", "", "", "Administrator", "", "1999-02-25", "PROCESSMAKER_ADMIN",
|
||||
"", "", "NORMAL");
|
||||
$table = "Users";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendPOST($table,$key);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$key1 = array("00000000000000000000000000000002");
|
||||
$resp = $rest->sendGET($table,$key1);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'USERS', 'SELECT * FROM USERS WHERE USR_UID = "00000000000000000000000000000002"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($queryTable, $resp, "ERROR inserting data");
|
||||
}
|
||||
|
||||
public function testPut()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array( "00000000000000000000000000000002", "adminsad", "21232f297a57a5a743894a0e4a801fc3", "Administrator", "adminsad@processmaker.com", "2020-01-01", "1999-11-30 00:00:00", "2008-05-23 18:36:19", "ACTIVE", "US", "FL", "MMK", "", "", "1-305-402-0282", "1-305-675-1400", "", "", "Administrator", "", "1999-02-25", "PROCESSMAKER_ADMIN", "", "", "NORMAL");
|
||||
$table = "USERS";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendPUT($table,$key);
|
||||
//$rest->displayResponse();
|
||||
|
||||
$key1 = array("00000000000000000000000000000002");
|
||||
$resp = $rest->sendGET($table,$key1);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'USERS', 'SELECT * FROM USERS WHERE USR_UID = "00000000000000000000000000000002"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($queryTable, $resp, "ERROR updating data");
|
||||
}
|
||||
|
||||
public function testDelete()
|
||||
{
|
||||
$msg = array( 'user'=>'admin' , 'password'=>'admin');
|
||||
$method = "login";
|
||||
|
||||
$jsonm = new JsonMessage();
|
||||
$jsonm->send($method,$msg);
|
||||
//$jsonm->displayResponse();
|
||||
|
||||
$xmlm = new XmlMessage();
|
||||
$xmlm->send($method, $msg);
|
||||
//$xmlm->displayResponse();
|
||||
|
||||
$key = array("00000000000000000000000000000002");
|
||||
$table = "USERS";
|
||||
|
||||
$rest = new RestMessage();
|
||||
$rest->sendDELETE($table,$key);
|
||||
//$rest->displayResponse();
|
||||
$resp = $rest->sendGET($table,$key);
|
||||
|
||||
$queryTable = $this->getConnection()->createQueryTable(
|
||||
'USERS', 'SELECT * FROM USERS WHERE USR_UID = "00000000000000000000000000000002"'
|
||||
);
|
||||
|
||||
//$this->assertEquals($queryTable, $resp, "ERROR deleting data");
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@ class Services_Rest_AppDocument
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_TAGS);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_STATUS);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_STATUS_DATE);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_FIELDNAME);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
@@ -63,5 +63,82 @@ class Services_Rest_AppThread
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'POST' method for Rest API
|
||||
*
|
||||
* @param mixed $appUid, $appThreadIndex Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function post($appUid, $appThreadIndex, $appThreadParent, $appThreadStatus, $delIndex)
|
||||
{
|
||||
try {
|
||||
$result = array();
|
||||
$obj = new AppThread();
|
||||
|
||||
$obj->setAppUid($appUid);
|
||||
$obj->setAppThreadIndex($appThreadIndex);
|
||||
$obj->setAppThreadParent($appThreadParent);
|
||||
$obj->setAppThreadStatus($appThreadStatus);
|
||||
$obj->setDelIndex($delIndex);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'PUT' method for Rest API
|
||||
*
|
||||
* @param mixed $appUid, $appThreadIndex Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function put($appUid, $appThreadIndex, $appThreadParent, $appThreadStatus, $delIndex)
|
||||
{
|
||||
try {
|
||||
$obj = AppThreadPeer::retrieveByPK($appUid, $appThreadIndex);
|
||||
|
||||
$obj->setAppThreadParent($appThreadParent);
|
||||
$obj->setAppThreadStatus($appThreadStatus);
|
||||
$obj->setDelIndex($delIndex);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'DELETE' method for Rest API
|
||||
*
|
||||
* @param mixed $appUid, $appThreadIndex Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function delete($appUid, $appThreadIndex)
|
||||
{
|
||||
$conn = Propel::getConnection(AppThreadPeer::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
$conn->begin();
|
||||
|
||||
$obj = AppThreadPeer::retrieveByPK($appUid, $appThreadIndex);
|
||||
if (! is_object($obj)) {
|
||||
throw new RestException(412, 'Record does not exist.');
|
||||
}
|
||||
$obj->delete();
|
||||
|
||||
$conn->commit();
|
||||
} catch (Exception $e) {
|
||||
$conn->rollback();
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -65,5 +65,87 @@ class Services_Rest_CalendarDefinition
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'POST' method for Rest API
|
||||
*
|
||||
* @param mixed $calendarUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function post($calendarUid, $calendarName, $calendarCreateDate, $calendarUpdateDate, $calendarWorkDays, $calendarDescription, $calendarStatus)
|
||||
{
|
||||
try {
|
||||
$result = array();
|
||||
$obj = new CalendarDefinition();
|
||||
|
||||
$obj->setCalendarUid($calendarUid);
|
||||
$obj->setCalendarName($calendarName);
|
||||
$obj->setCalendarCreateDate($calendarCreateDate);
|
||||
$obj->setCalendarUpdateDate($calendarUpdateDate);
|
||||
$obj->setCalendarWorkDays($calendarWorkDays);
|
||||
$obj->setCalendarDescription($calendarDescription);
|
||||
$obj->setCalendarStatus($calendarStatus);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'PUT' method for Rest API
|
||||
*
|
||||
* @param mixed $calendarUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function put($calendarUid, $calendarName, $calendarCreateDate, $calendarUpdateDate, $calendarWorkDays, $calendarDescription, $calendarStatus)
|
||||
{
|
||||
try {
|
||||
$obj = CalendarDefinitionPeer::retrieveByPK($calendarUid);
|
||||
|
||||
$obj->setCalendarName($calendarName);
|
||||
$obj->setCalendarCreateDate($calendarCreateDate);
|
||||
$obj->setCalendarUpdateDate($calendarUpdateDate);
|
||||
$obj->setCalendarWorkDays($calendarWorkDays);
|
||||
$obj->setCalendarDescription($calendarDescription);
|
||||
$obj->setCalendarStatus($calendarStatus);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'DELETE' method for Rest API
|
||||
*
|
||||
* @param mixed $calendarUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function delete($calendarUid)
|
||||
{
|
||||
$conn = Propel::getConnection(CalendarDefinitionPeer::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
$conn->begin();
|
||||
|
||||
$obj = CalendarDefinitionPeer::retrieveByPK($calendarUid);
|
||||
if (! is_object($obj)) {
|
||||
throw new RestException(412, 'Record does not exist.');
|
||||
}
|
||||
$obj->delete();
|
||||
|
||||
$conn->commit();
|
||||
} catch (Exception $e) {
|
||||
$conn->rollback();
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -63,5 +63,80 @@ class Services_Rest_Content
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'POST' method for Rest API
|
||||
*
|
||||
* @param mixed $conCategory, $conParent, $conId, $conLang Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function post($conCategory, $conParent, $conId, $conLang, $conValue)
|
||||
{
|
||||
try {
|
||||
$result = array();
|
||||
$obj = new Content();
|
||||
|
||||
$obj->setConCategory($conCategory);
|
||||
$obj->setConParent($conParent);
|
||||
$obj->setConId($conId);
|
||||
$obj->setConLang($conLang);
|
||||
$obj->setConValue($conValue);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'PUT' method for Rest API
|
||||
*
|
||||
* @param mixed $conCategory, $conParent, $conId, $conLang Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function put($conCategory, $conParent, $conId, $conLang, $conValue)
|
||||
{
|
||||
try {
|
||||
$obj = ContentPeer::retrieveByPK($conCategory, $conParent, $conId, $conLang);
|
||||
|
||||
$obj->setConValue($conValue);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'DELETE' method for Rest API
|
||||
*
|
||||
* @param mixed $conCategory, $conParent, $conId, $conLang Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function delete($conCategory, $conParent, $conId, $conLang)
|
||||
{
|
||||
$conn = Propel::getConnection(ContentPeer::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
$conn->begin();
|
||||
|
||||
$obj = ContentPeer::retrieveByPK($conCategory, $conParent, $conId, $conLang);
|
||||
if (! is_object($obj)) {
|
||||
throw new RestException(412, 'Record does not exist.');
|
||||
}
|
||||
$obj->delete();
|
||||
|
||||
$conn->commit();
|
||||
} catch (Exception $e) {
|
||||
$conn->rollback();
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -61,5 +61,79 @@ class Services_Rest_Holiday
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'POST' method for Rest API
|
||||
*
|
||||
* @param mixed $hldUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function post($hldUid, $hldDate, $hldDescription)
|
||||
{
|
||||
try {
|
||||
$result = array();
|
||||
$obj = new Holiday();
|
||||
|
||||
$obj->setHldUid($hldUid);
|
||||
$obj->setHldDate($hldDate);
|
||||
$obj->setHldDescription($hldDescription);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'PUT' method for Rest API
|
||||
*
|
||||
* @param mixed $hldUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function put($hldUid, $hldDate, $hldDescription)
|
||||
{
|
||||
try {
|
||||
$obj = HolidayPeer::retrieveByPK($hldUid);
|
||||
|
||||
$obj->setHldDate($hldDate);
|
||||
$obj->setHldDescription($hldDescription);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'DELETE' method for Rest API
|
||||
*
|
||||
* @param mixed $hldUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function delete($hldUid)
|
||||
{
|
||||
$conn = Propel::getConnection(HolidayPeer::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
$conn->begin();
|
||||
|
||||
$obj = HolidayPeer::retrieveByPK($hldUid);
|
||||
if (! is_object($obj)) {
|
||||
throw new RestException(412, 'Record does not exist.');
|
||||
}
|
||||
$obj->delete();
|
||||
|
||||
$conn->commit();
|
||||
} catch (Exception $e) {
|
||||
$conn->rollback();
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -83,5 +83,123 @@ class Services_Rest_Process
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'POST' method for Rest API
|
||||
*
|
||||
* @param mixed $proUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function post($proUid, $proParent, $proTime, $proTimeunit, $proStatus, $proTypeDay, $proType, $proAssignment, $proShowMap, $proShowMessage, $proShowDelegate, $proShowDynaform, $proCategory, $proSubCategory, $proIndustry, $proUpdateDate, $proCreateDate, $proCreateUser, $proHeight, $proWidth, $proTitleX, $proTitleY, $proDebug, $proDynaforms, $proDerivationScreenTpl)
|
||||
{
|
||||
try {
|
||||
$result = array();
|
||||
$obj = new Process();
|
||||
|
||||
$obj->setProUid($proUid);
|
||||
$obj->setProParent($proParent);
|
||||
$obj->setProTime($proTime);
|
||||
$obj->setProTimeunit($proTimeunit);
|
||||
$obj->setProStatus($proStatus);
|
||||
$obj->setProTypeDay($proTypeDay);
|
||||
$obj->setProType($proType);
|
||||
$obj->setProAssignment($proAssignment);
|
||||
$obj->setProShowMap($proShowMap);
|
||||
$obj->setProShowMessage($proShowMessage);
|
||||
$obj->setProShowDelegate($proShowDelegate);
|
||||
$obj->setProShowDynaform($proShowDynaform);
|
||||
$obj->setProCategory($proCategory);
|
||||
$obj->setProSubCategory($proSubCategory);
|
||||
$obj->setProIndustry($proIndustry);
|
||||
$obj->setProUpdateDate($proUpdateDate);
|
||||
$obj->setProCreateDate($proCreateDate);
|
||||
$obj->setProCreateUser($proCreateUser);
|
||||
$obj->setProHeight($proHeight);
|
||||
$obj->setProWidth($proWidth);
|
||||
$obj->setProTitleX($proTitleX);
|
||||
$obj->setProTitleY($proTitleY);
|
||||
$obj->setProDebug($proDebug);
|
||||
$obj->setProDynaforms($proDynaforms);
|
||||
$obj->setProDerivationScreenTpl($proDerivationScreenTpl);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'PUT' method for Rest API
|
||||
*
|
||||
* @param mixed $proUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function put($proUid, $proParent, $proTime, $proTimeunit, $proStatus, $proTypeDay, $proType, $proAssignment, $proShowMap, $proShowMessage, $proShowDelegate, $proShowDynaform, $proCategory, $proSubCategory, $proIndustry, $proUpdateDate, $proCreateDate, $proCreateUser, $proHeight, $proWidth, $proTitleX, $proTitleY, $proDebug, $proDynaforms, $proDerivationScreenTpl)
|
||||
{
|
||||
try {
|
||||
$obj = ProcessPeer::retrieveByPK($proUid);
|
||||
|
||||
$obj->setProParent($proParent);
|
||||
$obj->setProTime($proTime);
|
||||
$obj->setProTimeunit($proTimeunit);
|
||||
$obj->setProStatus($proStatus);
|
||||
$obj->setProTypeDay($proTypeDay);
|
||||
$obj->setProType($proType);
|
||||
$obj->setProAssignment($proAssignment);
|
||||
$obj->setProShowMap($proShowMap);
|
||||
$obj->setProShowMessage($proShowMessage);
|
||||
$obj->setProShowDelegate($proShowDelegate);
|
||||
$obj->setProShowDynaform($proShowDynaform);
|
||||
$obj->setProCategory($proCategory);
|
||||
$obj->setProSubCategory($proSubCategory);
|
||||
$obj->setProIndustry($proIndustry);
|
||||
$obj->setProUpdateDate($proUpdateDate);
|
||||
$obj->setProCreateDate($proCreateDate);
|
||||
$obj->setProCreateUser($proCreateUser);
|
||||
$obj->setProHeight($proHeight);
|
||||
$obj->setProWidth($proWidth);
|
||||
$obj->setProTitleX($proTitleX);
|
||||
$obj->setProTitleY($proTitleY);
|
||||
$obj->setProDebug($proDebug);
|
||||
$obj->setProDynaforms($proDynaforms);
|
||||
$obj->setProDerivationScreenTpl($proDerivationScreenTpl);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'DELETE' method for Rest API
|
||||
*
|
||||
* @param mixed $proUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function delete($proUid)
|
||||
{
|
||||
$conn = Propel::getConnection(ProcessPeer::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
$conn->begin();
|
||||
|
||||
$obj = ProcessPeer::retrieveByPK($proUid);
|
||||
if (! is_object($obj)) {
|
||||
throw new RestException(412, 'Record does not exist.');
|
||||
}
|
||||
$obj->delete();
|
||||
|
||||
$conn->commit();
|
||||
} catch (Exception $e) {
|
||||
$conn->rollback();
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -65,5 +65,87 @@ class Services_Rest_Session
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'POST' method for Rest API
|
||||
*
|
||||
* @param mixed $sesUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function post($sesUid, $sesStatus, $usrUid, $sesRemoteIp, $sesInitDate, $sesDueDate, $sesEndDate)
|
||||
{
|
||||
try {
|
||||
$result = array();
|
||||
$obj = new Session();
|
||||
|
||||
$obj->setSesUid($sesUid);
|
||||
$obj->setSesStatus($sesStatus);
|
||||
$obj->setUsrUid($usrUid);
|
||||
$obj->setSesRemoteIp($sesRemoteIp);
|
||||
$obj->setSesInitDate($sesInitDate);
|
||||
$obj->setSesDueDate($sesDueDate);
|
||||
$obj->setSesEndDate($sesEndDate);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'PUT' method for Rest API
|
||||
*
|
||||
* @param mixed $sesUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function put($sesUid, $sesStatus, $usrUid, $sesRemoteIp, $sesInitDate, $sesDueDate, $sesEndDate)
|
||||
{
|
||||
try {
|
||||
$obj = SessionPeer::retrieveByPK($sesUid);
|
||||
|
||||
$obj->setSesStatus($sesStatus);
|
||||
$obj->setUsrUid($usrUid);
|
||||
$obj->setSesRemoteIp($sesRemoteIp);
|
||||
$obj->setSesInitDate($sesInitDate);
|
||||
$obj->setSesDueDate($sesDueDate);
|
||||
$obj->setSesEndDate($sesEndDate);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'DELETE' method for Rest API
|
||||
*
|
||||
* @param mixed $sesUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function delete($sesUid)
|
||||
{
|
||||
$conn = Propel::getConnection(SessionPeer::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
$conn->begin();
|
||||
|
||||
$obj = SessionPeer::retrieveByPK($sesUid);
|
||||
if (! is_object($obj)) {
|
||||
throw new RestException(412, 'Record does not exist.');
|
||||
}
|
||||
$obj->delete();
|
||||
|
||||
$conn->commit();
|
||||
} catch (Exception $e) {
|
||||
$conn->rollback();
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -66,5 +66,89 @@ class Services_Rest_Step
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'POST' method for Rest API
|
||||
*
|
||||
* @param mixed $stepUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function post($stepUid, $proUid, $tasUid, $stepTypeObj, $stepUidObj, $stepCondition, $stepPosition, $stepMode)
|
||||
{
|
||||
try {
|
||||
$result = array();
|
||||
$obj = new Step();
|
||||
|
||||
$obj->setStepUid($stepUid);
|
||||
$obj->setProUid($proUid);
|
||||
$obj->setTasUid($tasUid);
|
||||
$obj->setStepTypeObj($stepTypeObj);
|
||||
$obj->setStepUidObj($stepUidObj);
|
||||
$obj->setStepCondition($stepCondition);
|
||||
$obj->setStepPosition($stepPosition);
|
||||
$obj->setStepMode($stepMode);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'PUT' method for Rest API
|
||||
*
|
||||
* @param mixed $stepUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function put($stepUid, $proUid, $tasUid, $stepTypeObj, $stepUidObj, $stepCondition, $stepPosition, $stepMode)
|
||||
{
|
||||
try {
|
||||
$obj = StepPeer::retrieveByPK($stepUid);
|
||||
|
||||
$obj->setProUid($proUid);
|
||||
$obj->setTasUid($tasUid);
|
||||
$obj->setStepTypeObj($stepTypeObj);
|
||||
$obj->setStepUidObj($stepUidObj);
|
||||
$obj->setStepCondition($stepCondition);
|
||||
$obj->setStepPosition($stepPosition);
|
||||
$obj->setStepMode($stepMode);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'DELETE' method for Rest API
|
||||
*
|
||||
* @param mixed $stepUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function delete($stepUid)
|
||||
{
|
||||
$conn = Propel::getConnection(StepPeer::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
$conn->begin();
|
||||
|
||||
$obj = StepPeer::retrieveByPK($stepUid);
|
||||
if (! is_object($obj)) {
|
||||
throw new RestException(412, 'Record does not exist.');
|
||||
}
|
||||
$obj->delete();
|
||||
|
||||
$conn->commit();
|
||||
} catch (Exception $e) {
|
||||
$conn->rollback();
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -70,5 +70,97 @@ class Services_Rest_SubProcess
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'POST' method for Rest API
|
||||
*
|
||||
* @param mixed $spUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function post($spUid, $proUid, $tasUid, $proParent, $tasParent, $spType, $spSynchronous, $spSynchronousType, $spSynchronousWait, $spVariablesOut, $spVariablesIn, $spGridIn)
|
||||
{
|
||||
try {
|
||||
$result = array();
|
||||
$obj = new SubProcess();
|
||||
|
||||
$obj->setSpUid($spUid);
|
||||
$obj->setProUid($proUid);
|
||||
$obj->setTasUid($tasUid);
|
||||
$obj->setProParent($proParent);
|
||||
$obj->setTasParent($tasParent);
|
||||
$obj->setSpType($spType);
|
||||
$obj->setSpSynchronous($spSynchronous);
|
||||
$obj->setSpSynchronousType($spSynchronousType);
|
||||
$obj->setSpSynchronousWait($spSynchronousWait);
|
||||
$obj->setSpVariablesOut($spVariablesOut);
|
||||
$obj->setSpVariablesIn($spVariablesIn);
|
||||
$obj->setSpGridIn($spGridIn);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'PUT' method for Rest API
|
||||
*
|
||||
* @param mixed $spUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function put($spUid, $proUid, $tasUid, $proParent, $tasParent, $spType, $spSynchronous, $spSynchronousType, $spSynchronousWait, $spVariablesOut, $spVariablesIn, $spGridIn)
|
||||
{
|
||||
try {
|
||||
$obj = SubProcessPeer::retrieveByPK($spUid);
|
||||
|
||||
$obj->setProUid($proUid);
|
||||
$obj->setTasUid($tasUid);
|
||||
$obj->setProParent($proParent);
|
||||
$obj->setTasParent($tasParent);
|
||||
$obj->setSpType($spType);
|
||||
$obj->setSpSynchronous($spSynchronous);
|
||||
$obj->setSpSynchronousType($spSynchronousType);
|
||||
$obj->setSpSynchronousWait($spSynchronousWait);
|
||||
$obj->setSpVariablesOut($spVariablesOut);
|
||||
$obj->setSpVariablesIn($spVariablesIn);
|
||||
$obj->setSpGridIn($spGridIn);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'DELETE' method for Rest API
|
||||
*
|
||||
* @param mixed $spUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function delete($spUid)
|
||||
{
|
||||
$conn = Propel::getConnection(SubProcessPeer::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
$conn->begin();
|
||||
|
||||
$obj = SubProcessPeer::retrieveByPK($spUid);
|
||||
if (! is_object($obj)) {
|
||||
throw new RestException(412, 'Record does not exist.');
|
||||
}
|
||||
$obj->delete();
|
||||
|
||||
$conn->commit();
|
||||
} catch (Exception $e) {
|
||||
$conn->rollback();
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ class Services_Rest_Task
|
||||
$criteria->addSelectColumn(TaskPeer::TAS_PRIORITY_VARIABLE);
|
||||
$criteria->addSelectColumn(TaskPeer::TAS_ASSIGN_TYPE);
|
||||
$criteria->addSelectColumn(TaskPeer::TAS_ASSIGN_VARIABLE);
|
||||
$criteria->addSelectColumn(TaskPeer::TAS_GROUP_VARIABLE);
|
||||
$criteria->addSelectColumn(TaskPeer::TAS_MI_INSTANCE_VARIABLE);
|
||||
$criteria->addSelectColumn(TaskPeer::TAS_MI_COMPLETE_VARIABLE);
|
||||
$criteria->addSelectColumn(TaskPeer::TAS_ASSIGN_LOCATION);
|
||||
|
||||
@@ -84,5 +84,125 @@ class Services_Rest_Users
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'POST' method for Rest API
|
||||
*
|
||||
* @param mixed $usrUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function post($usrUid, $usrUsername, $usrPassword, $usrFirstname, $usrLastname, $usrEmail, $usrDueDate, $usrCreateDate, $usrUpdateDate, $usrStatus, $usrCountry, $usrCity, $usrLocation, $usrAddress, $usrPhone, $usrFax, $usrCellular, $usrZipCode, $depUid, $usrPosition, $usrResume, $usrBirthday, $usrRole, $usrReportsTo, $usrReplacedBy, $usrUx)
|
||||
{
|
||||
try {
|
||||
$result = array();
|
||||
$obj = new Users();
|
||||
|
||||
$obj->setUsrUid($usrUid);
|
||||
$obj->setUsrUsername($usrUsername);
|
||||
$obj->setUsrPassword($usrPassword);
|
||||
$obj->setUsrFirstname($usrFirstname);
|
||||
$obj->setUsrLastname($usrLastname);
|
||||
$obj->setUsrEmail($usrEmail);
|
||||
$obj->setUsrDueDate($usrDueDate);
|
||||
$obj->setUsrCreateDate($usrCreateDate);
|
||||
$obj->setUsrUpdateDate($usrUpdateDate);
|
||||
$obj->setUsrStatus($usrStatus);
|
||||
$obj->setUsrCountry($usrCountry);
|
||||
$obj->setUsrCity($usrCity);
|
||||
$obj->setUsrLocation($usrLocation);
|
||||
$obj->setUsrAddress($usrAddress);
|
||||
$obj->setUsrPhone($usrPhone);
|
||||
$obj->setUsrFax($usrFax);
|
||||
$obj->setUsrCellular($usrCellular);
|
||||
$obj->setUsrZipCode($usrZipCode);
|
||||
$obj->setDepUid($depUid);
|
||||
$obj->setUsrPosition($usrPosition);
|
||||
$obj->setUsrResume($usrResume);
|
||||
$obj->setUsrBirthday($usrBirthday);
|
||||
$obj->setUsrRole($usrRole);
|
||||
$obj->setUsrReportsTo($usrReportsTo);
|
||||
$obj->setUsrReplacedBy($usrReplacedBy);
|
||||
$obj->setUsrUx($usrUx);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'PUT' method for Rest API
|
||||
*
|
||||
* @param mixed $usrUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function put($usrUid, $usrUsername, $usrPassword, $usrFirstname, $usrLastname, $usrEmail, $usrDueDate, $usrCreateDate, $usrUpdateDate, $usrStatus, $usrCountry, $usrCity, $usrLocation, $usrAddress, $usrPhone, $usrFax, $usrCellular, $usrZipCode, $depUid, $usrPosition, $usrResume, $usrBirthday, $usrRole, $usrReportsTo, $usrReplacedBy, $usrUx)
|
||||
{
|
||||
try {
|
||||
$obj = UsersPeer::retrieveByPK($usrUid);
|
||||
|
||||
$obj->setUsrUsername($usrUsername);
|
||||
$obj->setUsrPassword($usrPassword);
|
||||
$obj->setUsrFirstname($usrFirstname);
|
||||
$obj->setUsrLastname($usrLastname);
|
||||
$obj->setUsrEmail($usrEmail);
|
||||
$obj->setUsrDueDate($usrDueDate);
|
||||
$obj->setUsrCreateDate($usrCreateDate);
|
||||
$obj->setUsrUpdateDate($usrUpdateDate);
|
||||
$obj->setUsrStatus($usrStatus);
|
||||
$obj->setUsrCountry($usrCountry);
|
||||
$obj->setUsrCity($usrCity);
|
||||
$obj->setUsrLocation($usrLocation);
|
||||
$obj->setUsrAddress($usrAddress);
|
||||
$obj->setUsrPhone($usrPhone);
|
||||
$obj->setUsrFax($usrFax);
|
||||
$obj->setUsrCellular($usrCellular);
|
||||
$obj->setUsrZipCode($usrZipCode);
|
||||
$obj->setDepUid($depUid);
|
||||
$obj->setUsrPosition($usrPosition);
|
||||
$obj->setUsrResume($usrResume);
|
||||
$obj->setUsrBirthday($usrBirthday);
|
||||
$obj->setUsrRole($usrRole);
|
||||
$obj->setUsrReportsTo($usrReportsTo);
|
||||
$obj->setUsrReplacedBy($usrReplacedBy);
|
||||
$obj->setUsrUx($usrUx);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'DELETE' method for Rest API
|
||||
*
|
||||
* @param mixed $usrUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function delete($usrUid)
|
||||
{
|
||||
$conn = Propel::getConnection(UsersPeer::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
$conn->begin();
|
||||
|
||||
$obj = UsersPeer::retrieveByPK($usrUid);
|
||||
if (! is_object($obj)) {
|
||||
throw new RestException(412, 'Record does not exist.');
|
||||
}
|
||||
$obj->delete();
|
||||
|
||||
$conn->commit();
|
||||
} catch (Exception $e) {
|
||||
$conn->rollback();
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user