Package ca.cdr.api.consent
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 Summary
Modifier and TypeMethodDescriptionGet all parameters with their AND/OR structure.Get the base policy name (without query parameters).getFirstParameterValue(String theKey) Get the first value for a parameter.getParameter(String theKey) Get the AND/OR structure for a parameter.getParameterValues(String theKey) Deprecated.booleanhasParameter(String theKey) Check if a specific parameter exists.booleanCheck if the policy has any parameters.Parse a policy name string that may contain query parameters.
-
Method Details
-
parse
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
Check if the policy has any parameters.- Returns:
- true if parameters exist
-
hasParameter
Check if a specific parameter exists.- Parameters:
theKey- the parameter key- Returns:
- true if the parameter exists
-
getParameter
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.UsegetParameter(String)to access the AND/OR structureGet 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
-
getParameter(String)to access the AND/OR structure