Added correction to generated resource providers (#5743)

* Added correction to generated resource providers

* add changelog and fix issue that was adding languange SP to version that does not have language as a SP

* actually fix the test

* fix changelog wrong issue number

---------

Co-authored-by: Jens Kristian Villadsen <jenskristianvilladsen@gmail.com>
Co-authored-by: Long Ma <long@smilecdr.com>
This commit is contained in:
longma1 2024-02-27 15:12:23 -07:00 committed by Long Ma
parent c30608a55c
commit 6a67fa4155
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,4 @@
---
type: fix
issue: 5742
title: Fixed behaviour of the _language query parameter. Now it is picked up as search parameter in the resource provider and filters accordingly. Thanks to Jens Villadsen (@jkiddo) for the contribution!

View File

@ -69,6 +69,16 @@ public class ${className}ResourceProvider extends
@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE)
UriAndListParam theSearchForProfile,
@Description(shortDefinition="Search the contents of the resource's data using a list")
@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_LIST)
StringAndListParam theList,
#if ( $version == 'R5' )
@Description(shortDefinition="The language of the resource")
@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_LANGUAGE)
TokenAndListParam theResourceLanguage,
#end
@Description(shortDefinition="Search for resources which have the given source value (Resource.meta.source)")
@OptionalParam(name=ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE)
UriAndListParam theSearchForSource,
@ -149,6 +159,10 @@ public class ${className}ResourceProvider extends
paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SECURITY, theSearchForSecurity);
paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_PROFILE, theSearchForProfile);
paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_SOURCE, theSearchForSource);
paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_LIST, theList);
#if ( $version == 'R5' )
paramMap.add(ca.uhn.fhir.rest.api.Constants.PARAM_LANGUAGE, theResourceLanguage);
#end
paramMap.add("_has", theHas);
#foreach ( $param in $searchParams )
paramMap.add("${param.name}", the${param.nameCapitalized});