예제 #1
0
 /**
  * @param int $userId
  * @param int
  * @param int $lastItem
  * @return array
  */
 protected function updateLastItem($userId, $groupId, $lastItem)
 {
     $type = GetParm("clearingTypes", PARM_INTEGER);
     $global = GetParm("globalDecision", PARM_STRING) === "on";
     $uploadTreeTableName = $this->uploadDao->getUploadtreeTableName($lastItem);
     $itemBounds = $this->uploadDao->getItemTreeBounds($lastItem, $uploadTreeTableName);
     $this->clearingDecisionEventProcessor->makeDecisionFromLastEvents($itemBounds, $userId, $groupId, $type, $global);
 }
 public function testMakeDecisionFromLastEventsWithInvalidType()
 {
     $this->clearingDao->shouldReceive("getRelevantClearingEvents")->never();
     $this->agentLicenseEventProcessor->shouldReceive("getScannerDetectedLicenses")->never();
     $this->clearingDao->shouldReceive("getRelevantClearingDecision")->never();
     $this->clearingDao->shouldReceive("createDecisionFromEvents")->never();
     $this->clearingDao->shouldReceive("removeWipClearingDecision")->never();
     $this->clearingDecisionProcessor->makeDecisionFromLastEvents($this->itemTreeBounds, $this->userId, $this->groupId, ClearingDecisionProcessor::NO_LICENSE_KNOWN_DECISION_TYPE - 1, false);
 }
예제 #3
0
 /**
  * @param ItemTreeBounds $itemTreeBounds
  * @param LicenseMatch[] $matches
  * @return boolean
  */
 private function autodecideNomosMatchesInsideMonk(ItemTreeBounds $itemTreeBounds, $matches)
 {
     $canDecide = count($matches) > 0;
     foreach ($matches as $licenseMatches) {
         if (!$canDecide) {
             break;
         }
         $canDecide &= $this->areNomosMatchesInsideAMonkMatch($licenseMatches);
     }
     if ($canDecide) {
         $this->clearingDecisionProcessor->makeDecisionFromLastEvents($itemTreeBounds, $this->userId, $this->groupId, DecisionTypes::IDENTIFIED, $global = true);
     }
     return $canDecide;
 }
예제 #4
0
 /**
  * @param ItemTreeBounds $itemTreeBounds
  * @param int $userId
  */
 protected function processClearingEventsForItem(ItemTreeBounds $itemTreeBounds, $userId, $groupId, $additionalEventsFromThisJob)
 {
     $this->dbManager->begin();
     $itemId = $itemTreeBounds->getItemId();
     switch ($this->conflictStrategyId) {
         case self::FORCE_DECISION:
             $createDecision = true;
             break;
         default:
             $createDecision = !$this->clearingDecisionProcessor->hasUnhandledScannerDetectedLicenses($itemTreeBounds, $groupId, $additionalEventsFromThisJob, $this->licenseMap);
     }
     if ($createDecision) {
         $this->clearingDecisionProcessor->makeDecisionFromLastEvents($itemTreeBounds, $userId, $groupId, DecisionTypes::IDENTIFIED, $this->decisionIsGlobal, $additionalEventsFromThisJob);
     } else {
         foreach ($additionalEventsFromThisJob as $eventId) {
             $this->clearingDao->copyEventIdTo($eventId, $itemId, $userId, $groupId);
         }
         $this->clearingDao->markDecisionAsWip($itemId, $userId, $groupId);
     }
     $this->heartbeat(1);
     $this->dbManager->commit();
 }