Changeset 2311 for sandbox/workflow/branches/609/inc/engine
- Timestamp:
- 03/19/10 17:22:08 (14 years ago)
- Location:
- sandbox/workflow/branches/609/inc/engine
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/workflow/branches/609/inc/engine/config.ajax.inc.php
r2233 r2311 256 256 function galaxia_get_config_values($parameters=array()) 257 257 { 258 $config = new ajax_config();258 $config = &Factory::getInstance('ajax_config'); 259 259 $config->read_repository(); 260 260 -
sandbox/workflow/branches/609/inc/engine/src/API/BaseActivity.php
r795 r2311 97 97 * @access public 98 98 */ 99 function BaseActivity( &$db)99 function BaseActivity() 100 100 { 101 101 $this->type='base'; 102 102 $this->child_name = 'BaseActivity'; 103 parent::Base( $db);103 parent::Base(); 104 104 } 105 105 … … 122 122 if(!$result || !$result->numRows() ) return false; 123 123 $res = $result->fetchRow(); 124 124 125 switch($res['wf_type']) { 125 126 case 'start': 126 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'Start.php');127 $act = new Start($this->db);128 break; 127 $act = &Factory::newInstance('Start'); 128 break; 129 129 130 case 'end': 130 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'End.php');131 $act = new End($this->db);132 break; 131 $act = &Factory::newInstance('End'); 132 break; 133 133 134 case 'join': 134 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'Join.php');135 $act = new Join($this->db);136 break; 135 $act = &Factory::newInstance('Join'); 136 break; 137 137 138 case 'split': 138 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'Split.php');139 $act = new Split($this->db);140 break; 139 $act = &Factory::newInstance('Split'); 140 break; 141 141 142 case 'standalone': 142 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'Standalone.php');143 $act = new Standalone($this->db);144 break; 143 $act = &Factory::newInstance('Standalone'); 144 break; 145 145 146 case 'view': 146 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'View.php');147 $act = new View($this->db);148 break; 147 $act = &Factory::newInstance('View'); 148 break; 149 149 150 case 'switch': 150 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'SwitchActivity.php');151 $act = new SwitchActivity($this->db);152 break; 151 $act = &Factory::newInstance('SwitchActivity'); 152 break; 153 153 154 case 'activity': 154 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'activities'.SEP.'Activity.php');155 $act = new Activity($this->db);156 break; 155 $act = &Factory::newInstance('Activity'); 156 break; 157 157 158 default: 158 159 trigger_error('Unknown activity type:'.$res['wf_type'],E_USER_WARNING); 159 160 } 160 161 161 162 $act->setName($res['wf_name']); 162 163 $act->setProcessId($res['wf_p_id']); -
sandbox/workflow/branches/609/inc/engine/src/API/Instance.php
r795 r2311 1 1 <?php 2 2 require_once (GALAXIA_LIBRARY.SEP.'src'.SEP.'common'.SEP.'Base.php'); 3 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'common' . SEP . 'WfSecurity.php');4 3 require_once(GALAXIA_LIBRARY . SEP . 'src' . SEP . 'ProcessManager' . SEP . 'ActivityManager.php'); 5 4 … … 141 140 142 141 var $activityID = null; 143 function Instance( $db)142 function Instance() 144 143 { 145 144 $this->child_name = 'Instance'; 146 parent::Base( $db);145 parent::Base(); 147 146 } 148 147 … … 1171 1170 1172 1171 //lock rows and ensure access is granted 1173 if (!(isset($this->security))) $this->security = & new WfSecurity($this->db);1172 if (!(isset($this->security))) $this->security = &Factory::getInstance('WfSecurity', $this->db); 1174 1173 if (!($this->security->checkUserAction($activityId,$this->instanceId,'complete'))) 1175 1174 { … … 1551 1550 { 1552 1551 //we check rights for this user on the next activity 1553 if (!(isset($this->security))) $this->security = & new WfSecurity($this->db);1552 if (!(isset($this->security))) $this->security = &Factory::getInstance('WfSecurity'); 1554 1553 if ($this->security->checkUserAccess($the_next_user,$activityId)) 1555 1554 { … … 1560 1559 { 1561 1560 // then check to see if there is a default user 1562 $activity_manager = & new ActivityManager($this->db);1561 $activity_manager = &Factory::newInstance('ActivityManager'); 1563 1562 //get_default_user will give us '*' if there is no default_user or if the default user has no role 1564 1563 //mapped anymore -
sandbox/workflow/branches/609/inc/engine/src/API/Process.php
r795 r2311 48 48 * @access public 49 49 */ 50 function Process( &$db)50 function Process() 51 51 { 52 52 $this->child_name = 'Process'; 53 parent::Base( $db);53 parent::Base(); 54 54 } 55 55 -
sandbox/workflow/branches/609/inc/engine/src/API/activities/Activity.php
r795 r2311 16 16 * @access public 17 17 */ 18 function Activity( &$db)18 function Activity() 19 19 { 20 parent::Base( $db);20 parent::Base(); 21 21 $this->child_name = 'Activity'; 22 22 } -
sandbox/workflow/branches/609/inc/engine/src/API/activities/End.php
r795 r2311 15 15 * @access public 16 16 */ 17 function End( &$db)17 function End() 18 18 { 19 parent::Base( $db);19 parent::Base(); 20 20 $this->child_name = 'End'; 21 21 } -
sandbox/workflow/branches/609/inc/engine/src/API/activities/Join.php
r795 r2311 15 15 * @access public 16 16 */ 17 function Join( &$db)17 function Join() 18 18 { 19 parent::Base( $db);19 parent::Base(); 20 20 $this->child_name = 'Join'; 21 21 } -
sandbox/workflow/branches/609/inc/engine/src/API/activities/Split.php
r795 r2311 15 15 * @access public 16 16 */ 17 function Split( &$db)17 function Split() 18 18 { 19 parent::Base( $db);19 parent::Base(); 20 20 $this->child_name = 'Split'; 21 21 } -
sandbox/workflow/branches/609/inc/engine/src/API/activities/Standalone.php
r795 r2311 15 15 * @access public 16 16 */ 17 function Standalone( &$db)17 function Standalone() 18 18 { 19 parent::Base( $db);19 parent::Base(); 20 20 $this->child_name = 'Standalone'; 21 21 } -
sandbox/workflow/branches/609/inc/engine/src/API/activities/Start.php
r795 r2311 15 15 * @access public 16 16 */ 17 function Start( &$db)17 function Start() 18 18 { 19 parent::Base( $db);19 parent::Base(); 20 20 $this->child_name = 'Start'; 21 21 } -
sandbox/workflow/branches/609/inc/engine/src/API/activities/SwitchActivity.php
r795 r2311 16 16 * @access public 17 17 */ 18 function SwitchActivity( &$db)18 function SwitchActivity() 19 19 { 20 parent::Base( $db);20 parent::Base(); 21 21 $this->child_name = 'Switch'; 22 22 } -
sandbox/workflow/branches/609/inc/engine/src/API/activities/View.php
r795 r2311 16 16 * @access public 17 17 */ 18 function View( &$db)18 function View() 19 19 { 20 parent::Base( $db);20 parent::Base(); 21 21 $this->child_name = 'View'; 22 22 } -
sandbox/workflow/branches/609/inc/engine/src/GUI/GUI.php
r795 r2311 32 32 * @access public 33 33 */ 34 function GUI( &$db)34 function GUI() 35 35 { 36 36 $this->child_name = 'GUI'; 37 parent::Base($db); 38 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'common'.SEP.'WfSecurity.php'); 39 $this->wf_security =& new WfSecurity($this->db); 37 parent::Base(); 38 $this->wf_security = &Factory::getInstance('WfSecurity'); 40 39 } 41 40 … … 703 702 if (!(isset($this->pm))) 704 703 { 705 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'ProcessManager'.SEP.'ProcessManager.php'); 706 $this->pm =& new ProcessManager($this->db); 704 $this->pm = &Factory::newInstance('ProcessManager'); 707 705 } 708 706 $this->process_cache[$pId]['view'] = $this->pm->get_process_view_activity($pId); … … 871 869 { 872 870 //the security object said everything was fine 873 $instance = new Instance($this->db);871 $instance = &Factory::newInstance('Instance'); 874 872 $instance->getInstance($instanceId); 875 873 if (!empty($instance->instanceId)) … … 975 973 { 976 974 //the security object said everything was fine 977 $instance = & new Instance($this->db);975 $instance = &Factory::newInstance('Instance'); 978 976 $instance->getInstance($instanceId); 979 977 // we force the execution of the activity … … 1012 1010 { 1013 1011 //the security object said everything was fine 1014 $instance = & new Instance($this->db);1012 $instance = &Factory::newInstance('Instance'); 1015 1013 $instance->getInstance($instanceId); 1016 1014 // we force the continuation of the flow -
sandbox/workflow/branches/609/inc/engine/src/ProcessManager/ActivityManager.php
r795 r2311 26 26 * @access public 27 27 */ 28 function ActivityManager( &$db)29 { 30 parent::BaseManager( $db);28 function ActivityManager() 29 { 30 parent::BaseManager(); 31 31 $this->child_name = 'ActivityManager'; 32 32 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'ProcessManager' .SEP . 'ProcessManager.php'); … … 370 370 function build_process_graph($pId) 371 371 { 372 if (!(isset($this->process_manager))) $this->process_manager = new ProcessManager($this->db);372 if (!(isset($this->process_manager))) $this->process_manager = &Factory::newInstance('ProcessManager'); 373 373 $attributes = Array( 374 374 375 375 ); 376 $graph = new Process_GraphViz(true,$attributes);376 $graph = &Factory::newInstance('Process_GraphViz', true, $attributes); 377 377 $name = $this->process_manager->_get_normalized_name($pId); 378 378 $graph->set_pid($name); … … 747 747 { 748 748 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP . 'BaseActivity.php'); 749 $act = new BaseActivity($this->db);749 $act = &Factory::newInstance('BaseActivity'); 750 750 //Warning, we now use the BaseActivity object for it, interactivity and autorouting is now true/fales, not y/n 751 751 return ($act->getActivity($activityId,false,true, true)); … … 825 825 function remove_activity($pId, $activityId, $transaction = true) 826 826 { 827 if (!(isset($this->process_manager))) $this->process_manager = new ProcessManager($this->db);827 if (!(isset($this->process_manager))) $this->process_manager = &Factory::newInstance('ProcessManager'); 828 828 $proc_info = $this->process_manager->get_process($pId); 829 829 $actname = $this->_get_normalized_name($activityId); … … 888 888 function replace_activity($pId, $activityId, $vars, $create_files=true) 889 889 { 890 if (!(isset($this->process_manager))) $this->process_manager = new ProcessManager($this->db);890 if (!(isset($this->process_manager))) $this->process_manager = &Factory::newInstance('ProcessManager'); 891 891 $TABLE_NAME = GALAXIA_TABLE_PREFIX.'activities'; 892 892 $now = date("U"); … … 1195 1195 elseif ( (!($result=='*')) && $performAccessCheck) 1196 1196 { 1197 $wf_security = new WfSecurity($this->db);1197 $wf_security = &Factory::getInstance('WfSecurity', $this->db); 1198 1198 // perform the check 1199 1199 if (!($wf_security->checkUserAccess($result,$activityId))) -
sandbox/workflow/branches/609/inc/engine/src/ProcessManager/BaseManager.php
r2165 r2311 18 18 * @access public 19 19 */ 20 function BaseManager( &$db)20 function BaseManager() 21 21 { 22 22 $this->child_name = 'BaseManager'; 23 parent::Base( $db);23 parent::Base(); 24 24 } 25 25 -
sandbox/workflow/branches/609/inc/engine/src/ProcessManager/InstanceManager.php
r795 r2311 16 16 * @access public 17 17 */ 18 function InstanceManager( &$db)19 { 20 parent::BaseManager( $db);18 function InstanceManager() 19 { 20 parent::BaseManager(); 21 21 $this->child_name = 'InstanceManager'; 22 22 } -
sandbox/workflow/branches/609/inc/engine/src/ProcessManager/JobManager.php
r795 r2311 76 76 * @access public 77 77 */ 78 public function JobManager( &$db)79 { 80 parent::BaseManager( $db);78 public function JobManager() 79 { 80 parent::BaseManager(); 81 81 $this->child_name = 'JobManager'; 82 82 83 83 $this->jobTable = GALAXIA_TABLE_PREFIX . 'jobs'; 84 84 $this->logTable = GALAXIA_TABLE_PREFIX . 'job_logs'; 85 $this->processManager = new ProcessManager($this->db);85 $this->processManager = &Factory::newInstance('ProcessManager'); 86 86 } 87 87 -
sandbox/workflow/branches/609/inc/engine/src/ProcessManager/ProcessManager.php
r2165 r2311 66 66 * @access public 67 67 */ 68 function ProcessManager( &$db)69 { 70 parent::BaseManager( $db);68 function ProcessManager() 69 { 70 parent::BaseManager(); 71 71 $this->child_name = 'ProcessManager'; 72 72 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'ProcessManager'.SEP.'ActivityManager.php'); … … 131 131 function serialize_process($pId) 132 132 { 133 if (!(isset($this->activity_manager))) $this->activity_manager = new ActivityManager($this->db);133 if (!(isset($this->activity_manager))) $this->activity_manager = &Factory::newInstance('ActivityManager'); 134 134 // <process> 135 135 $out = '<process>'."\n"; … … 459 459 { 460 460 //Now the show begins 461 if (!(isset($this->activity_manager))) $this->activity_manager = new ActivityManager($this->db);462 if (!(isset($this->role_manager))) $this->role_manager = new RoleManager($this->db);461 if (!(isset($this->activity_manager))) $this->activity_manager = &Factory::newInstance('ActivityManager'); 462 if (!(isset($this->role_manager))) $this->role_manager = &Factory::newInstance('RoleManager'); 463 463 if (!isset($this->jobManager)) 464 $this->jobManager = new JobManager($this->db);464 $this->jobManager = &Factory::newInstance('JobManager'); 465 465 466 466 // First create the process. Always inactive and inactive first. … … 620 620 function new_process_version($pId, $minor=true) 621 621 { 622 if (!(isset($this->activity_manager))) $this->activity_manager = new ActivityManager($this->db);622 if (!(isset($this->activity_manager))) $this->activity_manager = &Factory::newInstance('ActivityManager'); 623 623 $oldpid = $pId; 624 624 //retrieve process info with config rows … … 671 671 } 672 672 // create roles 673 if (!(isset($this->role_manager))) $this->role_manager = new RoleManager($this->db);673 if (!(isset($this->role_manager))) $this->role_manager = &Factory::newInstance('RoleManager'); 674 674 $query = 'select * from '.GALAXIA_TABLE_PREFIX.'roles where wf_p_id=?'; 675 675 $result = $this->query($query, array($oldpid)); … … 853 853 function remove_process($pId) 854 854 { 855 if (!(isset($this->activity_manager))) $this->activity_manager = new ActivityManager($this->db);855 if (!(isset($this->activity_manager))) $this->activity_manager = &Factory::newInstance('ActivityManager'); 856 856 if (!isset($this->jobManager)) 857 $this->jobManager = new JobManager($this->db);857 $this->jobManager = &Factory::newInstance('JobManager'); 858 858 $this->deactivate_process($pId); 859 859 $name = $this->_get_normalized_name($pId); … … 919 919 function replace_process($pId, &$vars, $create = true) 920 920 { 921 if (!(isset($this->activity_manager))) $this->activity_manager = new ActivityManager($this->db);921 if (!(isset($this->activity_manager))) $this->activity_manager = &Factory::newInstance('ActivityManager'); 922 922 $TABLE_NAME = GALAXIA_TABLE_PREFIX.'processes'; 923 923 $now = date("U"); … … 1296 1296 { 1297 1297 //Warning: this means you have to include the Process.php from the API 1298 $this->Process = new Process($this->db);1298 $this->Process = &Factory::newInstance('Process'); 1299 1299 $this->Process->getProcess($pId); 1300 1300 $result_array = $this->Process->getConfigValues($config_array); … … 1316 1316 { 1317 1317 //Warning: this means you have to include the Process.php from the API 1318 $this->Process = new Process($this->db);1318 $this->Process = &Factory::newInstance('Process'); 1319 1319 $this->Process->getProcess($pId); 1320 1320 $this->Process->setConfigValues($config_array); -
sandbox/workflow/branches/609/inc/engine/src/ProcessManager/RoleManager.php
r2233 r2311 19 19 * @access public 20 20 */ 21 function RoleManager( &$db)22 { 23 parent::Base( $db);21 function RoleManager() 22 { 23 parent::Base(); 24 24 $this->child_name = 'RoleManager'; 25 25 } -
sandbox/workflow/branches/609/inc/engine/src/ProcessMonitor/ProcessMonitor.php
r795 r2311 18 18 * @access public 19 19 */ 20 function ProcessMonitor( &$db)20 function ProcessMonitor() 21 21 { 22 22 $this->child_name = 'ProcessMonitor'; 23 parent::Base( $db);23 parent::Base(); 24 24 // check the the actual user can really do this 25 25 if ( !(galaxia_user_can_monitor())) -
sandbox/workflow/branches/609/inc/engine/src/common/Base.php
r2165 r2311 39 39 var $child_name = 'Base'; 40 40 41 /** 42 * @var object $db_shared_obj The database abstraction object shared between 43 * all instances of this class. 44 * @acess private 45 * @static 46 */ 47 private static $db_shared_obj = null; 48 41 49 /** 42 50 * Constructor receiving a database abstraction object … … 46 54 * @access public 47 55 */ 48 function Base( &$db)56 function Base() 49 57 { 50 if(!$db) { 58 /** 59 * New Stuff! 60 * We decided to get here the database object. In a recent past, 61 * all the classes that specialize this one passed a db object. 62 * Now, to simplify and save memory, we store the database object 63 * into a single and static atribute shared among each instance 64 * of this class. 65 * 66 * To prevent to modify all sub-classes to use "self::$db" instead 67 * of "this->db", we made a very tiny workaround here. In the first 68 * instantiation of this class, we instantiate the database object 69 * and store it into 'self::$db_shared_obj'. Any subsequent 70 * instantiations will just point to the static one. 71 */ 72 if (!self::$db_shared_obj) 73 self::$db_shared_obj = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 74 75 $this->db = &self::$db_shared_obj; 76 77 78 if(!$this->db) { 51 79 die('Invalid db object passed to '.$this->child_name.' constructor'); 52 80 } 53 81 //Force transactionnal mysql (Innodb) -> mysqlt 54 if ($ db->databaseType=='mysql')82 if ($this->db->databaseType=='mysql') 55 83 { 56 84 $GLOBALS['phpgw']->db->disconnect(); 57 $ db = $GLOBALS['phpgw']->db->connect(85 $this->db = $GLOBALS['phpgw']->db->connect( 58 86 $GLOBALS['phpgw_info']['server']['db_name'], 59 87 $GLOBALS['phpgw_info']['server']['db_host'], … … 64 92 ); 65 93 } 66 $this->db = &$db;67 94 } 68 95 -
sandbox/workflow/branches/609/inc/engine/src/common/WfRuntime.php
r2253 r2311 86 86 * @access public 87 87 */ 88 function WfRuntime( &$db)88 function WfRuntime() 89 89 { 90 90 $this->child_name = 'WfRuntime'; 91 parent::Base($db); 92 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'BaseActivity.php'); 93 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Process.php'); 94 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Instance.php'); 95 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'common'.SEP.'WfSecurity.php'); 96 91 parent::Base(); 92 97 93 //first the activity is not set 98 94 $this->activity = null; 99 $this->instance = new Instance($this->db);100 $this->process = new Process($this->db);101 $this->security = new WfSecurity($this->db);95 $this->instance = &Factory::newInstance('Instance'); 96 $this->process = &Factory::newInstance('Process'); 97 $this->security = &Factory::getInstance('WfSecurity'); 102 98 } 103 99 … … 276 272 return false; 277 273 } 278 $base_activity = new BaseActivity($this->db);274 $base_activity = &Factory::getInstance('BaseActivity', $this->db); 279 275 $this->activity =& $base_activity->getActivity($activity_id, $with_roles, $with_agents); 280 276 if (!$this->activity) -
sandbox/workflow/branches/609/inc/engine/src/common/WfSecurity.php
r795 r2311 23 23 * @access public 24 24 */ 25 function WfSecurity( &$db)25 function WfSecurity() 26 26 { 27 27 $this->child_name = 'WfSecurity'; 28 parent::Base($db); 29 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Instance.php'); 30 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Process.php'); 31 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'BaseActivity.php'); 28 parent::Base(); 29 30 /* I'm not really sure if we can strip it out. */ 31 32 //require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Instance.php'); 33 //require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'Process.php'); 34 //require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'API'.SEP.'BaseActivity.php'); 32 35 } 33 36 … … 58 61 ); 59 62 //check theses values for this process and store the result for this object life duration 60 $myProcess = new Process($this->db);63 $myProcess = &Factory::newInstance('Process'); 61 64 $myProcess->getProcess($pId); 62 65 $this->processesConfig[$pId] = $myProcess->getConfigValues($arrayConf); … … 577 580 if (!(isset($this->pm))) 578 581 { 579 require_once(GALAXIA_LIBRARY.SEP.'src'.SEP.'ProcessManager'.SEP.'ProcessManager.php'); 580 $this->pm = new ProcessManager($this->db); 582 $this->pm = &Factory::newInstance('ProcessManager'); 581 583 } 582 584 //$this->error[] = 'DEBUG: checking to see if there is no view activities on process :'.$pId.':'.$this->pm->get_process_view_activity($pId);
Note: See TracChangeset
for help on using the changeset viewer.