Class ConsentParameterizedPolicyRequest

java.lang.Object
ca.cdr.api.consent.ConsentParameterizedPolicyRequest

A consent policy request for parameterized policies that accept query parameters.

Contains:

  1. The policy name which should be mapped to a new instance of an IConsentService
  2. The UserSessionDetailsJson of the user making the request (may be null during bootstrap validation).
  3. A map of parameters with AND/OR structure that can be used to configure the consent service.
  4. An optional Consent resource for consent-resource-based policies.

Parameterized policies support query parameters that configure their behavior. Parameters are parsed into an AND/OR structure where:

  • Comma-separated values within a single parameter create OR conditions
  • Repeated parameter occurrences (separated by &) create AND groups

Example: RedactFhirPathsWhen?_type=Patient,Observation&fhirpath=Patient.name&fhirpath=Patient.address

For fixed policies that do not accept parameters, use ConsentFixedPolicyRequest instead.

  • Constructor Details

  • Method Details

    • getPolicyName

    • getUserSessionDetailsJson

    • addParameter

      public void addParameter(String theKey, String theValue)
      Add a parameter value. The value is split on commas to create an OR list, and each call creates a new AND group for the key. This supports multi-valued query parameters like fhirpath=X,Y&fhirpath=Z where X,Y is an OR list and Z is a separate AND group.
      Parameters:
      theKey - the parameter key
      theValue - the parameter value (comma-separated values become OR conditions)
    • addParameterOrList

      public void addParameterOrList(String theKey, List<String> theOrList)
      Add a pre-split OR list as a new AND group for the key. This is used when parameters have already been parsed and split.
      Parameters:
      theKey - the parameter key
      theOrList - the pre-split OR values
    • hasParameter

      public boolean hasParameter(String theKey)
      Check if a parameter exists.
      Parameters:
      theKey - the parameter key
      Returns:
      true if the parameter exists
    • getParameter

      public List<List<String>> getParameter(String theKey)
      Get the AND/OR structure for a parameter. The outer list represents AND groups (each occurrence of the parameter). The inner list represents OR values (comma-separated within one occurrence).
      Parameters:
      theKey - the parameter key
      Returns:
      list of AND groups, each containing OR values, or empty list if not found
    • getAllParameters

      Get all parameters with their AND/OR structure.
      Returns:
      unmodifiable map of parameter keys to lists of AND groups
    • getConsentResource

      @Nullable public IBaseResource getConsentResource()
      Get the Consent resource associated with this request. This is only set for consent-resource-based policies.
      Returns:
      the Consent resource, or null for builtin policies
    • setConsentResource

      Set the Consent resource for consent-resource-based policies.
      Parameters:
      theConsentResource - the Consent resource
      Returns:
      this request for method chaining