Interface WorkflowConditionProvider

All Superinterfaces:
Provider
All Known Implementing Classes:
GroupMembershipWorkflowConditionProvider, IdentityProviderWorkflowConditionProvider, RoleWorkflowConditionProvider, UserAttributeWorkflowConditionProvider

public interface WorkflowConditionProvider extends Provider
Defines a provider interface for evaluating conditions within workflow executions.

Implementations of this interface are responsible for determining whether specific conditions are met based on the context of a workflow execution, as well as providing JPA Criteria API predicates for querying resources based on these conditions.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Evaluates the condition against the given workflow execution context.
    Returns the ResourceType} that this condition is capable of evaluating.
    jakarta.persistence.criteria.Predicate
    toPredicate(jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.criteria.CriteriaQuery<String> query, jakarta.persistence.criteria.Root<?> resourceRoot)
    Creates a JPA Criteria API Predicate representing this condition for use in queries.
    void
    Validates the internal configuration/state of this condition provider.

    Methods inherited from interface org.keycloak.provider.Provider

    close
  • Method Details

    • getSupportedResourceType

      ResourceType getSupportedResourceType()
      Returns the ResourceType} that this condition is capable of evaluating.
      Returns:
      the supported ResourceType for this condition implementation
    • evaluate

      boolean evaluate(WorkflowExecutionContext context)
      Evaluates the condition against the given workflow execution context.

      Implementations should inspect the provided context and return true when the condition is satisfied and false otherwise. Typically, implementations use the resource found in the context to test if the condition holds or not, but sometimes the condition may depend on other aspects, such as the current time or other environmental conditions not directly related to the resource.
      Parameters:
      context - the execution context for the workflow evaluation
      Returns:
      true if the condition is met, false otherwise
    • toPredicate

      jakarta.persistence.criteria.Predicate toPredicate(jakarta.persistence.criteria.CriteriaBuilder cb, jakarta.persistence.criteria.CriteriaQuery<String> query, jakarta.persistence.criteria.Root<?> resourceRoot)
      Creates a JPA Criteria API Predicate representing this condition for use in queries.

      Implementations should construct and return a Predicate that can be applied to a query that targets the underlying resource. The method receives a CriteriaBuilder, the CriteriaQuery being built and the query Root corresponding to the resource being filtered.
      Parameters:
      cb - the CriteriaBuilder used to construct predicates
      query - the CriteriaQuery being constructed
      resourceRoot - the Root representing the resource entity in the query
      Returns:
      a Predicate representing this condition for use in a CriteriaQuery
    • validate

      void validate() throws WorkflowInvalidStateException
      Validates the internal configuration/state of this condition provider.

      Implementations should perform any necessary self-checks and throw a WorkflowInvalidStateException if the provider is not correctly configured or cannot operate safely.
      Throws:
      WorkflowInvalidStateException - if the provider is in an invalid state