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

Bump certifi from 2022.12.7 to 2023.7.22 in /.github/workflows/cdr_check #39

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
13 changes: 4 additions & 9 deletions .github/workflows/cdr_check/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* Copyright (C) 2014 - 2023 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -93,10 +93,17 @@ public boolean matchesInclude(Include theInclude) {
int colonIndex = theInclude.getValue().indexOf(':');
if (colonIndex != -1) {
// DSTU2+ style
String resourceName = theInclude.getValue().substring(0, colonIndex);
String paramName = theInclude.getValue().substring(colonIndex + 1);
String targetResourceName = theInclude.getParamTargetType();
if (targetResourceName != null
&& !targetResourceName.equals(
myResource.getReferenceElement().getResourceType())) {
return false;
}

String resourceName = theInclude.getParamType();
RuntimeResourceDefinition resourceDef = myContext.getResourceDefinition(resourceName);
if (resourceDef != null) {
String paramName = theInclude.getParamName();
RuntimeSearchParam searchParamDef = resourceDef.getSearchParam(paramName);
if (searchParamDef != null) {
final String completeName = myOwningResource + "." + myName;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package ca.uhn.fhir.util;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Include;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.dstu3.model.Reference;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.util.List;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class ResourceReferenceInfoTest {

private ResourceReferenceInfo resourceReferenceInfo;

private final FhirContext fhirContext = FhirContext.forDstu3();

@BeforeEach
public void setUp() {
Reference theElement = new Reference()
.setReference("Practitioner/123")
.setDisplay("Test Practitioner");

Patient theOwningResource = new Patient()
.addGeneralPractitioner(theElement);

resourceReferenceInfo =
new ResourceReferenceInfo(fhirContext, theOwningResource, List.of("generalPractitioner"), theElement);
}

@Test
public void matchesInclude_hasTargetResourceType_matched() {
assertTrue(resourceReferenceInfo.matchesInclude(new Include("Patient:general-practitioner:Practitioner")));
}

@Test
public void matchesInclude_hasNotTargetResourceType_matched() {
assertTrue(resourceReferenceInfo.matchesInclude(new Include("Patient:general-practitioner")));
}

@Test
public void matchesInclude_hasDifferentTargetResourceType_notMatched() {
assertFalse(resourceReferenceInfo.matchesInclude(new Include("Patient:general-practitioner:Organization")));
}
}
Loading