Class FindQueryUtils
java.lang.Object
org.projecthusky.communication.xdsmhdconversion.utils.FindQueryUtils
Utilities for MHD "Find" transactions (ITI-66 and ITI-67).
- Author:
- Quentin Ligier
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ca.uhn.fhir.rest.server.exceptions.InvalidRequestException
invalidRequestException
(org.hl7.fhir.r4.model.OperationOutcome.IssueType type, String message, Object... args) static String
parseAuthor
(@Nullable ca.uhn.fhir.rest.param.StringParam stringParam, String author) Converts a string token from a FHIR search parameter to a string of XDS author.static void
parseAuthor
(@Nullable ca.uhn.fhir.rest.param.StringParam stringParam, List<@NonNull String> authors) Converts a string token from a FHIR search parameter to a list of XDS authors.static void
parseCodeList
(@Nullable ca.uhn.fhir.rest.param.TokenOrListParam tokenOrListParam, List<@NonNull org.openehealth.ipf.commons.ihe.xds.core.metadata.Code> codeList, String paramName) Converts a list of token from a FHIR search parameter to a list of XDSCode
s and maps the FHIR system URIs to XDS system OIDs if the mapping exists.static void
parseStatusParam
(@Nullable ca.uhn.fhir.rest.param.TokenOrListParam statusTokens, List<org.openehealth.ipf.commons.ihe.xds.core.metadata.AvailabilityStatus> statusList) Parses the query parameter 'status' as a set ofAvailabilityStatus
and adds it to the corresponding field of the find document query.static void
parseStringList
(@Nullable ca.uhn.fhir.rest.param.TokenOrListParam tokens, List<@NonNull String> stringList, String paramName) Converts a list of token from a FHIR search parameter to a list of strings.static List<@NonNull org.openehealth.ipf.commons.ihe.xds.core.metadata.Code>
toXdsCodeList
(@Nullable ca.uhn.fhir.rest.param.TokenOrListParam tokens) Converts a list of token from a FHIR search parameter to a list of XDSCode
s and maps the FHIR system URIs to XDS system OIDs if the mapping exists.static XdsTimeRange
toXdsTimeRange
(@Nullable ca.uhn.fhir.rest.param.DateRangeParam dateRange) Constructs an XDS time range from a FHIR date range.
-
Constructor Details
-
FindQueryUtils
public FindQueryUtils()
-
-
Method Details
-
parseCodeList
public static void parseCodeList(@Nullable ca.uhn.fhir.rest.param.TokenOrListParam tokenOrListParam, List<@NonNull org.openehealth.ipf.commons.ihe.xds.core.metadata.Code> codeList, String paramName) throws ca.uhn.fhir.rest.server.exceptions.InvalidRequestException Converts a list of token from a FHIR search parameter to a list of XDSCode
s and maps the FHIR system URIs to XDS system OIDs if the mapping exists. The tokens shall not have a modifier.- Parameters:
tokenOrListParam
- The FHIR tokens search parameter.codeList
- The XDS code list.paramName
- The name of the FHIR parameter.- Throws:
ca.uhn.fhir.rest.server.exceptions.InvalidRequestException
-
parseStringList
public static void parseStringList(@Nullable ca.uhn.fhir.rest.param.TokenOrListParam tokens, List<@NonNull String> stringList, String paramName) throws ca.uhn.fhir.rest.server.exceptions.InvalidRequestException Converts a list of token from a FHIR search parameter to a list of strings. The tokens shall not have a system or a modifier.- Parameters:
tokens
- The FHIR tokens search parameter.stringList
- The string list.paramName
- The name of the FHIR parameter.- Throws:
ca.uhn.fhir.rest.server.exceptions.InvalidRequestException
-
parseStatusParam
public static void parseStatusParam(@Nullable ca.uhn.fhir.rest.param.TokenOrListParam statusTokens, List<org.openehealth.ipf.commons.ihe.xds.core.metadata.AvailabilityStatus> statusList) throws ca.uhn.fhir.rest.server.exceptions.InvalidRequestException Parses the query parameter 'status' as a set ofAvailabilityStatus
and adds it to the corresponding field of the find document query. It is required and limited to 'current' and 'superseded' values.- Parameters:
statusTokens
- The FHIR search parameters 'status'.statusList
- The list of XDS availability status to be filled.- Throws:
ca.uhn.fhir.rest.server.exceptions.InvalidRequestException
-
parseAuthor
public static void parseAuthor(@Nullable ca.uhn.fhir.rest.param.StringParam stringParam, List<@NonNull String> authors) Converts a string token from a FHIR search parameter to a list of XDS authors.IPF does not accept modifiers for these fields.
- Parameters:
stringParam
- The FHIR search parameters.authors
- The list of author.
-
parseAuthor
public static String parseAuthor(@Nullable ca.uhn.fhir.rest.param.StringParam stringParam, String author) Converts a string token from a FHIR search parameter to a string of XDS author.IPF does not accept modifiers for these fields.
- Parameters:
stringParam
- The FHIR search parameters.author
- The author.
-
toXdsTimeRange
public static XdsTimeRange toXdsTimeRange(@Nullable ca.uhn.fhir.rest.param.DateRangeParam dateRange) Constructs an XDS time range from a FHIR date range.XDS time range is compared with an inclusive lower bound and an exclusive upper bound. The instants returned by the
DateRangeParam
are both inclusive, so the upper bound is shifted by one second.- Parameters:
dateRange
- The FHIR date range search parameter.- Returns:
- the equivalent XDS time range.
-
toXdsCodeList
public static List<@NonNull org.openehealth.ipf.commons.ihe.xds.core.metadata.Code> toXdsCodeList(@Nullable ca.uhn.fhir.rest.param.TokenOrListParam tokens) throws ca.uhn.fhir.rest.server.exceptions.InvalidRequestException Converts a list of token from a FHIR search parameter to a list of XDSCode
s and maps the FHIR system URIs to XDS system OIDs if the mapping exists.- Parameters:
tokens
- The list of FHIR tokens.- Returns:
- a list of equivalent XDS codes.
- Throws:
ca.uhn.fhir.rest.server.exceptions.InvalidRequestException
- if a token is invalid.
-
invalidRequestException
-