FOSSology  4.4.0
Open Source License Compliance by Open Source Software
DeciderJobAgentPlugin.php
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2014-2015 Siemens AG
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
7 
12 namespace Fossology\DeciderJob\UI;
13 
15 
16 include_once(__DIR__ . "/../agent/version.php");
17 
23 {
24  const CONFLICT_STRATEGY_FLAG = "-k";
25 
26  function __construct()
27  {
28  $this->Name = "agent_deciderjob";
29  $this->Title = _("Automatic User License Decider");
30  $this->AgentName = AGENT_DECIDER_JOB_NAME;
31 
32  parent::__construct();
33  }
34 
39  function preInstall()
40  {
41  // no menue entry
42  }
43 
48  public function AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=array(), $conflictStrategyId=null)
49  {
50  $dependencies[] = "agent_adj2nest";
51 
52  $jobQueueId = \IsAlreadyScheduled($jobId, $this->AgentName, $uploadId);
53  if ($jobQueueId != 0) {
54  return $jobQueueId;
55  }
56 
57  $args = ($conflictStrategyId !== null) ? $this::CONFLICT_STRATEGY_FLAG.$conflictStrategyId : '';
58 
59  return $this->doAgentAdd($jobId, $uploadId, $errorMsg, $dependencies, $uploadId, $args);
60  }
61 }
62 
63 register_plugin(new DeciderJobAgentPlugin());
AgentAdd($jobId, $uploadId, &$errorMsg, $dependencies=array(), $conflictStrategyId=null)
doAgentAdd($jobId, $uploadId, &$errorMsg, $dependencies, $jqargs="", $jq_cmd_args=null)
IsAlreadyScheduled($job_pk, $AgentName, $upload_pk)
Check if an agent is already scheduled in a job.
Definition: common-job.php:378
DeciderJobAgent's UI.