示例#1
0
                    $rou_id = $oRoute->create($aFields);
                    unset($aFields);
                }
                break;
            case 'DISCRIMINATOR':
                //Girish ->Added to save changes, while editing the route
                foreach ($aData['TASK'] as $iKey => $aRow) {
                    $aFields['PRO_UID'] = $aData['PROCESS'];
                    $aFields['TAS_UID'] = $aRow;
                    $aFields['ROU_NEXT_TASK'] = $aData['ROU_NEXT_TASK'][0];
                    $aFields['ROU_CASE'] = $iKey;
                    $aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
                    $aFields['GAT_UID'] = $aData['GAT_UID'];
                    if (isset($aData['PORT_NUMBER_IP'])) {
                        $aFields['ROU_TO_PORT'] = $aData['PORT_NUMBER_IP'];
                    }
                    if (isset($aData['PORT_NUMBER_OP'])) {
                        $aFields['ROU_FROM_PORT'] = $aData['PORT_NUMBER_OP'];
                    }
                    $routeData = $oTasks->getRouteByType($aData['PROCESS'], $aData['ROU_NEXT_TASK'][0], $aData['ROU_TYPE']);
                    foreach ($routeData as $route) {
                        $sFields['ROU_UID'] = $route['ROU_UID'];
                        $rou_id = $oRoute->update($sFields);
                    }
                    $rou_id = $oRoute->create($aFields);
                    unset($aFields);
                }
                break;
        }
        echo $rou_id;
}
 public function currentPattern($sProcessUID, $sTaskUID)
 {
     try {
         $oProcess = new Process();
         $aFields = $oProcess->load($sProcessUID);
         $oTask = new Task();
         $aFields = $oTask->load($sTaskUID);
         $aFields = array();
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(RoutePeer::PRO_UID, $sProcessUID);
         $oCriteria->add(RoutePeer::TAS_UID, $sTaskUID);
         $oCriteria->addAscendingOrderByColumn(RoutePeer::ROU_CASE);
         $oDataset = RoutePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         $aRow = $oDataset->getRow();
         $params = array();
         //      $sql = BasePeer::createSelectSql($oCriteria, $params);
         //      echo $sProcessUID."-".$sTaskUID."-";
         //      echo $sql;
         //      var_dump($aRow);
         //      die();
         if (is_array($aRow)) {
             $aFields['ROU_TYPE'] = $aRow['ROU_TYPE'];
             $aFields['ROU_TYPE_OLD'] = $aRow['ROU_TYPE'];
             switch ($aRow['ROU_TYPE']) {
                 case 'SEQUENTIAL':
                 case 'SEC-JOIN':
                     $aFields['ROU_UID'] = $aRow['ROU_UID'];
                     $aFields['ROU_NEXT_TASK'] = $aRow['ROU_NEXT_TASK'];
                     $aFields['ROU_TO_LAST_USER'] = $aRow['ROU_TO_LAST_USER'];
                     if ($aRow['ROU_TYPE'] == 'SEQUENTIAL') {
                         $sXmlform = 'patterns_Sequential';
                     } else {
                         $sXmlform = 'patterns_ParallelJoin';
                     }
                     break;
                 case 'SELECT':
                     $aFields['GRID_SELECT_TYPE']['ROU_UID'][$aRow['ROU_CASE']] = $aRow['ROU_UID'];
                     $aFields['GRID_SELECT_TYPE']['ROU_NEXT_TASK'][$aRow['ROU_CASE']] = $aRow['ROU_NEXT_TASK'];
                     $aFields['GRID_SELECT_TYPE']['ROU_CONDITION'][$aRow['ROU_CASE']] = $aRow['ROU_CONDITION'];
                     $aFields['GRID_SELECT_TYPE']['ROU_TO_LAST_USER'][$aRow['ROU_CASE']] = $aRow['ROU_TO_LAST_USER'];
                     while ($aRow = $oDataset->getRow()) {
                         $aFields['GRID_SELECT_TYPE']['ROU_UID'][$aRow['ROU_CASE']] = $aRow['ROU_UID'];
                         $aFields['GRID_SELECT_TYPE']['ROU_NEXT_TASK'][$aRow['ROU_CASE']] = $aRow['ROU_NEXT_TASK'];
                         $aFields['GRID_SELECT_TYPE']['ROU_CONDITION'][$aRow['ROU_CASE']] = $aRow['ROU_CONDITION'];
                         $aFields['GRID_SELECT_TYPE']['ROU_TO_LAST_USER'][$aRow['ROU_CASE']] = $aRow['ROU_TO_LAST_USER'];
                         $oDataset->next();
                     }
                     $sXmlform = 'patterns_Select';
                     break;
                 case 'EVALUATE':
                     G::LoadClass('xmlfield_InputPM');
                     $aFields['GRID_EVALUATE_TYPE']['ROU_UID'][$aRow['ROU_CASE']] = $aRow['ROU_UID'];
                     $aFields['GRID_EVALUATE_TYPE']['ROU_NEXT_TASK'][$aRow['ROU_CASE']] = $aRow['ROU_NEXT_TASK'];
                     $aFields['GRID_EVALUATE_TYPE']['ROU_CONDITION'][$aRow['ROU_CASE']] = $aRow['ROU_CONDITION'];
                     $aFields['GRID_EVALUATE_TYPE']['ROU_TO_LAST_USER'][$aRow['ROU_CASE']] = $aRow['ROU_TO_LAST_USER'];
                     while ($aRow = $oDataset->getRow()) {
                         $aFields['GRID_EVALUATE_TYPE']['ROU_UID'][$aRow['ROU_CASE']] = $aRow['ROU_UID'];
                         $aFields['GRID_EVALUATE_TYPE']['ROU_NEXT_TASK'][$aRow['ROU_CASE']] = $aRow['ROU_NEXT_TASK'];
                         $aFields['GRID_EVALUATE_TYPE']['ROU_CONDITION'][$aRow['ROU_CASE']] = $aRow['ROU_CONDITION'];
                         $aFields['GRID_EVALUATE_TYPE']['ROU_TO_LAST_USER'][$aRow['ROU_CASE']] = $aRow['ROU_TO_LAST_USER'];
                         $oDataset->next();
                     }
                     $sXmlform = 'patterns_Evaluate';
                     break;
                 case 'PARALLEL':
                     $aFields['GRID_PARALLEL_TYPE']['ROU_UID'][$aRow['ROU_CASE']] = $aRow['ROU_UID'];
                     $aFields['GRID_PARALLEL_TYPE']['ROU_NEXT_TASK'][$aRow['ROU_CASE']] = $aRow['ROU_NEXT_TASK'];
                     while ($aRow = $oDataset->getRow()) {
                         $aFields['GRID_PARALLEL_TYPE']['ROU_UID'][$aRow['ROU_CASE']] = $aRow['ROU_UID'];
                         $aFields['GRID_PARALLEL_TYPE']['ROU_NEXT_TASK'][$aRow['ROU_CASE']] = $aRow['ROU_NEXT_TASK'];
                         $oDataset->next();
                     }
                     $sXmlform = 'patterns_Parallel';
                     break;
                 case 'PARALLEL-BY-EVALUATION':
                     G::LoadClass('xmlfield_InputPM');
                     $aFields['GRID_PARALLEL_EVALUATION_TYPE']['ROU_UID'][$aRow['ROU_CASE']] = $aRow['ROU_UID'];
                     $aFields['GRID_PARALLEL_EVALUATION_TYPE']['ROU_NEXT_TASK'][$aRow['ROU_CASE']] = $aRow['ROU_NEXT_TASK'];
                     $aFields['GRID_PARALLEL_EVALUATION_TYPE']['ROU_CONDITION'][$aRow['ROU_CASE']] = $aRow['ROU_CONDITION'];
                     while ($aRow = $oDataset->getRow()) {
                         $aFields['GRID_PARALLEL_EVALUATION_TYPE']['ROU_UID'][$aRow['ROU_CASE']] = $aRow['ROU_UID'];
                         $aFields['GRID_PARALLEL_EVALUATION_TYPE']['ROU_NEXT_TASK'][$aRow['ROU_CASE']] = $aRow['ROU_NEXT_TASK'];
                         $aFields['GRID_PARALLEL_EVALUATION_TYPE']['ROU_CONDITION'][$aRow['ROU_CASE']] = $aRow['ROU_CONDITION'];
                         $aFields['GRID_PARALLEL_EVALUATION_TYPE']['ROU_OPTIONAL'][$aRow['ROU_CASE']] = $aRow['ROU_OPTIONAL'];
                         $oDataset->next();
                     }
                     $sXmlform = 'patterns_ParallelByEvaluation';
                     break;
                 case 'DISCRIMINATOR':
                     G::LoadClass('xmlfield_InputPM');
                     $aFields['GRID_DISCRIMINATOR_TYPE']['ROU_UID'][$aRow['ROU_CASE']] = $aRow['ROU_UID'];
                     $aFields['GRID_DISCRIMINATOR_TYPE']['ROU_NEXT_TASK'][$aRow['ROU_CASE']] = $aRow['ROU_NEXT_TASK'];
                     $aFields['GRID_DISCRIMINATOR_TYPE']['ROU_CONDITION'][$aRow['ROU_CASE']] = $aRow['ROU_CONDITION'];
                     $aFields['GRID_DISCRIMINATOR_TYPE']['ROU_OPTIONAL'][$aRow['ROU_CASE']] = $aRow['ROU_OPTIONAL'];
                     G::LoadClass('tasks');
                     $oTasks = new Tasks();
                     $routeData = $oTasks->getRouteByType($sProcessUID, $aRow['ROU_NEXT_TASK'], $aRow['ROU_TYPE']);
                     $aFields['ROUTE_COUNT'] = count($routeData);
                     $sXmlform = 'patterns_Discriminator';
                     break;
                 default:
                     throw new Exception(G::loadTranslation('ID_INVALID_ROU_TYPE_DEFINITION_ON_ROUTE_TABLE'));
                     break;
             }
         }
         $aFields['action'] = 'savePattern';
         $aFields['LANG'] = SYS_LANG;
         $aFields['PROCESS'] = $sProcessUID;
         $aFields['TASK'] = $sTaskUID;
         global $G_PUBLISH;
         $G_PUBLISH = new Publisher();
         $G_PUBLISH->AddContent('xmlform', 'xmlform', 'patterns/' . $sXmlform, '', $aFields, '../patterns/patterns_Ajax');
         G::RenderPage('publish', 'raw');
         return true;
     } catch (Exception $oError) {
         global $G_PUBLISH;
         $G_PUBLISH = new Publisher();
         $aMessage = array();
         $aMessage['MESSAGE'] = $oError->getMessage();
         $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
         G::RenderPage('publish', 'blank');
         die;
     }
 }