Skip to content

Commit

Permalink
feat(fossid-webapp): Support for comments in marked as identified files
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
nnobelis authored and MarcelBochtler committed Sep 25, 2023
1 parent 12d2bde commit 0705ede
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (C) 2023 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
* License-Filename: LICENSE
*/

package org.ossreviewtoolkit.clients.fossid.model.identification.markedAsIdentified

data class Comment(val id: Int, val identificationId: Int, val comment: String)
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import org.ossreviewtoolkit.clients.fossid.model.summary.SummaryIdentifiedFile

data class MarkedAsIdentifiedFile(
val comment: String?,
val comments: Map<Int, Comment> = emptyMap(),

val identificationId: Int,

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"response" : {
"status" : 200,
"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 }}}}",
"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\" } } } }}",
"headers" : {
"Content-Type" : "text/html; charset=UTF-8",
"Date" : "Thu, 03 Dec 2020 08:04:04 GMT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ private fun createMarkAsIdentifiedFile(license: String): MarkedAsIdentifiedFile

return MarkedAsIdentifiedFile(
"comment",
emptyMap(),
1,
"copyright",
1,
Expand Down

0 comments on commit 0705ede

Please sign in to comment.