public function routeToBpmnFlow(
        $objectOriginBpmnType,
        $objectOriginUid,
        $objectOriginBouX,
        $objectOriginBouY,
        $objectOriginBouWidth,
        $objectOriginBouHeight,
        $objectDestBpmnType,
        $objectDestUid,
        $objectDestBouX,
        $objectDestBouY,
        $objectDestBouWidth,
        $objectDestBouHeight,
        $condition = ""
    ) {
        try {
            $objectOriginBouWidth2  = (int)($objectOriginBouWidth / 2);
            $objectDestBouWidth2  = (int)($objectDestBouWidth / 2);

            $flowX1 = $objectOriginBouX + $objectOriginBouWidth2;
            $flowY1 = $objectOriginBouY + $objectOriginBouHeight;
            $flowX2 = $objectDestBouX + $objectDestBouWidth2;
            $flowY2 = $objectDestBouY;

            //Flow
            $arrayData = array(
                "FLO_TYPE"                => "SEQUENCE",
                "FLO_ELEMENT_ORIGIN"      => $objectOriginUid,
                "FLO_ELEMENT_ORIGIN_TYPE" => $objectOriginBpmnType,
                "FLO_ELEMENT_DEST"        => $objectDestUid,
                "FLO_ELEMENT_DEST_TYPE"   => $objectDestBpmnType,
                "FLO_IS_INMEDIATE"        => 1,
                "FLO_CONDITION"           => $condition,
                "FLO_X1"                  => $flowX1,
                "FLO_Y1"                  => $flowY1,
                "FLO_X2"                  => $flowX2,
                "FLO_Y2"                  => $flowY2,
                "FLO_STATE"               => json_encode(array())
            );

            $flowUid = $this->bp->addFlow($arrayData);

            //Return
            return $flowUid;
        } catch (\Exception $e) {
            throw $e;
        }
    }
Exemple #2
0
    public function addFlow($data)
    {
        $floUid = parent::addFlow($data);

        // to add start event->activity  as initial or end task
        switch ($data["FLO_ELEMENT_ORIGIN_TYPE"]) {
            case "bpmnEvent":
                switch ($data["FLO_ELEMENT_DEST_TYPE"]) {
                    case "bpmnActivity":
                        $event = \BpmnEventPeer::retrieveByPK($data["FLO_ELEMENT_ORIGIN"]);

                        //Setting as start Task
                        if (!is_null($event) && $event->getEvnType() == "START" && $event->getEvnMarker() == "EMPTY") {
                            $this->wp->setStartTask($data["FLO_ELEMENT_DEST"]);
                        }

                        //$this->updateEventStartObjects($data["FLO_ELEMENT_ORIGIN"], $data["FLO_ELEMENT_DEST"]);

                        //WebEntry-Event - Update
                        $this->updateWebEntryEventByEvent($data["FLO_ELEMENT_ORIGIN"], array("ACT_UID" => $data["FLO_ELEMENT_DEST"]));
                        break;
                    case "bpmnEvent":
                        $messageEventRelationUid = $this->createMessageEventRelationByBpmnFlow(\BpmnFlowPeer::retrieveByPK($floUid));
                        break;
                }
                break;
            case "bpmnActivity":
                switch ($data["FLO_ELEMENT_DEST_TYPE"]) {
                    case "bpmnEvent":
                        $event = \BpmnEventPeer::retrieveByPK($data["FLO_ELEMENT_DEST"]);

                        //Setting as end Task
                        if (!is_null($event) && $event->getEvnType() == "END" && $event->getEvnMarker() == "EMPTY") {
                            $this->wp->setEndTask($data["FLO_ELEMENT_ORIGIN"]);
                        }
                        break;
                }
                break;
        }

        return $floUid;
    }