10 namespace Fossology\Lib\Dao;
36 $this->logger = $logger;
48 $statement = __METHOD__.
".AddingNewRevision";
50 $keys =
"spasht_type,spasht_provider,spasht_namespace,spasht_name," .
51 "spasht_revision,upload_fk";
54 $coordinate->getType(),
55 $coordinate->getProvider(),
56 $coordinate->getNamespace(),
57 $coordinate->getName(),
58 $coordinate->getRevision(),
62 return $this->
dbManager->insertInto(
"spasht", $keys, $params, $statement,
76 "spasht_type" => $coordinate->getType(),
77 "spasht_provider" => $coordinate->getProvider(),
78 "spasht_namespace" => $coordinate->getNamespace(),
79 "spasht_name" => $coordinate->getName(),
80 "spasht_revision" => $coordinate->getRevision()
83 $tableName =
"spasht";
84 $primaryColumn =
'upload_fk';
86 $this->
dbManager->updateTableRow($tableName, $assocParams, $primaryColumn,
87 $uploadID, __METHOD__ .
".updateCoordinates");
98 $statement = __METHOD__.
".CheckUpload";
100 $params = [ $uploadID ];
102 $sql =
"SELECT * FROM spasht ".
103 "WHERE upload_fk = $1";
105 $row = $this->
dbManager->getSingleRow($sql, $params, $statement);
119 $statement = __METHOD__.
".CheckUpload";
121 $params = [ $uploadID ];
123 $sql =
"SELECT * FROM spasht_ars ".
124 "WHERE upload_fk = $1 ORDER BY ars_pk DESC;";
126 $row = $this->
dbManager->getSingleRow($sql, $params, $statement);
139 $itemTable = $item->getUploadTreeTableName();
140 $stmt = __METHOD__ .
"$itemTable";
141 $params = array($hash, $item->getLeft(), $item->getRight());
143 if ($action ==
"delete") {
144 $setSql =
"is_enabled='false'";
146 }
else if ($action ==
"rollback") {
147 $setSql =
"is_enabled='true'";
148 $stmt .=
'.rollback';
150 $setSql =
"textfinding = $4, hash = md5($4), is_enabled='true'";
154 $sql =
"UPDATE copyright_spasht AS cpr SET $setSql
155 FROM copyright_spasht as cp
156 INNER JOIN $itemTable AS ut ON cp.pfile_fk = ut.pfile_fk
157 WHERE cpr.copyright_spasht_pk = cp.copyright_spasht_pk
159 AND ( ut.lft BETWEEN $2 AND $3 )";
160 if (
'uploadtree_a' == $item->getUploadTreeTableName()) {
161 $params[] = $item->getUploadId();
162 $sql .=
" AND ut.upload_fk=$".count($params);
165 $this->
dbManager->getSingleRow($sql, $params, $stmt);
176 'type' => $row[
'spasht_type'],
177 'provider' => $row[
'spasht_provider'],
178 'namespace' => $row[
'spasht_namespace'],
179 'name' => $row[
'spasht_name'],
180 'revision' => $row[
'spasht_revision']
199 $sql =
"SELECT ri_component_type, ri_component_id " .
200 "FROM report_info WHERE upload_fk = $1;";
201 $compRow = $this->
dbManager->getSingleRow($sql, [$uploadId]);
203 empty($compRow) || empty($compRow[
'ri_component_id'])
204 || $compRow[
'ri_component_id'] ==
"NA"
212 $componentId = $compRow[
'ri_component_id'];
214 if ($purl[
"scheme"] !=
"pkg") {
218 "type" => $purl[
"type"],
219 "provider" => $purl[
"type"],
220 "namespace" => $purl[
"namespace"],
221 "name" => $purl[
"name"],
222 "revision" => $purl[
"version"]
alterComponentRevision($coordinate, $uploadID)
__construct(DbManager $dbManager, Logger $logger)
addComponentRevision($coordinate, $uploadID)
updateCopyright($item, $hash, $content, $action='')
getCoordinateFromCompId($uploadId)
Get ClearlyDefined Coordinate if component id is a pURL.
static fromString($input)
static replaceUnicodeControlChar($input, $replace="")
fo_dbManager * dbManager
fo_dbManager object