FOSSology  4.4.0
Open Source License Compliance by Open Source Software
Fossology\Lib\Application\LicenseCompatibilityRulesYamlImport Class Reference

Import licenses from YAML. More...

Collaboration diagram for Fossology\Lib\Application\LicenseCompatibilityRulesYamlImport:
Collaboration graph

Public Member Functions

 __construct (DbManager $dbManager, UserDao $userDao, LicenseDao $licenseDao, CompatibilityDao $compatibilityDao)
 
 handleFile ($filename)
 Read the YAML line by line and import it. More...
 

Protected Attributes

 $dbManager
 
 $userDao
 
 $licenseDao
 
 $compatibilityDao
 
 $alias
 

Private Member Functions

 handleYaml ($row)
 
 updateLicense ($row, $lrPk)
 Update the license info in the DB. More...
 
 handleYamlLicense ($row)
 Handle a single row from YAML. More...
 
 insertNewLicense ($row)
 Insert a new license in DB. More...
 

Detailed Description

Import licenses from YAML.

Definition at line 25 of file LicenseCompatibilityRulesYamlImport.php.

Constructor & Destructor Documentation

◆ __construct()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImport::__construct ( DbManager  $dbManager,
UserDao  $userDao,
LicenseDao  $licenseDao,
CompatibilityDao  $compatibilityDao 
)

Constructor

Parameters
DbManager$dbManagerDB manager to use
UserDao$userDaoUser Dao to use
LicenseDao$licenseDaoLicense Dao to use
CompatibilityDao$compatibilityDaoCompatibility DAO to use

Definition at line 56 of file LicenseCompatibilityRulesYamlImport.php.

Member Function Documentation

◆ handleFile()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImport::handleFile (   $filename)

Read the YAML line by line and import it.

Parameters
string$filenameLocation of the YAML file.
Returns
string Error message, if any. Otherwise Read yaml: <count> licenses on success.

Definition at line 72 of file LicenseCompatibilityRulesYamlImport.php.

◆ handleYaml()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImport::handleYaml (   $row)
private

Handle a single row read from the YAML.

Parameters
array$rowSingle row from YAML
Returns
string Log messages

Definition at line 102 of file LicenseCompatibilityRulesYamlImport.php.

◆ handleYamlLicense()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImport::handleYamlLicense (   $row)
private

Handle a single row from YAML.

The function checks if the license data is already in the DB, then updates it. Otherwise, inserts new row in the DB.

Parameters
array$rowYAML row to be inserted.
Returns
string Log messages.

Definition at line 172 of file LicenseCompatibilityRulesYamlImport.php.

◆ insertNewLicense()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImport::insertNewLicense (   $row)
private

Insert a new license in DB.

Parameters
array$rowRows coming from YAML
Returns
int

Definition at line 219 of file LicenseCompatibilityRulesYamlImport.php.

◆ updateLicense()

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImport::updateLicense (   $row,
  $lrPk 
)
private

Update the license info in the DB.

Parameters
array$rowRow with new values.
int$lrPkMatched license ID.
Returns
string Log messages.

Definition at line 135 of file LicenseCompatibilityRulesYamlImport.php.

Member Data Documentation

◆ $alias

Fossology\Lib\Application\LicenseCompatibilityRulesYamlImport::$alias
protected
Initial value:
= [
'firstname' => ['firstname', 'mainname', 'First Name'],
'secondname' => ['secondname', 'subname', 'Second Name'],
'firsttype' => ['firsttype', 'maintype', 'First Type'],
'secondtype' => ['secondtype', 'subtype', 'Second Type'],
'compatibility' => ['compatibility', 'Compatibility'],
'comment' => ['comment', 'text', 'Comment']
]

Definition at line 40 of file LicenseCompatibilityRulesYamlImport.php.

◆ $compatibilityDao

CompatibilityDao Fossology\Lib\Application\LicenseCompatibilityRulesYamlImport::$compatibilityDao
protected

Compatibility DAO to use

Definition at line 38 of file LicenseCompatibilityRulesYamlImport.php.

◆ $dbManager

DbManager Fossology\Lib\Application\LicenseCompatibilityRulesYamlImport::$dbManager
protected

DB manager to use

Definition at line 29 of file LicenseCompatibilityRulesYamlImport.php.

◆ $licenseDao

LicenseDao Fossology\Lib\Application\LicenseCompatibilityRulesYamlImport::$licenseDao
protected

License DAO to use

Definition at line 35 of file LicenseCompatibilityRulesYamlImport.php.

◆ $userDao

UserDao Fossology\Lib\Application\LicenseCompatibilityRulesYamlImport::$userDao
protected

User DAO to use

Definition at line 32 of file LicenseCompatibilityRulesYamlImport.php.


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