FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
Fossology\UI\Api\Helper\UploadHelper Class Reference

Handle new file uploads from Slim framework and move to FOSSology. More...

Collaboration diagram for Fossology\UI\Api\Helper\UploadHelper:
Collaboration graph

Public Member Functions

 __construct ()
 
 createNewUpload (ServerRequestInterface $request, $folderId, $fileDescription, $isPublic, $ignoreScm, $uploadType)
 
 generateUploadSummary ($uploadId, $groupId)
 

Public Attributes

const VALID_VCS_TYPES
 
const VALID_UPLOAD_TYPES
 

Private Member Functions

 createFileUpload ($uploadedFile, $folderId, $fileDescription, $isPublic, $ignoreScm=0)
 
 handleUpload ($body, $uploadType, $folderId, $fileDescription, $isPublic, $ignoreScm=0)
 
 sanitizeVcsData (&$vcsData)
 Check if the passed VCS object is correct or not. More...
 
 sanitizeUrlData (&$urlData)
 Check if the passed URL object is correct or not. More...
 
 sanitizeSrvData (&$srvData)
 Check if the passed server upload object is correct or not. More...
 
 generateVcsUpload ($vcsData, $folderId, $fileDescription, $isPublic, $ignoreScm)
 
 generateUrlUpload ($urlData, $folderName, $fileDescription, $isPublic, $ignoreScm)
 
 generateSrvUpload ($srvData, $folderName, $fileDescription, $isPublic, $ignoreScm)
 
 getMainLicenses ($dbManager, $uploadId, $groupId)
 

Private Attributes

 $uploadFilePage
 
 $uploadVcsPage
 
 $uploadUrlPage
 
 $uploadSrvPage
 

Detailed Description

Handle new file uploads from Slim framework and move to FOSSology.

Definition at line 42 of file UploadHelper.php.

Constructor & Destructor Documentation

Fossology\UI\Api\Helper\UploadHelper::__construct ( )

Constructor to get UploadFilePage and UploadVcsPage objects.

Definition at line 90 of file UploadHelper.php.

Member Function Documentation

Fossology\UI\Api\Helper\UploadHelper::createFileUpload (   $uploadedFile,
  $folderId,
  $fileDescription,
  $isPublic,
  $ignoreScm = 0 
)
private

Create request required by UploadFilePage

Parameters
array$uploadedFileUploaded file object by Slim
string$folderIdID of the folder to upload the file
string$fileDescriptionDescription of file uploaded
string$isPublicUpload is public, private or protected
integer$ignoreScm1 if the SCM should be ignored.
Returns
array Array with status, message and upload id

Definition at line 152 of file UploadHelper.php.

Fossology\UI\Api\Helper\UploadHelper::createNewUpload ( ServerRequestInterface  $request,
  $folderId,
  $fileDescription,
  $isPublic,
  $ignoreScm,
  $uploadType 
)

Get a request from Slim and translate to Symfony request to be processed by FOSSology

Parameters
ServerRequestInterface$request
string$folderIdID of the folder to upload the file
string$fileDescriptionDescription of file uploaded
string$isPublicUpload is public, private or protected
boolean$ignoreScmTrue if the SCM should be ignored.
string$uploadTypeType of upload (if other than file)
Returns
array Array with status, message and upload id
See also
createVcsUpload()
createFileUpload()

Definition at line 112 of file UploadHelper.php.

Fossology\UI\Api\Helper\UploadHelper::generateSrvUpload (   $srvData,
  $folderName,
  $fileDescription,
  $isPublic,
  $ignoreScm 
)
private

Generate the upload by calling handleRequest of HelperToUploadSrvPage

Parameters
array$srvDataInformation from POST
string$folderIdID of the folder
string$fileDescriptionDescription of the upload
string$isPublicUpload is public, private or protected
integer$ignoreScm1 if the SCM should be ignored.
Returns
array Array with status, message and upload id

Definition at line 457 of file UploadHelper.php.

Fossology\UI\Api\Helper\UploadHelper::generateUploadSummary (   $uploadId,
  $groupId 
)

Generate UploadSummary object for given upload respective to given group id

Parameters
integer$uploadIdUpload ID
integer$groupIdGroup ID
Returns
Fossology::UI::Api::Models::UploadSummary

Definition at line 491 of file UploadHelper.php.

Fossology\UI\Api\Helper\UploadHelper::generateUrlUpload (   $urlData,
  $folderName,
  $fileDescription,
  $isPublic,
  $ignoreScm 
)
private

Generate the upload by calling handleRequest of HelperToUploadUrlPage

Parameters
array$urlDataInformation from POST
string$folderIdID of the folder
string$fileDescriptionDescription of the upload
string$isPublicUpload is public, private or protected
integer$ignoreScm1 if the SCM should be ignored.
Returns
array Array with status, message and upload id

Definition at line 414 of file UploadHelper.php.

Fossology\UI\Api\Helper\UploadHelper::generateVcsUpload (   $vcsData,
  $folderId,
  $fileDescription,
  $isPublic,
  $ignoreScm 
)
private

Generate the upload by calling handleRequest of HelperToUploadVcsPage

Parameters
array$vcsDataInformation from POST
string$folderIdID of the folder
string$fileDescriptionDescription of the upload
string$isPublicUpload is public, private or protected
integer$ignoreScm1 if the SCM should be ignored.
Returns
array Array with status, message and upload id

Definition at line 370 of file UploadHelper.php.

Fossology\UI\Api\Helper\UploadHelper::getMainLicenses (   $dbManager,
  $uploadId,
  $groupId 
)
private

Get main license selected for the upload

Parameters
DbManager$dbManagerDbManager object
integer$uploadIdUpload ID
integer$groupIdGroup ID
Returns
NULL|array

Definition at line 549 of file UploadHelper.php.

Fossology\UI\Api\Helper\UploadHelper::handleUpload (   $body,
  $uploadType,
  $folderId,
  $fileDescription,
  $isPublic,
  $ignoreScm = 0 
)
private

Create request required by Upload pages

Parameters
array$bodyParsed upload request
string$uploadTypeType of upload (url, vcs or server)
string$folderIdID of the folder to upload the file
string$fileDescriptionDescription of file uploaded
string$isPublicUpload is public, private or protected
integer$ignoreScm1 if the SCM should be ignored.
Returns
array Array with status, message and upload id

Definition at line 192 of file UploadHelper.php.

Fossology\UI\Api\Helper\UploadHelper::sanitizeSrvData ( $srvData)
private

Check if the passed server upload object is correct or not.

  1. Check if all the required parameters are passed by user.
  2. Add missing keys with empty data to prevent warnings.
Parameters
array$srvDataParsed server upload object to be sanitized
Returns
array|boolean True if everything is correct, error array otherwise

Definition at line 339 of file UploadHelper.php.

Fossology\UI\Api\Helper\UploadHelper::sanitizeUrlData ( $urlData)
private

Check if the passed URL object is correct or not.

  1. Check if all the required parameters are passed by user.
  2. Add missing keys with empty data to prevent warnings.
Parameters
array$urlDataParsed URL object to be sanitized
Returns
array|boolean True if everything is correct, error array otherwise

Definition at line 299 of file UploadHelper.php.

Fossology\UI\Api\Helper\UploadHelper::sanitizeVcsData ( $vcsData)
private

Check if the passed VCS object is correct or not.

  1. Check if all the required parameters are passed by user.
  2. Translate the vcsType to required values.
  3. Add missing keys with empty data to prevent warnings.
Parameters
array$vcsDataParsed VCS object to be sanitized
Returns
array|boolean True if everything is correct, error array otherwise

Definition at line 244 of file UploadHelper.php.

Member Data Documentation

HelperToUploadFilePage Fossology\UI\Api\Helper\UploadHelper::$uploadFilePage
private

Object to handle file based uploads

Definition at line 48 of file UploadHelper.php.

HelperToUploadSrvPage Fossology\UI\Api\Helper\UploadHelper::$uploadSrvPage
private

Object to handle server based uploads

Definition at line 66 of file UploadHelper.php.

HelperToUploadUrlPage Fossology\UI\Api\Helper\UploadHelper::$uploadUrlPage
private

Object to handle URL based uploads

Definition at line 60 of file UploadHelper.php.

HelperToUploadVcsPage Fossology\UI\Api\Helper\UploadHelper::$uploadVcsPage
private

Object to handle VCS based uploads

Definition at line 54 of file UploadHelper.php.

array Fossology\UI\Api\Helper\UploadHelper::VALID_UPLOAD_TYPES
Initial value:
= array(
"vcs",
"url",
"server"
)

Array of valid inputs for uploadType parameter

Definition at line 81 of file UploadHelper.php.

array Fossology\UI\Api\Helper\UploadHelper::VALID_VCS_TYPES
Initial value:
= array(
"git",
"svn"
)

Array of valid inputs for vcsType parameter

Definition at line 72 of file UploadHelper.php.


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