9 namespace Fossology\Lib\Report;
23 public function __construct()
27 $this->clearingDao = $container->get(
'dao.clearing');
28 $this->licenseDao = $container->get(
'dao.license');
30 parent::__construct($groupBy =
'text');
33 protected function getStatements($uploadId, $uploadTreeTableName, $groupId =
null)
35 $dbManager = $GLOBALS[
'container']->get(
'db.manager');
36 $licenseMap =
new LicenseMap($dbManager, $groupId, LicenseMap::REPORT,
true);
37 $mainLicIds = $this->clearingDao->getMainLicenseIds($uploadId, $groupId);
39 $allStatements = array();
40 foreach ($mainLicIds as $originLicenseId) {
41 $allLicenseCols = $this->licenseDao->getLicenseById($originLicenseId, $groupId);
43 if ($allLicenseCols ===
null) {
44 error_log(
"Error: License ID " . $originLicenseId .
" not found in the database.");
47 $allStatements[] = array(
48 'licenseId' => $originLicenseId,
49 'risk' => $allLicenseCols->getRisk(),
50 'content' => $licenseMap->getProjectedSpdxId($originLicenseId),
51 'text' => $allLicenseCols->getText(),
52 'name' => $licenseMap->getProjectedShortname($originLicenseId, $allLicenseCols->getShortName())
55 return $allStatements;
58 public function getCleared($uploadId, $objectAgent, $groupId=
null, $extended=
true, $agentcall=
null, $isUnifiedReport=
false)
60 $uploadTreeTableName = $this->uploadDao->getUploadtreeTableName($uploadId);
61 $statements = $this->
getStatements($uploadId, $uploadTreeTableName, $groupId);
63 for ($i=0; $i<=count($statements); $i++) {
64 unset($statements[$i][
'risk']);
65 unset($statements[$i][
'licenseId']);
68 return array(
"statements" => array_values($statements));
Wrapper class for license map.
getStatements($uploadId, $uploadTreeTableName, $groupId=null)