diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/StringClientParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/StringClientParam.java index 9aa120ff94f..47d79cd1bea 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/StringClientParam.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/StringClientParam.java @@ -59,6 +59,13 @@ public class StringClientParam extends BaseClientParam implements IParam { return new StringExactly(); } + /** + * The string contains given value + */ + public IStringMatch contains() { + return new StringContains(); + } + public interface IStringMatch { /** @@ -109,6 +116,28 @@ public class StringClientParam extends BaseClientParam implements IParam { } } + private class StringContains implements IStringMatch { + @Override + public ICriterion value(String theValue) { + return new StringCriterion(getParamName() + Constants.PARAMQUALIFIER_STRING_CONTAINS, theValue); + } + + @Override + public ICriterion value(StringDt theValue) { + return new StringCriterion(getParamName() + Constants.PARAMQUALIFIER_STRING_CONTAINS, theValue.getValue()); + } + + @Override + public ICriterion values(List theValue) { + return new StringCriterion(getParamName() + Constants.PARAMQUALIFIER_STRING_CONTAINS, theValue); + } + + @Override + public ICriterion values(String... theValues) { + return new StringCriterion(getParamName() + Constants.PARAMQUALIFIER_STRING_CONTAINS, Arrays.asList(theValues)); + } + } + private class StringMatches implements IStringMatch { @Override public ICriterion value(String theValue) { diff --git a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/method/SearchParameter.java b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/method/SearchParameter.java index 930a3947c33..10423ae83da 100644 --- a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/method/SearchParameter.java +++ b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/method/SearchParameter.java @@ -53,7 +53,7 @@ public class SearchParameter extends BaseQueryParameter { ourParamTypes.put(StringParam.class, RestSearchParameterTypeEnum.STRING); ourParamTypes.put(StringOrListParam.class, RestSearchParameterTypeEnum.STRING); ourParamTypes.put(StringAndListParam.class, RestSearchParameterTypeEnum.STRING); - ourParamQualifiers.put(RestSearchParameterTypeEnum.STRING, CollectionUtil.newSet(Constants.PARAMQUALIFIER_STRING_EXACT, Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); + ourParamQualifiers.put(RestSearchParameterTypeEnum.STRING, CollectionUtil.newSet(Constants.PARAMQUALIFIER_STRING_EXACT, Constants.PARAMQUALIFIER_STRING_CONTAINS, Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); ourParamTypes.put(UriParam.class, RestSearchParameterTypeEnum.URI); ourParamTypes.put(UriOrListParam.class, RestSearchParameterTypeEnum.URI); diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/SearchParameter.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/SearchParameter.java index 16dade4ee31..db0b19c5ff9 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/SearchParameter.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/SearchParameter.java @@ -53,7 +53,7 @@ public class SearchParameter extends BaseQueryParameter { ourParamTypes.put(StringParam.class, RestSearchParameterTypeEnum.STRING); ourParamTypes.put(StringOrListParam.class, RestSearchParameterTypeEnum.STRING); ourParamTypes.put(StringAndListParam.class, RestSearchParameterTypeEnum.STRING); - ourParamQualifiers.put(RestSearchParameterTypeEnum.STRING, CollectionUtil.newSet(Constants.PARAMQUALIFIER_STRING_EXACT, Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); + ourParamQualifiers.put(RestSearchParameterTypeEnum.STRING, CollectionUtil.newSet(Constants.PARAMQUALIFIER_STRING_EXACT, Constants.PARAMQUALIFIER_STRING_CONTAINS, Constants.PARAMQUALIFIER_MISSING, EMPTY_STRING)); ourParamTypes.put(UriParam.class, RestSearchParameterTypeEnum.URI); ourParamTypes.put(UriOrListParam.class, RestSearchParameterTypeEnum.URI);