Merge pull request #595 from ferOnti/master

fixing REST
This commit is contained in:
ferOnti
2012-09-24 12:12:29 -07:00
74 changed files with 1939 additions and 224 deletions

View File

@@ -5204,11 +5204,12 @@ function getDirectorySize($path,$maxmtime=0)
$restClasses = array_merge($restClasses, $pluginClasses);
}
foreach ($restClasses as $classFile) {
if (! file_exists($classFile)) {
foreach ($restClasses as $key => $classFile) {
if ( !file_exists($classFile) ) {
unset($restClasses[$key]);
continue;
}
//load the file, and check if exist the class inside it.
require_once $classFile;
$namespace = 'Services_Rest_';
$className = str_replace('.php', '', basename($classFile));
@@ -5219,22 +5220,23 @@ function getDirectorySize($path,$maxmtime=0)
// Couldn't resolve the class name, just skipp it
if (! class_exists($namespace . $className)) {
unset($restClasses[$key]);
continue;
}
}
$className = $namespace . $className;
$reflClass = new ReflectionClass($className);
// verify if there is an auth class implementing 'iAuthenticate' that wasn't from plugin
// verify if there is an auth class implementing 'iAuthenticate'
$classNameAuth = $namespace . $className;
$reflClass = new ReflectionClass($classNameAuth);
// that wasn't from plugin
if ($reflClass->implementsInterface('iAuthenticate') && $namespace != 'Plugin_Services_Rest_') {
// auth class found, set as restler authentication class handler
$rest->addAuthenticationClass($className);
$rest->addAuthenticationClass($classNameAuth);
} else {
// add api class
$rest->addAPIClass($className);
$rest->addAPIClass($classNameAuth);
}
}
//end foreach rest class
// resolving the class for current request
$uriPart = explode('/', $uri);

View File

@@ -164,6 +164,7 @@ class Restler
415 => 'Unsupported Media Type',
416 => 'Requested Range Not Satisfiable',
417 => 'Expectation Failed',
417 => 'Record not found',
500 => 'Internal Server Error',
501 => 'Not Implemented',
502 => 'Bad Gateway',
@@ -380,6 +381,7 @@ class Restler
}
}
}
$this->applyClassMetadata(get_class($this->request_format),
$this->request_format, $o);
$pre_process = '_' . $this->request_format->getExtension() . '_'
@@ -695,7 +697,7 @@ class Restler
//echo PHP_EOL.$url.' = '.$this->url.PHP_EOL;
$call = (object) $call;
if (strstr($url, ':')) {
$regex = preg_replace('/\\\:([^\/]+)/', '(?P<$1>[^/]+)',
$regex = preg_replace('/\\\:([^\/]*)/', '(?P<$1>[^/]*)',
preg_quote($url));
if (preg_match(":^$regex$:i", $this->url, $matches)) {
foreach ($matches as $arg => $match) {
@@ -713,8 +715,6 @@ class Restler
}
}
if ($found) {
//echo PHP_EOL."Found $url ";
//print_r($call);
$p = $call->defaults;
foreach ($call->arguments as $key => $value) {
//echo "$key => $value \n";

View File

@@ -259,7 +259,9 @@ EOT;
));
$c = 0;
foreach ($this->config['_tables'] as $table => $conf) {
//print_r ($this->config);die;
//foreach ($this->config['_tables'] as $table => $conf) {
foreach ($this->config as $table => $conf) {
$classname = self::camelize($table, 'class');
$allowedMethods = explode(' ', $conf['ALLOW_METHODS']);
$methods = '';

View File

@@ -10,7 +10,15 @@
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
{% for column in columns %}$criteria->addSelectColumn({{ classname }}Peer::{{column}});
@@ -23,11 +31,26 @@
}
} else {
$record = {{ classname }}Peer::retrieveByPK({{ primaryKeys }});
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table {{ classname }} ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -11,6 +11,7 @@ class Services_Rest_Auth implements iAuthenticate
function __isAuthenticated()
{
return true;
if (array_key_exists('HTTP_AUTH_KEY', $_SERVER)) {
$authKey = $_SERVER['HTTP_AUTH_KEY'];
} elseif (array_key_exists('auth_key', $_GET)) {

View File

@@ -14,7 +14,15 @@ class Services_Rest_AdditionalTables
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
@@ -42,12 +50,27 @@ class Services_Rest_AdditionalTables
}
} else {
$record = AdditionalTablesPeer::retrieveByPK($addTabUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table AdditionalTables ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_AppCacheView
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(AppCacheViewPeer::APP_UID);
@@ -56,12 +64,27 @@ class Services_Rest_AppCacheView
}
} else {
$record = AppCacheViewPeer::retrieveByPK($appUid, $delIndex);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table AppCacheView ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_AppDelay
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(AppDelayPeer::APP_DELAY_UID);
@@ -40,12 +48,27 @@ class Services_Rest_AppDelay
}
} else {
$record = AppDelayPeer::retrieveByPK($appDelayUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table AppDelay ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_AppDelegation
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(AppDelegationPeer::APP_UID);
@@ -48,12 +56,27 @@ class Services_Rest_AppDelegation
}
} else {
$record = AppDelegationPeer::retrieveByPK($appUid, $delIndex);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table AppDelegation ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_AppDocument
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID);
@@ -40,12 +48,27 @@ class Services_Rest_AppDocument
}
} else {
$record = AppDocumentPeer::retrieveByPK($appDocUid, $docVersion);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table AppDocument ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_AppEvent
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(AppEventPeer::APP_UID);
@@ -33,12 +41,27 @@ class Services_Rest_AppEvent
}
} else {
$record = AppEventPeer::retrieveByPK($appUid, $delIndex, $evnUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table AppEvent ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_AppFolder
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(AppFolderPeer::FOLDER_UID);
@@ -31,12 +39,27 @@ class Services_Rest_AppFolder
}
} else {
$record = AppFolderPeer::retrieveByPK($folderUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table AppFolder ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_AppHistory
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(AppHistoryPeer::APP_UID);
@@ -35,12 +43,27 @@ class Services_Rest_AppHistory
}
} else {
$record = AppHistoryPeer::retrieveByPK();
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table AppHistory ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_AppMessage
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_UID);
@@ -42,12 +50,27 @@ class Services_Rest_AppMessage
}
} else {
$record = AppMessagePeer::retrieveByPK($appMsgUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table AppMessage ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_AppNotes
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(AppNotesPeer::APP_UID);
@@ -36,12 +44,27 @@ class Services_Rest_AppNotes
}
} else {
$record = AppNotesPeer::retrieveByPK();
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table AppNotes ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_AppOwner
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(AppOwnerPeer::APP_UID);
@@ -29,12 +37,27 @@ class Services_Rest_AppOwner
}
} else {
$record = AppOwnerPeer::retrieveByPK($appUid, $ownUid, $usrUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table AppOwner ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_AppSolrQueue
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(AppSolrQueuePeer::APP_UID);
@@ -28,12 +36,27 @@ class Services_Rest_AppSolrQueue
}
} else {
$record = AppSolrQueuePeer::retrieveByPK($appUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table AppSolrQueue ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_AppThread
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(AppThreadPeer::APP_UID);
@@ -31,12 +39,27 @@ class Services_Rest_AppThread
}
} else {
$record = AppThreadPeer::retrieveByPK($appUid, $appThreadIndex);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table AppThread ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_Application
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(ApplicationPeer::APP_UID);
@@ -42,14 +50,129 @@ class Services_Rest_Application
}
} else {
$record = ApplicationPeer::retrieveByPK($appUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table Application ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}
/**
* Implementation for 'POST' method for Rest API
*
* @param mixed $appUid 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, $appNumber, $appParent, $appStatus, $proUid, $appProcStatus, $appProcCode, $appParallel, $appInitUser, $appCurUser, $appCreateDate, $appInitDate, $appFinishDate, $appUpdateDate, $appData, $appPin)
{
try {
$result = array();
$obj = new Application();
$obj->setAppUid($appUid);
$obj->setAppNumber($appNumber);
$obj->setAppParent($appParent);
$obj->setAppStatus($appStatus);
$obj->setProUid($proUid);
$obj->setAppProcStatus($appProcStatus);
$obj->setAppProcCode($appProcCode);
$obj->setAppParallel($appParallel);
$obj->setAppInitUser($appInitUser);
$obj->setAppCurUser($appCurUser);
$obj->setAppCreateDate($appCreateDate);
$obj->setAppInitDate($appInitDate);
$obj->setAppFinishDate($appFinishDate);
$obj->setAppUpdateDate($appUpdateDate);
$obj->setAppData($appData);
$obj->setAppPin($appPin);
$obj->save();
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
}
/**
* Implementation for 'PUT' method for Rest API
*
* @param mixed $appUid 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, $appNumber, $appParent, $appStatus, $proUid, $appProcStatus, $appProcCode, $appParallel, $appInitUser, $appCurUser, $appCreateDate, $appInitDate, $appFinishDate, $appUpdateDate, $appData, $appPin)
{
try {
$obj = ApplicationPeer::retrieveByPK($appUid);
$obj->setAppNumber($appNumber);
$obj->setAppParent($appParent);
$obj->setAppStatus($appStatus);
$obj->setProUid($proUid);
$obj->setAppProcStatus($appProcStatus);
$obj->setAppProcCode($appProcCode);
$obj->setAppParallel($appParallel);
$obj->setAppInitUser($appInitUser);
$obj->setAppCurUser($appCurUser);
$obj->setAppCreateDate($appCreateDate);
$obj->setAppInitDate($appInitDate);
$obj->setAppFinishDate($appFinishDate);
$obj->setAppUpdateDate($appUpdateDate);
$obj->setAppData($appData);
$obj->setAppPin($appPin);
$obj->save();
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
}
/**
* Implementation for 'DELETE' method for Rest API
*
* @param mixed $appUid 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)
{
$conn = Propel::getConnection(ApplicationPeer::DATABASE_NAME);
try {
$conn->begin();
$obj = ApplicationPeer::retrieveByPK($appUid);
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());
}
}
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_CalendarAssignments
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(CalendarAssignmentsPeer::OBJECT_UID);
@@ -29,12 +37,27 @@ class Services_Rest_CalendarAssignments
}
} else {
$record = CalendarAssignmentsPeer::retrieveByPK($objectUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table CalendarAssignments ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_CalendarBusinessHours
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(CalendarBusinessHoursPeer::CALENDAR_UID);
@@ -30,12 +38,27 @@ class Services_Rest_CalendarBusinessHours
}
} else {
$record = CalendarBusinessHoursPeer::retrieveByPK($calendarUid, $calendarBusinessDay, $calendarBusinessStart, $calendarBusinessEnd);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table CalendarBusinessHours ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_CalendarDefinition
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_UID);
@@ -33,12 +41,27 @@ class Services_Rest_CalendarDefinition
}
} else {
$record = CalendarDefinitionPeer::retrieveByPK($calendarUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table CalendarDefinition ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_CalendarHolidays
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(CalendarHolidaysPeer::CALENDAR_UID);
@@ -30,12 +38,27 @@ class Services_Rest_CalendarHolidays
}
} else {
$record = CalendarHolidaysPeer::retrieveByPK($calendarUid, $calendarHolidayName);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table CalendarHolidays ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_CaseScheduler
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_UID);
@@ -51,12 +59,27 @@ class Services_Rest_CaseScheduler
}
} else {
$record = CaseSchedulerPeer::retrieveByPK($schUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table CaseScheduler ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_CaseTracker
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(CaseTrackerPeer::PRO_UID);
@@ -30,12 +38,27 @@ class Services_Rest_CaseTracker
}
} else {
$record = CaseTrackerPeer::retrieveByPK($proUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table CaseTracker ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_CaseTrackerObject
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(CaseTrackerObjectPeer::CTO_UID);
@@ -32,12 +40,27 @@ class Services_Rest_CaseTrackerObject
}
} else {
$record = CaseTrackerObjectPeer::retrieveByPK($ctoUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table CaseTrackerObject ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_Configuration
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(ConfigurationPeer::CFG_UID);
@@ -32,12 +40,27 @@ class Services_Rest_Configuration
}
} else {
$record = ConfigurationPeer::retrieveByPK($cfgUid, $objUid, $proUid, $usrUid, $appUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table Configuration ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_Content
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(ContentPeer::CON_CATEGORY);
@@ -31,12 +39,27 @@ class Services_Rest_Content
}
} else {
$record = ContentPeer::retrieveByPK($conCategory, $conParent, $conId, $conLang);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table Content ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_Dashlet
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(DashletPeer::DAS_UID);
@@ -34,12 +42,27 @@ class Services_Rest_Dashlet
}
} else {
$record = DashletPeer::retrieveByPK($dasUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table Dashlet ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

View File

@@ -14,7 +14,15 @@ class Services_Rest_DashletInstance
{
$result = array();
try {
if (func_num_args() == 0) {
$noArguments = true;
$argumentList = func_get_args();
foreach ($argumentList as $arg) {
if (!is_null($arg)) {
$noArguments = false;
}
}
if ($noArguments) {
$criteria = new Criteria('workflow');
$criteria->addSelectColumn(DashletInstancePeer::DAS_INS_UID);
@@ -34,12 +42,27 @@ class Services_Rest_DashletInstance
}
} else {
$record = DashletInstancePeer::retrieveByPK($dasInsUid);
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
if ($record) {
$result = $record->toArray(BasePeer::TYPE_FIELDNAME);
} else {
$paramValues = "";
foreach ($argumentList as $arg) {
$paramValues .= (strlen($paramValues) ) ? ', ' : '';
if (!is_null($arg)) {
$paramValues .= "$arg";
} else {
$paramValues .= "NULL";
}
}
throw new RestException(417, "table DashletInstance ($paramValues)" );
}
}
} catch (RestException $e) {
throw new RestException($e->getCode(), $e->getMessage());
} catch (Exception $e) {
throw new RestException(412, $e->getMessage());
}
return $result;
}

Some files were not shown because too many files have changed in this diff Show More