FEATURE: First commit for ProcessMaker Rest Support

What is Functional

- Restler thirdparty library added
- Restler integration with gulliver added
- Rest requests are dispatched by sysGeneric
- Restler autodiscover for classes that implements Restler iAuthenticate interface added

What Missing

- ProcessMaker Api implemented yet
- some rest api class are in workflow/engine/services/rest/*.php
This commit is contained in:
Erik Amaru Ortiz
2012-08-10 16:54:12 -04:00
parent f783bc09f4
commit 9b1867a410
41 changed files with 8285 additions and 85 deletions

View File

@@ -64,10 +64,11 @@
define( 'PATH_WORKFLOW_MSSQL_DATA', PATH_CORE . 'data' . PATH_SEP.'mssql'.PATH_SEP);
define( 'PATH_RBAC_MSSQL_DATA', PATH_RBAC_CORE . 'data' . PATH_SEP.'mssql'.PATH_SEP);
define( 'PATH_CONTROLLERS', PATH_CORE . 'controllers' . PATH_SEP );
define( 'PATH_SERVICES_REST', PATH_CORE . 'services' . PATH_SEP . 'rest' . PATH_SEP);
// include Gulliver Class
require_once( PATH_GULLIVER . PATH_SEP . 'class.g.php');
if(file_exists(FILE_PATHS_INSTALLED)) {
// backward compatibility; parsing old definitions in the compiled path constant
$tmp = file_get_contents(FILE_PATHS_INSTALLED);
@@ -76,28 +77,28 @@
@file_put_contents(FILE_PATHS_INSTALLED, str_replace('PATH_OUTTRUNK', 'PATH_DATA', $tmp));
}
// end backward compatibility
// include the workspace installed configuration
require_once FILE_PATHS_INSTALLED;
// defining system constant when a valid workspace environment exists
define('PATH_LANGUAGECONT', PATH_DATA . "META-INF" . PATH_SEP);
define('PATH_CUSTOM_SKINS', PATH_DATA . 'skins' . PATH_SEP);
define('PATH_TEMPORAL', PATH_C . 'dynEditor/');
define('PATH_DB', PATH_DATA . 'sites' . PATH_SEP);
// smarty constants
// smarty constants
define('PATH_SMARTY_C', PATH_C . 'smarty' . PATH_SEP . 'c');
define('PATH_SMARTY_CACHE', PATH_C . 'smarty' . PATH_SEP . 'cache');
if (!is_dir(PATH_SMARTY_C)) {
G::mk_dir(PATH_SMARTY_C);
}
if (!is_dir(PATH_SMARTY_CACHE)) {
if (!is_dir(PATH_SMARTY_CACHE)) {
G::mk_dir(PATH_SMARTY_CACHE);
}
}
// set include path
set_include_path(
PATH_CORE . PATH_SEPARATOR .
@@ -110,7 +111,7 @@
/**
* Global definitions, before it was the defines.php file
*/
// URL Key
define("URL_KEY", 'c0l0s40pt1mu59r1m3' );
@@ -134,7 +135,7 @@
// Number of files per folder at PATH_UPLOAD (cases documents)
define('APPLICATION_DOCUMENTS_PER_FOLDER', 1000);
// Server of ProcessMaker Library
// Server of ProcessMaker Library
define('PML_SERVER' , 'http://library.processmaker.com');
define('PML_WSDL_URL' , PML_SERVER . '/syspmLibrary/en/green/services/wsdl');
define('PML_UPLOAD_URL', PML_SERVER . '/syspmLibrary/en/green/services/uploadProcess');

View File

@@ -0,0 +1,30 @@
<?php
class Author
{
public $dp;
static $FIELDS = array('name', 'email');
function __construct()
{
}
function get($id=NULL)
{
return is_null($id) ? 'GET: getting all records' : "Getting a record with id: $id";
}
function post($request_data=NULL)
{
return 'POST: posting 1';
}
function put($id=NULL, $request_data=NULL)
{
return 'PUT: update 1';
}
function delete($id=NULL) {
return 'DELETE: deleting '.$id;
}
}

View File

@@ -0,0 +1,37 @@
<?php
class BMI {
function index($height=162.6, $weight=84) {
$result = new stdClass();
# 1 pound = 0.45359237 kilograms
# 1 meter = 3.2808399 feet
# 1 meter = 39.3700787 inches
# 1 meter = 100 cms
#assume height is given in centimeters
$cm = $height;
#assume weight is given in kilograms
$kg = $weight;
$meter = $cm / 100;
$inches = $meter * 39.3700787;
$feet = round($inches/12);
$inches = $inches % 12;
$result->bmi = round($kg/($meter*$meter),2);
$lb = round($kg/0.45359237,2);
if($result->bmi<18.5){
$result->message = 'Underweight';
}elseif ($result->bmi<=24.9){
$result->message = 'Normal weight';
}elseif ($result->bmi<=29.9){
$result->message = 'Overweight';
}else{
$result->message = 'Obesity';
}
$result->metric = array('height'=>"$cm centimeter", 'weight'=>"$weight kilograms");
$result->imperial = array('height'=>"$feet feet $inches inches", 'weight'=>"$lb pounds");
return $result;
}
}

View File

@@ -0,0 +1,6 @@
<?php
class Say {
function hello($to='world') {
return "Hello $to!";
}
}

View File

@@ -0,0 +1,15 @@
<?php
class Simple {
function normal() {
return 'open for all';
}
protected function restricted() {
return 'protected method';
}
/**
* @protected
*/
function restricted2(){
return 'protected by comment';
}
}

View File

@@ -0,0 +1,16 @@
<?php
class SimpleAuth implements iAuthenticate
{
const KEY = 'sample';
function __isAuthenticated()
{
print_r($_SERVER);
return isset($_GET['key']) && $_GET['key']==SimpleAuth::KEY ? TRUE : FALSE;
}
function key()
{
return SimpleAuth::KEY;
}
}