示例#1
0
 function index($httpData)
 {
     if (!isset($httpData->id)) {
         throw new Exception('The Process ID was not set!');
     }
     require_once 'classes/model/Process.php';
     $process = ProcessPeer::retrieveByPK($httpData->id);
     if (get_class($process) != 'Process') {
         throw new Exception("The Process with UID: {$httpData->id} doesn't exist!");
     }
     $_SESSION['PROCESS'] = $httpData->id;
     $_SESSION['PROCESSMAP'] = 'BPMN';
     $this->includeExtJS('bpmn/MyWorkflow', true);
     $this->includeExtJS('bpmn/pmosExt', true);
     $this->includeExtJS('bpmn/TaskContext', true);
     $this->includeExtJS('bpmn/designerComponents', true);
     $this->includeExtJS('bpmn/designer', true);
     $this->includeExtJS('bpmn/Annotation', true);
     $this->includeExtJS('bpmn/bpmnShapes', true);
     $this->includeExtJS('bpmn/EventEmptyStart');
     $this->includeExtJS('bpmn/EventMessageStart');
     $this->includeExtJS('bpmn/EventTimerStart');
     $this->includeExtJS('bpmn/EventEmptyInter');
     $this->includeExtJS('bpmn/EventMessageRecInter');
     $this->includeExtJS('bpmn/EventMessageSendInter');
     $this->includeExtJS('bpmn/EventTimerInter');
     $this->includeExtJS('bpmn/EventEmptyEnd');
     $this->includeExtJS('bpmn/EventMessageEnd');
     $this->includeExtJS('bpmn/GatewayInclusive');
     $this->includeExtJS('bpmn/GatewayExclusiveData');
     $this->includeExtJS('bpmn/GatewayParallel');
     $this->includeExtJS('bpmn/GridPanel');
     $this->includeExtJS('bpmn/SubProcess');
     $this->includeExtJS('bpmn/ProcessOptions', true);
     $this->includeExtJS('bpmn/ProcessMapContext', true);
     $this->includeExtJS('bpmn/ProcessOptions', true);
     $this->setJSVar('pro_uid', $httpData->id);
     $this->setJSVar('pro_title', $process->getProTitle());
     $this->setView('bpmn/designer');
     G::RenderPage('publish', 'extJs');
 }
示例#2
0
 /**
  * Remove the Prolication document registry
  *
  * @param array $aData or string $ProUid
  * @return string
  *
  */
 public function remove($ProUid)
 {
     if (is_array($ProUid)) {
         $ProUid = isset($ProUid['PRO_UID']) ? $ProUid['PRO_UID'] : '';
     }
     try {
         $oPro = ProcessPeer::retrieveByPK($ProUid);
         if (!is_null($oPro)) {
             Content::removeContent('PRO_TITLE', '', $oPro->getProUid());
             Content::removeContent('PRO_DESCRIPTION', '', $oPro->getProUid());
             $this->memcachedDelete();
             return $oPro->delete();
         } else {
             throw new Exception("The row '{$ProUid}' in table Process doesn't exist!");
         }
     } catch (Exception $oError) {
         throw $oError;
     }
 }
示例#3
0
    /**

     * Gets processCategory record, if the process had one

     *

     * @param $sProUid string for the process Uid

     * @return $processCategory array

     */

    public function getProcessCategoryRow ($sProUid)

    {

        $process = ProcessPeer::retrieveByPK( $sProUid );



        if ($process->getProCategory() == '') {

            return null;

        }



        $oCriteria = new Criteria( 'workflow' );

        $oCriteria->add( ProcessCategoryPeer::CATEGORY_UID, $process->getProCategory() );

        $oDataset = ProcessCategoryPeer::doSelectRS( $oCriteria );

        $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

        $oDataset->next();



        return $oDataset->getRow();

    }
示例#4
0
 /**
  * Implementation for 'DELETE' 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 delete($proUid)
 {
     $conn = Propel::getConnection(ProcessPeer::DATABASE_NAME);
     try {
         $conn->begin();
         $obj = ProcessPeer::retrieveByPK($proUid);
         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());
     }
 }
示例#5
0
 public static function removeIfExists($proUid)
 {
     $process = \ProcessPeer::retrieveByPK($proUid);
     if ($process) {
         $me = new self();
         $me->proUid = $process->getProUid();
         $me->remove();
     }
 }
示例#6
0
    public function generateBpmn($processUid, $processUidFieldNameForException, $userUid = "")
    {
        $bpmnProjectUid = "";

        try {
            //Verify data
            $obj = \ProcessPeer::retrieveByPK($processUid);

            if (is_null($obj)) {
                throw new \Exception(\G::LoadTranslation("ID_PROCESS_DOES_NOT_EXIST", array($processUidFieldNameForException, $processUid)));
            }

            //Verify data
            $criteria = new \Criteria("workflow");

            $criteria->addSelectColumn(\BpmnProjectPeer::PRJ_UID);
            $criteria->add(\BpmnProjectPeer::PRJ_UID, $processUid, \Criteria::EQUAL);

            $rsCriteria = \BpmnProjectPeer::doSelectRS($criteria);

            if ($rsCriteria->next()) {
                throw new \Exception(\G::LoadTranslation("ID_PROJECT_IS_BPMN", array($processUidFieldNameForException, $processUid)));
            }

            //Set data
            $processUidBk = $processUid;

            list($arrayWorkflowData, $arrayWorkflowFile) = $this->getData($processUid); //Get workflow data

            $arrayWorkflowData["process"] = $arrayWorkflowData["process"][0];

            $arrayWorkflowData["groupwfs"] = array();

            //Create WorkflowBpmn
            $arrayUid  = array();
            $arrayUid2 = array();

            //Process
            $arrayProcessData = $arrayWorkflowData["process"];

            unset(
                $arrayProcessData["PRO_UID"],
                $arrayProcessData["PRO_UPDATE_DATE"]
            );

            $arrayProcessData["PRO_PARENT"] = $processUidBk;
            $arrayProcessData["PRO_TITLE"]  = $arrayProcessData["PRO_TITLE"] . " - New version - " . date("M d, H:i:s");
            $arrayProcessData["PRO_CREATE_USER"] = ($userUid != "")? $userUid : "00000000000000000000000000000001";

            $this->create($arrayProcessData);

            $processUid = $this->getUid();

            $bpmnProjectUid = $processUid;

            //Task
            foreach ($arrayWorkflowData["tasks"] as $value) {
                $arrayTaskData = $value;

                $taskUidOld = $arrayTaskData["TAS_UID"];

                //Add
                unset($arrayTaskData["TAS_UID"]);

                $taskUid = $this->addTask($arrayTaskData);

                //Add new UID
                $arrayUid["task"][$taskUidOld] = $taskUid;

                $arrayUid2[] = array(
                    "old_uid" => $taskUidOld,
                    "new_uid" => $taskUid
                );
            }

            //$arrayWorkflowData["tasks"] = array();

            //Route
            $arrayRouteSecJoin = array();

            foreach ($arrayWorkflowData["routes"] as $value) {
                $arrayRouteData = $value;

                $arrayRouteData["TAS_UID"] = $arrayUid["task"][$arrayRouteData["TAS_UID"]];
                $arrayRouteData["ROU_NEXT_TASK"] = ($arrayRouteData["ROU_NEXT_TASK"] != "-1")? $arrayUid["task"][$arrayRouteData["ROU_NEXT_TASK"]] : $arrayRouteData["ROU_NEXT_TASK"];

                if ($arrayRouteData["ROU_TYPE"] != "SEC-JOIN") {
                    //Add
                    $result = $this->addRoute($arrayRouteData["TAS_UID"], $arrayRouteData["ROU_NEXT_TASK"], $arrayRouteData["ROU_TYPE"], $arrayRouteData["ROU_CONDITION"]);
                } else {
                    $arrayRouteSecJoin[] = $arrayRouteData;
                }
            }

            $arrayWorkflowData["routes"] = array();

            //Route SEC-JOIN
            foreach ($arrayRouteSecJoin as $value) {
                $arrayRouteData = $value;

                $result = $this->addRouteSecJoin($arrayRouteData["TAS_UID"], $arrayRouteData["ROU_NEXT_TASK"]);
            }

            //Lane
            foreach ($arrayWorkflowData["lanes"] as $value) {
                $arrayLaneData = $value;

                $swiX = (int)($arrayLaneData["SWI_X"]);
                $swiY = (int)($arrayLaneData["SWI_Y"]);

                switch ($arrayLaneData["SWI_TYPE"]) {
                    case "TEXT":
                        $swiUid = $this->addText($arrayLaneData["SWI_TEXT"], $swiX, $swiY);
                        break;
                    case "LINE":
                        $direction = (($swiX == 0)? "HORIZONTAL" : "VERTICAL");

                        $swiUid = $this->addLine(($direction == "HORIZONTAL")? $swiY : $swiX, $direction);
                        break;
                }
            }

            $arrayWorkflowData["lanes"] = array();

            //Data
            $arrayUid2 = array_merge(
                array(
                    array(
                        "old_uid" => $processUidBk,
                        "new_uid" => $processUid
                    )
                ),
                $arrayUid2
            );

            list($arrayWorkflowData, $arrayWorkflowFile) = $this->updateDataUidByArrayUid($arrayWorkflowData, $arrayWorkflowFile, $arrayUid2);

            $arrayWorkflowData["tasks"] = array();

            $this->createDataByArrayData($arrayWorkflowData);
            $this->createDataFileByArrayFile($arrayWorkflowFile);

            //Return
            return $bpmnProjectUid;
        } catch (\Exception $e) {
            if ($bpmnProjectUid != "") {
                $this->remove();
            }

            throw $e;
        }
    }