Updating API Rest Dispatching, adding alias support from a conf api.ini file
This commit is contained in:
247
workflow/engine/src/Services/Api/OAuth2/PmPdo.php
Normal file
247
workflow/engine/src/Services/Api/OAuth2/PmPdo.php
Normal file
@@ -0,0 +1,247 @@
|
||||
<?php
|
||||
|
||||
namespace Services\Api\OAuth2;
|
||||
|
||||
/**
|
||||
* Simple PmPDO storage for all storage types
|
||||
* based on \OAuth2\Storage\Pdo
|
||||
*
|
||||
* @author Erik Amaru Ortiz <aortiz.erik at gmail dot com>
|
||||
*/
|
||||
class PmPdo implements \OAuth2\Storage\AuthorizationCodeInterface,
|
||||
\OAuth2\Storage\AccessTokenInterface,
|
||||
\OAuth2\Storage\ClientCredentialsInterface,
|
||||
\OAuth2\Storage\UserCredentialsInterface,
|
||||
\OAuth2\Storage\RefreshTokenInterface,
|
||||
\OAuth2\Storage\JwtBearerInterface
|
||||
{
|
||||
|
||||
protected $db;
|
||||
protected $config;
|
||||
|
||||
public function __construct($connection, $config = array())
|
||||
{
|
||||
if (!$connection instanceof \PDO) {
|
||||
if (!is_array($connection)) {
|
||||
throw new \InvalidArgumentException('First argument to OAuth2\Storage\Pdo must be an instance of PDO or a configuration array');
|
||||
}
|
||||
if (!isset($connection['dsn'])) {
|
||||
throw new \InvalidArgumentException('configuration array must contain "dsn"');
|
||||
}
|
||||
// merge optional parameters
|
||||
$connection = array_merge(array(
|
||||
'username' => null,
|
||||
'password' => null,
|
||||
), $connection);
|
||||
$connection = new \PDO($connection['dsn'], $connection['username'], $connection['password']);
|
||||
}
|
||||
$this->db = $connection;
|
||||
|
||||
// debugging
|
||||
$connection->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$this->config = array_merge(array(
|
||||
'client_table' => 'OAUTH_CLIENTS',
|
||||
'access_token_table' => 'OAUTH_ACCESS_TOKENS',
|
||||
'refresh_token_table' => 'OAUTH_REFRESH_TOKENS',
|
||||
'code_table' => 'OAUTH_AUTHORIZATION_CODES',
|
||||
'user_table' => 'OAUTH_USERS',
|
||||
'jwt_table' => 'OAUTH_JWT',
|
||||
), $config);
|
||||
}
|
||||
|
||||
/* OAuth2_Storage_ClientCredentialsInterface */
|
||||
public function checkClientCredentials($client_id, $client_secret = null)
|
||||
{
|
||||
$stmt = $this->db->prepare(sprintf('SELECT * from %s WHERE CLIENT_ID = :client_id', $this->config['client_table']));
|
||||
$stmt->execute(compact('client_id'));
|
||||
$result = self::expandCase($stmt->fetch());
|
||||
|
||||
// make this extensible
|
||||
return $result['client_secret'] == $client_secret;
|
||||
}
|
||||
|
||||
public function getClientDetails($client_id)
|
||||
{
|
||||
$stmt = $this->db->prepare(sprintf('SELECT * from %s WHERE CLIENT_ID = :client_id', $this->config['client_table']));
|
||||
$stmt->execute(compact('client_id'));
|
||||
|
||||
return self::expandCase($stmt->fetch());
|
||||
}
|
||||
|
||||
public function checkRestrictedGrantType($client_id, $grant_type)
|
||||
{
|
||||
$details = $this->getClientDetails($client_id);
|
||||
if (isset($details['grant_types'])) {
|
||||
$grant_types = explode(' ', $details['grant_types']);
|
||||
|
||||
return in_array($grant_type, (array) $grant_types);
|
||||
}
|
||||
|
||||
// if grant_types are not defined, then none are restricted
|
||||
return true;
|
||||
}
|
||||
|
||||
/* OAuth2_Storage_AccessTokenInterface */
|
||||
public function getAccessToken($access_token)
|
||||
{
|
||||
$stmt = $this->db->prepare(sprintf('SELECT * from %s WHERE ACCESS_TOKEN = :access_token', $this->config['access_token_table']));
|
||||
|
||||
$token = $stmt->execute(compact('access_token'));
|
||||
if ($token = self::expandCase($stmt->fetch())) {
|
||||
// convert date string back to timestamp
|
||||
$token['expires'] = strtotime($token['expires']);
|
||||
}
|
||||
|
||||
return $token;
|
||||
}
|
||||
|
||||
public function setAccessToken($access_token, $client_id, $user_id, $expires, $scope = null)
|
||||
{
|
||||
// convert expires to datestring
|
||||
$expires = date('Y-m-d H:i:s', $expires);
|
||||
|
||||
// if it exists, update it.
|
||||
if ($this->getAccessToken($access_token)) {
|
||||
$stmt = $this->db->prepare(sprintf('UPDATE %s SET CLIENT_ID=:client_id, EXPIRES=:expires, USER_ID=:user_id, SCOPE=:scope WHERE ACCESS_TOKEN=:access_token', $this->config['access_token_table']));
|
||||
} else {
|
||||
$stmt = $this->db->prepare(sprintf('INSERT INTO %s (ACCESS_TOKEN, CLIENT_ID, EXPIRES, USER_ID, SCOPE) VALUES (:access_token, :client_id, :expires, :user_id, :scope)', $this->config['access_token_table']));
|
||||
}
|
||||
return $stmt->execute(compact('access_token', 'client_id', 'user_id', 'expires', 'scope'));
|
||||
}
|
||||
|
||||
/* OAuth2_Storage_AuthorizationCodeInterface */
|
||||
public function getAuthorizationCode($code)
|
||||
{
|
||||
$stmt = $this->db->prepare(sprintf('SELECT * FROM %s WHERE AUTHORIZATION_CODE = :code', $this->config['code_table']));
|
||||
$stmt->execute(compact('code'));
|
||||
|
||||
if ($code = self::expandCase($stmt->fetch())) {
|
||||
// convert date string back to timestamp
|
||||
$code['expires'] = strtotime($code['expires']);
|
||||
}
|
||||
|
||||
return $code;
|
||||
}
|
||||
|
||||
public function setAuthorizationCode($code, $client_id, $user_id, $redirect_uri, $expires, $scope = null)
|
||||
{
|
||||
// convert expires to datestring
|
||||
$expires = date('Y-m-d H:i:s', $expires);
|
||||
|
||||
// if it exists, update it.
|
||||
if ($this->getAuthorizationCode($code)) {
|
||||
$stmt = $this->db->prepare($sql = sprintf('UPDATE %s SET CLIENT_ID=:client_id, USER_ID=:user_id, REDIRECT_URI=:redirect_uri, EXPIRES=:expires, SCOPE=:scope where AUTHORIZATION_CODE=:code', $this->config['code_table']));
|
||||
} else {
|
||||
$stmt = $this->db->prepare(sprintf('INSERT INTO %s (AUTHORIZATION_CODE, CLIENT_ID, USER_ID, REDIRECT_URI, EXPIRES, SCOPE) VALUES (:code, :client_id, :user_id, :redirect_uri, :expires, :scope)', $this->config['code_table']));
|
||||
}
|
||||
return $stmt->execute(compact('code', 'client_id', 'user_id', 'redirect_uri', 'expires', 'scope'));
|
||||
}
|
||||
|
||||
public function expireAuthorizationCode($code)
|
||||
{
|
||||
$stmt = $this->db->prepare(sprintf('DELETE FROM %s WHERE AUTHORIZATION_CODE = :code', $this->config['code_table']));
|
||||
|
||||
return $stmt->execute(compact('code'));
|
||||
}
|
||||
|
||||
/* OAuth2_Storage_UserCredentialsInterface */
|
||||
public function checkUserCredentials($username, $password)
|
||||
{
|
||||
if ($user = $this->getUser($username)) {
|
||||
return $this->checkPassword($user, $password);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getUserDetails($username)
|
||||
{
|
||||
return $this->getUser($username);
|
||||
}
|
||||
|
||||
/* OAuth2_Storage_RefreshTokenInterface */
|
||||
public function getRefreshToken($refresh_token)
|
||||
{
|
||||
$stmt = $this->db->prepare(sprintf('SELECT * FROM %s WHERE REFRESH_TOKEN = :refresh_token', $this->config['refresh_token_table']));
|
||||
|
||||
$token = $stmt->execute(compact('refresh_token'));
|
||||
if ($token = self::expandCase($stmt->fetch())) {
|
||||
// convert expires to epoch time
|
||||
$token['expires'] = strtotime($token['expires']);
|
||||
}
|
||||
|
||||
return $token;
|
||||
}
|
||||
|
||||
public function setRefreshToken($refresh_token, $client_id, $user_id, $expires, $scope = null)
|
||||
{
|
||||
// convert expires to datestring
|
||||
$expires = date('Y-m-d H:i:s', $expires);
|
||||
|
||||
$stmt = $this->db->prepare(sprintf('INSERT INTO %s (REFRESH_TOKEN, CLIENT_ID, USER_ID, EXPIRES, SCOPE) VALUES (:refresh_token, :client_id, :user_id, :expires, :scope)', $this->config['refresh_token_table']));
|
||||
|
||||
return $stmt->execute(compact('refresh_token', 'client_id', 'user_id', 'expires', 'scope'));
|
||||
}
|
||||
|
||||
public function unsetRefreshToken($refresh_token)
|
||||
{
|
||||
$stmt = $this->db->prepare(sprintf('DELETE FROM %s WHERE REFRESH_TOKEN = :refresh_token', $this->config['refresh_token_table']));
|
||||
|
||||
return $stmt->execute(compact('refresh_token'));
|
||||
}
|
||||
|
||||
// plaintext passwords are bad! Override this for your application
|
||||
protected function checkPassword($user, $password)
|
||||
{
|
||||
return $user['password'] == sha1($password);
|
||||
}
|
||||
|
||||
public function getUser($username)
|
||||
{
|
||||
$stmt = $this->db->prepare($sql = sprintf('SELECT * FROM %s WHERE USERNAME=:username', $this->config['user_table']));
|
||||
$stmt->execute(array('username' => $username));
|
||||
|
||||
if (!$userInfo = $stmt->fetch()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$userInfo = self::expandCase($userInfo);
|
||||
|
||||
// the default behavior is to use "username" as the user_id
|
||||
return array_merge(array(
|
||||
'user_id' => $username
|
||||
), $userInfo);
|
||||
}
|
||||
|
||||
public function setUser($username, $password, $firstName = null, $lastName = null)
|
||||
{
|
||||
// do not store in plaintext
|
||||
$password = sha1($password);
|
||||
|
||||
// if it exists, update it.
|
||||
if ($this->getUser($username)) {
|
||||
$stmt = $this->db->prepare($sql = sprintf('UPDATE %s SET PASSWORD=:password, FIRST_NAME=:firstName, LAST_NAME=:lastName WHERE USERNAME=:username', $this->config['user_table']));
|
||||
} else {
|
||||
$stmt = $this->db->prepare(sprintf('INSERT INTO %s (USERNAME, PASSWORD, FIRST_NAME, LAST_NAME) VALUES (:username, :password, :firstName, :lastName)', $this->config['user_table']));
|
||||
}
|
||||
return $stmt->execute(compact('username', 'password', 'firstName', 'lastName'));
|
||||
}
|
||||
|
||||
/* OAuth2_Storage_JWTBearerInterface */
|
||||
public function getClientKey($client_id, $subject)
|
||||
{
|
||||
$stmt = $this->db->prepare($sql = sprintf('SELECT PUBLIC_KEY from %s WHERE CLIENT_ID=:client_id AND SUBJECT=:subject', $this->config['jwt_table']));
|
||||
|
||||
$stmt->execute(array('client_id' => $client_id, 'subject' => $subject));
|
||||
return self::expandCase($stmt->fetch());
|
||||
}
|
||||
|
||||
protected static function expandCase($a, $case = CASE_LOWER)
|
||||
{
|
||||
if (! is_array($a)) {
|
||||
return $a;
|
||||
}
|
||||
|
||||
return array_merge($a, array_change_key_case($a, $case));
|
||||
}
|
||||
}
|
||||
227
workflow/engine/src/Services/Api/OAuth2/Server.php
Normal file
227
workflow/engine/src/Services/Api/OAuth2/Server.php
Normal file
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
namespace Services\Api\OAuth2;
|
||||
|
||||
use Luracast\Restler\iAuthenticate;
|
||||
|
||||
|
||||
/**
|
||||
* Class Server
|
||||
*
|
||||
* @package OAuth2
|
||||
* @author Erik Amaru Ortiz <aortiz.erik at gmail dot com>
|
||||
*
|
||||
*/
|
||||
class Server implements iAuthenticate
|
||||
{
|
||||
/**
|
||||
* @var OAuth2_Server
|
||||
*/
|
||||
protected $server;
|
||||
/**
|
||||
* @var OAuth2_Storage_Pdo
|
||||
*/
|
||||
protected $storage;
|
||||
protected $scope = array();
|
||||
|
||||
protected static $pmClientId;
|
||||
protected static $userId;
|
||||
protected static $dbUser;
|
||||
protected static $dbPassword;
|
||||
protected static $dsn;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
require_once 'PmPdo.php';
|
||||
|
||||
$this->scope = array(
|
||||
'view_processes' => 'View Processes',
|
||||
'edit_processes' => 'Edit Processes'
|
||||
);
|
||||
|
||||
// $dsn is the Data Source Name for your database, for exmaple "mysql:dbname=my_oauth2_db;host=localhost"
|
||||
$config = array('dsn' => self::$dsn, 'username' => self::$dbUser, 'password' => self::$dbPassword);
|
||||
//var_dump($config); die;
|
||||
$this->storage = new PmPdo($config);
|
||||
|
||||
// Pass a storage object or array of storage objects to the OAuth2 server class
|
||||
$this->server = new \OAuth2\Server($this->storage);
|
||||
|
||||
$this->server->setConfig('enforce_state', false);
|
||||
|
||||
// Add the "Authorization Code" grant type (this is where the oauth magic happens)
|
||||
$this->server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($this->storage));
|
||||
|
||||
// Add the "Client Credentials" grant type (it is the simplest of the grant types)
|
||||
//$this->server->addGrantType(new \OAuth2\GrantType\ClientCredentials($this->storage));
|
||||
|
||||
// Add the "Refresh token" grant type
|
||||
$this->server->addGrantType(new \OAuth2\GrantType\RefreshToken($this->storage));
|
||||
|
||||
$scope = new \OAuth2\Scope(array(
|
||||
'supported_scopes' => array_keys($this->scope)
|
||||
));
|
||||
$this->server->setScopeUtil($scope);
|
||||
}
|
||||
|
||||
public static function setDatabaseSource($user, $password, $dsn)
|
||||
{
|
||||
self::$dbUser = $user;
|
||||
self::$dbPassword = $password;
|
||||
self::$dsn = $dsn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @view oauth2/server/register.php
|
||||
* @format HtmlFormat
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
static::$server->getResponse(\OAuth2\Request::createFromGlobals());
|
||||
return array('queryString' => $_SERVER['QUERY_STRING']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stage 1: Client sends the user to this page
|
||||
*
|
||||
* User responds by accepting or denying
|
||||
*
|
||||
* @view oauth2/server/authorize.php
|
||||
* @format HtmlFormat
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
$clientId = \OAuth2\Request::createFromGlobals()->query('client_id', '');
|
||||
$requestedScope = \OAuth2\Request::createFromGlobals()->query('scope', '');
|
||||
$requestedScope = empty($requestedScope) ? array() : explode(' ', $requestedScope);
|
||||
|
||||
if (! empty($clientId)) {
|
||||
$clientDetails = $this->storage->getClientDetails(\OAuth2\Request::createFromGlobals()->query('client_id'));
|
||||
}
|
||||
|
||||
return array(
|
||||
'client_details' => $clientDetails,
|
||||
'query_string' => $_SERVER['QUERY_STRING'],
|
||||
'supportedScope' => $this->scope,
|
||||
'requestedScope' => $requestedScope
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stage 2: User response is captured here
|
||||
*
|
||||
* Success or failure is communicated back to the Client using the redirect
|
||||
* url provided by the client
|
||||
*
|
||||
* On success authorization code is sent along
|
||||
*
|
||||
*
|
||||
* @param bool $authorize
|
||||
* @param string $userId optional user id
|
||||
* @param bool $returnResponse optional flag to specify if the function should return the Response object
|
||||
* @return \OAuth2\ResponseInterface
|
||||
* @format JsonFormat,UploadFormat
|
||||
*/
|
||||
public function postAuthorize($authorize = false, $userId = null, $returnResponse = false)
|
||||
{
|
||||
$request = \OAuth2\Request::createFromGlobals();
|
||||
$response = new \OAuth2\Response();
|
||||
|
||||
$response = $this->server->handleAuthorizeRequest(
|
||||
$request,
|
||||
$response,
|
||||
(bool)$authorize,
|
||||
$userId
|
||||
);
|
||||
|
||||
if ($returnResponse) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
die($response->send());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stage 3: Client directly calls this api to exchange access token
|
||||
*
|
||||
* It can then use this access token to make calls to protected api
|
||||
*
|
||||
* @format JsonFormat,UploadFormat
|
||||
*/
|
||||
public function postToken()
|
||||
{
|
||||
// Handle a request for an OAuth2.0 Access Token and send the response to the client
|
||||
$request = \OAuth2\Request::createFromGlobals();
|
||||
$response = $this->server->handleTokenRequest($request);
|
||||
|
||||
/* DEPREACATED
|
||||
$token = $response->getParameters();
|
||||
if (array_key_exists('access_token', $token)) {
|
||||
$data = $this->storage->getAccessToken($token['access_token']);
|
||||
|
||||
// verify if the client is our local PM Designer client
|
||||
if ($data['client_id'] == self::getPmClientId()) {
|
||||
error_log('do stuff - is a request from local pm client');
|
||||
require_once "classes/model/PmoauthUserAccessTokens.php";
|
||||
|
||||
$userToken = new \PmoauthUserAccessTokens();
|
||||
$userToken->setAccessToken($token['access_token']);
|
||||
$userToken->setRefreshToken($token['refresh_token']);
|
||||
$userToken->setUserId($data['user_id']);
|
||||
$userToken->setSessionId(session_id());
|
||||
|
||||
$userToken->save();
|
||||
}
|
||||
}*/
|
||||
|
||||
$response->send();
|
||||
}
|
||||
|
||||
/**
|
||||
* Access verification method.
|
||||
*
|
||||
* API access will be denied when this method returns false
|
||||
*
|
||||
* @return boolean true when api access is allowed; false otherwise
|
||||
*/
|
||||
public function __isAllowed()
|
||||
{
|
||||
$request = \OAuth2\Request::createFromGlobals();
|
||||
$allowed = $this->server->verifyResourceRequest($request);
|
||||
$token = $this->server->getAccessTokenData($request);
|
||||
|
||||
self::$userId = $token['user_id'];
|
||||
|
||||
// verify if the client is not our local PM Designer client
|
||||
if ($token['client_id'] != self::getPmClientId()) {
|
||||
// return $allowed;
|
||||
}
|
||||
|
||||
// making a local session verification for PM Web Designer Client
|
||||
if (! isset($_SESSION) || ! array_key_exists('USER_LOGGED', $_SESSION)) {
|
||||
// return false;
|
||||
}
|
||||
|
||||
return $allowed;
|
||||
}
|
||||
|
||||
public static function setPmClientId($clientId)
|
||||
{
|
||||
self::$pmClientId = $clientId;
|
||||
}
|
||||
|
||||
public static function getPmClientId()
|
||||
{
|
||||
return self::$pmClientId;
|
||||
}
|
||||
|
||||
public function getServer()
|
||||
{
|
||||
return $this->server;
|
||||
}
|
||||
|
||||
public function getUserId()
|
||||
{
|
||||
return self::$userId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
namespace Services\Api\ProcessMaker;
|
||||
|
||||
class Application extends \ProcessMaker\Api
|
||||
{
|
||||
/**
|
||||
* Sample api protected with OAuth2
|
||||
*
|
||||
* For testing the oAuth token
|
||||
*
|
||||
* @access protected
|
||||
*/
|
||||
public function get($id)
|
||||
{
|
||||
$data = array(
|
||||
'USSER_LOGGED' => $this->getUserId(),
|
||||
"APP_UID" => $id,
|
||||
"PRO_UID" => "13885168416038181883131343548151",
|
||||
"DUMMY" => "sample data",
|
||||
"WS" => $this->getWorkspace()
|
||||
);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function post($requestData = null)
|
||||
{
|
||||
$requestData['processed'] = true;
|
||||
|
||||
return $requestData;
|
||||
}
|
||||
}
|
||||
259
workflow/engine/src/Services/Api/ProcessMaker/Process.php
Normal file
259
workflow/engine/src/Services/Api/ProcessMaker/Process.php
Normal file
@@ -0,0 +1,259 @@
|
||||
<?php
|
||||
namespace Services\Api\ProcessMaker;
|
||||
|
||||
use \ProcessMaker\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Process Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Process extends Api
|
||||
{
|
||||
public function index($proTitle = "", $proCategory = "", $start = 0, $limit = 25)
|
||||
{
|
||||
try {
|
||||
$arrayFilterData = array();
|
||||
|
||||
if ($proTitle != "") {
|
||||
$arrayFilterData["processName"] = $proTitle;
|
||||
}
|
||||
|
||||
if ($proCategory != "") {
|
||||
$arrayFilterData["category"] = $proCategory;
|
||||
}
|
||||
|
||||
$process = new \BusinessModel\Process();
|
||||
$data = $process->loadAllProcess($arrayFilterData, $start, $limit);
|
||||
|
||||
// Composing Response
|
||||
$response = array(
|
||||
'processes' => $data['data'],
|
||||
'totalCount' => $data['totalCount']
|
||||
);
|
||||
|
||||
return $response;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function get($processUid)
|
||||
{
|
||||
$response = array();
|
||||
|
||||
try {
|
||||
$process = new \BusinessModel\Process();
|
||||
|
||||
$data = $process->loadProcess($processUid);
|
||||
|
||||
//Response
|
||||
$response["success"] = true;
|
||||
$response["message"] = "Process load successfully";
|
||||
$response["data"] = $data;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function post($request_data = null)
|
||||
{
|
||||
defined('SYS_LANG') || define("SYS_LANG", $request_data["lang"]);
|
||||
|
||||
try {
|
||||
$process = new \BusinessModel\Process();
|
||||
$userUid = $this->getUserId();
|
||||
|
||||
return $process->createProcess($userUid, $request_data);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function put($processUid, $request_data = null)
|
||||
{
|
||||
$response = array();
|
||||
|
||||
try {
|
||||
$process = new \BusinessModel\Process();
|
||||
$userUid = $this->getUserId();
|
||||
|
||||
$data = $process->updateProcess($processUid, $userUid, $request_data);
|
||||
|
||||
//Response
|
||||
$response["success"] = true;
|
||||
$response["message"] = "Process updated successfully";
|
||||
$response["data"] = $data;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function delete($processUid, $checkCases = 1)
|
||||
{
|
||||
$response = array();
|
||||
|
||||
try {
|
||||
$process = new \BusinessModel\Process();
|
||||
|
||||
$result = $process->deleteProcess($processUid, (($checkCases && $checkCases == 1)? true : false));
|
||||
|
||||
//Response
|
||||
$response["success"] = true;
|
||||
$response["message"] = "Process was deleted successfully";
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::SYSTEM_EXCEPTION_STATUS, $e->getMessage());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @url GET /:processUid/activity/:activityUid
|
||||
*/
|
||||
public function getActivity($activityUid, $processUid)
|
||||
{
|
||||
$response = array();
|
||||
|
||||
try {
|
||||
$task1 = new \Task();
|
||||
$task2 = new \BusinessModel\Task();
|
||||
|
||||
$arrayData = $task1->load($activityUid);
|
||||
|
||||
$arrayData = array(
|
||||
//"tas_uid" => $activityUid,
|
||||
"tas_title" => $arrayData["TAS_TITLE"],
|
||||
"tas_description" => $arrayData["TAS_DESCRIPTION"],
|
||||
"tas_posx" => $arrayData["TAS_POSX"],
|
||||
"tas_posy" => $arrayData["TAS_POSY"],
|
||||
"tas_start" => $arrayData["TAS_START"],
|
||||
"_extended" => array(
|
||||
"properties" => $task2->getProperties($activityUid, true),
|
||||
"steps" => array(
|
||||
"steps" => $task2->getSteps($activityUid, true),
|
||||
"conditions" => "...", //lo mismo que steps //$task->getSteps()
|
||||
"triggers" => $task2->getTriggers($activityUid, true),
|
||||
"users" => $task2->getUsers($activityUid, 1, true),
|
||||
"users_adhoc" => $task2->getUsers($activityUid, 2, true)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
//Response
|
||||
$response["success"] = true;
|
||||
$response["message"] = "Properties loaded successfully";
|
||||
$response["data"] = array("activity" => $arrayData);
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
$response["success"] = false;
|
||||
$response["message"] = $e->getMessage();
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:processUid/activity/:activityUid/properties
|
||||
*/
|
||||
public function getActivityProperties($activityUid, $processUid)
|
||||
{
|
||||
$response = array();
|
||||
|
||||
try {
|
||||
$task1 = new \Task();
|
||||
|
||||
$arrayData = $task1->load($activityUid);
|
||||
|
||||
$arrayData = array(
|
||||
//"tas_uid" => $activityUid,
|
||||
"tas_title" => $arrayData["TAS_TITLE"],
|
||||
"tas_description" => $arrayData["TAS_DESCRIPTION"],
|
||||
"tas_posx" => $arrayData["TAS_POSX"],
|
||||
"tas_posy" => $arrayData["TAS_POSY"],
|
||||
"tas_start" => $arrayData["TAS_START"]
|
||||
);
|
||||
|
||||
//Response
|
||||
$response["success"] = true;
|
||||
$response["message"] = "Properties loaded successfully";
|
||||
$response["data"] = array("activity" => $arrayData);
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
$response["success"] = false;
|
||||
$response["message"] = $e->getMessage();
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:processUid/activity/:activityUid/extended
|
||||
*/
|
||||
public function getActivityExtended($activityUid, $processUid)
|
||||
{
|
||||
$response = array();
|
||||
|
||||
try {
|
||||
$task2 = new \BusinessModel\Task();
|
||||
|
||||
$arrayData = array(
|
||||
"_extended" => array(
|
||||
"properties" => $task2->getProperties($activityUid, true),
|
||||
"steps" => array(
|
||||
"steps" => $task2->getSteps($activityUid, true),
|
||||
"conditions" => "...", //lo mismo que steps //$task->getSteps()
|
||||
"triggers" => $task2->getTriggers($activityUid, true),
|
||||
"users" => $task2->getUsers($activityUid, 1, true),
|
||||
"users_adhoc" => $task2->getUsers($activityUid, 2, true)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
//Response
|
||||
$response["success"] = true;
|
||||
$response["message"] = "Extended loaded successfully";
|
||||
$response["data"] = array("activity" => $arrayData);
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
$response["success"] = false;
|
||||
$response["message"] = $e->getMessage();
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:processUid/activity/:activityUid/steps/list
|
||||
*/
|
||||
public function getActivityStepsList($activityUid, $processUid, $start = 0, $limit = 10)
|
||||
{
|
||||
$response = array();
|
||||
|
||||
try {
|
||||
$task = new \BusinessModel\Task();
|
||||
|
||||
$data = $task->getStepsList($activityUid, $processUid, false, $start, $limit);
|
||||
|
||||
//Response
|
||||
$response["success"] = true;
|
||||
$response["message"] = "Steps loaded successfully";
|
||||
$response["data"] = $data;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
$response["success"] = false;
|
||||
$response["message"] = $e->getMessage();
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
116
workflow/engine/src/Services/Api/ProcessMaker/Test.php
Normal file
116
workflow/engine/src/Services/Api/ProcessMaker/Test.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
namespace Services\Api\ProcessMaker;
|
||||
|
||||
use \ProcessMaker\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
class Test extends Api
|
||||
{
|
||||
protected $data = array();
|
||||
|
||||
function __construct()
|
||||
{
|
||||
if (! isset($_SESSION['__rest_tmp__'])) {
|
||||
$this->data[1] = array(
|
||||
'id' => '1',
|
||||
'name' => 'John',
|
||||
'lastname' => 'Doe',
|
||||
'age' => '27'
|
||||
);
|
||||
$this->saveData();
|
||||
} else {
|
||||
$this->loadData();
|
||||
}
|
||||
}
|
||||
|
||||
function index()
|
||||
{
|
||||
return array_values($this->data);
|
||||
}
|
||||
|
||||
function get($id)
|
||||
{
|
||||
if (array_key_exists($id, $this->data)) {
|
||||
return $this->data[$id];
|
||||
}
|
||||
|
||||
throw new RestException(400, "Record not found. Record with id: $id does not exist!");
|
||||
}
|
||||
|
||||
function post($request_data = NULL)
|
||||
{
|
||||
$id = count($this->data) + 1;
|
||||
$this->data[$id] = array(
|
||||
'id' => $id,
|
||||
'name' => '',
|
||||
'lastname' => '',
|
||||
'age' => ''
|
||||
);
|
||||
|
||||
if (array_key_exists('name', $request_data)) {
|
||||
$this->data[$id]['name'] = $request_data['name'];
|
||||
}
|
||||
if (array_key_exists('lastname', $request_data)) {
|
||||
$this->data[$id]['lastname'] = $request_data['lastname'];
|
||||
}
|
||||
if (array_key_exists('age', $request_data)) {
|
||||
$this->data[$id]['age'] = $request_data['age'];
|
||||
}
|
||||
|
||||
$this->saveData();
|
||||
|
||||
return $this->data[$id];
|
||||
}
|
||||
|
||||
function put($id, $request_data = NULL)
|
||||
{
|
||||
if (array_key_exists($id, $this->data)) {
|
||||
if (array_key_exists('name', $request_data)) {
|
||||
$this->data[$id] = $request_data['name'];
|
||||
}
|
||||
if (array_key_exists('lastname', $request_data)) {
|
||||
$this->data[$id] = $request_data['lastname'];
|
||||
}
|
||||
if (array_key_exists('age', $request_data)) {
|
||||
$this->data[$id] = $request_data['age'];
|
||||
}
|
||||
$this->saveData();
|
||||
|
||||
return $this->data[$id];
|
||||
} else {
|
||||
throw new RestException(400, "Record not found. Record with id: $id does not exist!");
|
||||
}
|
||||
}
|
||||
|
||||
function delete($id)
|
||||
{
|
||||
if (array_key_exists($id, $this->data)) {
|
||||
$row = $this->data[$id];
|
||||
unset($this->data[$id]);
|
||||
$this->saveData();
|
||||
|
||||
return $row;
|
||||
} else {
|
||||
throw new RestException(400, "Record not found. Record with id: $id does not exist!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /testing/sample/:param
|
||||
*/
|
||||
function doOverride($param)
|
||||
{
|
||||
return $param;
|
||||
}
|
||||
|
||||
/* Private methods */
|
||||
private function loadData()
|
||||
{
|
||||
$this->data = $_SESSION['__rest_tmp__'];
|
||||
}
|
||||
|
||||
private function saveData()
|
||||
{
|
||||
$_SESSION['__rest_tmp__'] = $this->data;
|
||||
}
|
||||
}
|
||||
30
workflow/engine/src/Services/Api/ProcessMaker/Test2.php
Normal file
30
workflow/engine/src/Services/Api/ProcessMaker/Test2.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace Services\Api\ProcessMaker;
|
||||
|
||||
use \ProcessMaker\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
class Test2 extends Api
|
||||
{
|
||||
|
||||
function hello()
|
||||
{
|
||||
return 'GEEET ALL';
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /getHello
|
||||
*/
|
||||
function helloworld($param = '')
|
||||
{
|
||||
return 'Greetings, from a overridden url ' . $param;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /sample/other/large/:name
|
||||
*/
|
||||
function sampleOther($name)
|
||||
{
|
||||
return 'Name: ' . $name;
|
||||
}
|
||||
}
|
||||
6
workflow/engine/src/Services/api.ini
Normal file
6
workflow/engine/src/Services/api.ini
Normal file
@@ -0,0 +1,6 @@
|
||||
;
|
||||
; API Rest Configuration File
|
||||
;
|
||||
|
||||
[alias]
|
||||
test = "Services\Api\ProcessMaker\Test2"
|
||||
36
workflow/engine/src/Services/rest/Auth.php
Normal file
36
workflow/engine/src/Services/rest/Auth.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
G::LoadClass('sessions');
|
||||
G::LoadClass('wsBase');
|
||||
|
||||
class Services_Rest_Auth implements iAuthenticate
|
||||
{
|
||||
public $realm = 'Restricted API';
|
||||
|
||||
public static $userId = '';
|
||||
public static $authKey = '';
|
||||
|
||||
function __isAuthenticated()
|
||||
{
|
||||
return true;
|
||||
if (array_key_exists('HTTP_AUTH_KEY', $_SERVER)) {
|
||||
$authKey = $_SERVER['HTTP_AUTH_KEY'];
|
||||
} elseif (array_key_exists('auth_key', $_GET)) {
|
||||
$authKey = $_GET['auth_key'];
|
||||
} else {
|
||||
throw new RestException(401, 'Authentication Required');
|
||||
}
|
||||
|
||||
$sessions = new Sessions();
|
||||
$session = $sessions->verifySession($authKey);
|
||||
|
||||
if (is_array($session)) {
|
||||
$sesInfo = $sessions->getSessionUser($authKey);
|
||||
self::$userId = $sesInfo['USR_UID'];
|
||||
self::$authKey = $authKey;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
throw new RestException(401, 'Wrong Credentials!');
|
||||
}
|
||||
}
|
||||
21
workflow/engine/src/Services/rest/Case.php
Normal file
21
workflow/engine/src/Services/rest/Case.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_Case
|
||||
{
|
||||
protected function get($id = '', $start=null, $limit=null, $type=null, $filter=null, $search=null, $process=null, $user=null, $status=null, $typeResource=null, $dateFrom=null, $dateTo=null)
|
||||
{
|
||||
if (empty($id)) {
|
||||
// getting all records.
|
||||
G::loadClass('applications');
|
||||
$app = new Applications();
|
||||
$userUid = Services_Rest_Auth::$userId;
|
||||
|
||||
return $app->getAll($userUid, $start, $limit, $type, $filter, $search, $process, $status, $typeResource, $dateFrom, $dateTo);
|
||||
} else {
|
||||
// get a specific record.
|
||||
G::loadClass('wsBase');
|
||||
$wsBase = new wsBase();
|
||||
return $wsBase->getCaseInfo($id);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
workflow/engine/src/Services/rest/Login.php
Normal file
20
workflow/engine/src/Services/rest/Login.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
G::loadClass('wsBase');
|
||||
G::LoadClass('sessions');
|
||||
|
||||
class Services_Rest_Login
|
||||
{
|
||||
public function post($user, $password)
|
||||
{
|
||||
$wsBase = new wsBase();
|
||||
$result = $wsBase->login($user, $password);
|
||||
|
||||
if ($result->status_code == 0) {
|
||||
return array(
|
||||
'auth_key' => $result->message,
|
||||
);
|
||||
} else {
|
||||
throw new RestException(401, $result->message);
|
||||
}
|
||||
}
|
||||
}
|
||||
78
workflow/engine/src/Services/rest/crud/AdditionalTables.php
Normal file
78
workflow/engine/src/Services/rest/crud/AdditionalTables.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_AdditionalTables
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $addTabUid 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 get($addTabUid=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_CLASS_NAME);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_SDW_LOG_INSERT);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_SDW_LOG_UPDATE);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_SDW_LOG_DELETE);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_SDW_LOG_SELECT);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_SDW_MAX_LENGTH);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_SDW_AUTO_DELETE);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_PLG_UID);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::DBS_UID);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TYPE);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_GRID);
|
||||
$criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TAG);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = AdditionalTablesPeer::retrieveByPK($addTabUid);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
92
workflow/engine/src/Services/rest/crud/AppCacheView.php
Normal file
92
workflow/engine/src/Services/rest/crud/AppCacheView.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_AppCacheView
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $appUid, $delIndex 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 get($appUid=null, $delIndex=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::DEL_INDEX);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::APP_NUMBER);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::APP_STATUS);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::USR_UID);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::PREVIOUS_USR_UID);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::DEL_DELEGATE_DATE);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::DEL_INIT_DATE);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::DEL_TASK_DUE_DATE);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::DEL_FINISH_DATE);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::DEL_THREAD_STATUS);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::APP_THREAD_STATUS);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::APP_TITLE);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::APP_PRO_TITLE);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::APP_TAS_TITLE);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::APP_CURRENT_USER);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::APP_DEL_PREVIOUS_USER);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::DEL_PRIORITY);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::DEL_DURATION);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::DEL_QUEUE_DURATION);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::DEL_DELAY_DURATION);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::DEL_STARTED);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::DEL_FINISHED);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::DEL_DELAYED);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::APP_CREATE_DATE);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::APP_FINISH_DATE);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::APP_UPDATE_DATE);
|
||||
$criteria->addSelectColumn(AppCacheViewPeer::APP_OVERDUE_PERCENTAGE);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = AppCacheViewPeer::retrieveByPK($appUid, $delIndex);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
76
workflow/engine/src/Services/rest/crud/AppDelay.php
Normal file
76
workflow/engine/src/Services/rest/crud/AppDelay.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_AppDelay
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $appDelayUid 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 get($appDelayUid=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(AppDelayPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(AppDelayPeer::APP_UID);
|
||||
$criteria->addSelectColumn(AppDelayPeer::APP_THREAD_INDEX);
|
||||
$criteria->addSelectColumn(AppDelayPeer::APP_DEL_INDEX);
|
||||
$criteria->addSelectColumn(AppDelayPeer::APP_TYPE);
|
||||
$criteria->addSelectColumn(AppDelayPeer::APP_STATUS);
|
||||
$criteria->addSelectColumn(AppDelayPeer::APP_NEXT_TASK);
|
||||
$criteria->addSelectColumn(AppDelayPeer::APP_DELEGATION_USER);
|
||||
$criteria->addSelectColumn(AppDelayPeer::APP_ENABLE_ACTION_USER);
|
||||
$criteria->addSelectColumn(AppDelayPeer::APP_ENABLE_ACTION_DATE);
|
||||
$criteria->addSelectColumn(AppDelayPeer::APP_DISABLE_ACTION_USER);
|
||||
$criteria->addSelectColumn(AppDelayPeer::APP_DISABLE_ACTION_DATE);
|
||||
$criteria->addSelectColumn(AppDelayPeer::APP_AUTOMATIC_DISABLED_DATE);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = AppDelayPeer::retrieveByPK($appDelayUid);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
84
workflow/engine/src/Services/rest/crud/AppDelegation.php
Normal file
84
workflow/engine/src/Services/rest/crud/AppDelegation.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_AppDelegation
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $appUid, $delIndex 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 get($appUid=null, $delIndex=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::USR_UID);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_TYPE);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_THREAD);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_THREAD_STATUS);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_PRIORITY);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_DURATION);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_QUEUE_DURATION);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_DELAY_DURATION);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_STARTED);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_FINISHED);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_DELAYED);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_DATA);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::APP_OVERDUE_PERCENTAGE);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = AppDelegationPeer::retrieveByPK($appUid, $delIndex);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
77
workflow/engine/src/Services/rest/crud/AppDocument.php
Normal file
77
workflow/engine/src/Services/rest/crud/AppDocument.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_AppDocument
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $appDocUid, $docVersion 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 get($appDocUid=null, $docVersion=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::DOC_VERSION);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_UID);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::DEL_INDEX);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::DOC_UID);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::USR_UID);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_TYPE);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_CREATE_DATE);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_INDEX);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::FOLDER_UID);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_PLUGIN);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_TAGS);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_STATUS);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_STATUS_DATE);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_FIELDNAME);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = AppDocumentPeer::retrieveByPK($appDocUid, $docVersion);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
69
workflow/engine/src/Services/rest/crud/AppEvent.php
Normal file
69
workflow/engine/src/Services/rest/crud/AppEvent.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_AppEvent
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $appUid, $delIndex, $evnUid 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 get($appUid=null, $delIndex=null, $evnUid=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(AppEventPeer::DEL_INDEX);
|
||||
$criteria->addSelectColumn(AppEventPeer::EVN_UID);
|
||||
$criteria->addSelectColumn(AppEventPeer::APP_EVN_ACTION_DATE);
|
||||
$criteria->addSelectColumn(AppEventPeer::APP_EVN_ATTEMPTS);
|
||||
$criteria->addSelectColumn(AppEventPeer::APP_EVN_LAST_EXECUTION_DATE);
|
||||
$criteria->addSelectColumn(AppEventPeer::APP_EVN_STATUS);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = AppEventPeer::retrieveByPK($appUid, $delIndex, $evnUid);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
67
workflow/engine/src/Services/rest/crud/AppFolder.php
Normal file
67
workflow/engine/src/Services/rest/crud/AppFolder.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_AppFolder
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $folderUid 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 get($folderUid=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(AppFolderPeer::FOLDER_PARENT_UID);
|
||||
$criteria->addSelectColumn(AppFolderPeer::FOLDER_NAME);
|
||||
$criteria->addSelectColumn(AppFolderPeer::FOLDER_CREATE_DATE);
|
||||
$criteria->addSelectColumn(AppFolderPeer::FOLDER_UPDATE_DATE);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = AppFolderPeer::retrieveByPK($folderUid);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
71
workflow/engine/src/Services/rest/crud/AppHistory.php
Normal file
71
workflow/engine/src/Services/rest/crud/AppHistory.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_AppHistory
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed 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 get()
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(AppHistoryPeer::DEL_INDEX);
|
||||
$criteria->addSelectColumn(AppHistoryPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(AppHistoryPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(AppHistoryPeer::DYN_UID);
|
||||
$criteria->addSelectColumn(AppHistoryPeer::USR_UID);
|
||||
$criteria->addSelectColumn(AppHistoryPeer::APP_STATUS);
|
||||
$criteria->addSelectColumn(AppHistoryPeer::HISTORY_DATE);
|
||||
$criteria->addSelectColumn(AppHistoryPeer::HISTORY_DATA);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = AppHistoryPeer::retrieveByPK();
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
78
workflow/engine/src/Services/rest/crud/AppMessage.php
Normal file
78
workflow/engine/src/Services/rest/crud/AppMessage.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_AppMessage
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $appMsgUid 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 get($appMsgUid=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(AppMessagePeer::MSG_UID);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_UID);
|
||||
$criteria->addSelectColumn(AppMessagePeer::DEL_INDEX);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_TYPE);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_SUBJECT);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_FROM);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_TO);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_BODY);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_DATE);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_CC);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_BCC);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_TEMPLATE);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_STATUS);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_ATTACH);
|
||||
$criteria->addSelectColumn(AppMessagePeer::APP_MSG_SEND_DATE);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = AppMessagePeer::retrieveByPK($appMsgUid);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
72
workflow/engine/src/Services/rest/crud/AppNotes.php
Normal file
72
workflow/engine/src/Services/rest/crud/AppNotes.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_AppNotes
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed 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 get()
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(AppNotesPeer::USR_UID);
|
||||
$criteria->addSelectColumn(AppNotesPeer::NOTE_DATE);
|
||||
$criteria->addSelectColumn(AppNotesPeer::NOTE_CONTENT);
|
||||
$criteria->addSelectColumn(AppNotesPeer::NOTE_TYPE);
|
||||
$criteria->addSelectColumn(AppNotesPeer::NOTE_AVAILABILITY);
|
||||
$criteria->addSelectColumn(AppNotesPeer::NOTE_ORIGIN_OBJ);
|
||||
$criteria->addSelectColumn(AppNotesPeer::NOTE_AFFECTED_OBJ1);
|
||||
$criteria->addSelectColumn(AppNotesPeer::NOTE_AFFECTED_OBJ2);
|
||||
$criteria->addSelectColumn(AppNotesPeer::NOTE_RECIPIENTS);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = AppNotesPeer::retrieveByPK();
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
137
workflow/engine/src/Services/rest/crud/AppOwner.php
Normal file
137
workflow/engine/src/Services/rest/crud/AppOwner.php
Normal file
@@ -0,0 +1,137 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_AppOwner
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $appUid, $ownUid, $usrUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function get($appUid=null, $ownUid=null, $usrUid=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(AppOwnerPeer::OWN_UID);
|
||||
$criteria->addSelectColumn(AppOwnerPeer::USR_UID);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = AppOwnerPeer::retrieveByPK($appUid, $ownUid, $usrUid);
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'POST' method for Rest API
|
||||
*
|
||||
* @param mixed $appUid, $ownUid, $usrUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function post($appUid, $ownUid, $usrUid)
|
||||
{
|
||||
try {
|
||||
$result = array();
|
||||
$obj = new AppOwner();
|
||||
|
||||
$obj->setAppUid($appUid);
|
||||
$obj->setOwnUid($ownUid);
|
||||
$obj->setUsrUid($usrUid);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'PUT' method for Rest API
|
||||
*
|
||||
* @param mixed $appUid, $ownUid, $usrUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function put($appUid, $ownUid, $usrUid)
|
||||
{
|
||||
try {
|
||||
$obj = AppOwnerPeer::retrieveByPK($appUid, $ownUid, $usrUid);
|
||||
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'DELETE' method for Rest API
|
||||
*
|
||||
* @param mixed $appUid, $ownUid, $usrUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function delete($appUid, $ownUid, $usrUid)
|
||||
{
|
||||
$conn = Propel::getConnection(AppOwnerPeer::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
$conn->begin();
|
||||
|
||||
$obj = AppOwnerPeer::retrieveByPK($appUid, $ownUid, $usrUid);
|
||||
if (! is_object($obj)) {
|
||||
throw new RestException(412, 'Record does not exist.');
|
||||
}
|
||||
$obj->delete();
|
||||
|
||||
$conn->commit();
|
||||
} catch (Exception $e) {
|
||||
$conn->rollback();
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
64
workflow/engine/src/Services/rest/crud/AppSolrQueue.php
Normal file
64
workflow/engine/src/Services/rest/crud/AppSolrQueue.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_AppSolrQueue
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' 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 get($appUid=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(AppSolrQueuePeer::APP_UPDATED);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = AppSolrQueuePeer::retrieveByPK($appUid);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
144
workflow/engine/src/Services/rest/crud/AppThread.php
Normal file
144
workflow/engine/src/Services/rest/crud/AppThread.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_AppThread
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $appUid, $appThreadIndex Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function get($appUid=null, $appThreadIndex=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(AppThreadPeer::APP_THREAD_INDEX);
|
||||
$criteria->addSelectColumn(AppThreadPeer::APP_THREAD_PARENT);
|
||||
$criteria->addSelectColumn(AppThreadPeer::APP_THREAD_STATUS);
|
||||
$criteria->addSelectColumn(AppThreadPeer::DEL_INDEX);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = AppThreadPeer::retrieveByPK($appUid, $appThreadIndex);
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'POST' method for Rest API
|
||||
*
|
||||
* @param mixed $appUid, $appThreadIndex Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function post($appUid, $appThreadIndex, $appThreadParent, $appThreadStatus, $delIndex)
|
||||
{
|
||||
try {
|
||||
$result = array();
|
||||
$obj = new AppThread();
|
||||
|
||||
$obj->setAppUid($appUid);
|
||||
$obj->setAppThreadIndex($appThreadIndex);
|
||||
$obj->setAppThreadParent($appThreadParent);
|
||||
$obj->setAppThreadStatus($appThreadStatus);
|
||||
$obj->setDelIndex($delIndex);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'PUT' method for Rest API
|
||||
*
|
||||
* @param mixed $appUid, $appThreadIndex Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function put($appUid, $appThreadIndex, $appThreadParent, $appThreadStatus, $delIndex)
|
||||
{
|
||||
try {
|
||||
$obj = AppThreadPeer::retrieveByPK($appUid, $appThreadIndex);
|
||||
|
||||
$obj->setAppThreadParent($appThreadParent);
|
||||
$obj->setAppThreadStatus($appThreadStatus);
|
||||
$obj->setDelIndex($delIndex);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'DELETE' method for Rest API
|
||||
*
|
||||
* @param mixed $appUid, $appThreadIndex Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function delete($appUid, $appThreadIndex)
|
||||
{
|
||||
$conn = Propel::getConnection(AppThreadPeer::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
$conn->begin();
|
||||
|
||||
$obj = AppThreadPeer::retrieveByPK($appUid, $appThreadIndex);
|
||||
if (! is_object($obj)) {
|
||||
throw new RestException(412, 'Record does not exist.');
|
||||
}
|
||||
$obj->delete();
|
||||
|
||||
$conn->commit();
|
||||
} catch (Exception $e) {
|
||||
$conn->rollback();
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
178
workflow/engine/src/Services/rest/crud/Application.php
Normal file
178
workflow/engine/src/Services/rest/crud/Application.php
Normal file
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_Application
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' 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 get($appUid=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_NUMBER);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_PARENT);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_STATUS);
|
||||
$criteria->addSelectColumn(ApplicationPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_PROC_STATUS);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_PROC_CODE);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_PARALLEL);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_INIT_USER);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_CUR_USER);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_CREATE_DATE);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_INIT_DATE);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_FINISH_DATE);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_UPDATE_DATE);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_DATA);
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_PIN);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = ApplicationPeer::retrieveByPK($appUid);
|
||||
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, G::LoadTranslation('ID_RECORD_DOES_NOT_EXIST'));
|
||||
}
|
||||
$obj->delete();
|
||||
|
||||
$conn->commit();
|
||||
} catch (Exception $e) {
|
||||
$conn->rollback();
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_CalendarAssignments
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $objectUid 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 get($objectUid=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(CalendarAssignmentsPeer::CALENDAR_UID);
|
||||
$criteria->addSelectColumn(CalendarAssignmentsPeer::OBJECT_TYPE);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = CalendarAssignmentsPeer::retrieveByPK($objectUid);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_CalendarBusinessHours
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $calendarUid, $calendarBusinessDay, $calendarBusinessStart, $calendarBusinessEnd 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 get($calendarUid=null, $calendarBusinessDay=null, $calendarBusinessStart=null, $calendarBusinessEnd=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(CalendarBusinessHoursPeer::CALENDAR_BUSINESS_DAY);
|
||||
$criteria->addSelectColumn(CalendarBusinessHoursPeer::CALENDAR_BUSINESS_START);
|
||||
$criteria->addSelectColumn(CalendarBusinessHoursPeer::CALENDAR_BUSINESS_END);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = CalendarBusinessHoursPeer::retrieveByPK($calendarUid, $calendarBusinessDay, $calendarBusinessStart, $calendarBusinessEnd);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
151
workflow/engine/src/Services/rest/crud/CalendarDefinition.php
Normal file
151
workflow/engine/src/Services/rest/crud/CalendarDefinition.php
Normal file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_CalendarDefinition
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $calendarUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function get($calendarUid=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_NAME);
|
||||
$criteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_CREATE_DATE);
|
||||
$criteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_UPDATE_DATE);
|
||||
$criteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_WORK_DAYS);
|
||||
$criteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_DESCRIPTION);
|
||||
$criteria->addSelectColumn(CalendarDefinitionPeer::CALENDAR_STATUS);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = CalendarDefinitionPeer::retrieveByPK($calendarUid);
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'POST' method for Rest API
|
||||
*
|
||||
* @param mixed $calendarUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function post($calendarUid, $calendarName, $calendarCreateDate, $calendarUpdateDate, $calendarWorkDays, $calendarDescription, $calendarStatus)
|
||||
{
|
||||
try {
|
||||
$result = array();
|
||||
$obj = new CalendarDefinition();
|
||||
|
||||
$obj->setCalendarUid($calendarUid);
|
||||
$obj->setCalendarName($calendarName);
|
||||
$obj->setCalendarCreateDate($calendarCreateDate);
|
||||
$obj->setCalendarUpdateDate($calendarUpdateDate);
|
||||
$obj->setCalendarWorkDays($calendarWorkDays);
|
||||
$obj->setCalendarDescription($calendarDescription);
|
||||
$obj->setCalendarStatus($calendarStatus);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'PUT' method for Rest API
|
||||
*
|
||||
* @param mixed $calendarUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function put($calendarUid, $calendarName, $calendarCreateDate, $calendarUpdateDate, $calendarWorkDays, $calendarDescription, $calendarStatus)
|
||||
{
|
||||
try {
|
||||
$obj = CalendarDefinitionPeer::retrieveByPK($calendarUid);
|
||||
|
||||
$obj->setCalendarName($calendarName);
|
||||
$obj->setCalendarCreateDate($calendarCreateDate);
|
||||
$obj->setCalendarUpdateDate($calendarUpdateDate);
|
||||
$obj->setCalendarWorkDays($calendarWorkDays);
|
||||
$obj->setCalendarDescription($calendarDescription);
|
||||
$obj->setCalendarStatus($calendarStatus);
|
||||
|
||||
$obj->save();
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation for 'DELETE' method for Rest API
|
||||
*
|
||||
* @param mixed $calendarUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function delete($calendarUid)
|
||||
{
|
||||
$conn = Propel::getConnection(CalendarDefinitionPeer::DATABASE_NAME);
|
||||
|
||||
try {
|
||||
$conn->begin();
|
||||
|
||||
$obj = CalendarDefinitionPeer::retrieveByPK($calendarUid);
|
||||
if (! is_object($obj)) {
|
||||
throw new RestException(412, 'Record does not exist.');
|
||||
}
|
||||
$obj->delete();
|
||||
|
||||
$conn->commit();
|
||||
} catch (Exception $e) {
|
||||
$conn->rollback();
|
||||
throw new RestException(412, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
66
workflow/engine/src/Services/rest/crud/CalendarHolidays.php
Normal file
66
workflow/engine/src/Services/rest/crud/CalendarHolidays.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_CalendarHolidays
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $calendarUid, $calendarHolidayName 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 get($calendarUid=null, $calendarHolidayName=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(CalendarHolidaysPeer::CALENDAR_HOLIDAY_NAME);
|
||||
$criteria->addSelectColumn(CalendarHolidaysPeer::CALENDAR_HOLIDAY_START);
|
||||
$criteria->addSelectColumn(CalendarHolidaysPeer::CALENDAR_HOLIDAY_END);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = CalendarHolidaysPeer::retrieveByPK($calendarUid, $calendarHolidayName);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
87
workflow/engine/src/Services/rest/crud/CaseScheduler.php
Normal file
87
workflow/engine/src/Services/rest/crud/CaseScheduler.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_CaseScheduler
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $schUid 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 get($schUid=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_DEL_USER_NAME);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_DEL_USER_PASS);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_DEL_USER_UID);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_NAME);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_TIME_NEXT_RUN);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_LAST_RUN_TIME);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_STATE);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_LAST_STATE);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::USR_UID);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_OPTION);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_START_TIME);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_START_DATE);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_DAYS_PERFORM_TASK);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_EVERY_DAYS);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_WEEK_DAYS);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_START_DAY);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_MONTHS);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_END_DATE);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_REPEAT_EVERY);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_REPEAT_UNTIL);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::SCH_REPEAT_STOP_IF_RUNNING);
|
||||
$criteria->addSelectColumn(CaseSchedulerPeer::CASE_SH_PLUGIN_UID);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = CaseSchedulerPeer::retrieveByPK($schUid);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
66
workflow/engine/src/Services/rest/crud/CaseTracker.php
Normal file
66
workflow/engine/src/Services/rest/crud/CaseTracker.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
class Services_Rest_CaseTracker
|
||||
{
|
||||
/**
|
||||
* Implementation for 'GET' method for Rest API
|
||||
*
|
||||
* @param mixed $proUid Primary key
|
||||
*
|
||||
* @return array $result Returns array within multiple records or a single record depending if
|
||||
* a single selection was requested passing id(s) as param
|
||||
*/
|
||||
protected function get($proUid=null)
|
||||
{
|
||||
$result = array();
|
||||
try {
|
||||
$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);
|
||||
$criteria->addSelectColumn(CaseTrackerPeer::CT_MAP_TYPE);
|
||||
$criteria->addSelectColumn(CaseTrackerPeer::CT_DERIVATION_HISTORY);
|
||||
$criteria->addSelectColumn(CaseTrackerPeer::CT_MESSAGE_HISTORY);
|
||||
|
||||
$dataset = AppEventPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($dataset->next()) {
|
||||
$result[] = $dataset->getRow();
|
||||
}
|
||||
} else {
|
||||
$record = CaseTrackerPeer::retrieveByPK($proUid);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user