14 namespace Fossology\DecisionImporter;
25 private $uploadtreeList;
28 private $clearing_decisionList;
31 private $clearing_eventList;
34 private $clearing_decision_eventList;
37 private $license_ref_bulkList;
40 private $license_set_bulkList;
43 private $highlight_bulk;
46 private $copyrightList;
49 private $copyright_decisionList;
52 private $copyright_eventList;
58 private $ecc_decisionList;
61 private $ecc_eventList;
67 private $ipra_decisionList;
70 private $ipra_eventList;
76 private $licensesList;
79 private $mainLicenseList;
81 private function __construct()
92 $decisionData =
new self();
93 $data = json_decode(file_get_contents($path),
true);
94 $decisionData->insertPfileList($data[
'pfile'])
95 ->insertUploadtreeList($data[
'uploadtree'])
96 ->insertClearingDecisionList($data[
'clearing_decision'])
97 ->insertClearingEventList($data[
'clearing_event'])
98 ->insertClearingDecisionEventList($data[
'clearing_decision_event'])
99 ->insertLicenseRefBulk($data[
'license_ref_bulk'])
100 ->insertLicenseSetBulk($data[
'license_set_bulk'])
101 ->insertHighlightBulk($data[
'highlight_bulk'])
102 ->insertCopyrightList($data[
'copyright'])
103 ->insertCopyrightDecisionList($data[
'copyright_decision'])
104 ->insertCopyrightEventList($data[
'copyright_event'])
105 ->insertEccList($data[
'ecc'])
106 ->insertEccDecisionList($data[
'ecc_decision'])
107 ->insertEccEventList($data[
'ecc_event'])
108 ->insertIpraList($data[
'ipra'])
109 ->insertIpraDecisionList($data[
'ipra_decision'])
110 ->insertIpraEventList($data[
'ipra_event'])
111 ->insertReportInfo($data[
'report_info'])
112 ->insertLicensesList($data[
'licenses'])
113 ->insertMainListList($data[
'upload_clearing_license']);
114 return $decisionData;
123 $this->mainLicenseList = [];
124 foreach ($mainLicenseList as $mainLicenseItem) {
125 $this->mainLicenseList[$mainLicenseItem] = [
126 "old_rfid" => $mainLicenseItem
138 $this->licensesList = [];
139 foreach ($licensesList as $licenseItem) {
140 $this->licensesList[$licenseItem[
'rf_pk']] = $licenseItem;
151 $this->report_info = $report_info;
161 $this->ipra_eventList = [];
162 foreach ($ipra_eventList as $ipraEventItem) {
163 $this->ipra_eventList[] = $this->
createEventItem($ipraEventItem,
"ipra");
176 "old_cpid" => $eventItemData[$agentName .
'_fk'],
177 "old_itemid" => $eventItemData[
'uploadtree_fk'],
178 "content" => $eventItemData[
'content'],
179 "hash" => $eventItemData[
'hash'],
180 "is_enabled" => $eventItemData[
'is_enabled'],
181 "scope" => $eventItemData[
'scope'],
191 $this->ipra_decisionList = [];
192 foreach ($ipra_decisionList as $ipraDecisionItem) {
193 $this->ipra_decisionList[$ipraDecisionItem[
'ipra_decision_pk']] =
206 "old_pfile" => $decisionItemData[
'pfile_fk'],
207 "clearing_decision_type_fk" => $decisionItemData[
'clearing_decision_type_fk'],
208 "description" => $decisionItemData[
'description'],
209 "textfinding" => $decisionItemData[
'textfinding'],
210 "hash" => $decisionItemData[
'hash'],
211 "comment" => $decisionItemData[
'comment'],
221 $this->ipraList = [];
222 foreach ($ipraList as $ipraItem) {
223 $this->ipraList[$ipraItem[
'ipra_pk']] = $this->
createCxItem($ipraItem);
235 "old_pfile" => $cxItemData[
'pfile_fk'],
236 "content" => $cxItemData[
'content'],
237 "hash" => $cxItemData[
'hash'],
238 "copy_startbyte" => $cxItemData[
'copy_startbyte'],
239 "copy_endbyte" => $cxItemData[
'copy_endbyte'],
249 $this->ecc_eventList = [];
250 foreach ($ecc_eventList as $eccEventItem) {
262 $this->ecc_decisionList = [];
263 foreach ($ecc_decisionList as $eccDecisionItem) {
264 $this->ecc_decisionList[$eccDecisionItem[
'ecc_decision_pk']] = $this->
createDecisionItem($eccDecisionItem);
276 foreach ($eccList as $eccItem) {
277 $this->eccList[$eccItem[
'ecc_pk']] = $this->
createCxItem($eccItem);
288 $this->copyright_eventList = [];
289 foreach ($copyright_eventList as $copyrightEventItem) {
290 $this->copyright_eventList[] = $this->
createEventItem($copyrightEventItem,
"copyright");
301 $this->copyright_decisionList = [];
302 foreach ($copyright_decisionList as $copyrightDecisionItem) {
303 $this->copyright_decisionList[$copyrightDecisionItem[
'copyright_decision_pk']] =
315 $this->copyrightList = [];
316 foreach ($copyrightList as $copyrightItem) {
317 $this->copyrightList[$copyrightItem[
'copyright_pk']] = $this->
createCxItem($copyrightItem);
328 $this->highlight_bulk = [];
329 foreach ($highlightBulkList as $highlightBulkItem) {
330 $this->highlight_bulk[] = [
331 "old_ceid" => $highlightBulkItem[
'clearing_event_fk'],
332 "old_lrbid" => $highlightBulkItem[
'lrb_fk'],
333 "start" => $highlightBulkItem[
'start'],
334 "len" => $highlightBulkItem[
'len'],
346 $this->license_set_bulkList = [];
347 foreach ($licenseSetBulkList as $licenseSetBulkItem) {
348 if (!array_key_exists($licenseSetBulkItem[
"lrb_fk"], $this->license_set_bulkList)) {
349 $this->license_set_bulkList[$licenseSetBulkItem[
"lrb_fk"]] = [];
351 $this->license_set_bulkList[$licenseSetBulkItem[
"lrb_fk"]][] = [
352 "old_rfid" => $licenseSetBulkItem[
'rf_fk'],
353 "removing" => $licenseSetBulkItem[
'removing'] ==
"t",
354 "comment" => $licenseSetBulkItem[
'comment'],
355 "reportinfo" => $licenseSetBulkItem[
'reportinfo'],
356 "acknowledgement" => $licenseSetBulkItem[
'acknowledgement'],
368 $this->license_ref_bulkList = [];
369 foreach ($licenseRefBulkList as $licenseRefBulkItem) {
370 $this->license_ref_bulkList[$licenseRefBulkItem[
"lrb_pk"]] = [
371 "rf_text" => $licenseRefBulkItem[
'rf_text'],
372 "old_itemid" => $licenseRefBulkItem[
'uploadtree_fk'],
373 "ignore_irrelevant" => $licenseRefBulkItem[
'ignore_irrelevant'] ==
"t",
374 "bulk_delimiters" => $licenseRefBulkItem[
'bulk_delimiters'],
375 "scan_findings" => $licenseRefBulkItem[
'scan_findings'],
387 $this->clearing_decision_eventList = [];
388 foreach ($clearing_decision_eventList as $clearingDecisionEventItem) {
389 if (!array_key_exists($clearingDecisionEventItem[
'clearing_decision_fk'], $this->clearing_decision_eventList)) {
390 $this->clearing_decision_eventList[$clearingDecisionEventItem[
'clearing_decision_fk']] = [];
392 $this->clearing_decision_eventList[$clearingDecisionEventItem[
'clearing_decision_fk']][] =
393 $clearingDecisionEventItem[
'clearing_event_fk'];
404 $this->clearing_eventList = [];
405 foreach ($clearing_eventList as $clearingEventItem) {
406 $this->clearing_eventList[$clearingEventItem[
'clearing_event_pk']] = [
407 "old_itemid" => $clearingEventItem[
'uploadtree_fk'],
408 "old_rfid" => $clearingEventItem[
'rf_fk'],
409 "removed" => $clearingEventItem[
'removed'],
410 "old_lrbid" => $clearingEventItem[
'lrb_pk'],
411 "type_fk" => $clearingEventItem[
'type_fk'],
412 "comment" => $clearingEventItem[
'comment'],
413 "reportinfo" => $clearingEventItem[
'reportinfo'],
414 "acknowledgement" => $clearingEventItem[
'acknowledgement'],
415 "date_added" => $clearingEventItem[
'date_added'],
427 $this->clearing_decisionList = [];
428 foreach ($clearing_decisionList as $clearingDecisionItem) {
429 $this->clearing_decisionList[$clearingDecisionItem[
'clearing_decision_pk']] = [
430 "old_itemid" => $clearingDecisionItem[
'uploadtree_fk'],
431 "old_pfile" => $clearingDecisionItem[
'pfile_fk'],
432 "decision_type" => $clearingDecisionItem[
'decision_type'],
433 "scope" => $clearingDecisionItem[
'scope'],
434 "date_added" => $clearingDecisionItem[
'date_added'],
446 $this->uploadtreeList = [];
447 foreach ($uploadtreeList as $uploadTreeItem) {
448 $this->uploadtreeList[$uploadTreeItem[
'uploadtree_pk']] = [
449 "old_pfile" => $uploadTreeItem[
'pfile_fk'],
450 "lft" => $uploadTreeItem[
'lft'],
451 "rgt" => $uploadTreeItem[
'rgt'],
452 "path" => array_key_exists(
"path", $uploadTreeItem) ? $uploadTreeItem[
"path"] :
""
464 $this->pfileList = [];
465 foreach ($pfileList as $oldId => $hash) {
466 $this->pfileList[$oldId] = [
"hash" => $hash];
476 return $this->mainLicenseList;
485 $this->mainLicenseList = $mainLicenseList;
494 return $this->highlight_bulk;
503 $this->highlight_bulk = $highlight_bulk;
512 return $this->pfileList;
521 $this->pfileList = $pfileList;
530 return $this->uploadtreeList;
539 $this->uploadtreeList = $uploadtreeList;
548 return $this->clearing_decisionList;
557 $this->clearing_decisionList = $clearing_decisionList;
566 return $this->clearing_eventList;
575 $this->clearing_eventList = $clearing_eventList;
584 return $this->clearing_decision_eventList;
593 $this->clearing_decision_eventList = $clearing_decision_eventList;
602 return $this->license_ref_bulkList;
611 $this->license_ref_bulkList = $license_ref_bulkList;
620 return $this->license_set_bulkList;
629 $this->license_set_bulkList = $license_set_bulkList;
638 return $this->copyrightList;
647 $this->copyrightList = $copyrightList;
656 return $this->copyright_decisionList;
665 $this->copyright_decisionList = $copyright_decisionList;
674 return $this->copyright_eventList;
683 $this->copyright_eventList = $copyright_eventList;
692 return $this->eccList;
701 $this->eccList = $eccList;
710 return $this->ecc_decisionList;
719 $this->ecc_decisionList = $ecc_decisionList;
728 return $this->ecc_eventList;
737 $this->ecc_eventList = $ecc_eventList;
746 return $this->ipraList;
755 $this->ipraList = $ipraList;
764 return $this->ipra_decisionList;
773 $this->ipra_decisionList = $ipra_decisionList;
782 return $this->ipra_eventList;
791 $this->ipra_eventList = $ipra_eventList;
800 return $this->report_info;
809 $this->report_info = $report_info;
818 return $this->licensesList;
827 $this->licensesList = $licensesList;
insertEccDecisionList(array $ecc_decisionList)
insertMainListList(array $mainLicenseList)
createDecisionItem(array $decisionItemData)
setLicenseSetBulkList(array $license_set_bulkList)
setEccList(array $eccList)
insertIpraDecisionList(array $ipra_decisionList)
setPfileList(array $pfileList)
insertClearingDecisionList(array $clearing_decisionList)
setMainLicenseList(array $mainLicenseList)
setLicenseRefBulkList(array $license_ref_bulkList)
insertCopyrightEventList(array $copyright_eventList)
setEccEventList(array $ecc_eventList)
setClearingDecisionList(array $clearing_decisionList)
setUploadtreeList(array $uploadtreeList)
setEccDecisionList(array $ecc_decisionList)
insertEccList(array $eccList)
setReportInfo(array $report_info)
insertIpraEventList(array $ipra_eventList)
insertUploadtreeList(array $uploadtreeList)
getClearingDecisionEventList()
setIpraList(array $ipraList)
setHighlightBulk(array $highlight_bulk)
setIpraDecisionList(array $ipra_decisionList)
insertCopyrightList(array $copyrightList)
static createFromFile(string $path)
getCopyrightDecisionList()
setCopyrightEventList(array $copyright_eventList)
insertReportInfo(array $report_info)
setLicensesList(array $licensesList)
insertClearingDecisionEventList(array $clearing_decision_eventList)
insertLicenseSetBulk(array $licenseSetBulkList)
setCopyrightList(array $copyrightList)
insertEccEventList(array $ecc_eventList)
setCopyrightDecisionList(array $copyright_decisionList)
insertPfileList(array $pfileList)
setClearingDecisionEventList(array $clearing_decision_eventList)
createCxItem(array $cxItemData)
insertClearingEventList(array $clearing_eventList)
insertLicensesList(array $licensesList)
insertLicenseRefBulk(array $licenseRefBulkList)
createEventItem(array $eventItemData, string $agentName)
insertHighlightBulk(array $highlightBulkList)
getClearingDecisionList()
setClearingEventList(array $clearing_eventList)
setIpraEventList(array $ipra_eventList)
insertIpraList(array $ipraList)
insertCopyrightDecisionList(array $copyright_decisionList)