Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4917 refactor nicknaming hapi with version bump #4955

Merged
merged 25 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixing some tests
  • Loading branch information
leif stawnyczy authored and leif stawnyczy committed May 25, 2023
commit 6b02faed3ca474b05deecca210bf8b8bc5364b34
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@
import static org.slf4j.LoggerFactory.getLogger;

@ExtendWith(SpringExtension.class)
@ContextConfiguration(classes = {MdmSubmitterConfig.class, MdmConsumerConfig.class, TestMdmConfigR4.class, SubscriptionProcessorConfig.class})
@ContextConfiguration(classes = {
MdmSubmitterConfig.class,
MdmConsumerConfig.class,
TestMdmConfigR4.class,
SubscriptionProcessorConfig.class
})
abstract public class BaseMdmR4Test extends BaseJpaR4Test {

protected static final String PARTITION_1 = "PART-1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import ca.uhn.fhir.mdm.provider.MdmControllerHelper;
import ca.uhn.fhir.mdm.provider.MdmProviderDstu3Plus;
import ca.uhn.fhir.mdm.rules.config.MdmSettings;
import ca.uhn.fhir.mdm.rules.svc.MdmResourceMatcherSvc;
import ca.uhn.fhir.mdm.util.MessageHelper;
import com.google.common.base.Charsets;
import org.apache.commons.io.IOUtils;
Expand Down Expand Up @@ -34,6 +35,8 @@ public abstract class BaseProviderR4Test extends BaseMdmR4Test {
@Autowired
protected MdmSettings myMdmSettings;
@Autowired
protected MdmResourceMatcherSvc myMdmResourceMatcherSvc;
@Autowired
private MdmControllerHelper myMdmHelper;
@Autowired
Batch2JobHelper myBatch2JobHelper;
Expand All @@ -48,7 +51,7 @@ protected void setMdmRuleJson(String theString) throws IOException {
String json = IOUtils.toString(resource.getInputStream(), Charsets.UTF_8);
myMdmSettings.setEnabled(true);
myMdmSettings.setScriptText(json);
myMdmResourceMatcherSvc.setMdmSettings(myMdmSettings);
myMdmResourceMatcherSvc.setMdmRulesJson(myMdmSettings.getMdmRules());
}

@BeforeEach
Expand All @@ -62,7 +65,7 @@ public void before() throws Exception {
public void after() throws IOException {
super.after();
myMdmSettings.setScriptText(defaultScript);
myMdmResourceMatcherSvc.setMdmSettings(myMdmSettings);
myMdmResourceMatcherSvc.setMdmRulesJson(myMdmSettings.getMdmRules());
}

protected void clearMdmLinks() {
Expand Down
6 changes: 0 additions & 6 deletions hapi-fhir-server-mdm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@
<artifactId>hapi-fhir-storage</artifactId>
<version>${project.version}</version>
</dependency>
<!-- should be a dependency of hapi-fhir-storage, but... -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-searchparam</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void validateIsMdmManaged(String theName, IAnyResource theResource) {
public IBaseBundle getMatchesAndPossibleMatchesForResource(IAnyResource theResource, String theResourceType, RequestDetails theRequestDetails) {
RequestPartitionId requestPartitionId;
ReadPartitionIdRequestDetails details = ReadPartitionIdRequestDetails.forSearchType(theResourceType, null, null);
if (myMdmSettings.getSearchAllPartitionForMatch()){
if (myMdmSettings.getSearchAllPartitionForMatch()) {
requestPartitionId = RequestPartitionId.allPartitions();
} else {
requestPartitionId = myRequestPartitionHelperSvc.determineReadPartitionForRequest(theRequestDetails, details);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ public MdmResourceFieldMatcher(
* @param theRightResource the second {@link IBaseResource}
* @return A boolean indicating whether they match.
*/
@SuppressWarnings("rawtypes")
public MdmMatchEvaluation match(IBaseResource theLeftResource, IBaseResource theRightResource) {
validate(theLeftResource);
validate(theRightResource);
Expand Down Expand Up @@ -186,8 +185,12 @@ private ExtraMatchParams getExtraMatcherParams() {
MdmMatcherJson matcherJson = myMdmFieldMatchJson.getMatcher();

ExtraMatchParams params = new ExtraMatchParams();
params.setExactMatch(matcherJson.getExact());
params.setIdentificationSystem(matcherJson.getIdentifierSystem());
if (matcherJson != null) {
params.setExactMatch(matcherJson.getExact());
params.setIdentificationSystem(matcherJson.getIdentifierSystem());
} else {
System.out.println("hereherhehere");
}
return params;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.jpa.searchparam.matcher.IMdmFieldMatcher;
import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.api.MdmConstants;
import ca.uhn.fhir.mdm.api.MdmMatchEvaluation;
Expand All @@ -32,6 +31,7 @@
import ca.uhn.fhir.mdm.rules.json.MdmFieldMatchJson;
import ca.uhn.fhir.mdm.rules.json.MdmRulesJson;
import ca.uhn.fhir.mdm.rules.matcher.IMatcherFactory;
import com.google.common.annotations.VisibleForTesting;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.slf4j.Logger;
import org.springframework.stereotype.Service;
Expand All @@ -51,9 +51,10 @@ public class MdmResourceMatcherSvc {

private final FhirContext myFhirContext;
private final IMatcherFactory myMatcherFactory;
private MdmRulesJson myMdmRulesJson;
private final List<MdmResourceFieldMatcher> myFieldMatchers = new ArrayList<>();

private MdmRulesJson myMdmRulesJson;

public MdmResourceMatcherSvc(
FhirContext theFhirContext,
IMatcherFactory theIMatcherFactory,
Expand Down Expand Up @@ -148,11 +149,16 @@ private MdmMatchOutcome getMatchOutcome(IBaseResource theLeftResource, IBaseReso
return retVal;
}


private boolean isValidResourceType(String theResourceType, String theFieldComparatorType) {
return (
theFieldComparatorType.equalsIgnoreCase(MdmConstants.ALL_RESOURCE_SEARCH_PARAM_TYPE)
|| theFieldComparatorType.equalsIgnoreCase(theResourceType)
);
}

@VisibleForTesting
public void setMdmRulesJson(MdmRulesJson theMdmRulesJson) {
myMdmRulesJson = theMdmRulesJson;
addFieldMatchers();
}
}