propagate class rename

This commit is contained in:
Tadgh 2020-08-06 11:32:06 -07:00
parent d6ad434339
commit c4fd055e52
4 changed files with 18 additions and 13 deletions

View File

@ -214,7 +214,7 @@ public class EmpiConsumerConfig {
} }
@Bean @Bean
EmpiResourceFilteringSvc empiMessageFilteringSvc() { EmpiResourceFilteringSvc empiResourceFilteringSvc() {
return new EmpiResourceFilteringSvc(); return new EmpiResourceFilteringSvc();
} }
} }

View File

@ -32,7 +32,7 @@ public class EmpiResourceFilteringSvc {
* If the payload has no attributes that appear in the Candidate Search Params, processing should be skipped, as there is not * If the payload has no attributes that appear in the Candidate Search Params, processing should be skipped, as there is not
* sufficient information to perform meaningful EMPI processing. (For example, how can EMPI processing occur on a patient that has _no_ attributes?) * sufficient information to perform meaningful EMPI processing. (For example, how can EMPI processing occur on a patient that has _no_ attributes?)
* *
* @param theMessage the message provided by the EMPI channel. * @param theResource the resource that you wish to check against EMPI rules.
* *
* @return whether or not EMPI processing should proceed * @return whether or not EMPI processing should proceed
*/ */
@ -41,7 +41,7 @@ public class EmpiResourceFilteringSvc {
List<EmpiResourceSearchParamJson> candidateSearchParams = empiSettings.getEmpiRules().getCandidateSearchParams(); List<EmpiResourceSearchParamJson> candidateSearchParams = empiSettings.getEmpiRules().getCandidateSearchParams();
boolean containsValueForSomeSearchParam = candidateSearchParams.stream() boolean containsValueForSomeSearchParam = candidateSearchParams.stream()
.filter(csp -> searchParamIsValidForType(csp, resourceType)) .filter(csp -> myEmpiSearchParamSvc.searchParamTypeIsValidForResourceType(csp.getResourceType(), resourceType))
.flatMap(csp -> csp.getSearchParams().stream()) .flatMap(csp -> csp.getSearchParams().stream())
.map(searchParam -> myEmpiSearchParamSvc.getValueFromResourceForSearchParam(theResource, searchParam)) .map(searchParam -> myEmpiSearchParamSvc.getValueFromResourceForSearchParam(theResource, searchParam))
.anyMatch(valueList -> !valueList.isEmpty()); .anyMatch(valueList -> !valueList.isEmpty());
@ -49,9 +49,4 @@ public class EmpiResourceFilteringSvc {
ourLog.debug("Is {} suitable for EMPI processing? : {}", theResource.getId(), containsValueForSomeSearchParam); ourLog.debug("Is {} suitable for EMPI processing? : {}", theResource.getId(), containsValueForSomeSearchParam);
return containsValueForSomeSearchParam; return containsValueForSomeSearchParam;
} }
private boolean searchParamIsValidForType(EmpiResourceSearchParamJson theSearchParamJson, String theResourceType) {
return theSearchParamJson.getResourceType().equalsIgnoreCase(theResourceType) || theSearchParamJson.getResourceType().equalsIgnoreCase("*");
}
} }

View File

@ -93,4 +93,14 @@ public class EmpiSearchParamSvc implements ISearchParamRetriever {
IFhirResourceDao resourceDao = myDaoRegistry.getResourceDao(theTargetType); IFhirResourceDao resourceDao = myDaoRegistry.getResourceDao(theTargetType);
return mySearchBuilderFactory.newSearchBuilder(resourceDao, theTargetType, resourceDao.getResourceType()); return mySearchBuilderFactory.newSearchBuilder(resourceDao, theTargetType, resourceDao.getResourceType());
} }
/**
* Will return true if the types match, or the search param type is '*', otherwise false.
* @param theSearchParamType
* @param theResourceType
* @return
*/
public boolean searchParamTypeIsValidForResourceType(String theSearchParamType, String theResourceType) {
return theSearchParamType.equalsIgnoreCase(theResourceType) || theSearchParamType.equalsIgnoreCase("*");
}
} }

View File

@ -13,7 +13,7 @@ import static org.hamcrest.Matchers.is;
class EmpiResourceFilteringSvcTest extends BaseEmpiR4Test { class EmpiResourceFilteringSvcTest extends BaseEmpiR4Test {
@Autowired @Autowired
private EmpiResourceFilteringSvc myEmpiMessageFilteringSvc; private EmpiResourceFilteringSvc myEmpiResourceFilteringSvc;
@Test @Test
public void testFilterResourcesWhichHaveNoRelevantAttributes() { public void testFilterResourcesWhichHaveNoRelevantAttributes() {
@ -21,7 +21,7 @@ class EmpiResourceFilteringSvcTest extends BaseEmpiR4Test {
patient.setDeceased(new BooleanType(true)); //EMPI rules defined do not care about the deceased attribute. patient.setDeceased(new BooleanType(true)); //EMPI rules defined do not care about the deceased attribute.
//SUT //SUT
boolean shouldBeProcessed = myEmpiMessageFilteringSvc.shouldBeProcessed(patient); boolean shouldBeProcessed = myEmpiResourceFilteringSvc.shouldBeProcessed(patient);
assertThat(shouldBeProcessed, is(equalTo(false))); assertThat(shouldBeProcessed, is(equalTo(false)));
} }
@ -32,7 +32,7 @@ class EmpiResourceFilteringSvcTest extends BaseEmpiR4Test {
patient.addIdentifier().setValue("Hey I'm an ID! rules defined in empi-rules.json care about me!"); patient.addIdentifier().setValue("Hey I'm an ID! rules defined in empi-rules.json care about me!");
//SUT //SUT
boolean shouldBeProcessed = myEmpiMessageFilteringSvc.shouldBeProcessed(patient); boolean shouldBeProcessed = myEmpiResourceFilteringSvc.shouldBeProcessed(patient);
assertThat(shouldBeProcessed, is(equalTo(true))); assertThat(shouldBeProcessed, is(equalTo(true)));
} }