Class ParameterizedPolicyQueryParameterParser

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

Parser for consent policy names that may contain query parameters. Splits policy names on '?' and parses query parameters with URL decoding.

Examples:

  • "RedactFhirPathsWhen?_type=Patient" ? base="RedactFhirPathsWhen", params={_type:[Patient]}
  • "RedactFhirPathsWhen?a=b&a=c" ? base="RedactFhirPathsWhen", params={a:[[b],[c]]}
  • "RedactFhirPathsWhen?a=b,c&a=d" ? base="RedactFhirPathsWhen", params={a:[[b,c],[d]]}
  • Method Details

    • parse

      public static ParameterizedPolicyQueryParameterParser parse(String thePolicyNameWithParams)
      Parse a policy name string that may contain query parameters.
      Parameters:
      thePolicyNameWithParams - the policy name, optionally followed by ?key=valueinvalid input: '&key2'=value2
      Returns:
      a parsed result containing the base policy name and parameters
    • getBasePolicyName

      Get the base policy name (without query parameters).
      Returns:
      the base policy name
    • hasParameters

      public boolean hasParameters()
      Check if the policy has any parameters.
      Returns:
      true if parameters exist
    • hasParameter

      public boolean hasParameter(String theKey)
      Check if a specific 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
    • getFirstParameterValue

      Get the first value for a parameter.
      Parameters:
      theKey - the parameter key
      Returns:
      the first value from the first AND group, or null if not found
    • getParameterValues

      Deprecated.
      Use getParameter(String) to access the AND/OR structure
      Get all values for a parameter, flattened across all AND groups.
      Parameters:
      theKey - the parameter key
      Returns:
      list of all 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