Package com.lpvs.service
Class LPVSQueueService
java.lang.Object
com.lpvs.service.LPVSQueueService
Service for managing LPVSQueue elements and processing webhooks.
-
Constructor Summary
ConstructorsConstructorDescriptionLPVSQueueService
(LPVSGitHubService gitHubService, LPVSDetectService detectService, LPVSLicenseService licenseService, LPVSPullRequestRepository lpvsPullRequestRepository, LPVSQueueRepository queueRepository, int maxAttempts) Constructor for LPVSQueueService. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the LPVSQueue element to the end of the queue.void
Adds the LPVSQueue element to the front of the queue.void
Checks for any previous LPVSQueue elements and processes them.void
Deletes the LPVSQueue element from the repository and the queue.getLatestScan
(List<LPVSQueue> webhookConfigList) Gets the LPVSQueue element with the latest scan date.getQueue()
Gets the entire LPVSQueue.Gets the first element from the LPVSQueue.void
processWebHook
(LPVSQueue webhookConfig) Asynchronously processes the LPVSQueue element, handling GitHub webhook events.
-
Constructor Details
-
LPVSQueueService
public LPVSQueueService(LPVSGitHubService gitHubService, LPVSDetectService detectService, LPVSLicenseService licenseService, LPVSPullRequestRepository lpvsPullRequestRepository, LPVSQueueRepository queueRepository, @Value("${lpvs.attempts:4}") int maxAttempts) Constructor for LPVSQueueService.- Parameters:
gitHubService
- Service for interacting with GitHub.detectService
- Service for detecting licenses in scanned files.licenseService
- Service for managing licenses and license conflicts.lpvsPullRequestRepository
- Repository for storing LPVSPullRequest entities.queueRepository
- Repository for storing LPVSQueue entities.maxAttempts
- Maximum attempts for processing LPVSQueue elements.
-
-
Method Details
-
getQueueFirstElement
Gets the first element from the LPVSQueue.- Returns:
- The first LPVSQueue element.
- Throws:
InterruptedException
- If interrupted while waiting for the element.
-
addFirst
Adds the LPVSQueue element to the front of the queue.- Parameters:
webhookConfig
- The LPVSQueue element to be added.- Throws:
InterruptedException
- If interrupted while waiting to add the element.
-
add
Adds the LPVSQueue element to the end of the queue.- Parameters:
webhookConfig
- The LPVSQueue element to be added.- Throws:
InterruptedException
- If interrupted while waiting to add the element.
-
delete
Deletes the LPVSQueue element from the repository and the queue.- Parameters:
webhookConfig
- The LPVSQueue element to be deleted.
-
getQueue
Gets the entire LPVSQueue.- Returns:
- The BlockingDeque containing LPVSQueue elements.
-
checkForQueue
Checks for any previous LPVSQueue elements and processes them.- Throws:
InterruptedException
- If interrupted while processing the queue.
-
getLatestScan
Gets the LPVSQueue element with the latest scan date.- Parameters:
webhookConfigList
- The list of LPVSQueue elements.- Returns:
- The LPVSQueue element with the latest scan date.
-
processWebHook
Asynchronously processes the LPVSQueue element, handling GitHub webhook events.- Parameters:
webhookConfig
- The LPVSQueue element to be processed.
-