Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(obligation): endpoint to list license obligations from license db. #2276

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

rudra-superrr
Copy link
Contributor

@rudra-superrr rudra-superrr commented Jan 19, 2024

Issue: Closes #2275

Description: get license obligations for the project from license database.

Steps to test:

  • create a release and a project to which the release will be linked
  • add a CLX attachment to release, having status checked/accepted
  • in attachment usages of project enable the license info checkbox for the release(having attachment)
  • run the new endpoint to get the list of obligations from the license database

@rudra-superrr rudra-superrr added REST New-UI Level for the API and UI level changes for the new-ui labels Jan 19, 2024
@rudra-superrr rudra-superrr changed the title Endpoint to add license obligations from license database. Endpoint to list license obligations from license database. Jan 19, 2024
@rudra-superrr rudra-superrr added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for labels Jan 19, 2024
@smrutis1 smrutis1 self-requested a review January 25, 2024 05:45
@rudra-superrr rudra-superrr changed the title Endpoint to list license obligations from license database. feat(obligation): endpoint to list license obligations from license db. Jan 30, 2024
@rudra-superrr rudra-superrr force-pushed the feat/licenseDbObligations branch 3 times, most recently from 1b49027 to 699a910 Compare February 14, 2024 06:46
@keerthi-bl
Copy link
Contributor

Testing this PR

@keerthi-bl
Copy link
Contributor

Test Successfull.

image

@keerthi-bl
Copy link
Contributor

Test Successful.

@rudra-superrr rudra-superrr force-pushed the feat/licenseDbObligations branch 2 times, most recently from f34f4f8 to b858ae3 Compare March 7, 2024 08:34
@rudra-superrr rudra-superrr removed the needs general test This is general testing, meaning that there is no org specific issue to check for label Mar 7, 2024
@KoukiHama KoukiHama requested review from tienlee and hoangnt2 March 13, 2024 10:08
@KoukiHama
Copy link
Member

@tienlee @hoangnt2 coucld you review this PR?

@@ -19,6 +19,7 @@
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused import

@@ -49,6 +50,7 @@
import org.eclipse.sw360.datahandler.resourcelists.PaginationResult;
import org.eclipse.sw360.datahandler.resourcelists.ResourceClassNotFoundException;
import org.eclipse.sw360.datahandler.thrift.MainlineState;
import org.eclipse.sw360.datahandler.thrift.ObligationStatus;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import

@@ -72,6 +74,8 @@
import org.eclipse.sw360.datahandler.thrift.licenseinfo.OutputFormatInfo;
import org.eclipse.sw360.datahandler.thrift.licenseinfo.OutputFormatVariant;
import org.eclipse.sw360.datahandler.thrift.licenses.License;
import org.eclipse.sw360.datahandler.thrift.projects.ObligationList;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import

tags = {"Project"}
)
@RequestMapping(value = PROJECTS_URL + "/{id}/licenseDbObligations", method = RequestMethod.GET)
public ResponseEntity<?> getLicObligations(@RequestParam(defaultValue = "0") int page,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use Pageable instead of page and size?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tried with Pageable but finding some challenges, therefore switched to page and size for time being.

import org.eclipse.sw360.datahandler.thrift.components.Release;
import org.eclipse.sw360.datahandler.thrift.components.ReleaseClearingStatusData;
import org.eclipse.sw360.datahandler.thrift.components.ReleaseLink;
import org.eclipse.sw360.datahandler.thrift.licenseinfo.LicenseInfoParsingResult;
import org.eclipse.sw360.datahandler.thrift.licenseinfo.LicenseInfoService;
import org.eclipse.sw360.datahandler.thrift.licenseinfo.LicenseObligationsStatusInfo;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused import

import org.eclipse.sw360.datahandler.thrift.projects.Project;
import org.eclipse.sw360.datahandler.thrift.projects.ProjectClearingState;
import org.eclipse.sw360.datahandler.thrift.projects.ProjectData;
import org.eclipse.sw360.datahandler.thrift.projects.ProjectLink;
import org.eclipse.sw360.datahandler.common.ThriftEnumUtils;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused import

import javax.annotation.PreDestroy;

import java.io.IOException;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused import

@@ -57,14 +70,22 @@
import org.springframework.security.access.AccessDeniedException;
import org.springframework.stereotype.Service;

import com.google.common.collect.Lists;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused import

@@ -57,14 +70,22 @@
import org.springframework.security.access.AccessDeniedException;
import org.springframework.stereotype.Service;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused import

@@ -134,6 +157,183 @@ public String getCyclicLinkedProjectPath(Project project, User user) throws TExc
return cyclicLinkedProjectPath;
}

public Map<String, Set<Release>> getLicensesFromAttachmentUsage(
Map<String, AttachmentUsage> licenseInfoAttachmentUsage,
Map<String, ProjectReleaseRelationship> releaseIdToUsage, User user) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused param releaseIdToUsage

@rudra-superrr rudra-superrr force-pushed the feat/licenseDbObligations branch from b858ae3 to 68426de Compare March 14, 2024 05:13
Signed-off-by: Rudra Chopra <prabhuchopra@gmail.com>
@rudra-superrr rudra-superrr force-pushed the feat/licenseDbObligations branch from 68426de to 5fcb353 Compare March 14, 2024 05:31
@rudra-superrr
Copy link
Contributor Author

Review comments addressed.
Sorry for these unused imports as these imports were used by either of the obligation PRs and I forgot to remove them.

@hoangnt2
Copy link
Contributor

Code look good to me

@rudra-superrr rudra-superrr added the ready ready to merge label Mar 14, 2024
@ag4ums ag4ums merged commit 2da903b into eclipse-sw360:main Mar 15, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New-UI Level for the API and UI level changes for the new-ui ready ready to merge REST
Projects
None yet
Development

Successfully merging this pull request may close these issues.

List license obligations from licenseDatabase
5 participants