Пример #1
0
 /**
  * Builds Project Data Structure
  *
  * @return array
  */
 protected function buildData()
 {
     $data = array();
     $data["metadata"] = $this->getMetadata();
     $data["metadata"]["workspace"] = defined("SYS_SYS") ? SYS_SYS : "Unknown";
     $data["metadata"]["name"] = $this->getProjectName();
     $data["metadata"]["uid"] = $this->getProjectUid();
     $bpmnStruct["ACTIVITY"] = \BpmnActivity::getAll($this->prjUid);
     $bpmnStruct["ARTIFACT"] = \BpmnArtifact::getAll($this->prjUid);
     $bpmnStruct["BOUND"] = \BpmnBound::getAll($this->prjUid);
     $bpmnStruct["DATA"] = \BpmnData::getAll($this->prjUid);
     $bpmnStruct["DIAGRAM"] = \BpmnDiagram::getAll($this->prjUid);
     $bpmnStruct["DOCUMENTATION"] = array();
     $bpmnStruct["EVENT"] = \BpmnEvent::getAll($this->prjUid);
     $bpmnStruct["EXTENSION"] = array();
     $bpmnStruct["FLOW"] = \BpmnFlow::getAll($this->prjUid, null, null, "", CASE_UPPER, false);
     $bpmnStruct["GATEWAY"] = \BpmnGateway::getAll($this->prjUid);
     $bpmnStruct["LANE"] = \BpmnLane::getAll($this->prjUid);
     $bpmnStruct["LANESET"] = \BpmnLaneset::getAll($this->prjUid);
     $bpmnStruct["PARTICIPANT"] = \BpmnParticipant::getAll($this->prjUid);
     $bpmnStruct["PROCESS"] = \BpmnProcess::getAll($this->prjUid);
     $bpmnStruct["PROJECT"] = array(\BpmnProjectPeer::retrieveByPK($this->prjUid)->toArray());
     $workflow = new \ProcessMaker\Project\Workflow();
     list($workflowData, $workflowFile) = $workflow->getData($this->prjUid);
     $data["bpmn-definition"] = $bpmnStruct;
     $data["workflow-definition"] = $workflowData;
     $data["workflow-files"] = $workflowFile;
     return $data;
 }
Пример #2
0
 /**
  * Method called to associate a BpmnEvent object to this object
  * through the BpmnEvent foreign key attribute
  *
  * @param      BpmnEvent $l BpmnEvent
  * @return     void
  * @throws     PropelException
  */
 public function addBpmnEvent(BpmnEvent $l)
 {
     $this->collBpmnEvents[] = $l;
     $l->setBpmnProject($this);
 }
Пример #3
0
    public function mapBpmnEventToWorkflowRoutes($activityUid, $eventUid, $routeType = "SEQUENTIAL", $routeCondition = "", $routeDefault = 0)
    {
        try {
            $arrayEventData = \BpmnEvent::findOneBy(\BpmnEventPeer::EVN_UID, $eventUid)->toArray();

            if (!is_null($arrayEventData)) {
                $arrayEventType   = array("INTERMEDIATE");
                $arrayEventMarker = array("MESSAGECATCH", "TIMER");

                if (in_array($arrayEventData["EVN_TYPE"], $arrayEventType) && in_array($arrayEventData["EVN_MARKER"], $arrayEventMarker)) {
                    $arrayKey = array(
                        "MESSAGECATCH" => "intermediate-catch-message-event",
                        "TIMER"        => "intermediate-catch-timer-event"
                    );

                    $taskUid = $this->createTaskByElement(
                        $eventUid,
                        "bpmnEvent",
                        $arrayKey[$arrayEventData["EVN_MARKER"]]
                    );

                    $result = $this->wp->addRoute($activityUid, $taskUid, $routeType, $routeCondition, $routeDefault);

                    $activityUid = $taskUid;

                    $routeType = "SEQUENTIAL";
                    $routeCondition = "";
                    $routeDefault = 0;
                }

                //Flows
                $arrayFlow = \BpmnFlow::findAllBy(array(
                    \BpmnFlowPeer::FLO_TYPE                => array("MESSAGE", \Criteria::NOT_EQUAL),
                    \BpmnFlowPeer::FLO_ELEMENT_ORIGIN      => $eventUid,
                    \BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => "bpmnEvent"
                ));

                foreach ($arrayFlow as $value) {
                    $arrayFlowData = $value->toArray();

                    switch ($arrayFlowData["FLO_ELEMENT_DEST_TYPE"]) {
                        case "bpmnActivity":
                            //Event ----> Activity
                            $result = $this->wp->addRoute($activityUid, $arrayFlowData["FLO_ELEMENT_DEST"], $routeType, $routeCondition, $routeDefault);
                            break;
                        case "bpmnGateway":
                            //Event ----> Gateway
                            $this->mapBpmnGatewayToWorkflowRoutes($activityUid, $arrayFlowData["FLO_ELEMENT_DEST"]);
                            break;
                        case "bpmnEvent":
                            //Event ----> Event
                            $event = \BpmnEventPeer::retrieveByPK($arrayFlowData["FLO_ELEMENT_DEST"]);

                            if (!is_null($event)) {
                                switch ($event->getEvnType()) {
                                    case "START":
                                        throw new \LogicException("Incorrect design" . PHP_EOL . "Given: bpmnEvent -> " . $arrayFlowData["FLO_ELEMENT_DEST_TYPE"]);
                                        break;
                                    case "END":
                                        //$event->getEvnMarker(): EMPTY or MESSAGETHROW
                                        switch ($event->getEvnMarker()) {
                                            case "MESSAGETHROW":
                                                $taskUid = $this->createTaskByElement(
                                                    $event->getEvnUid(),
                                                    "bpmnEvent",
                                                    "end-message-event"
                                                );

                                                $result = $this->wp->addRoute($activityUid, $taskUid, $routeType, $routeCondition, $routeDefault);
                                                $result = $this->wp->addRoute($taskUid, -1, "SEQUENTIAL");
                                                break;
                                            case "EMAIL":
                                                $taskUid = $this->createTaskByElement(
                                                    $event->getEvnUid(),
                                                    "bpmnEvent",
                                                    "end-email-event"
                                                );

                                                $result = $this->wp->addRoute($activityUid, $taskUid, $routeType, $routeCondition, $routeDefault);
                                                $result = $this->wp->addRoute($taskUid, -1, "SEQUENTIAL");
                                                break;
                                            default:
                                                //EMPTY //and others types
                                                $result = $this->wp->addRoute($activityUid, -1, $routeType, $routeCondition, $routeDefault);
                                                break;
                                        }
                                        break;
                                    default:
                                        //INTERMEDIATE //and others types
                                        $this->mapBpmnEventToWorkflowRoutes($activityUid, $arrayFlowData["FLO_ELEMENT_DEST"], $routeType, $routeCondition, $routeDefault);
                                        break;
                                }
                            }
                            break;
                        default:
                            //For ProcessMaker is only allowed flows between: "event -> activity", "event -> gateway", "event -> event"
                            //any another flow is considered invalid
                            throw new \LogicException(
                                "For ProcessMaker is only allowed flows between: \"event -> activity\", \"event -> gateway\", \"event -> event\"" . PHP_EOL .
                                "Given: bpmnEvent -> " . $arrayFlowData["FLO_ELEMENT_DEST_TYPE"]
                            );
                    }
                }
            }
        } catch (\Exception $e) {
            throw $e;
        }
    }
Пример #4
0
    public function getEvents($start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
    {
        if (is_array($start)) {
            extract($start);
        }

        //return Event::getAll($this->project->getPrjUid(), null, null, '', $changeCaseTo);

        $filter = $changeCaseTo != CASE_UPPER ? array_map("strtolower", self::$excludeFields["event"]) : self::$excludeFields["event"];

        return self::filterCollectionArrayKeys(
            Event::getAll($this->getUid(), $start, $limit, $filter, $changeCaseTo),
            $filter
        );
    }
Пример #5
0
 /**
  * This method gets the form data from BpmnActivity or BpmnEvent, for purposes of reassignment of the case
  * @param array $args
  * @return array
  */
 public function getFormDataAdhoc($args)
 {
     $bpmFlow = BeanFactory::getBean('pmse_BpmFlow');
     //new BpmFlow();
     $orderBy = '';
     $where = "cas_id='{$args['cas_id']}' AND cas_index='{$args['cas_index']}'";
     $joinedTables = array(array('INNER', 'bpmn_process', 'bpmn_process.pro_id=bpm_flow.pro_id'));
     $flowList = $bpmFlow->getSelectRows($orderBy, $where, 0, -1, -1, array(), $joinedTables);
     foreach ($flowList['rowList'] as $flow) {
         switch ($flow['bpmn_type']) {
             case 'bpmnActivity':
                 $objectBean = new BpmnActivity();
                 $objectBean->retrieve_by_string_fields(array('act_id' => $flow['bpmn_id']));
                 $taskName = $objectBean->act_name;
                 break;
             case 'bpmnEvent':
                 $objectBean = new BpmnEvent();
                 $objectBean->retrieve_by_string_fields(array('evn_id' => $flow['bpmn_id']));
                 $taskName = $objectBean->evn_name;
                 break;
             default:
                 break;
         }
         $processName = $flow['pro_name'];
     }
     return array("process_name" => $processName, "process_task" => $taskName);
 }