From 09157844266605443d22b84a4dd53d2fa7f2e8e0 Mon Sep 17 00:00:00 2001 From: Fernando Ontiveros Date: Mon, 24 Sep 2012 15:09:48 -0400 Subject: [PATCH] working in the REST API, rebuilding classes for all tables and fixing small errors --- gulliver/system/class.g.php | 22 +-- gulliver/thirdparty/restler/restler.php | 6 +- workflow/engine/lib/Service/Rest/RestTool.php | 4 +- .../lib/Service/Rest/templates/methodGet.tpl | 29 +++- workflow/engine/services/rest/Auth.php | 1 + .../services/rest/crud/AdditionalTables.php | 29 +++- .../services/rest/crud/AppCacheView.php | 29 +++- .../engine/services/rest/crud/AppDelay.php | 29 +++- .../services/rest/crud/AppDelegation.php | 29 +++- .../engine/services/rest/crud/AppDocument.php | 29 +++- .../engine/services/rest/crud/AppEvent.php | 29 +++- .../engine/services/rest/crud/AppFolder.php | 29 +++- .../engine/services/rest/crud/AppHistory.php | 29 +++- .../engine/services/rest/crud/AppMessage.php | 29 +++- .../engine/services/rest/crud/AppNotes.php | 29 +++- .../engine/services/rest/crud/AppOwner.php | 29 +++- .../services/rest/crud/AppSolrQueue.php | 29 +++- .../engine/services/rest/crud/AppThread.php | 29 +++- .../engine/services/rest/crud/Application.php | 129 +++++++++++++++++- .../rest/crud/CalendarAssignments.php | 29 +++- .../rest/crud/CalendarBusinessHours.php | 29 +++- .../services/rest/crud/CalendarDefinition.php | 29 +++- .../services/rest/crud/CalendarHolidays.php | 29 +++- .../services/rest/crud/CaseScheduler.php | 29 +++- .../engine/services/rest/crud/CaseTracker.php | 29 +++- .../services/rest/crud/CaseTrackerObject.php | 29 +++- .../services/rest/crud/Configuration.php | 29 +++- .../engine/services/rest/crud/Content.php | 29 +++- .../engine/services/rest/crud/Dashlet.php | 29 +++- .../services/rest/crud/DashletInstance.php | 29 +++- .../engine/services/rest/crud/DbSource.php | 29 +++- .../engine/services/rest/crud/Department.php | 29 +++- .../services/rest/crud/DimTimeComplete.php | 29 +++- .../services/rest/crud/DimTimeDelegate.php | 29 +++- .../engine/services/rest/crud/Dynaform.php | 29 +++- workflow/engine/services/rest/crud/Event.php | 29 +++- .../services/rest/crud/FieldCondition.php | 29 +++- workflow/engine/services/rest/crud/Fields.php | 29 +++- .../engine/services/rest/crud/Gateway.php | 29 +++- .../engine/services/rest/crud/GroupUser.php | 29 +++- .../engine/services/rest/crud/Groupwf.php | 29 +++- .../engine/services/rest/crud/Holiday.php | 29 +++- .../services/rest/crud/InputDocument.php | 29 +++- .../engine/services/rest/crud/IsoCountry.php | 29 +++- .../engine/services/rest/crud/IsoLocation.php | 29 +++- .../services/rest/crud/IsoSubdivision.php | 29 +++- .../engine/services/rest/crud/Language.php | 29 +++- workflow/engine/services/rest/crud/Lexico.php | 29 +++- .../services/rest/crud/LogCasesScheduler.php | 29 +++- .../engine/services/rest/crud/LoginLog.php | 29 +++- .../services/rest/crud/ObjectPermission.php | 29 +++- .../services/rest/crud/OutputDocument.php | 29 +++- .../engine/services/rest/crud/Process.php | 29 +++- .../services/rest/crud/ProcessCategory.php | 29 +++- .../services/rest/crud/ProcessOwner.php | 29 +++- .../engine/services/rest/crud/ProcessUser.php | 29 +++- .../engine/services/rest/crud/ReportTable.php | 29 +++- .../engine/services/rest/crud/ReportVar.php | 29 +++- workflow/engine/services/rest/crud/Route.php | 29 +++- .../engine/services/rest/crud/Session.php | 29 +++- .../engine/services/rest/crud/ShadowTable.php | 29 +++- workflow/engine/services/rest/crud/Stage.php | 29 +++- workflow/engine/services/rest/crud/Step.php | 29 +++- .../services/rest/crud/StepSupervisor.php | 29 +++- .../engine/services/rest/crud/StepTrigger.php | 29 +++- .../services/rest/crud/SubApplication.php | 29 +++- .../engine/services/rest/crud/SubProcess.php | 29 +++- .../services/rest/crud/SwimlanesElements.php | 29 +++- workflow/engine/services/rest/crud/Task.php | 29 +++- .../engine/services/rest/crud/TaskUser.php | 29 +++- .../engine/services/rest/crud/Translation.php | 29 +++- .../engine/services/rest/crud/Triggers.php | 29 +++- workflow/engine/services/rest/crud/Users.php | 29 +++- .../services/rest/crud/UsersProperties.php | 29 +++- 74 files changed, 1939 insertions(+), 224 deletions(-) diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 94ea227aa..4857b9683 100755 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -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); diff --git a/gulliver/thirdparty/restler/restler.php b/gulliver/thirdparty/restler/restler.php index 170dd695b..edeb08960 100644 --- a/gulliver/thirdparty/restler/restler.php +++ b/gulliver/thirdparty/restler/restler.php @@ -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"; diff --git a/workflow/engine/lib/Service/Rest/RestTool.php b/workflow/engine/lib/Service/Rest/RestTool.php index cc77eb5de..c525ca3fe 100644 --- a/workflow/engine/lib/Service/Rest/RestTool.php +++ b/workflow/engine/lib/Service/Rest/RestTool.php @@ -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 = ''; diff --git a/workflow/engine/lib/Service/Rest/templates/methodGet.tpl b/workflow/engine/lib/Service/Rest/templates/methodGet.tpl index 59384c2a5..48db57a3b 100644 --- a/workflow/engine/lib/Service/Rest/templates/methodGet.tpl +++ b/workflow/engine/lib/Service/Rest/templates/methodGet.tpl @@ -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; } diff --git a/workflow/engine/services/rest/Auth.php b/workflow/engine/services/rest/Auth.php index 337e09886..a98720e48 100644 --- a/workflow/engine/services/rest/Auth.php +++ b/workflow/engine/services/rest/Auth.php @@ -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)) { diff --git a/workflow/engine/services/rest/crud/AdditionalTables.php b/workflow/engine/services/rest/crud/AdditionalTables.php index 01572741c..1c7c8117b 100644 --- a/workflow/engine/services/rest/crud/AdditionalTables.php +++ b/workflow/engine/services/rest/crud/AdditionalTables.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/AppCacheView.php b/workflow/engine/services/rest/crud/AppCacheView.php index fccd2425c..21118d609 100644 --- a/workflow/engine/services/rest/crud/AppCacheView.php +++ b/workflow/engine/services/rest/crud/AppCacheView.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/AppDelay.php b/workflow/engine/services/rest/crud/AppDelay.php index 881e5aa0e..07022f43c 100644 --- a/workflow/engine/services/rest/crud/AppDelay.php +++ b/workflow/engine/services/rest/crud/AppDelay.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/AppDelegation.php b/workflow/engine/services/rest/crud/AppDelegation.php index 17e4b7c10..4de946b4f 100644 --- a/workflow/engine/services/rest/crud/AppDelegation.php +++ b/workflow/engine/services/rest/crud/AppDelegation.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/AppDocument.php b/workflow/engine/services/rest/crud/AppDocument.php index 1711f7db1..5bad13a69 100644 --- a/workflow/engine/services/rest/crud/AppDocument.php +++ b/workflow/engine/services/rest/crud/AppDocument.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/AppEvent.php b/workflow/engine/services/rest/crud/AppEvent.php index 9c359ddc4..91ec39577 100644 --- a/workflow/engine/services/rest/crud/AppEvent.php +++ b/workflow/engine/services/rest/crud/AppEvent.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/AppFolder.php b/workflow/engine/services/rest/crud/AppFolder.php index f512758f2..e19e914ce 100644 --- a/workflow/engine/services/rest/crud/AppFolder.php +++ b/workflow/engine/services/rest/crud/AppFolder.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/AppHistory.php b/workflow/engine/services/rest/crud/AppHistory.php index dcc7866f6..ceec5f60b 100644 --- a/workflow/engine/services/rest/crud/AppHistory.php +++ b/workflow/engine/services/rest/crud/AppHistory.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/AppMessage.php b/workflow/engine/services/rest/crud/AppMessage.php index 2e4543640..09f80bfd5 100644 --- a/workflow/engine/services/rest/crud/AppMessage.php +++ b/workflow/engine/services/rest/crud/AppMessage.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/AppNotes.php b/workflow/engine/services/rest/crud/AppNotes.php index 6b74466f2..b2fcfd2ed 100644 --- a/workflow/engine/services/rest/crud/AppNotes.php +++ b/workflow/engine/services/rest/crud/AppNotes.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/AppOwner.php b/workflow/engine/services/rest/crud/AppOwner.php index e28d14cce..66e5d42d6 100644 --- a/workflow/engine/services/rest/crud/AppOwner.php +++ b/workflow/engine/services/rest/crud/AppOwner.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/AppSolrQueue.php b/workflow/engine/services/rest/crud/AppSolrQueue.php index 25209f5b2..332785f44 100644 --- a/workflow/engine/services/rest/crud/AppSolrQueue.php +++ b/workflow/engine/services/rest/crud/AppSolrQueue.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/AppThread.php b/workflow/engine/services/rest/crud/AppThread.php index 9fef7877a..d42e59891 100644 --- a/workflow/engine/services/rest/crud/AppThread.php +++ b/workflow/engine/services/rest/crud/AppThread.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/Application.php b/workflow/engine/services/rest/crud/Application.php index 0e67c4d13..d2314e57a 100644 --- a/workflow/engine/services/rest/crud/Application.php +++ b/workflow/engine/services/rest/crud/Application.php @@ -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()); + } + } + } diff --git a/workflow/engine/services/rest/crud/CalendarAssignments.php b/workflow/engine/services/rest/crud/CalendarAssignments.php index acdd586c2..87f5c83a7 100644 --- a/workflow/engine/services/rest/crud/CalendarAssignments.php +++ b/workflow/engine/services/rest/crud/CalendarAssignments.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/CalendarBusinessHours.php b/workflow/engine/services/rest/crud/CalendarBusinessHours.php index c742c2971..d428cc8b2 100644 --- a/workflow/engine/services/rest/crud/CalendarBusinessHours.php +++ b/workflow/engine/services/rest/crud/CalendarBusinessHours.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/CalendarDefinition.php b/workflow/engine/services/rest/crud/CalendarDefinition.php index 658f86eb4..1b61fff5a 100644 --- a/workflow/engine/services/rest/crud/CalendarDefinition.php +++ b/workflow/engine/services/rest/crud/CalendarDefinition.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/CalendarHolidays.php b/workflow/engine/services/rest/crud/CalendarHolidays.php index 8ecbc60a2..7d4ee3bf4 100644 --- a/workflow/engine/services/rest/crud/CalendarHolidays.php +++ b/workflow/engine/services/rest/crud/CalendarHolidays.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/CaseScheduler.php b/workflow/engine/services/rest/crud/CaseScheduler.php index e8e5c660f..e299038cd 100644 --- a/workflow/engine/services/rest/crud/CaseScheduler.php +++ b/workflow/engine/services/rest/crud/CaseScheduler.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/CaseTracker.php b/workflow/engine/services/rest/crud/CaseTracker.php index 99fd9fa07..ae0e08bfa 100644 --- a/workflow/engine/services/rest/crud/CaseTracker.php +++ b/workflow/engine/services/rest/crud/CaseTracker.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/CaseTrackerObject.php b/workflow/engine/services/rest/crud/CaseTrackerObject.php index 904dbe11f..72ad1a36d 100644 --- a/workflow/engine/services/rest/crud/CaseTrackerObject.php +++ b/workflow/engine/services/rest/crud/CaseTrackerObject.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/Configuration.php b/workflow/engine/services/rest/crud/Configuration.php index 3b423e84b..7b77db325 100644 --- a/workflow/engine/services/rest/crud/Configuration.php +++ b/workflow/engine/services/rest/crud/Configuration.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/Content.php b/workflow/engine/services/rest/crud/Content.php index 4df5ed94b..6e7148a69 100644 --- a/workflow/engine/services/rest/crud/Content.php +++ b/workflow/engine/services/rest/crud/Content.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/Dashlet.php b/workflow/engine/services/rest/crud/Dashlet.php index abb002da9..3f40a2fc1 100644 --- a/workflow/engine/services/rest/crud/Dashlet.php +++ b/workflow/engine/services/rest/crud/Dashlet.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/DashletInstance.php b/workflow/engine/services/rest/crud/DashletInstance.php index 4b90bb942..c77246b5d 100644 --- a/workflow/engine/services/rest/crud/DashletInstance.php +++ b/workflow/engine/services/rest/crud/DashletInstance.php @@ -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; } diff --git a/workflow/engine/services/rest/crud/DbSource.php b/workflow/engine/services/rest/crud/DbSource.php index aafdfec28..5e74e5274 100644 --- a/workflow/engine/services/rest/crud/DbSource.php +++ b/workflow/engine/services/rest/crud/DbSource.php @@ -14,7 +14,15 @@ class Services_Rest_DbSource { $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(DbSourcePeer::DBS_UID); @@ -35,12 +43,27 @@ class Services_Rest_DbSource } } else { $record = DbSourcePeer::retrieveByPK($dbsUid, $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 DbSource ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Department.php b/workflow/engine/services/rest/crud/Department.php index b889e7d0a..54ab12361 100644 --- a/workflow/engine/services/rest/crud/Department.php +++ b/workflow/engine/services/rest/crud/Department.php @@ -14,7 +14,15 @@ class Services_Rest_Department { $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(DepartmentPeer::DEP_UID); @@ -33,12 +41,27 @@ class Services_Rest_Department } } else { $record = DepartmentPeer::retrieveByPK($depUid); - $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 Department ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/DimTimeComplete.php b/workflow/engine/services/rest/crud/DimTimeComplete.php index 9ed957eea..9e6cd7048 100644 --- a/workflow/engine/services/rest/crud/DimTimeComplete.php +++ b/workflow/engine/services/rest/crud/DimTimeComplete.php @@ -14,7 +14,15 @@ class Services_Rest_DimTimeComplete { $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(DimTimeCompletePeer::TIME_ID); @@ -34,12 +42,27 @@ class Services_Rest_DimTimeComplete } } else { $record = DimTimeCompletePeer::retrieveByPK($timeId); - $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 DimTimeComplete ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/DimTimeDelegate.php b/workflow/engine/services/rest/crud/DimTimeDelegate.php index 2b8fb7201..65902feae 100644 --- a/workflow/engine/services/rest/crud/DimTimeDelegate.php +++ b/workflow/engine/services/rest/crud/DimTimeDelegate.php @@ -14,7 +14,15 @@ class Services_Rest_DimTimeDelegate { $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(DimTimeDelegatePeer::TIME_ID); @@ -34,12 +42,27 @@ class Services_Rest_DimTimeDelegate } } else { $record = DimTimeDelegatePeer::retrieveByPK($timeId); - $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 DimTimeDelegate ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Dynaform.php b/workflow/engine/services/rest/crud/Dynaform.php index 27f6d1f50..37c7fb30a 100644 --- a/workflow/engine/services/rest/crud/Dynaform.php +++ b/workflow/engine/services/rest/crud/Dynaform.php @@ -14,7 +14,15 @@ class Services_Rest_Dynaform { $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(DynaformPeer::DYN_UID); @@ -30,12 +38,27 @@ class Services_Rest_Dynaform } } else { $record = DynaformPeer::retrieveByPK($dynUid); - $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 Dynaform ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Event.php b/workflow/engine/services/rest/crud/Event.php index e8fdcea14..a08d53e58 100644 --- a/workflow/engine/services/rest/crud/Event.php +++ b/workflow/engine/services/rest/crud/Event.php @@ -14,7 +14,15 @@ class Services_Rest_Event { $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(EventPeer::EVN_UID); @@ -46,12 +54,27 @@ class Services_Rest_Event } } else { $record = EventPeer::retrieveByPK($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 Event ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/FieldCondition.php b/workflow/engine/services/rest/crud/FieldCondition.php index 1b4448d0f..5d7413a04 100644 --- a/workflow/engine/services/rest/crud/FieldCondition.php +++ b/workflow/engine/services/rest/crud/FieldCondition.php @@ -14,7 +14,15 @@ class Services_Rest_FieldCondition { $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(FieldConditionPeer::FCD_UID); @@ -34,12 +42,27 @@ class Services_Rest_FieldCondition } } else { $record = FieldConditionPeer::retrieveByPK($fcdUid); - $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 FieldCondition ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Fields.php b/workflow/engine/services/rest/crud/Fields.php index c8da06f14..f6121b76d 100644 --- a/workflow/engine/services/rest/crud/Fields.php +++ b/workflow/engine/services/rest/crud/Fields.php @@ -14,7 +14,15 @@ class Services_Rest_Fields { $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(FieldsPeer::FLD_UID); @@ -41,12 +49,27 @@ class Services_Rest_Fields } } else { $record = FieldsPeer::retrieveByPK($fldUid); - $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 Fields ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Gateway.php b/workflow/engine/services/rest/crud/Gateway.php index 51daec779..eb287e780 100644 --- a/workflow/engine/services/rest/crud/Gateway.php +++ b/workflow/engine/services/rest/crud/Gateway.php @@ -14,7 +14,15 @@ class Services_Rest_Gateway { $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(GatewayPeer::GAT_UID); @@ -33,12 +41,27 @@ class Services_Rest_Gateway } } else { $record = GatewayPeer::retrieveByPK($gatUid); - $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 Gateway ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/GroupUser.php b/workflow/engine/services/rest/crud/GroupUser.php index 9ca4faad7..86c2e432d 100644 --- a/workflow/engine/services/rest/crud/GroupUser.php +++ b/workflow/engine/services/rest/crud/GroupUser.php @@ -14,7 +14,15 @@ class Services_Rest_GroupUser { $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(GroupUserPeer::GRP_UID); @@ -28,12 +36,27 @@ class Services_Rest_GroupUser } } else { $record = GroupUserPeer::retrieveByPK($grpUid, $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 GroupUser ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Groupwf.php b/workflow/engine/services/rest/crud/Groupwf.php index 56f84dda7..5555254cf 100644 --- a/workflow/engine/services/rest/crud/Groupwf.php +++ b/workflow/engine/services/rest/crud/Groupwf.php @@ -14,7 +14,15 @@ class Services_Rest_Groupwf { $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(GroupwfPeer::GRP_UID); @@ -30,12 +38,27 @@ class Services_Rest_Groupwf } } else { $record = GroupwfPeer::retrieveByPK($grpUid); - $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 Groupwf ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Holiday.php b/workflow/engine/services/rest/crud/Holiday.php index 5b25d8df4..3911a8882 100644 --- a/workflow/engine/services/rest/crud/Holiday.php +++ b/workflow/engine/services/rest/crud/Holiday.php @@ -14,7 +14,15 @@ class Services_Rest_Holiday { $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(HolidayPeer::HLD_UID); @@ -29,12 +37,27 @@ class Services_Rest_Holiday } } else { $record = HolidayPeer::retrieveByPK($hldUid); - $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 Holiday ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/InputDocument.php b/workflow/engine/services/rest/crud/InputDocument.php index 460774fa5..1077871ab 100644 --- a/workflow/engine/services/rest/crud/InputDocument.php +++ b/workflow/engine/services/rest/crud/InputDocument.php @@ -14,7 +14,15 @@ class Services_Rest_InputDocument { $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(InputDocumentPeer::INP_DOC_UID); @@ -34,12 +42,27 @@ class Services_Rest_InputDocument } } else { $record = InputDocumentPeer::retrieveByPK($inpDocUid); - $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 InputDocument ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/IsoCountry.php b/workflow/engine/services/rest/crud/IsoCountry.php index 4c8146fa3..322ea2be4 100644 --- a/workflow/engine/services/rest/crud/IsoCountry.php +++ b/workflow/engine/services/rest/crud/IsoCountry.php @@ -14,7 +14,15 @@ class Services_Rest_IsoCountry { $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(IsoCountryPeer::IC_UID); @@ -29,12 +37,27 @@ class Services_Rest_IsoCountry } } else { $record = IsoCountryPeer::retrieveByPK($icUid); - $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 IsoCountry ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/IsoLocation.php b/workflow/engine/services/rest/crud/IsoLocation.php index 8f7d98280..6477d6842 100644 --- a/workflow/engine/services/rest/crud/IsoLocation.php +++ b/workflow/engine/services/rest/crud/IsoLocation.php @@ -14,7 +14,15 @@ class Services_Rest_IsoLocation { $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(IsoLocationPeer::IC_UID); @@ -31,12 +39,27 @@ class Services_Rest_IsoLocation } } else { $record = IsoLocationPeer::retrieveByPK($icUid, $ilUid); - $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 IsoLocation ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/IsoSubdivision.php b/workflow/engine/services/rest/crud/IsoSubdivision.php index ed5284ba8..072e4d0db 100644 --- a/workflow/engine/services/rest/crud/IsoSubdivision.php +++ b/workflow/engine/services/rest/crud/IsoSubdivision.php @@ -14,7 +14,15 @@ class Services_Rest_IsoSubdivision { $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(IsoSubdivisionPeer::IC_UID); @@ -29,12 +37,27 @@ class Services_Rest_IsoSubdivision } } else { $record = IsoSubdivisionPeer::retrieveByPK($icUid, $isUid); - $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 IsoSubdivision ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Language.php b/workflow/engine/services/rest/crud/Language.php index 6ed0c7988..6fe472ca7 100644 --- a/workflow/engine/services/rest/crud/Language.php +++ b/workflow/engine/services/rest/crud/Language.php @@ -14,7 +14,15 @@ class Services_Rest_Language { $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(LanguagePeer::LAN_ID); @@ -33,12 +41,27 @@ class Services_Rest_Language } } else { $record = LanguagePeer::retrieveByPK($lanId); - $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 Language ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Lexico.php b/workflow/engine/services/rest/crud/Lexico.php index 482fc8daa..1875a4fad 100644 --- a/workflow/engine/services/rest/crud/Lexico.php +++ b/workflow/engine/services/rest/crud/Lexico.php @@ -14,7 +14,15 @@ class Services_Rest_Lexico { $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(LexicoPeer::LEX_TOPIC); @@ -30,12 +38,27 @@ class Services_Rest_Lexico } } else { $record = LexicoPeer::retrieveByPK($lexTopic, $lexKey); - $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 Lexico ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/LogCasesScheduler.php b/workflow/engine/services/rest/crud/LogCasesScheduler.php index 274fcf938..7200ea46c 100644 --- a/workflow/engine/services/rest/crud/LogCasesScheduler.php +++ b/workflow/engine/services/rest/crud/LogCasesScheduler.php @@ -14,7 +14,15 @@ class Services_Rest_LogCasesScheduler { $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(LogCasesSchedulerPeer::LOG_CASE_UID); @@ -36,12 +44,27 @@ class Services_Rest_LogCasesScheduler } } else { $record = LogCasesSchedulerPeer::retrieveByPK($logCaseUid); - $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 LogCasesScheduler ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/LoginLog.php b/workflow/engine/services/rest/crud/LoginLog.php index 97beea5eb..761b423fa 100644 --- a/workflow/engine/services/rest/crud/LoginLog.php +++ b/workflow/engine/services/rest/crud/LoginLog.php @@ -14,7 +14,15 @@ class Services_Rest_LoginLog { $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(LoginLogPeer::LOG_UID); @@ -34,12 +42,27 @@ class Services_Rest_LoginLog } } else { $record = LoginLogPeer::retrieveByPK($logUid); - $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 LoginLog ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/ObjectPermission.php b/workflow/engine/services/rest/crud/ObjectPermission.php index 61d96427e..775ebb975 100644 --- a/workflow/engine/services/rest/crud/ObjectPermission.php +++ b/workflow/engine/services/rest/crud/ObjectPermission.php @@ -14,7 +14,15 @@ class Services_Rest_ObjectPermission { $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(ObjectPermissionPeer::OP_UID); @@ -37,12 +45,27 @@ class Services_Rest_ObjectPermission } } else { $record = ObjectPermissionPeer::retrieveByPK($opUid); - $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 ObjectPermission ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/OutputDocument.php b/workflow/engine/services/rest/crud/OutputDocument.php index c9039cabc..d65c49275 100644 --- a/workflow/engine/services/rest/crud/OutputDocument.php +++ b/workflow/engine/services/rest/crud/OutputDocument.php @@ -14,7 +14,15 @@ class Services_Rest_OutputDocument { $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(OutputDocumentPeer::OUT_DOC_UID); @@ -45,12 +53,27 @@ class Services_Rest_OutputDocument } } else { $record = OutputDocumentPeer::retrieveByPK($outDocUid); - $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 OutputDocument ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Process.php b/workflow/engine/services/rest/crud/Process.php index facc88b7e..8c4955dad 100644 --- a/workflow/engine/services/rest/crud/Process.php +++ b/workflow/engine/services/rest/crud/Process.php @@ -14,7 +14,15 @@ class Services_Rest_Process { $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(ProcessPeer::PRO_UID); @@ -51,12 +59,27 @@ class Services_Rest_Process } } else { $record = ProcessPeer::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 Process ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/ProcessCategory.php b/workflow/engine/services/rest/crud/ProcessCategory.php index 95b846998..2fd1f9f8c 100644 --- a/workflow/engine/services/rest/crud/ProcessCategory.php +++ b/workflow/engine/services/rest/crud/ProcessCategory.php @@ -14,7 +14,15 @@ class Services_Rest_ProcessCategory { $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(ProcessCategoryPeer::CATEGORY_UID); @@ -30,12 +38,27 @@ class Services_Rest_ProcessCategory } } else { $record = ProcessCategoryPeer::retrieveByPK($categoryUid); - $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 ProcessCategory ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/ProcessOwner.php b/workflow/engine/services/rest/crud/ProcessOwner.php index e8ace9b1b..ea3226aef 100644 --- a/workflow/engine/services/rest/crud/ProcessOwner.php +++ b/workflow/engine/services/rest/crud/ProcessOwner.php @@ -14,7 +14,15 @@ class Services_Rest_ProcessOwner { $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(ProcessOwnerPeer::OWN_UID); @@ -28,12 +36,27 @@ class Services_Rest_ProcessOwner } } else { $record = ProcessOwnerPeer::retrieveByPK($ownUid, $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 ProcessOwner ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/ProcessUser.php b/workflow/engine/services/rest/crud/ProcessUser.php index ed9c5a59d..5915e90b9 100644 --- a/workflow/engine/services/rest/crud/ProcessUser.php +++ b/workflow/engine/services/rest/crud/ProcessUser.php @@ -14,7 +14,15 @@ class Services_Rest_ProcessUser { $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(ProcessUserPeer::PU_UID); @@ -30,12 +38,27 @@ class Services_Rest_ProcessUser } } else { $record = ProcessUserPeer::retrieveByPK($puUid); - $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 ProcessUser ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/ReportTable.php b/workflow/engine/services/rest/crud/ReportTable.php index 4c0ed4818..6c5fd1586 100644 --- a/workflow/engine/services/rest/crud/ReportTable.php +++ b/workflow/engine/services/rest/crud/ReportTable.php @@ -14,7 +14,15 @@ class Services_Rest_ReportTable { $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(ReportTablePeer::REP_TAB_UID); @@ -34,12 +42,27 @@ class Services_Rest_ReportTable } } else { $record = ReportTablePeer::retrieveByPK($repTabUid); - $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 ReportTable ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/ReportVar.php b/workflow/engine/services/rest/crud/ReportVar.php index a17162431..e09877a5d 100644 --- a/workflow/engine/services/rest/crud/ReportVar.php +++ b/workflow/engine/services/rest/crud/ReportVar.php @@ -14,7 +14,15 @@ class Services_Rest_ReportVar { $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(ReportVarPeer::REP_VAR_UID); @@ -31,12 +39,27 @@ class Services_Rest_ReportVar } } else { $record = ReportVarPeer::retrieveByPK($repVarUid); - $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 ReportVar ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Route.php b/workflow/engine/services/rest/crud/Route.php index 854005cda..08d474d40 100644 --- a/workflow/engine/services/rest/crud/Route.php +++ b/workflow/engine/services/rest/crud/Route.php @@ -14,7 +14,15 @@ class Services_Rest_Route { $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(RoutePeer::ROU_UID); @@ -43,12 +51,27 @@ class Services_Rest_Route } } else { $record = RoutePeer::retrieveByPK($rouUid); - $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 Route ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Session.php b/workflow/engine/services/rest/crud/Session.php index 66de99c0d..4c9163702 100644 --- a/workflow/engine/services/rest/crud/Session.php +++ b/workflow/engine/services/rest/crud/Session.php @@ -14,7 +14,15 @@ class Services_Rest_Session { $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(SessionPeer::SES_UID); @@ -33,12 +41,27 @@ class Services_Rest_Session } } else { $record = SessionPeer::retrieveByPK($sesUid); - $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 Session ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/ShadowTable.php b/workflow/engine/services/rest/crud/ShadowTable.php index e1b640e3a..ddff5c2b7 100644 --- a/workflow/engine/services/rest/crud/ShadowTable.php +++ b/workflow/engine/services/rest/crud/ShadowTable.php @@ -14,7 +14,15 @@ class Services_Rest_ShadowTable { $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(ShadowTablePeer::SHD_UID); @@ -33,12 +41,27 @@ class Services_Rest_ShadowTable } } else { $record = ShadowTablePeer::retrieveByPK($shdUid); - $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 ShadowTable ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Stage.php b/workflow/engine/services/rest/crud/Stage.php index 0801d853e..8c611fc97 100644 --- a/workflow/engine/services/rest/crud/Stage.php +++ b/workflow/engine/services/rest/crud/Stage.php @@ -14,7 +14,15 @@ class Services_Rest_Stage { $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(StagePeer::STG_UID); @@ -31,12 +39,27 @@ class Services_Rest_Stage } } else { $record = StagePeer::retrieveByPK($stgUid); - $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 Stage ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Step.php b/workflow/engine/services/rest/crud/Step.php index ea584a83c..932eff2de 100644 --- a/workflow/engine/services/rest/crud/Step.php +++ b/workflow/engine/services/rest/crud/Step.php @@ -14,7 +14,15 @@ class Services_Rest_Step { $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(StepPeer::STEP_UID); @@ -34,12 +42,27 @@ class Services_Rest_Step } } else { $record = StepPeer::retrieveByPK($stepUid); - $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 Step ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/StepSupervisor.php b/workflow/engine/services/rest/crud/StepSupervisor.php index fa91a1220..b2a1ceeb7 100644 --- a/workflow/engine/services/rest/crud/StepSupervisor.php +++ b/workflow/engine/services/rest/crud/StepSupervisor.php @@ -14,7 +14,15 @@ class Services_Rest_StepSupervisor { $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(StepSupervisorPeer::STEP_UID); @@ -31,12 +39,27 @@ class Services_Rest_StepSupervisor } } else { $record = StepSupervisorPeer::retrieveByPK($stepUid); - $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 StepSupervisor ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/StepTrigger.php b/workflow/engine/services/rest/crud/StepTrigger.php index 2481de234..2bb98ca27 100644 --- a/workflow/engine/services/rest/crud/StepTrigger.php +++ b/workflow/engine/services/rest/crud/StepTrigger.php @@ -14,7 +14,15 @@ class Services_Rest_StepTrigger { $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(StepTriggerPeer::STEP_UID); @@ -32,12 +40,27 @@ class Services_Rest_StepTrigger } } else { $record = StepTriggerPeer::retrieveByPK($stepUid, $tasUid, $triUid, $stType); - $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 StepTrigger ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/SubApplication.php b/workflow/engine/services/rest/crud/SubApplication.php index 441a4abb8..760603e0a 100644 --- a/workflow/engine/services/rest/crud/SubApplication.php +++ b/workflow/engine/services/rest/crud/SubApplication.php @@ -14,7 +14,15 @@ class Services_Rest_SubApplication { $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(SubApplicationPeer::APP_UID); @@ -35,12 +43,27 @@ class Services_Rest_SubApplication } } else { $record = SubApplicationPeer::retrieveByPK($appUid, $appParent, $delIndexParent, $delThreadParent); - $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 SubApplication ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/SubProcess.php b/workflow/engine/services/rest/crud/SubProcess.php index d404743f3..453e0d2e6 100644 --- a/workflow/engine/services/rest/crud/SubProcess.php +++ b/workflow/engine/services/rest/crud/SubProcess.php @@ -14,7 +14,15 @@ class Services_Rest_SubProcess { $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(SubProcessPeer::SP_UID); @@ -38,12 +46,27 @@ class Services_Rest_SubProcess } } else { $record = SubProcessPeer::retrieveByPK($spUid); - $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 SubProcess ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/SwimlanesElements.php b/workflow/engine/services/rest/crud/SwimlanesElements.php index 8b4443d40..0b94ce989 100644 --- a/workflow/engine/services/rest/crud/SwimlanesElements.php +++ b/workflow/engine/services/rest/crud/SwimlanesElements.php @@ -14,7 +14,15 @@ class Services_Rest_SwimlanesElements { $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(SwimlanesElementsPeer::SWI_UID); @@ -34,12 +42,27 @@ class Services_Rest_SwimlanesElements } } else { $record = SwimlanesElementsPeer::retrieveByPK($swiUid); - $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 SwimlanesElements ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Task.php b/workflow/engine/services/rest/crud/Task.php index 3ea0f097c..6630bceec 100644 --- a/workflow/engine/services/rest/crud/Task.php +++ b/workflow/engine/services/rest/crud/Task.php @@ -14,7 +14,15 @@ class Services_Rest_Task { $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(TaskPeer::PRO_UID); @@ -67,12 +75,27 @@ class Services_Rest_Task } } else { $record = TaskPeer::retrieveByPK($tasUid); - $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 Task ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/TaskUser.php b/workflow/engine/services/rest/crud/TaskUser.php index 44f5e5c14..d54319066 100644 --- a/workflow/engine/services/rest/crud/TaskUser.php +++ b/workflow/engine/services/rest/crud/TaskUser.php @@ -14,7 +14,15 @@ class Services_Rest_TaskUser { $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(TaskUserPeer::TAS_UID); @@ -30,12 +38,27 @@ class Services_Rest_TaskUser } } else { $record = TaskUserPeer::retrieveByPK($tasUid, $usrUid, $tuType, $tuRelation); - $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 TaskUser ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Translation.php b/workflow/engine/services/rest/crud/Translation.php index 0a8908ee5..072387d0a 100644 --- a/workflow/engine/services/rest/crud/Translation.php +++ b/workflow/engine/services/rest/crud/Translation.php @@ -14,7 +14,15 @@ class Services_Rest_Translation { $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(TranslationPeer::TRN_CATEGORY); @@ -31,12 +39,27 @@ class Services_Rest_Translation } } else { $record = TranslationPeer::retrieveByPK($trnCategory, $trnId, $trnLang); - $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 Translation ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Triggers.php b/workflow/engine/services/rest/crud/Triggers.php index 645cb5b49..cf15540c9 100644 --- a/workflow/engine/services/rest/crud/Triggers.php +++ b/workflow/engine/services/rest/crud/Triggers.php @@ -14,7 +14,15 @@ class Services_Rest_Triggers { $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(TriggersPeer::TRI_UID); @@ -31,12 +39,27 @@ class Services_Rest_Triggers } } else { $record = TriggersPeer::retrieveByPK($triUid); - $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 Triggers ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/Users.php b/workflow/engine/services/rest/crud/Users.php index ea7d427a9..c7e520b9d 100644 --- a/workflow/engine/services/rest/crud/Users.php +++ b/workflow/engine/services/rest/crud/Users.php @@ -14,7 +14,15 @@ class Services_Rest_Users { $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(UsersPeer::USR_UID); @@ -52,12 +60,27 @@ class Services_Rest_Users } } else { $record = UsersPeer::retrieveByPK($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 Users ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; } diff --git a/workflow/engine/services/rest/crud/UsersProperties.php b/workflow/engine/services/rest/crud/UsersProperties.php index 80095b3bc..09bac6b2b 100644 --- a/workflow/engine/services/rest/crud/UsersProperties.php +++ b/workflow/engine/services/rest/crud/UsersProperties.php @@ -14,7 +14,15 @@ class Services_Rest_UsersProperties { $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(UsersPropertiesPeer::USR_UID); @@ -30,12 +38,27 @@ class Services_Rest_UsersProperties } } else { $record = UsersPropertiesPeer::retrieveByPK($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 UsersProperties ($paramValues)" ); + } } + } catch (RestException $e) { + throw new RestException($e->getCode(), $e->getMessage()); } catch (Exception $e) { throw new RestException(412, $e->getMessage()); } - + return $result; }