|
| 1 | +/* |
| 2 | + * Copyright Siemens AG, 2025. Part of the SW360 Portal Project. |
| 3 | + * Copyright Sandip Mandal<sandipmandal02.sm@gmail.com>, 2026. |
| 4 | + * This program and the accompanying materials are made |
| 5 | + * available under the terms of the Eclipse Public License 2.0 |
| 6 | + * which is available at https://www.eclipse.org/legal/epl-2.0/ |
| 7 | + * |
| 8 | + * SPDX-License-Identifier: EPL-2.0 |
| 9 | + */ |
| 10 | +package org.eclipse.sw360.rest.resourceserver.release; |
| 11 | + |
| 12 | +import com.fasterxml.jackson.annotation.JsonInclude; |
| 13 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 14 | + |
| 15 | +import java.util.List; |
| 16 | + |
| 17 | +/** |
| 18 | + * Data Transfer Object for FOSSology release information. |
| 19 | + * Reflects the three-step FOSSology workflow: upload → scan → report. |
| 20 | + */ |
| 21 | +@JsonInclude(JsonInclude.Include.NON_NULL) |
| 22 | +public class FossologyReleaseInfo { |
| 23 | + |
| 24 | + /** |
| 25 | + * Report formats supported by FOSSology, available once scanning is complete. |
| 26 | + */ |
| 27 | + public static final List<String> REPORT_FORMATS = List.of( |
| 28 | + "spdx2", "spdx2tv", "spdx3json", "spdx3rdf", "spdx3jsonld", |
| 29 | + "dep5", "readmeoss", "unifiedreport", "clixml", "cyclonedx" |
| 30 | + ); |
| 31 | + |
| 32 | + @JsonProperty("uploadId") |
| 33 | + private String uploadId; |
| 34 | + |
| 35 | + @JsonProperty("uploadStatus") |
| 36 | + private String uploadStatus; |
| 37 | + |
| 38 | + @JsonProperty("scanStatus") |
| 39 | + private String scanStatus; |
| 40 | + |
| 41 | + @JsonProperty("reportStatus") |
| 42 | + private String reportStatus; |
| 43 | + |
| 44 | + @JsonProperty("processStatus") |
| 45 | + private String processStatus; |
| 46 | + |
| 47 | + @JsonProperty("sourceAttachmentId") |
| 48 | + private String sourceAttachmentId; |
| 49 | + |
| 50 | + @JsonProperty("reportAttachmentId") |
| 51 | + private String reportAttachmentId; |
| 52 | + |
| 53 | + @JsonProperty("availableReportFormats") |
| 54 | + private List<String> availableReportFormats; |
| 55 | + |
| 56 | + @JsonProperty("lastUpdated") |
| 57 | + private String lastUpdated; |
| 58 | + |
| 59 | + public FossologyReleaseInfo() { |
| 60 | + } |
| 61 | + |
| 62 | + public String getUploadId() { return uploadId; } |
| 63 | + public void setUploadId(String uploadId) { this.uploadId = uploadId; } |
| 64 | + |
| 65 | + public String getUploadStatus() { return uploadStatus; } |
| 66 | + public void setUploadStatus(String uploadStatus) { this.uploadStatus = uploadStatus; } |
| 67 | + |
| 68 | + public String getScanStatus() { return scanStatus; } |
| 69 | + public void setScanStatus(String scanStatus) { this.scanStatus = scanStatus; } |
| 70 | + |
| 71 | + public String getReportStatus() { return reportStatus; } |
| 72 | + public void setReportStatus(String reportStatus) { this.reportStatus = reportStatus; } |
| 73 | + |
| 74 | + public String getProcessStatus() { return processStatus; } |
| 75 | + public void setProcessStatus(String processStatus) { this.processStatus = processStatus; } |
| 76 | + |
| 77 | + public String getSourceAttachmentId() { return sourceAttachmentId; } |
| 78 | + public void setSourceAttachmentId(String sourceAttachmentId) { this.sourceAttachmentId = sourceAttachmentId; } |
| 79 | + |
| 80 | + public String getReportAttachmentId() { return reportAttachmentId; } |
| 81 | + public void setReportAttachmentId(String reportAttachmentId) { this.reportAttachmentId = reportAttachmentId; } |
| 82 | + |
| 83 | + public List<String> getAvailableReportFormats() { return availableReportFormats; } |
| 84 | + public void setAvailableReportFormats(List<String> availableReportFormats) { this.availableReportFormats = availableReportFormats; } |
| 85 | + |
| 86 | + public String getLastUpdated() { return lastUpdated; } |
| 87 | + public void setLastUpdated(String lastUpdated) { this.lastUpdated = lastUpdated; } |
| 88 | + |
| 89 | + public static Builder builder() { |
| 90 | + return new Builder(); |
| 91 | + } |
| 92 | + |
| 93 | + public static class Builder { |
| 94 | + private String uploadId; |
| 95 | + private String uploadStatus; |
| 96 | + private String scanStatus; |
| 97 | + private String reportStatus; |
| 98 | + private String processStatus; |
| 99 | + private String sourceAttachmentId; |
| 100 | + private String reportAttachmentId; |
| 101 | + private List<String> availableReportFormats; |
| 102 | + private String lastUpdated; |
| 103 | + |
| 104 | + public Builder uploadId(String uploadId) { this.uploadId = uploadId; return this; } |
| 105 | + public Builder uploadStatus(String uploadStatus) { this.uploadStatus = uploadStatus; return this; } |
| 106 | + public Builder scanStatus(String scanStatus) { this.scanStatus = scanStatus; return this; } |
| 107 | + public Builder reportStatus(String reportStatus) { this.reportStatus = reportStatus; return this; } |
| 108 | + public Builder processStatus(String processStatus) { this.processStatus = processStatus; return this; } |
| 109 | + public Builder sourceAttachmentId(String sourceAttachmentId) { this.sourceAttachmentId = sourceAttachmentId; return this; } |
| 110 | + public Builder reportAttachmentId(String reportAttachmentId) { this.reportAttachmentId = reportAttachmentId; return this; } |
| 111 | + public Builder availableReportFormats(List<String> formats) { this.availableReportFormats = formats; return this; } |
| 112 | + public Builder lastUpdated(String lastUpdated) { this.lastUpdated = lastUpdated; return this; } |
| 113 | + |
| 114 | + public FossologyReleaseInfo build() { |
| 115 | + FossologyReleaseInfo info = new FossologyReleaseInfo(); |
| 116 | + info.setUploadId(uploadId); |
| 117 | + info.setUploadStatus(uploadStatus); |
| 118 | + info.setScanStatus(scanStatus); |
| 119 | + info.setReportStatus(reportStatus); |
| 120 | + info.setProcessStatus(processStatus); |
| 121 | + info.setSourceAttachmentId(sourceAttachmentId); |
| 122 | + info.setReportAttachmentId(reportAttachmentId); |
| 123 | + info.setAvailableReportFormats(availableReportFormats == null ? null : List.copyOf(availableReportFormats)); |
| 124 | + info.setLastUpdated(lastUpdated); |
| 125 | + return info; |
| 126 | + } |
| 127 | + } |
| 128 | + |
| 129 | + @Override |
| 130 | + public String toString() { |
| 131 | + return "FossologyReleaseInfo{" + |
| 132 | + "uploadId='" + uploadId + '\'' + |
| 133 | + ", uploadStatus='" + uploadStatus + '\'' + |
| 134 | + ", scanStatus='" + scanStatus + '\'' + |
| 135 | + ", reportStatus='" + reportStatus + '\'' + |
| 136 | + ", processStatus='" + processStatus + '\'' + |
| 137 | + '}'; |
| 138 | + } |
| 139 | +} |
0 commit comments