FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Fossology\UI\Api\Controllers\JobController Class Reference

Controller for Job model. More...

Inheritance diagram for Fossology\UI\Api\Controllers\JobController:
Inheritance graph
Collaboration diagram for Fossology\UI\Api\Controllers\JobController:
Collaboration graph

Public Member Functions

 getAllJobs ($request, $response, $args)
 
 getJobs ($request, $response, $args)
 
 createJob ($request, $response, $args)
 
 deleteJob ($request, $response, $args)
 
- Public Member Functions inherited from Fossology\UI\Api\Controllers\RestController
 __construct ($container)
 

Public Attributes

const UPLOAD_PARAM = "upload"
 
const JOB_COMPLETED = 0x1 << 1
 
const JOB_STARTED = 0x1 << 2
 
const JOB_QUEUED = 0x1 << 3
 
const JOB_FAILED = 0x1 << 4
 

Private Member Functions

 getAllUserResults ($id, $uid, $request, $response, $limit, $page, $apiVersion)
 
 getAllResults ($id, $request, $response, $limit, $page, $apiVersion)
 
 getFilteredResults ($uploadId, $request, $response, $limit, $page, $apiVersion)
 
 updateEtaAndStatus (&$job)
 
 getUploadEtaInSeconds ($jobId, $uploadId)
 
 getJobStatus ($jobqueue)
 
 addJobQueue (&$job, $request=null)
 
 compareJobsInfo ($JobsInfo1, $JobsInfo2)
 Sort compare function to order $JobsInfo by job_pk. More...
 
 sortJobsByDate ($job1, $job2)
 Sort compare function to order $JobsInfo by jobqueue start time. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Fossology\UI\Api\Controllers\RestController
 getParsedBody (ServerRequestInterface $request)
 Parse request body as JSON and return associative PHP array. More...
 
 throwNotAdminException ()
 
 uploadAccessible ($id)
 
 isItemExists (int $uploadId, int $itemId)
 
- Protected Attributes inherited from Fossology\UI\Api\Controllers\RestController
 $container
 
 $restHelper
 
 $dbHelper
 

Detailed Description

Controller for Job model.

Definition at line 37 of file JobController.php.

Member Function Documentation

◆ addJobQueue()

Fossology\UI\Api\Controllers\JobController::addJobQueue ( $job,
  $request = null 
)
private

Add the job queue to the job object

Parameters
[in,out]Job$jobThe job to be updated
Request$requestThe request object

Definition at line 522 of file JobController.php.

◆ compareJobsInfo()

Fossology\UI\Api\Controllers\JobController::compareJobsInfo (   $JobsInfo1,
  $JobsInfo2 
)
private

Sort compare function to order $JobsInfo by job_pk.

Parameters
array$JobsInfo1Result from GetJobInfo
array$JobsInfo2Result from GetJobInfo
Returns
int

Definition at line 555 of file JobController.php.

◆ createJob()

Fossology\UI\Api\Controllers\JobController::createJob (   $request,
  $response,
  $args 
)

Create a new job

Parameters
ServerRequestInterface$request
ResponseHelper$response
array$args
Returns
ResponseHelper
Exceptions
HttpErrorException

Definition at line 160 of file JobController.php.

◆ deleteJob()

Fossology\UI\Api\Controllers\JobController::deleteJob (   $request,
  $response,
  $args 
)

Delete a job using it's Job ID and Queue ID. Job ID is job_pk in job table and Queue ID is jobqueue_pk in jobqueue table

Parameters
ServerRequestInterface$request
ResponseHelper$response
array$args
Returns
ResponseHelper
Exceptions
HttpErrorException

Definition at line 197 of file JobController.php.

◆ getAllJobs()

Fossology\UI\Api\Controllers\JobController::getAllJobs (   $request,
  $response,
  $args 
)

Get all jobs created by all the users

Parameters
ServerRequestInterface$request
ResponseHelper$response
array$args
Returns
ResponseHelper
Exceptions
HttpErrorException

Definition at line 69 of file JobController.php.

◆ getAllResults()

Fossology\UI\Api\Controllers\JobController::getAllResults (   $id,
  $request,
  $response,
  $limit,
  $page,
  $apiVersion 
)
private

Get all jobs for the current user.

Parameters
integer | null$idSpecific job id or null for all jobs
Request$requestRequest object
ResponseHelper$responseResponse object
integer$limitLimit of jobs per page
integer$pagePage number required
integer$apiVersionAPI version
Returns
ResponseHelper

Definition at line 290 of file JobController.php.

◆ getAllUserResults()

Fossology\UI\Api\Controllers\JobController::getAllUserResults (   $id,
  $uid,
  $request,
  $response,
  $limit,
  $page,
  $apiVersion 
)
private

Get all jobs created by the current user.

Parameters
integer | null$idSpecific job id or null for all jobs
integer$uidSpecific user id
Request$requestRequest object
ResponseHelper$responseResponse object
integer$limitLimit of jobs per page
integer$pagePage number required
integer$apiVersionAPI version
Returns
ResponseHelper

Definition at line 260 of file JobController.php.

◆ getFilteredResults()

Fossology\UI\Api\Controllers\JobController::getFilteredResults (   $uploadId,
  $request,
  $response,
  $limit,
  $page,
  $apiVersion 
)
private

Get all jobs for the given upload.

Parameters
integer$uploadIdUpload id to be filtered
Request$requestRequest object
ResponseHelper$responseResponse object
integer$limitLimit of jobs per page
integer$pagePage number required
integer$apiVersionAPI version
Returns
ResponseHelper
Exceptions
HttpNotFoundException

Definition at line 321 of file JobController.php.

◆ getJobs()

Fossology\UI\Api\Controllers\JobController::getJobs (   $request,
  $response,
  $args 
)

Get all jobs by a user

Parameters
ServerRequestInterface$request
ResponseHelper$response
array$args
Returns
ResponseHelper
Exceptions
HttpErrorException

Definition at line 105 of file JobController.php.

◆ getJobStatus()

Fossology\UI\Api\Controllers\JobController::getJobStatus (   $jobqueue)
private

Get the job status based on jobqueue.

Parameters
array$jobqueueThe job queue with job id as values
Returns
string Job status (Completed, Processing, Queued or Failed)

Definition at line 384 of file JobController.php.

◆ getUploadEtaInSeconds()

Fossology\UI\Api\Controllers\JobController::getUploadEtaInSeconds (   $jobId,
  $uploadId 
)
private

Get the ETA in seconds for the upload.

Parameters
integer$jobIdThe job ID for which the ETA is required
integer$uploadIdUpload for which the ETA is required
Returns
integer ETA in seconds (0 if job already finished)

Definition at line 365 of file JobController.php.

◆ sortJobsByDate()

Fossology\UI\Api\Controllers\JobController::sortJobsByDate (   $job1,
  $job2 
)
private

Sort compare function to order $JobsInfo by jobqueue start time.

Parameters
array$job1Result from finalJobs
array$job2Result from finalJobs
Returns
int

Definition at line 566 of file JobController.php.

◆ updateEtaAndStatus()

Fossology\UI\Api\Controllers\JobController::updateEtaAndStatus ( $job)
private

Update the ETA and status for the given job

Parameters
[in,out]Job$jobThe job to be updated

Definition at line 345 of file JobController.php.

Member Data Documentation

◆ JOB_COMPLETED

const Fossology\UI\Api\Controllers\JobController::JOB_COMPLETED = 0x1 << 1

Job completed successfully

Definition at line 46 of file JobController.php.

◆ JOB_FAILED

const Fossology\UI\Api\Controllers\JobController::JOB_FAILED = 0x1 << 4

Job failed

Definition at line 58 of file JobController.php.

◆ JOB_QUEUED

const Fossology\UI\Api\Controllers\JobController::JOB_QUEUED = 0x1 << 3

Job waiting to be queued

Definition at line 54 of file JobController.php.

◆ JOB_STARTED

const Fossology\UI\Api\Controllers\JobController::JOB_STARTED = 0x1 << 2

Job started by scheduler

Definition at line 50 of file JobController.php.

◆ UPLOAD_PARAM

const Fossology\UI\Api\Controllers\JobController::UPLOAD_PARAM = "upload"

Get query parameter name for upload filtering

Definition at line 42 of file JobController.php.


The documentation for this class was generated from the following file: