Skip to content

Commit 0705ede

Browse files
nnobelisMarcelBochtler
authored andcommitted
feat(fossid-webapp): Support for comments in marked as identified files
The `comment` property of a file which is marked as identified seems to have been replaced my a new property `comments` in newer versions of FossID. Since both properties are optional, they can be both present in the model to maintain backward compatibility. It was not possible to identify which version of FossID introduced this change. Signed-off-by: Nicolas Nobelis <[email protected]>
1 parent 12d2bde commit 0705ede

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright (C) 2023 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* SPDX-License-Identifier: Apache-2.0
17+
* License-Filename: LICENSE
18+
*/
19+
20+
package org.ossreviewtoolkit.clients.fossid.model.identification.markedAsIdentified
21+
22+
data class Comment(val id: Int, val identificationId: Int, val comment: String)

clients/fossid-webapp/src/main/kotlin/model/identification/markedAsIdentified/MarkedAsIdentifiedFile.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import org.ossreviewtoolkit.clients.fossid.model.summary.SummaryIdentifiedFile
2828

2929
data class MarkedAsIdentifiedFile(
3030
val comment: String?,
31+
val comments: Map<Int, Comment> = emptyMap(),
3132

3233
val identificationId: Int,
3334

clients/fossid-webapp/src/test/assets/return-type/mappings/apiphp-list_marked_as_identified_files_not_empty.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"response" : {
1414
"status" : 200,
15-
"body" : "{\"operation\":\"get_marked_as_identified_files\",\"status\":\"1\",\"data\":{\"2\": {\n \"row_id\": \"2\",\n \"file_path\": \"src\\/FileWithoutLicense.java\",\n \"file_id\": \"754803\",\n \"is_distributed\": \"1\",\n \"file_md5\": \"f6ed9e5e51888ca574a987536c9f422b\",\n \"file_sha1\": \"fcf5a18336476cdd9248a4a4fb19f5bd623fbc22\",\n \"file_sha256\": \"cb75d8a36aed92b6ebbb57e7c7ff0bb8777254594ac036ee707df164d27bef9d\",\n \"file_size\": \"1587\",\n \"identification_id\": \"1309401\",\n \"identification_copyright\": \"\",\n \"component_id\": null,\n \"component_name\": null,\n \"component_version\": null,\n \"component_copyright\": null,\n \"component_cpe\": null,\n \"component_license_name\": null,\n \"component_license_identifier\": null,\n \"component_license_is_foss\": null,\n \"component_license_is_spdx_standard\": null,\n \"component_include_in_report\": null,\n \"component_is_copyleft\": null,\n \"comment\": null\n }}}}",
15+
"body" : "{ \"operation\": \"get_marked_as_identified_files\", \"status\": \"1\", \"data\": { \"2\": { \"row_id\": \"2\", \"file_path\": \"src\\/FileWithoutLicense.java\", \"file_id\": \"754803\", \"is_distributed\": \"1\", \"file_md5\": \"f6ed9e5e51888ca574a987536c9f422b\", \"file_sha1\": \"fcf5a18336476cdd9248a4a4fb19f5bd623fbc22\", \"file_sha256\": \"cb75d8a36aed92b6ebbb57e7c7ff0bb8777254594ac036ee707df164d27bef9d\", \"file_size\": \"1587\", \"identification_id\": \"1309401\", \"identification_copyright\": \"\", \"component_id\": null, \"component_name\": null, \"component_version\": null, \"component_copyright\": null, \"component_cpe\": null, \"component_license_name\": null, \"component_license_identifier\": null, \"component_license_is_foss\": null, \"component_license_is_spdx_standard\": null, \"component_include_in_report\": null, \"component_is_copyleft\": null, \"comment\": null,\n \"comments\": { \"243909\": { \"id\": 243909, \"identification_id\": 10397697, \"comment\": \"Test Nino\" }, \"243910\": { \"id\": 243910, \"identification_id\": 10397697, \"comment\": \"TestORT\" } } } }}",
1616
"headers" : {
1717
"Content-Type" : "text/html; charset=UTF-8",
1818
"Date" : "Thu, 03 Dec 2020 08:04:04 GMT",

plugins/scanners/fossid/src/test/kotlin/FossIdLicenseMappingTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ private fun createMarkAsIdentifiedFile(license: String): MarkedAsIdentifiedFile
133133

134134
return MarkedAsIdentifiedFile(
135135
"comment",
136+
emptyMap(),
136137
1,
137138
"copyright",
138139
1,

0 commit comments

Comments
 (0)