Class WebhookService
- java.lang.Object
-
- io.jans.ca.plugin.adminui.service.webhook.WebhookService
-
@Singleton public class WebhookService extends Object
-
-
Constructor Summary
Constructors Constructor Description WebhookService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WebhookEntry
addWebhook(WebhookEntry webhook)
The function adds a webhook entry to a database, assigns it a unique ID, and associates it with Aui features if provided.List<AuiFeature>
getAllAuiFeatures()
The function retrieves all AuiFeature objects from the entryManager and returns them as a List.List<AuiFeature>
getAllAuiFeaturesByWebhookId(String webhookId)
The function retrieves a list of AuiFeatures that are associated with a specific webhookId.List<AuiFeature>
getAuiFeaturesByIds(Set<String> ids)
The function `getAuiFeaturesByIds` retrieves a list of AuiFeature objects based on a list of IDs.int
getRecordMaxCount()
List<WebhookEntry>
getWebhookByIds(Set<String> ids)
The function `getWebhookByIds` retrieves a list of `WebhookEntry` objects based on a list of webhook IDs.List<WebhookEntry>
getWebhooksByFeatureId(String featureId)
void
removeWebhook(WebhookEntry webhook)
The function removes a webhook entry and throws an exception if there is an error.io.jans.orm.model.PagedResult<WebhookEntry>
searchWebhooks(io.jans.model.SearchRequest searchRequest)
The function searches for webhook entries based on the provided search criteria and returns a paged result.List<GenericResponse>
triggerEnabledWebhooks(Set<String> webhookIds)
The function triggers enabled webhooks by creating a thread pool, validating each webhook entry, and executing them concurrently.WebhookEntry
updateWebhook(WebhookEntry webhook)
The function updates a webhook entry, validates the entry, and performs additional operations if necessary.void
validateWebhookEntry(WebhookEntry webhookEntry)
-
-
-
Method Detail
-
getAllAuiFeatures
public List<AuiFeature> getAllAuiFeatures() throws ApplicationException
The function retrieves all AuiFeature objects from the entryManager and returns them as a List.- Returns:
- The method is returning a List of AuiFeature objects.
- Throws:
ApplicationException
-
getAllAuiFeaturesByWebhookId
public List<AuiFeature> getAllAuiFeaturesByWebhookId(String webhookId) throws ApplicationException
The function retrieves a list of AuiFeatures that are associated with a specific webhookId.- Parameters:
webhookId
- The parameter "webhookId" is a String that represents the ID of a webhook.- Returns:
- The method is returning a list of AuiFeature objects that have a webhookId matching the provided webhookId parameter.
- Throws:
ApplicationException
-
searchWebhooks
public io.jans.orm.model.PagedResult<WebhookEntry> searchWebhooks(io.jans.model.SearchRequest searchRequest) throws ApplicationException
The function searches for webhook entries based on the provided search criteria and returns a paged result.- Parameters:
searchRequest
- The `searchRequest` parameter is an object of type `SearchRequest`. It contains information about the search criteria and pagination for the webhooks search.- Returns:
- The method is returning a PagedResult object containing a list of WebhookEntry objects.
- Throws:
ApplicationException
-
getWebhookByIds
public List<WebhookEntry> getWebhookByIds(Set<String> ids)
The function `getWebhookByIds` retrieves a list of `WebhookEntry` objects based on a list of webhook IDs.- Parameters:
ids
- A list of webhook IDs to search for.- Returns:
- The method is returning a List of WebhookEntry objects.
-
getWebhooksByFeatureId
public List<WebhookEntry> getWebhooksByFeatureId(String featureId)
-
getAuiFeaturesByIds
public List<AuiFeature> getAuiFeaturesByIds(Set<String> ids)
The function `getAuiFeaturesByIds` retrieves a list of AuiFeature objects based on a list of IDs.- Parameters:
ids
- A list of String values representing the IDs of AuiFeatures to be retrieved.- Returns:
- The method is returning a List of AuiFeature objects.
-
addWebhook
public WebhookEntry addWebhook(WebhookEntry webhook) throws ApplicationException
The function adds a webhook entry to a database, assigns it a unique ID, and associates it with Aui features if provided.- Parameters:
webhook
- The parameter "webhook" is an object of type WebhookEntry. It represents the webhook entry that needs to be added.- Returns:
- The method is returning a WebhookEntry object.
- Throws:
ApplicationException
-
removeWebhook
public void removeWebhook(WebhookEntry webhook) throws ApplicationException
The function removes a webhook entry and throws an exception if there is an error.- Parameters:
webhook
- The parameter "webhook" is of type WebhookEntry. It represents the webhook entry that needs to be removed.- Throws:
ApplicationException
-
updateWebhook
public WebhookEntry updateWebhook(WebhookEntry webhook) throws ApplicationException
The function updates a webhook entry, validates the entry, and performs additional operations if necessary.- Parameters:
webhook
- The parameter "webhook" is an object of type WebhookEntry. It represents the webhook entry that needs to be updated.- Returns:
- The method is returning a WebhookEntry object.
- Throws:
ApplicationException
-
validateWebhookEntry
public void validateWebhookEntry(WebhookEntry webhookEntry) throws ApplicationException
- Throws:
ApplicationException
-
triggerEnabledWebhooks
public List<GenericResponse> triggerEnabledWebhooks(Set<String> webhookIds) throws ApplicationException
The function triggers enabled webhooks by creating a thread pool, validating each webhook entry, and executing them concurrently.- Parameters:
webhookIds
- A set of webhook IDs.- Returns:
- The method is returning a List of Strings.
- Throws:
ApplicationException
-
getRecordMaxCount
public int getRecordMaxCount()
-
-