Exemplo n.º 1
0
 public function OnEvent(CBPActivity $sender, $arEventParameters = array())
 {
     if ($sender == null) {
         throw new Exception("sender");
     }
     $sender->RemoveStatusChangeHandler(self::ClosedEvent, $this);
     if (!$this->TryNextIteration()) {
         $this->workflow->CloseActivity($this);
     }
 }
Exemplo n.º 2
0
 public function OnEvent(CBPActivity $sender, $arEventParameters = array())
 {
     $sender->RemoveStatusChangeHandler(self::ClosedEvent, $this);
     $bCloseActivity = false;
     if (is_a($sender, "CBPStateInitializationActivity")) {
         if (strlen($this->nextStateName) > 0) {
             $stateFinalization = null;
             for ($i = 0, $s = sizeof($this->arActivities); $i < $s; $i++) {
                 if (is_a($this->arActivities[$i], "CBPStateFinalizationActivity")) {
                     $stateFinalization = $this->arActivities[$i];
                 }
             }
             if ($stateFinalization != null) {
                 $stateFinalization->AddStatusChangeHandler(self::ClosedEvent, $this);
                 $this->workflow->ExecuteActivity($stateFinalization);
             } else {
                 $bCloseActivity = true;
             }
         } else {
             //$stateService = $this->workflow->GetService("StateService");
             //$stateService->SetStateParameters($this->GetWorkflowInstanceId(), $this->GetAvailableStateEvents());
             $status = $this->ExecuteState();
             if ($status != CBPActivityExecutionStatus::Executing) {
                 $bCloseActivity = true;
             }
         }
     } elseif (is_a($sender, "CBPStateFinalizationActivity")) {
         $bCloseActivity = true;
     } else {
         $stateFinalization = null;
         if (strlen($this->nextStateName) > 0) {
             for ($i = 0, $s = sizeof($this->arActivities); $i < $s; $i++) {
                 if (is_a($this->arActivities[$i], "CBPStateFinalizationActivity")) {
                     $stateFinalization = $this->arActivities[$i];
                 }
             }
         }
         if ($stateFinalization != null) {
             $stateFinalization->AddStatusChangeHandler(self::ClosedEvent, $this);
             $this->workflow->ExecuteActivity($stateFinalization);
         } else {
             $bCloseActivity = true;
         }
     }
     if ($bCloseActivity) {
         $this->arActivityState = array();
         $this->isListenTrigerred = false;
         $arEP = array();
         if (strlen($this->nextStateName) > 0) {
             $arEP["NextStateName"] = $this->nextStateName;
         }
         $this->workflow->CloseActivity($this, $arEP);
     }
 }
 public function OnEvent(CBPActivity $sender, $arEventParameters = array())
 {
     $sender->RemoveStatusChangeHandler(self::ClosedEvent, $this);
     if ($this->executionStatus == CBPActivityExecutionStatus::Canceling || $this->executionStatus == CBPActivityExecutionStatus::Faulting) {
         $this->workflow->CloseActivity($this);
     } else {
         if ($this->executionStatus == CBPActivityExecutionStatus::Executing && !$this->TryScheduleNextChild($context)) {
             $this->OnSequenceComplete();
             $this->workflow->CloseActivity($this);
         }
     }
 }
Exemplo n.º 4
0
 public function OnEvent(CBPActivity $sender, $arEventParameters = array())
 {
     $sender->RemoveStatusChangeHandler(self::ClosedEvent, $this);
     $flag = true;
     for ($i = 0; $i < count($this->arActivities); $i++) {
         $activity = $this->arActivities[$i];
         if ($activity->executionStatus != CBPActivityExecutionStatus::Initialized && $activity->executionStatus != CBPActivityExecutionStatus::Closed) {
             $flag = false;
             break;
         }
     }
     if ($flag) {
         $this->workflow->CloseActivity($this);
     }
 }
 public function OnEvent(CBPActivity $sender, $arEventParameters = array())
 {
     $sender->RemoveStatusChangeHandler(self::ClosedEvent, $this);
     if (array_key_exists("NextStateName", $arEventParameters) && strlen($arEventParameters["NextStateName"]) > 0) {
         $nextStateActivity = $this->GetStateActivityByName($arEventParameters["NextStateName"]);
         if ($nextStateActivity == null) {
             throw new Exception("nextStateActivity");
         }
         $nextStateActivity->ReInitialize();
         $nextStateActivity->AddStatusChangeHandler(self::ClosedEvent, $this);
         $this->workflow->ExecuteActivity($nextStateActivity);
     } else {
         $this->workflow->CloseActivity($this);
     }
 }
Exemplo n.º 6
0
 protected function OnEvent(CBPActivity $sender)
 {
     $sender->RemoveStatusChangeHandler(self::ClosedEvent, $this);
     $this->workflow->CloseActivity($this);
 }
Exemplo n.º 7
0
 public function OnEvent(CBPActivity $sender, $arEventParameters = array())
 {
     $sender->RemoveStatusChangeHandler(self::ClosedEvent, $this);
     $this->workflow->CloseActivity($this);
 }