Package com.lpvs.service
Class LPVSGitHubService
java.lang.Object
com.lpvs.service.LPVSGitHubService
Service class for interacting with GitHub repositories and managing license-related actions.
-
Constructor Summary
ConstructorsConstructorDescriptionLPVSGitHubService
(LPVSPullRequestRepository pullRequestRepository, LPVSDetectedLicenseRepository lpvsDetectedLicenseRepository, LPVSLicenseRepository lpvsLicenseRepository, LPVSLicenseConflictRepository lpvsLicenseConflictRepository, LPVSGitHubConnectionService gitHubConnectionService) Constructs an instance of LPVSGitHubService with the specified repositories and connection service. -
Method Summary
Modifier and TypeMethodDescriptionvoid
commentResults
(LPVSQueue webhookConfig, List<LPVSFile> scanResults, List<LPVSLicenseService.Conflict<String, String>> conflicts, LPVSPullRequest lpvsPullRequest) Comments on the pull request with the scan results and detected issues.getInternalQueueByPullRequest
(String pullRequest) Retrieves the LPVSQueue configuration for a given GitHub pull request URL.getPullRequestFiles
(LPVSQueue webhookConfig) Retrieves the file differences for a given pull request from GitHub.getRepositoryLicense
(LPVSQueue webhookConfig) Retrieves the license of the GitHub repository associated with the pull request.void
setErrorCheck
(LPVSQueue webhookConfig) Sets the commit status to error for the specified pull request.void
setPendingCheck
(LPVSQueue webhookConfig) Sets the commit status to pending for the specified pull request.
-
Constructor Details
-
LPVSGitHubService
@Autowired public LPVSGitHubService(LPVSPullRequestRepository pullRequestRepository, LPVSDetectedLicenseRepository lpvsDetectedLicenseRepository, LPVSLicenseRepository lpvsLicenseRepository, LPVSLicenseConflictRepository lpvsLicenseConflictRepository, LPVSGitHubConnectionService gitHubConnectionService) Constructs an instance of LPVSGitHubService with the specified repositories and connection service.- Parameters:
pullRequestRepository
- Repository for managing LPVS pull requests.lpvsDetectedLicenseRepository
- Repository for managing detected licenses.lpvsLicenseRepository
- Repository for managing licenses.lpvsLicenseConflictRepository
- Repository for managing license conflicts.gitHubConnectionService
- Service for establishing and managing connections to the GitHub API.
-
-
Method Details
-
getPullRequestFiles
Retrieves the file differences for a given pull request from GitHub.- Parameters:
webhookConfig
- LPVSQueue configuration for the pull request.- Returns:
- String representation of the pull request files or null if an error occurs.
-
setPendingCheck
Sets the commit status to pending for the specified pull request.- Parameters:
webhookConfig
- LPVSQueue configuration for the pull request.
-
setErrorCheck
Sets the commit status to error for the specified pull request.- Parameters:
webhookConfig
- LPVSQueue configuration for the pull request.
-
commentResults
public void commentResults(LPVSQueue webhookConfig, List<LPVSFile> scanResults, List<LPVSLicenseService.Conflict<String, String>> conflicts, LPVSPullRequest lpvsPullRequest) throws ExceptionComments on the pull request with the scan results and detected issues.- Parameters:
webhookConfig
- LPVSQueue configuration for the pull request.scanResults
- List of detected files and licenses.conflicts
- List of license conflicts.lpvsPullRequest
- LPVS entity representing the pull request.- Throws:
Exception
-
getRepositoryLicense
Retrieves the license of the GitHub repository associated with the pull request.- Parameters:
webhookConfig
- LPVSQueue configuration for the pull request.- Returns:
- License key of the GitHub repository or null if not available.
-
getInternalQueueByPullRequest
Retrieves the LPVSQueue configuration for a given GitHub pull request URL.- Parameters:
pullRequest
- The GitHub pull request URL.- Returns:
- LPVSQueue configuration for the given pull request.
-