Ignore:
Timestamp:
04/19/10 18:18:22 (14 years ago)
Author:
viani
Message:

Ticket #609 - Reconstrução da classe factory do workflow

Location:
trunk/workflow/inc/local/classes
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/workflow/inc/local/classes/class.JobBase.php

    r1437 r2591  
    8989        { 
    9090                require_once 'common.inc.php'; 
    91                 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareEnvironment(); 
     91                Factory::getInstance('WorkflowMacro')->prepareEnvironment(); 
    9292                $this->jobID = $jobID; 
    9393                $this->processID = $processID; 
    9494                $this->currentDate = $currentDate; 
    95                 $this->jobManager = &$GLOBALS['workflow']['factory']->getInstance('WorkflowJobManager'); 
     95                $this->jobManager = Factory::getInstance('WorkflowJobManager'); 
    9696                $this->testMode = $testMode; 
    9797                $this->maximumExecutionTime = $maximumExecutionTime; 
     
    148148        final private function prepareEnvironment() 
    149149        { 
    150                 $GLOBALS['workflow']['factory']->getInstance('WorkflowMacro')->prepareProcessEnvironment($this->processID); 
    151  
    152                 require_once PHPGW_SERVER_ROOT . '/workflow/inc/class.process_factory.inc.php'; 
     150                Factory::getInstance('WorkflowMacro')->prepareProcessEnvironment($this->processID); 
    153151 
    154152                $this->environment = array(); 
    155                 $this->environment['factory']  = &new ProcessFactory(); 
     153                $this->environment['factory']  = &Factory::newInstance('ProcessWrapperFactory'); 
    156154        } 
    157155 
     
    202200        final public function createNewInstance($startActivityId, $instanceName=false, $properties=false, $user=false) 
    203201        { 
    204                 $activityManager = CreateObject('workflow.workflow_activitymanager'); 
     202                $activityManager = Factory::getInstance('workflow_activitymanager'); 
    205203                $activity = $activityManager->get_activity($startActivityId); 
    206204 
  • trunk/workflow/inc/local/classes/class.wf_engine.php

    r795 r2591  
    6868                $flagObject[0] = is_null($this->processManager); 
    6969                if ($flagObject[0]) 
    70                         $this->processManager = CreateObject('workflow.workflow_processmanager'); 
     70                        $this->processManager = Factory::getInstance('workflow_processmanager'); 
    7171 
    7272                $output = array(); 
     
    9090        function continueInstance($activityID, $instanceID) 
    9191        { 
    92                 require_once 'class.wf_instance.php'; 
    93                 $WFInstance = new wf_instance(); 
     92                $WFInstance = &Factory::getInstance('wf_instance'); 
    9493                return $WFInstance->continueInstance($activityID, $instanceID); 
    9594        } 
     
    104103        function abortInstance($instanceID) 
    105104        { 
    106                 require_once 'class.wf_instance.php'; 
    107                 $WFInstance = new wf_instance(); 
     105                $WFInstance = &Factory::getInstance('wf_instance'); 
    108106                return $WFInstance->abort($instanceID); 
    109107        } 
     
    119117        function setInstanceName($instanceID, $name) 
    120118        { 
    121                 require_once 'class.wf_instance.php'; 
    122                 $WFInstance = new wf_instance(); 
     119                $WFInstance = &Factory::getInstance('wf_instance'); 
    123120                return $WFInstance->setName($instanceID, $name); 
    124121        } 
     
    134131        function setInstancePriority($instanceID, $priority) 
    135132        { 
    136                 require_once 'class.wf_instance.php'; 
    137                 $WFInstance = new wf_instance(); 
     133                $WFInstance = &Factory::getInstance('wf_instance'); 
    138134                return $WFInstance->setPriority($instanceID, $priority); 
    139135        } 
     
    149145        function getIdleInstances($numberOfDays, $activities = null) 
    150146        { 
    151                 require_once 'class.wf_instance.php'; 
    152                 $WFInstance = new wf_instance(); 
     147                $WFInstance = &Factory::getInstance('wf_instance'); 
    153148                return $WFInstance->getIdle($numberOfDays, $activities); 
    154149        } 
     
    175170        function getInstancesByName($name) 
    176171        { 
    177                 require_once 'class.wf_instance.php'; 
    178                 $WFInstance = new wf_instance(); 
     172                $WFInstance = &Factory::getInstance('wf_instance'); 
    179173                $preOutput = $WFInstance->getByName($name); 
    180174                $output = array(); 
     
    197191        function getChildInstances($instanceID = null, $activityID = null) 
    198192        { 
    199                 require_once 'class.wf_instance.php'; 
    200                 $WFInstance = new wf_instance(); 
     193                $WFInstance = &Factory::getInstance('wf_instance'); 
    201194                $preOutput = $WFInstance->getChildren($instanceID, $activityID); 
    202195                $output = array(); 
     
    217210        function getInstanceProperties($instanceID) 
    218211        { 
    219                 require_once 'class.wf_instance.php'; 
    220                 $WFInstance = new wf_instance(); 
     212                $WFInstance = &Factory::getInstance('wf_instance'); 
    221213                return $WFInstance->getProperties($instanceID); 
    222214        } 
     
    231223        function getChildInstanceProperties($instanceID) 
    232224        { 
    233                 require_once 'class.wf_instance.php'; 
    234                 $WFInstance = new wf_instance(); 
     225                $WFInstance = &Factory::getInstance('wf_instance'); 
    235226                return $WFInstance->getProperties($instanceID); 
    236227        } 
     
    247238                $flagObject[0] = is_null($this->acl); 
    248239                if ($flagObject[0]) 
    249                         $this->acl = CreateObject('workflow.workflow_acl'); 
     240                        $this->acl = Factory::getInstance('workflow_acl'); 
    250241 
    251242                $output = $this->acl->getUserPermissions($type, $uid); 
     
    268259                $flagObject[0] = is_null($this->acl); 
    269260                if ($flagObject[0]) 
    270                         $this->acl = CreateObject('workflow.workflow_acl'); 
     261                        $this->acl = Factory::getInstance('workflow_acl'); 
    271262 
    272263                $output = $this->acl->getUserGroupPermissions($type, $uid); 
     
    291282                /* build the SQL query */ 
    292283                $query = "SELECT wf_activity_id, wf_name, wf_normalized_name, wf_type, wf_description FROM egw_wf_activities WHERE (wf_activity_id = ?) AND (wf_p_id = ?)"; 
    293                 $db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
     284                $db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
    294285                $resultSet = $db->query($query, array($activityID, $processID)); 
    295286 
     
    319310                /* build the SQL query */ 
    320311                $query = "SELECT wf_activity_id, wf_name, wf_normalized_name, wf_type, wf_description FROM egw_wf_activities WHERE (wf_name = ?) AND (wf_p_id = ?)"; 
    321                 $db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
     312                $db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
    322313                $resultSet = $db->query($query, array($activityName, $processID)); 
    323314 
     
    346337        function getUserInstances($users, $activities = null, $status = null) 
    347338        { 
    348                 require_once 'class.wf_instance.php'; 
    349                 $WFInstance = new wf_instance(); 
     339                $WFInstance = &Factory::getInstance('wf_instance'); 
    350340                return $WFInstance->getByUser($users, $activities, $status); 
    351341        } 
     
    360350        function setInstanceProperty($instanceID, $nameProperty, $value) 
    361351        { 
    362                 require_once 'class.wf_instance.php'; 
    363                 $WFInstance = new wf_instance(); 
     352                $WFInstance = &Factory::getInstance('wf_instance'); 
    364353                return $WFInstance->setProperty($instanceID, $nameProperty, $value); 
    365354        } 
     
    377366        function checkUserAccessToInstance($userID, $instanceID, $activityID, $writeAccess = true) 
    378367        { 
    379                 require_once 'class.wf_instance.php'; 
    380                 $WFInstance = new wf_instance(); 
     368                $WFInstance = &Factory::getInstance('wf_instance'); 
    381369                return $WFInstance->checkUserAccess($userID, $instanceID, $activityID, $writeAccess); 
    382370        } 
  • trunk/workflow/inc/local/classes/class.wf_instance.php

    r1385 r2591  
    7777        { 
    7878                $instanceID = (int) $instanceID; 
    79                 $instance = CreateObject('workflow.workflow_instance'); 
     79                $instance = Factory::getInstance('workflow_instance'); 
    8080                if (!$instance->getInstance($instanceID)) 
    8181                        return false; 
     
    9292        { 
    9393                /* load the DB */ 
    94                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
     94                $this->db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
    9595 
    9696                /* load the process ID from the runtime */ 
     
    118118                $instance = $this->getInstanceObject($instanceID); 
    119119 
    120                 $runActivity = CreateObject('workflow.run_activity'); 
     120                $runActivity = Factory::getInstance('run_activity'); 
    121121 
    122122                ob_start(); 
     
    423423 
    424424                /* load the required instance (for the required user) */ 
    425                 require_once GALAXIA_LIBRARY . SEP . 'src' . SEP . 'GUI' . SEP . 'GUI.php'; 
    426                 $GUI = new GUI($GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID); 
     425                $GUI = &Factory::newInstance('GUI'); 
    427426                $userInstance = $GUI->gui_list_user_instances($userID, 0, -1, '', '', "(ga.wf_is_interactive = 'y') AND (gia.wf_activity_id = {$activityID}) AND (gia.wf_instance_id = {$instanceID})", false, $this->processID, true, false, true, false, false, false); 
    428427                $userInstance = $userInstance['data']; 
     
    456455                if ($userID !== '*') 
    457456                { 
    458                         require_once dirname(__FILE__) . '/class.wf_role.php'; 
    459                         require_once dirname(__FILE__) . '/class.wf_engine.php'; 
    460  
    461                         $wfRole = new wf_role(); 
    462                         $engine = new wf_engine(); 
     457                        $wfRole = Factory::getInstance('wf_role'); 
     458                        $engine = Factory::getInstance('wf_engine'); 
    463459                        /* get information about the activity */ 
    464460                        if (($activityInfo = $engine->getActivityInformationByID($activityID)) === false) 
     
    529525 
    530526                /* try to get the role id */ 
    531                 require_once dirname(__FILE__) . '/class.wf_role.php'; 
    532                 $wfRole = new wf_role(); 
     527                $wfRole = Factory::getInstance('wf_role'); 
    533528                if (($roleID = $wfRole->getRoleIdByName($roleName)) === false) 
    534529                        return false; 
  • trunk/workflow/inc/local/classes/class.wf_ldap.php

    r1067 r2591  
    11<?php 
    2 require_once PHPGW_SERVER_ROOT . SEP . 'workflow' . SEP . 'inc' . SEP . 'local' . SEP . 'classes' . SEP . 'class.wf_cached_ldap.php'; 
    32 
    43/** 
     
    4140        function wf_ldap() 
    4241        { 
    43                 $tmpLDAP = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     42                $tmpLDAP = Factory::getInstance('WorkflowLDAP'); 
    4443                $this->user_context  = $tmpLDAP->getUserContext(); 
    4544                $this->group_context = $tmpLDAP->getGroupContext(); 
    4645 
    47                 $this->ds = &$GLOBALS['workflow']['workflowObjects']->getLDAP(); 
     46                $this->ds = &Factory::getInstance('WorkflowObjects')->getLDAP(); 
    4847 
    49                 $this->cachedLDAP = new wf_cached_ldap(); 
     48                $this->cachedLDAP = &Factory::getInstance('wf_cached_ldap'); 
    5049                $this->cachedLDAP->setOperationMode($this->cachedLDAP->OPERATION_MODE_LDAP); 
    5150        } 
  • trunk/workflow/inc/local/classes/class.wf_location.php

    r2137 r2591  
    3636        function initialize() 
    3737        { 
    38                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBExpresso()->Link_ID; 
     38                $this->db = &Factory::getInstance('WorkflowObjects')->getDBExpresso()->Link_ID; 
    3939                $this->db->setFetchMode(ADODB_FETCH_ASSOC); 
    4040                $this->cityInfo = array(); 
  • trunk/workflow/inc/local/classes/class.wf_mail.php

    r795 r2591  
    3939                $requiredConfiguration = array('mail_smtp_profile' => false); 
    4040                $configuration = $GLOBALS['workflow']['wf_runtime']->process->getConfigValues($requiredConfiguration); 
    41                 $bo_emailadmin = CreateObject('emailadmin.bo'); 
     41                $bo_emailadmin = Factory::getInstance('bo'); 
    4242                $profileData = $bo_emailadmin->getProfile($configuration['mail_smtp_profile']); 
    4343 
  • trunk/workflow/inc/local/classes/class.wf_orgchart.php

    r2348 r2591  
    2424        function wf_orgchart() 
    2525        { 
    26                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBWorkflow()->Link_ID; 
     26                $this->db = &Factory::getInstance('WorkflowObjects')->getDBWorkflow()->Link_ID; 
    2727                $this->db->setFetchMode(ADODB_FETCH_ASSOC); 
    2828        } 
  • trunk/workflow/inc/local/classes/class.wf_role.php

    r1048 r2591  
    5757                        $this->processID = (int) $GLOBALS['workflow']['job']['processID']; 
    5858 
    59                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
    60                 $this->roleManager = CreateObject('workflow.workflow_rolemanager'); 
    61                 $this->activityManager = CreateObject('workflow.workflow_activitymanager'); 
     59                $this->db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
     60                $this->roleManager = Factory::getInstance('workflow_rolemanager'); 
     61                $this->activityManager = Factory::getInstance('workflow_activitymanager'); 
    6262        } 
    6363 
     
    186186                        $users = array((int) $users); 
    187187                $roleID = $this->roleManager->get_role_id($this->processID, $roleName); 
    188                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     188                $ldap = Factory::getInstance('WorkflowLDAP'); 
    189189                foreach ($users as $user) 
    190190                { 
     
    212212                $users = $this->roleManager->list_mapped_users($this->processID, false, array('wf_role_name' => $roleName)); 
    213213 
    214                 $ldap = &$GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP'); 
     214                $ldap = Factory::getInstance('WorkflowLDAP'); 
    215215                $output = array(); 
    216216                foreach ($users as $id => $login) 
     
    367367 
    368368                /* get the roles */ 
    369                 $userGroups = $GLOBALS['workflow']['factory']->getInstance('WorkflowLDAP')->getUserGroups($userID); 
     369                $userGroups = Factory::getInstance('WorkflowLDAP')->getUserGroups($userID); 
    370370                $query = 'SELECT DISTINCT role.wf_role_id, role.wf_name, role.wf_description FROM egw_wf_roles role, egw_wf_user_roles user_role WHERE (user_role.wf_role_id = role.wf_role_id) AND (role.wf_p_id = ?) AND (role.wf_role_id = ANY (?))'; 
    371371                $query .= ' AND (((user_role.wf_user = ?) AND (user_role.wf_account_type = ?))'; 
  • trunk/workflow/inc/local/classes/class.wf_workitem.php

    r795 r2591  
    2929        public function wf_workitem() 
    3030        { 
    31                 $this->db = &$GLOBALS['workflow']['workflowObjects']->getDBGalaxia()->Link_ID; 
     31                $this->db = &Factory::getInstance('WorkflowObjects')->getDBGalaxia()->Link_ID; 
    3232                $this->processID = (int) $GLOBALS['workflow']['wf_runtime']->activity->getProcessId(); 
    3333        } 
Note: See TracChangeset for help on using the changeset viewer.