Skip to content

Commit

Permalink
feat(SPDX): Use new SPDX library (#1496) and release pages for showin…
Browse files Browse the repository at this point in the history
…g SPDX/SPDX Lite data (#1240)

Signed-off-by: tuan99123 <tuan2.nguyennhu@toshiba.co.jp>
  • Loading branch information
tuannn2 committed Apr 12, 2022
1 parent 05f3130 commit 034daf4
Show file tree
Hide file tree
Showing 133 changed files with 13,917 additions and 268 deletions.
13 changes: 13 additions & 0 deletions backend/src-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,24 @@
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.spdx</groupId>
<artifactId>spdx-tools</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.spdx</groupId>
<artifactId>tools-java</artifactId>
<version>1.0.2</version>
<scope>compile</scope>
</dependency>
<!-- Needed by spdx-tools -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright TOSHIBA CORPORATION, 2021. Part of the SW360 Portal Project.
* Copyright Toshiba Software Development (Vietnam) Co., Ltd., 2021. Part of the SW360 Portal Project.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.sw360.components.summary;

import org.eclipse.sw360.datahandler.thrift.spdx.documentcreationinformation.*;

import static org.eclipse.sw360.datahandler.thrift.ThriftUtils.copyField;

/**
* Created by HieuPV on 22/07/21.
*
* @author hieu1.phamvan@toshiba.co.jp
*/
public class DocumentCreationInformationSummary extends DocumentSummary<DocumentCreationInformation> {

@Override
protected DocumentCreationInformation summary(SummaryType type, DocumentCreationInformation document) {
// Copy required details
DocumentCreationInformation copy = new DocumentCreationInformation();

switch (type) {
case SUMMARY:
copyField(document, copy, DocumentCreationInformation._Fields.ID);
copyField(document, copy, DocumentCreationInformation._Fields.SPDXID);
copyField(document, copy, DocumentCreationInformation._Fields.NAME);
break;
default:
break;
}

return copy;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright TOSHIBA CORPORATION, 2021. Part of the SW360 Portal Project.
* Copyright Toshiba Software Development (Vietnam) Co., Ltd., 2021. Part of the SW360 Portal Project.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.sw360.components.summary;

import org.eclipse.sw360.datahandler.thrift.spdx.fileinformation.*;

import static org.eclipse.sw360.datahandler.thrift.ThriftUtils.copyField;

/**
* Created by HieuPV on 22/07/21.
*
* @author hieu1.phamvan@toshiba.co.jp
*/
public class FileInformationSummary extends DocumentSummary<FileInformation> {

@Override
protected FileInformation summary(SummaryType type, FileInformation document) {
// Copy required details
FileInformation copy = new FileInformation();

switch (type) {
case SUMMARY:
copyField(document, copy, FileInformation._Fields.ID);
copyField(document, copy, FileInformation._Fields.SPDXID);
copyField(document, copy, FileInformation._Fields.FILE_NAME);
break;
default:
break;
}

return copy;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright TOSHIBA CORPORATION, 2021. Part of the SW360 Portal Project.
* Copyright Toshiba Software Development (Vietnam) Co., Ltd., 2021. Part of the SW360 Portal Project.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.sw360.components.summary;

import org.eclipse.sw360.datahandler.thrift.spdx.spdxpackageinfo.*;

import static org.eclipse.sw360.datahandler.thrift.ThriftUtils.copyField;

/**
* Created by HieuPV on 22/07/21.
*
* @author hieu1.phamvan@toshiba.co.jp
*/
public class PackageInformationSummary extends DocumentSummary<PackageInformation> {

@Override
protected PackageInformation summary(SummaryType type, PackageInformation document) {
// Copy required details
PackageInformation copy = new PackageInformation();

switch (type) {
case SUMMARY:
copyField(document, copy, PackageInformation._Fields.ID);
copyField(document, copy, PackageInformation._Fields.SPDXID);
copyField(document, copy, PackageInformation._Fields.NAME);
break;
default:
break;
}

return copy;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright TOSHIBA CORPORATION, 2021. Part of the SW360 Portal Project.
* Copyright Toshiba Software Development (Vietnam) Co., Ltd., 2021. Part of the SW360 Portal Project.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.sw360.components.summary;

import org.eclipse.sw360.datahandler.thrift.spdx.spdxdocument.SPDXDocument;

import static org.eclipse.sw360.datahandler.thrift.ThriftUtils.copyField;

/**
* Created by HieuPV on 22/07/21.
*
* @author hieu1.phamvan@toshiba.co.jp
*/
public class SpdxDocumentSummary extends DocumentSummary<SPDXDocument> {

@Override
protected SPDXDocument summary(SummaryType type, SPDXDocument document) {
// Copy required details
SPDXDocument copy = new SPDXDocument();

switch (type) {
case SUMMARY:
copyField(document, copy, SPDXDocument._Fields.ID);
copyField(document, copy, SPDXDocument._Fields.SPDX_DOCUMENT_CREATION_INFO_ID);
copyField(document, copy, SPDXDocument._Fields.SPDX_PACKAGE_INFO_IDS);
copyField(document, copy, SPDXDocument._Fields.SPDX_FILE_INFO_IDS);
default:
break;
}

return copy;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public List<ChangeLogs> getChangeLogsByDocumentId(User user, String docId) {
changeLogsByDocId = changeLogsByDocId.stream().filter(Objects::nonNull).filter(changeLog -> isNotEmptyChangeLog(changeLog))
.collect(Collectors.toList());
Collections.sort(changeLogsByDocId, Comparator.comparing(ChangeLogs::getChangeTimestamp).reversed());
changeLogsByDocId.stream().forEach(cl -> cl.setChangeTimestamp(cl.getChangeTimestamp().split(" ")[0]));
return changeLogsByDocId;
}

Expand Down
Loading

0 comments on commit 034daf4

Please sign in to comment.