use of ca.uhn.fhir.rest.param.StringParam in project openmrs-module-fhir2 by openmrs.
the class UserSearchQueryTest method searchForUsers_shouldReturnUsersByCity.
@Test
public void searchForUsers_shouldReturnUsersByCity() {
StringAndListParam city = new StringAndListParam().addAnd(new StringParam(CITY));
SearchParameterMap theParams = new SearchParameterMap().addParameter(ADDRESS_SEARCH_HANDLER, CITY_PROPERTY, city);
IBundleProvider results = search(theParams);
assertThat(results, notNullValue());
assertThat(results.size(), greaterThanOrEqualTo(1));
List<Practitioner> resultList = get(results);
assertThat(resultList, hasSize(greaterThanOrEqualTo(1)));
assertThat(resultList.get(0).getAddressFirstRep().getCity(), equalTo(CITY));
}
use of ca.uhn.fhir.rest.param.StringParam in project openmrs-module-fhir2 by openmrs.
the class SearchParameterMapTest method shouldAddStringOrListParamIntoTheMap.
@Test
public void shouldAddStringOrListParamIntoTheMap() {
StringOrListParam orListParam = new StringOrListParam();
orListParam.addOr(new StringParam("Clement"));
searchParam.addParameter(NAME, orListParam);
assertThat(searchParam, notNullValue());
assertThat(searchParam.getParameters(NAME), not(empty()));
assertThat(searchParam.getParameters(NAME), hasSize(is(1)));
}
use of ca.uhn.fhir.rest.param.StringParam in project openmrs-module-fhir2 by openmrs.
the class SearchParameterMapTest method shouldAddStringAndListParamIntoTheMap.
@Test
public void shouldAddStringAndListParamIntoTheMap() {
StringAndListParam andListParam = new StringAndListParam();
andListParam.addAnd(new StringParam("John"));
searchParam.addParameter(NAME, andListParam);
assertThat(searchParam, notNullValue());
assertThat(searchParam.getParameters(NAME), not(empty()));
assertThat(searchParam.getParameters(NAME), hasSize(is(1)));
}
use of ca.uhn.fhir.rest.param.StringParam in project openmrs-module-fhir2 by openmrs.
the class SearchParameterMapTest method shouldAddStringAndListParamIntoAnExistingMapUsingTheSameKeyValue.
@Test
public void shouldAddStringAndListParamIntoAnExistingMapUsingTheSameKeyValue() {
StringAndListParam andListParam1 = new StringAndListParam();
andListParam1.addAnd(new StringParam("John"));
StringAndListParam andListParam2 = new StringAndListParam();
andListParam2.addAnd(new StringParam("Joe"));
searchParam.addParameter(NAME, andListParam1);
searchParam.addParameter(NAME, andListParam2);
assertThat(searchParam, notNullValue());
assertThat(searchParam.getParameters(NAME), not(empty()));
assertThat(searchParam.getParameters(NAME), hasSize(is(2)));
}
use of ca.uhn.fhir.rest.param.StringParam in project elexis-server by elexis.
the class PersonResourceProvider method search.
@Search
public List<Person> search(@OptionalParam(name = Person.SP_NAME) StringParam name, @OptionalParam(name = ca.uhn.fhir.rest.api.Constants.PARAM_FILTER) StringAndListParam theFtFilter) {
IQuery<IPerson> query = modelService.getQuery(IPerson.class);
if (name != null) {
QueryUtil.andContactNameCriterion(query, name);
}
if (theFtFilter != null) {
new IContactSearchFilterQueryAdapter().adapt(query, theFtFilter);
}
List<IPerson> persons = query.execute();
List<Person> _persons = persons.parallelStream().map(org -> getTransformer().getFhirObject(org)).filter(Optional::isPresent).map(Optional::get).collect(Collectors.toList());
return _persons;
}
Aggregations