FOSSology  4.4.0
Open Source License Compliance by Open Source Software
JobQueue.php
Go to the documentation of this file.
1 <?php
2 /*
3  SPDX-FileCopyrightText: © 2022 Krishna Mahato <krishhtrishh9304@gmail.com>
4 
5  SPDX-License-Identifier: GPL-2.0-only
6 */
11 namespace Fossology\UI\Api\Models;
12 
17 class JobQueue
18 {
23  private $jobQueueId;
28  private $jobQueueType;
33  private $startTime;
38  private $endTime;
43  private $status;
48  private $itemsProcessed;
53  private $log;
58  private $dependencies;
63  private $itemsPerSec;
67  private $canDoActions;
72  private $isInProgress;
77  private $isReady;
82  private $download;
83 
102  $itemsPerSec, $canDoActions, $isInProgress,
104  {
105  $this->setJobQueueId($jobQueueId);
107  $this->setStartTime($startTime);
108  $this->setEndTime($endTime);
109  $this->setStatus($status);
111  $this->setLog($log);
114  $this->setCanDoActions($canDoActions);
116  $this->setIsReady($isReady);
117  $this->setDownload($download);
118  }
119 
123  public function getJobQueueId()
124  {
125  return $this->jobQueueId;
126  }
127 
131  public function setJobQueueId($jobQueueId)
132  {
133  $this->jobQueueId = intval($jobQueueId);
134  }
135 
139  public function getJobQueueType()
140  {
141  return $this->jobQueueType;
142  }
143 
148  {
149  $this->jobQueueType = $jobQueueType;
150  }
151 
155  public function getStartTime()
156  {
157  return $this->startTime;
158  }
159 
163  public function setStartTime($startTime)
164  {
165  $this->startTime = $startTime;
166  }
167 
171  public function getEndTime()
172  {
173  return $this->endTime;
174  }
175 
179  public function setEndTime($endTime)
180  {
181  $this->endTime = $endTime;
182  }
183 
187  public function getStatus()
188  {
189  return $this->status;
190  }
191 
195  public function setStatus($status)
196  {
197  $this->status = $status;
198  }
199 
203  public function getItemsProcessed()
204  {
205  return $this->itemsProcessed;
206  }
207 
212  {
213  $this->itemsProcessed = intval($itemsProcessed);
214  }
215 
219  public function getLog()
220  {
221  return $this->log;
222  }
223 
227  public function setLog($log)
228  {
229  $this->log = $log;
230  }
231 
235  public function getDependencies()
236  {
237  return $this->dependencies;
238  }
239 
244  {
245  $this->dependencies = [];
246  foreach ($dependencies as $dependency) {
247  $this->dependencies[] = intval($dependency);
248  }
249  }
250 
254  public function getItemsPerSec()
255  {
256  return $this->itemsPerSec;
257  }
258 
262  public function setItemsPerSec($itemsPerSec)
263  {
264  $this->itemsPerSec = floatval($itemsPerSec);
265  }
266 
270  public function isCanDoActions()
271  {
272  return $this->canDoActions;
273  }
274 
278  public function setCanDoActions($canDoActions)
279  {
280  $this->canDoActions = $canDoActions;
281  }
282 
286  public function isInProgress()
287  {
288  return $this->isInProgress;
289  }
290 
295  {
296  $this->isInProgress = $isInProgress;
297  }
298 
302  public function isReady()
303  {
304  return $this->isReady;
305  }
306 
310  public function setIsReady($isReady)
311  {
312  $this->isReady = $isReady;
313  }
314 
318  public function getDownload()
319  {
320  return $this->download;
321  }
322 
326  public function setDownload($download)
327  {
328  $this->download = $download;
329  }
330 
335  public function getJSON()
336  {
337  return json_encode($this->getArray());
338  }
339 
344  public function getArray()
345  {
346  return [
347  "jobQueueId" => $this->getJobQueueId(),
348  "jobQueueType" => $this->getJobQueueType(),
349  "startTime" => $this->getStartTime(),
350  "endTime" => $this->getEndTime(),
351  "status" => $this->getStatus(),
352  "itemsProcessed" => $this->getItemsProcessed(),
353  "log" => $this->getLog(),
354  "dependencies" => $this->getDependencies(),
355  "itemsPerSec" => $this->getItemsPerSec(),
356  "canDoActions" => $this->isCanDoActions(),
357  "isInProgress" => $this->isInProgress(),
358  "isReady" => $this->isReady(),
359  "download" => $this->getDownload() == null ? null : [
360  "text" => $this->getDownload()["text"],
361  "link" => $this->getDownload()["link"]
362  ]
363  ];
364  }
365 }
Model class to hold JobQueue info.
Definition: JobQueue.php:18
setItemsProcessed($itemsProcessed)
Definition: JobQueue.php:211
__construct($jobQueueId, $jobQueueType, $startTime, $endTime, $status, $itemsProcessed, $log, $dependencies, $itemsPerSec, $canDoActions, $isInProgress, $isReady, $download)
Definition: JobQueue.php:100