![]() |
FOSSology
4.7.1
Open Source License Compliance by Open Source Software
|
Import custom text phrases from CSV/JSON. More...

Public Member Functions | |
| __construct (DbManager $dbManager, UserDao $userDao, LicenseDao $licenseDao=null) | |
| setDelimiter ($delimiter=',') | |
| Update the delimiter. More... | |
| setEnclosure ($enclosure='"') | |
| Update the enclosure. More... | |
| handleFile ($filename, $fileExtension) | |
| Read the CSV/JSON file and import it. More... | |
| importJsonData ($data, string &$msg) | |
| Import JSON data directly. More... | |
Protected Attributes | |
| $dbManager | |
| $userDao | |
| $licenseDao | |
| $delimiter = ',' | |
| $enclosure = '"' | |
| $headrow = null | |
| $alias | |
Private Member Functions | |
| handleJsonFile ($filename) | |
| Handle JSON file import. More... | |
| handleCsvFile ($filename) | |
| Handle CSV file import. More... | |
| importPhrases ($data) | |
| Import phrases from data array. More... | |
| importSinglePhrase ($phraseData) | |
| Import a single phrase. More... | |
| mapHeaders ($data) | |
| Map CSV headers to standard field names. More... | |
| normalizeBulkExportValues ($mapped) | |
| Normalize values from bulk text export format. More... | |
| parseBoolean ($value) | |
| Parse boolean value from string. More... | |
| associateLicenses ($cpPk, $licenseNames, $removing=false, $allowCreate=false) | |
| isValidLicenseShortname ($shortname) | |
| Validate a license shortname before auto-creating it. More... | |
Import custom text phrases from CSV/JSON.
Definition at line 27 of file CustomTextImport.php.
| Fossology\Lib\Application\CustomTextImport::__construct | ( | DbManager | $dbManager, |
| UserDao | $userDao, | ||
| LicenseDao | $licenseDao = null |
||
| ) |
| DbManager | $dbManager | |
| UserDao | $userDao | |
| LicenseDao | $licenseDao | Falls back to DI container when null. |
Definition at line 64 of file CustomTextImport.php.
|
private |
Handle CSV file import.
| string | $filename | Location of the CSV file. |
Definition at line 134 of file CustomTextImport.php.
| Fossology\Lib\Application\CustomTextImport::handleFile | ( | $filename, | |
| $fileExtension | |||
| ) |
Read the CSV/JSON file and import it.
| string | $filename | Location of the file. |
| string | $fileExtension | File extension (csv or json) |
Read file: <count> phrases on success. Definition at line 96 of file CustomTextImport.php.
|
private |
Handle JSON file import.
| string | $filename | Location of the JSON file. |
Definition at line 110 of file CustomTextImport.php.
| Fossology\Lib\Application\CustomTextImport::importJsonData | ( | $data, | |
| string & | $msg | ||
| ) |
Import JSON data directly.
| array | $data | Decoded JSON array |
| string | $msg | Populated with the result message |
Definition at line 469 of file CustomTextImport.php.
|
private |
Import phrases from data array.
| array | $data | Array of phrase data |
Definition at line 175 of file CustomTextImport.php.
|
private |
Import a single phrase.
| array | $phraseData | Phrase data |
Definition at line 206 of file CustomTextImport.php.
|
private |
Validate a license shortname before auto-creating it.
| string | $shortname | License shortname to validate |
Definition at line 443 of file CustomTextImport.php.
|
private |
Map CSV headers to standard field names.
| array | $data | Row data |
Definition at line 288 of file CustomTextImport.php.
|
private |
Normalize values from bulk text export format.
The bulk text export produces arrays (JSON) or pipe-separated strings (CSV) for acknowledgements and comments. This method joins them into single strings suitable for the custom_phrase table. It also restores literal '\n' escape sequences (produced by the bulk CSV exporter) back to real newlines in the text field.
| array | $mapped | Mapped data |
Definition at line 319 of file CustomTextImport.php.
|
private |
Parse boolean value from string.
| string | $value | String value |
Definition at line 347 of file CustomTextImport.php.
| Fossology\Lib\Application\CustomTextImport::setDelimiter | ( | $delimiter = ',' | ) |
Update the delimiter.
| string | $delimiter | New delimiter to use. |
Definition at line 75 of file CustomTextImport.php.
| Fossology\Lib\Application\CustomTextImport::setEnclosure | ( | $enclosure = '"' | ) |
Update the enclosure.
| string | $enclosure | New enclosure to use. |
Definition at line 84 of file CustomTextImport.php.
|
protected |
Alias for headers
Definition at line 48 of file CustomTextImport.php.
|
protected |
DB manager to use
Definition at line 31 of file CustomTextImport.php.
|
protected |
Delimiter used in CSV
Definition at line 39 of file CustomTextImport.php.
|
protected |
Enclosure used in CSV
Definition at line 42 of file CustomTextImport.php.
|
protected |
Header of CSV
Definition at line 45 of file CustomTextImport.php.
|
protected |
User DAO to use
Definition at line 34 of file CustomTextImport.php.