Merge remote-tracking branch 'remotes/origin/master' into ks-subscription-delivery-queue-configurable-name

This commit is contained in:
Ken Stevens 2019-10-02 06:21:12 -04:00
commit ed195f8dab
27 changed files with 1088 additions and 896 deletions

View File

@ -87,11 +87,13 @@ public class ApacheHttpClient extends BaseHttpClient implements IHttpClient {
} }
@Override
protected IHttpRequest createHttpRequest() { protected IHttpRequest createHttpRequest() {
IHttpRequest retVal = createHttpRequest((HttpEntity)null); IHttpRequest retVal = createHttpRequest((HttpEntity)null);
return retVal; return retVal;
} }
@Override
protected IHttpRequest createHttpRequest(byte[] content) { protected IHttpRequest createHttpRequest(byte[] content) {
/* /*
* Note: Be careful about changing which constructor we use for * Note: Be careful about changing which constructor we use for
@ -109,6 +111,7 @@ public class ApacheHttpClient extends BaseHttpClient implements IHttpClient {
return result; return result;
} }
@Override
protected IHttpRequest createHttpRequest(Map<String, List<String>> theParams) { protected IHttpRequest createHttpRequest(Map<String, List<String>> theParams) {
List<NameValuePair> parameters = new ArrayList<NameValuePair>(); List<NameValuePair> parameters = new ArrayList<NameValuePair>();
for (Entry<String, List<String>> nextParam : theParams.entrySet()) { for (Entry<String, List<String>> nextParam : theParams.entrySet()) {
@ -124,6 +127,7 @@ public class ApacheHttpClient extends BaseHttpClient implements IHttpClient {
} }
@Override
protected IHttpRequest createHttpRequest(String theContents) { protected IHttpRequest createHttpRequest(String theContents) {
/* /*
* We aren't using a StringEntity here because the constructors * We aren't using a StringEntity here because the constructors

View File

@ -76,6 +76,7 @@ public class LoggingInterceptor implements IClientInterceptor {
} }
} }
@Override
@Hook(Pointcut.CLIENT_REQUEST) @Hook(Pointcut.CLIENT_REQUEST)
public void interceptRequest(IHttpRequest theRequest) { public void interceptRequest(IHttpRequest theRequest) {
if (myLogRequestSummary) { if (myLogRequestSummary) {
@ -101,6 +102,7 @@ public class LoggingInterceptor implements IClientInterceptor {
} }
} }
@Override
@Hook(Pointcut.CLIENT_RESPONSE) @Hook(Pointcut.CLIENT_RESPONSE)
public void interceptResponse(IHttpResponse theResponse) throws IOException { public void interceptResponse(IHttpResponse theResponse) throws IOException {
if (myLogResponseSummary) { if (myLogResponseSummary) {

View File

@ -35,10 +35,12 @@ public class IgPackParserDstu2 extends BaseIgPackParser<IValidationSupport> {
super(massage(theCtx)); super(massage(theCtx));
} }
@Override
protected IValidationSupport createValidationSupport(Map<IIdType, IBaseResource> theIgResources) { protected IValidationSupport createValidationSupport(Map<IIdType, IBaseResource> theIgResources) {
return new IgPackValidationSupportDstu2(theIgResources); return new IgPackValidationSupportDstu2(theIgResources);
} }
@Override
protected FhirVersionEnum provideExpectedVersion() { protected FhirVersionEnum provideExpectedVersion() {
return FhirVersionEnum.DSTU2_HL7ORG; return FhirVersionEnum.DSTU2_HL7ORG;
} }

View File

@ -37,10 +37,12 @@ public class IgPackParserDstu3 extends BaseIgPackParser<IValidationSupport> {
super(theCtx); super(theCtx);
} }
@Override
protected IValidationSupport createValidationSupport(Map<IIdType, IBaseResource> theIgResources) { protected IValidationSupport createValidationSupport(Map<IIdType, IBaseResource> theIgResources) {
return new IgPackValidationSupportDstu3(theIgResources); return new IgPackValidationSupportDstu3(theIgResources);
} }
@Override
protected FhirVersionEnum provideExpectedVersion() { protected FhirVersionEnum provideExpectedVersion() {
return FhirVersionEnum.DSTU3; return FhirVersionEnum.DSTU3;
} }

View File

@ -41,11 +41,13 @@ public class WebsocketWithCriteriaDstu2Test extends BaseResourceProviderDstu2Tes
private WebSocketClient myWebSocketClient; private WebSocketClient myWebSocketClient;
private SocketImplementation mySocketImplementation; private SocketImplementation mySocketImplementation;
@Override
@After @After
public void after() throws Exception { public void after() throws Exception {
super.after(); super.after();
} }
@Override
@Before @Before
public void before() throws Exception { public void before() throws Exception {
super.before(); super.before();

View File

@ -58,6 +58,7 @@ public class WebsocketWithSubscriptionIdDstu2Test extends BaseResourceProviderDs
@Autowired @Autowired
private SubscriptionTestUtil mySubscriptionTestUtil; private SubscriptionTestUtil mySubscriptionTestUtil;
@Override
@After @After
public void after() throws Exception { public void after() throws Exception {
super.after(); super.after();
@ -70,6 +71,7 @@ public class WebsocketWithSubscriptionIdDstu2Test extends BaseResourceProviderDs
myWebSocketClient.stop(); myWebSocketClient.stop();
} }
@Override
@Before @Before
public void before() throws Exception { public void before() throws Exception {
super.before(); super.before();

View File

@ -219,7 +219,7 @@ public class SearchMethodBinding extends BaseResourceReturningMethodBinding {
} }
} }
for (String next : theRequest.getParameters().keySet()) { for (String next : theRequest.getParameters().keySet()) {
if (next.startsWith("_") && !SPECIAL_SEARCH_PARAMS.contains(next)) { if (next.startsWith("_") && !SPECIAL_SEARCH_PARAMS.contains(truncModifierPart(next))) {
methodParamsTemp.add(next); methodParamsTemp.add(next);
} }
} }
@ -235,6 +235,13 @@ public class SearchMethodBinding extends BaseResourceReturningMethodBinding {
return true; return true;
} }
private String truncModifierPart(String param) {
int indexOfSeparator = param.indexOf(":");
if (indexOfSeparator != -1) {
return param.substring(0, indexOfSeparator);
}
return param;
}
@Override @Override
public IBundleProvider invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams) throws InvalidRequestException, InternalErrorException { public IBundleProvider invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams) throws InvalidRequestException, InternalErrorException {

View File

@ -1021,6 +1021,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
return Utilities.appendSlash(base) + type + "/" + id; return Utilities.appendSlash(base) + type + "/" + id;
} }
@Override
public BestPracticeWarningLevel getBasePracticeWarningLevel() { public BestPracticeWarningLevel getBasePracticeWarningLevel() {
return bpWarnings; return bpWarnings;
} }
@ -1416,6 +1417,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
this.anyExtensionsAllowed = anyExtensionsAllowed; this.anyExtensionsAllowed = anyExtensionsAllowed;
} }
@Override
public void setBestPracticeWarningLevel(BestPracticeWarningLevel value) { public void setBestPracticeWarningLevel(BestPracticeWarningLevel value) {
bpWarnings = value; bpWarnings = value;
} }
@ -1429,10 +1431,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
this.suppressLoincSnomedMessages = suppressLoincSnomedMessages; this.suppressLoincSnomedMessages = suppressLoincSnomedMessages;
} }
@Override
public IdStatus getResourceIdRule() { public IdStatus getResourceIdRule() {
return resourceIdRule; return resourceIdRule;
} }
@Override
public void setResourceIdRule(IdStatus resourceIdRule) { public void setResourceIdRule(IdStatus resourceIdRule) {
this.resourceIdRule = resourceIdRule; this.resourceIdRule = resourceIdRule;
} }

View File

@ -35,6 +35,7 @@ public class ContainedDt extends BaseContainedDt {
@Child(name = "resource", type = IResource.class, order = 0, min = 0, max = Child.MAX_UNLIMITED) @Child(name = "resource", type = IResource.class, order = 0, min = 0, max = Child.MAX_UNLIMITED)
private List<IResource> myContainedResources; private List<IResource> myContainedResources;
@Override
public List<IResource> getContainedResources() { public List<IResource> getContainedResources() {
if (myContainedResources == null) { if (myContainedResources == null) {
myContainedResources = new ArrayList<IResource>(); myContainedResources = new ArrayList<IResource>();

View File

@ -114,7 +114,8 @@ public class NarrativeDt extends BaseNarrativeDt {
* The status of the narrative - whether it's entirely generated (from just the defined data or the extensions too), or whether a human authored it and it may contain additional data * The status of the narrative - whether it's entirely generated (from just the defined data or the extensions too), or whether a human authored it and it may contain additional data
* </p> * </p>
*/ */
public BoundCodeDt<NarrativeStatusEnum> getStatus() { @Override
public BoundCodeDt<NarrativeStatusEnum> getStatus() {
if (myStatus == null) { if (myStatus == null) {
myStatus = new BoundCodeDt<NarrativeStatusEnum>(NarrativeStatusEnum.VALUESET_BINDER); myStatus = new BoundCodeDt<NarrativeStatusEnum>(NarrativeStatusEnum.VALUESET_BINDER);
} }
@ -170,7 +171,8 @@ public class NarrativeDt extends BaseNarrativeDt {
* The actual narrative content, a stripped down version of XHTML * The actual narrative content, a stripped down version of XHTML
* </p> * </p>
*/ */
public XhtmlDt getDiv() { @Override
public XhtmlDt getDiv() {
if (myDiv == null) { if (myDiv == null) {
myDiv = new XhtmlDt(); myDiv = new XhtmlDt();
} }

View File

@ -162,7 +162,8 @@ public class ResourceReferenceDt
* A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources * A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources
* </p> * </p>
*/ */
public IdDt getReference() { @Override
public IdDt getReference() {
if (myReference == null) { if (myReference == null) {
myReference = new IdDt(); myReference = new IdDt();
} }
@ -183,6 +184,7 @@ public class ResourceReferenceDt
* A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources * A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources
* </p> * </p>
*/ */
@Override
public ResourceReferenceDt setReference(IdDt theValue) { public ResourceReferenceDt setReference(IdDt theValue) {
myReference = theValue; myReference = theValue;
return this; return this;
@ -196,7 +198,8 @@ public class ResourceReferenceDt
* A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources * A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources
* </p> * </p>
*/ */
public ResourceReferenceDt setReference( String theId) { @Override
public ResourceReferenceDt setReference(String theId) {
myReference = new IdDt(theId); myReference = new IdDt(theId);
return this; return this;
} }
@ -240,7 +243,8 @@ public class ResourceReferenceDt
* Plain text narrative that identifies the resource in addition to the resource reference * Plain text narrative that identifies the resource in addition to the resource reference
* </p> * </p>
*/ */
public ResourceReferenceDt setDisplay( String theString) { @Override
public ResourceReferenceDt setDisplay(String theString) {
myDisplay = new StringDt(theString); myDisplay = new StringDt(theString);
return this; return this;
} }

View File

@ -313,10 +313,12 @@ public abstract class BaseResource extends BaseElement implements IResource {
myContained = theContained; myContained = theContained;
} }
@Override
public void setId(IdDt theId) { public void setId(IdDt theId) {
myId = theId; myId = theId;
} }
@Override
public BaseResource setId(IIdType theId) { public BaseResource setId(IIdType theId) {
if (theId instanceof IdDt) { if (theId instanceof IdDt) {
myId = (IdDt) theId; myId = (IdDt) theId;
@ -328,6 +330,7 @@ public abstract class BaseResource extends BaseElement implements IResource {
return this; return this;
} }
@Override
public BaseResource setId(String theId) { public BaseResource setId(String theId) {
if (theId == null) { if (theId == null) {
myId = null; myId = null;

View File

@ -142,6 +142,7 @@ public class FhirContextDstu2Test {
final CountDownLatch allDone = new CountDownLatch(numThreads); final CountDownLatch allDone = new CountDownLatch(numThreads);
for (final Runnable submittedTestRunnable : runnables) { for (final Runnable submittedTestRunnable : runnables) {
threadPool.submit(new Runnable() { threadPool.submit(new Runnable() {
@Override
public void run() { public void run() {
allExecutorThreadsReady.countDown(); allExecutorThreadsReady.countDown();
try { try {

View File

@ -17,6 +17,7 @@ public class CustomMedicationOrderDstu2 extends MedicationOrder {
@Child(name = "medication", order = Child.REPLACE_PARENT, min = 1, max = 1, summary = false, modifier = false, type = { Medication.class }) @Child(name = "medication", order = Child.REPLACE_PARENT, min = 1, max = 1, summary = false, modifier = false, type = { Medication.class })
private ResourceReferenceDt myMedication; private ResourceReferenceDt myMedication;
@Override
public ResourceReferenceDt getMedication() { public ResourceReferenceDt getMedication() {
return myMedication; return myMedication;
} }

View File

@ -7,10 +7,7 @@ import ca.uhn.fhir.model.dstu2.resource.Bundle;
import ca.uhn.fhir.model.dstu2.resource.Bundle.Link; import ca.uhn.fhir.model.dstu2.resource.Bundle.Link;
import ca.uhn.fhir.model.dstu2.resource.Patient; import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.rest.annotation.Create; import ca.uhn.fhir.rest.annotation.*;
import ca.uhn.fhir.rest.annotation.RequiredParam;
import ca.uhn.fhir.rest.annotation.ResourceParam;
import ca.uhn.fhir.rest.annotation.Search;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.MethodOutcome;
@ -41,6 +38,7 @@ import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -407,6 +405,70 @@ public class SearchDstu2Test {
assertEquals("Patient", ourLastRef.getResourceType()); assertEquals("Patient", ourLastRef.getResourceType());
} }
/**
* Verifies proper method binding to handle special search names(_id:[modifier], _language:[modifier])
*/
@Test
public void testSearchByIdExact() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_id:exact=aaa&reference=value");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent(), Charset.defaultCharset());
IOUtils.closeQuietly(status.getEntity().getContent());
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
assertEquals("idProvider", ourLastMethod);
}
@Test
public void testSearchByQualifiedIdQualifiedString() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_id:exact=aaa&stringParam:exact=value");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent(), Charset.defaultCharset());
IOUtils.closeQuietly(status.getEntity().getContent());
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
assertEquals("stringParam:true:true", ourLastMethod);
}
@Test
public void testSearchByQualifiedString() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_id=aaa&stringParam:exact=value");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent(), Charset.defaultCharset());
IOUtils.closeQuietly(status.getEntity().getContent());
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
assertEquals("stringParam:false:true", ourLastMethod);
}
@Test
public void testSearchByQualifiedIdString() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_id:exact=aaa&stringParam=value");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent(), Charset.defaultCharset());
IOUtils.closeQuietly(status.getEntity().getContent());
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
assertEquals("stringParam:true:false", ourLastMethod);
}
@Test
public void testSearchByIdString() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_id=aaa&stringParam=value");
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent(), Charset.defaultCharset());
IOUtils.closeQuietly(status.getEntity().getContent());
ourLog.info(responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
assertEquals("stringParam:false:false", ourLastMethod);
}
@Test @Test
public void testSearchWhitelist01Failing() throws Exception { public void testSearchWhitelist01Failing() throws Exception {
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=searchWhitelist01&ref=value"); HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_query=searchWhitelist01&ref=value");
@ -439,12 +501,13 @@ public class SearchDstu2Test {
ourServer = new Server(0); ourServer = new Server(0);
DummyPatientResourceProvider patientProvider = new DummyPatientResourceProvider(); DummyPatientResourceProvider patientProvider = new DummyPatientResourceProvider();
DummyPatientResourceNoIdProvider patientResourceNoIdProviderProvider = new DummyPatientResourceNoIdProvider();
ServletHandler proxyHandler = new ServletHandler(); ServletHandler proxyHandler = new ServletHandler();
ourServlet = new RestfulServer(ourCtx); ourServlet = new RestfulServer(ourCtx);
ourServlet.setPagingProvider(new FifoMemoryPagingProvider(10)); ourServlet.setPagingProvider(new FifoMemoryPagingProvider(10));
ourServlet.setDefaultResponseEncoding(EncodingEnum.XML); ourServlet.setDefaultResponseEncoding(EncodingEnum.XML);
ourServlet.setResourceProviders(patientProvider); ourServlet.setResourceProviders(patientResourceNoIdProviderProvider, patientProvider);
ServletHolder servletHolder = new ServletHolder(ourServlet); ServletHolder servletHolder = new ServletHolder(ourServlet);
proxyHandler.addServletWithMapping(servletHolder, "/*"); proxyHandler.addServletWithMapping(servletHolder, "/*");
@ -459,6 +522,23 @@ public class SearchDstu2Test {
} }
public static class DummyPatientResourceNoIdProvider implements IResourceProvider {
@Override
public Class<? extends IResource> getResourceType() {
return Patient.class;
}
//@formatter:off
@Search()
public List<Patient> searchByRef(
@RequiredParam(name = "reference") ReferenceParam theParam) {
ourLastMethod = "noIdProvider";
return Collections.emptyList();
}
//@formatter:on
}
public static class DummyPatientResourceProvider implements IResourceProvider { public static class DummyPatientResourceProvider implements IResourceProvider {
@Override @Override
@ -482,7 +562,27 @@ public class SearchDstu2Test {
public MethodOutcome create(@ResourceParam Patient thePatient) { public MethodOutcome create(@ResourceParam Patient thePatient) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
//@formatter:off
@Search()
public List<Patient> searchByIdRef(
@RequiredParam(name="_id") StringParam id,
@OptionalParam(name = "reference") ReferenceParam theParam) {
ourLastMethod = "idProvider";
return Collections.emptyList();
}
//@formatter:on
//@formatter:off
@Search()
public List<Patient> searchByQualifiedString(
@RequiredParam(name="_id") StringParam id,
@RequiredParam(name = "stringParam") StringParam stringParam) {
ourLastMethod = "stringParam:" + id.isExact() + ":" + stringParam.isExact();
return Collections.emptyList();
}
//@formatter:on
//@formatter:off //@formatter:off
@Search() @Search()
public List<Patient> searchDateAndList( public List<Patient> searchDateAndList(

View File

@ -787,6 +787,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
return Utilities.appendSlash(base) + type + "/" + id; return Utilities.appendSlash(base) + type + "/" + id;
} }
@Override
public BestPracticeWarningLevel getBasePracticeWarningLevel() { public BestPracticeWarningLevel getBasePracticeWarningLevel() {
return bpWarnings; return bpWarnings;
} }
@ -941,10 +942,12 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
return context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + type); return context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + type);
} }
@Override
public IdStatus getResourceIdRule() { public IdStatus getResourceIdRule() {
return resourceIdRule; return resourceIdRule;
} }
@Override
public void setResourceIdRule(IdStatus resourceIdRule) { public void setResourceIdRule(IdStatus resourceIdRule) {
this.resourceIdRule = resourceIdRule; this.resourceIdRule = resourceIdRule;
} }
@ -1209,6 +1212,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
return sd.getSnapshot().getElement().get(0); return sd.getSnapshot().getElement().get(0);
} }
@Override
public void setBestPracticeWarningLevel(BestPracticeWarningLevel value) { public void setBestPracticeWarningLevel(BestPracticeWarningLevel value) {
bpWarnings = value; bpWarnings = value;
} }
@ -2071,6 +2075,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
this.typeProfile = typeProfile; this.typeProfile = typeProfile;
} }
@Override
public boolean equalsDeep(Base other) { public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other) || !fhirType().equals(other.fhirType())) if (!super.equalsDeep(other) || !fhirType().equals(other.fhirType()))
return false; return false;
@ -2153,6 +2158,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
return true; return true;
} }
@Override
public boolean isPrimitive() { public boolean isPrimitive() {
String t = fhirType(); String t = fhirType();
return t.equalsIgnoreCase("boolean") || t.equalsIgnoreCase("integer") || t.equalsIgnoreCase("string") || t.equalsIgnoreCase("decimal") || t.equalsIgnoreCase("uri") || t.equalsIgnoreCase("base64Binary") || return t.equalsIgnoreCase("boolean") || t.equalsIgnoreCase("integer") || t.equalsIgnoreCase("string") || t.equalsIgnoreCase("decimal") || t.equalsIgnoreCase("uri") || t.equalsIgnoreCase("base64Binary") ||
@ -2188,6 +2194,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
return list; return list;
} }
@Override
public String primitiveValue() { public String primitiveValue() {
return wrapper.getAttribute("value"); return wrapper.getAttribute("value");
} }

View File

@ -23,6 +23,7 @@ public class ProfileValidator extends BaseValidator {
this.context = context; this.context = context;
} }
@Override
protected boolean rule(List<ValidationMessage> errors, IssueType type, String path, boolean b, String msg) { protected boolean rule(List<ValidationMessage> errors, IssueType type, String path, boolean b, String msg) {
String rn = path.contains(".") ? path.substring(0, path.indexOf(".")) : path; String rn = path.contains(".") ? path.substring(0, path.indexOf(".")) : path;
return super.rule(errors, type, path, b, msg, "<a href=\""+(rn.toLowerCase())+".html\">"+rn+"</a>: "+Utilities.escapeXml(msg)); return super.rule(errors, type, path, b, msg, "<a href=\""+(rn.toLowerCase())+".html\">"+rn+"</a>: "+Utilities.escapeXml(msg));

View File

@ -126,7 +126,8 @@ public class CodingDt
* The identification of the code system that defines the meaning of the symbol in the code. * The identification of the code system that defines the meaning of the symbol in the code.
* </p> * </p>
*/ */
public UriDt getSystemElement() { @Override
public UriDt getSystemElement() {
if (mySystem == null) { if (mySystem == null) {
mySystem = new UriDt(); mySystem = new UriDt();
} }
@ -144,7 +145,8 @@ public class CodingDt
* The identification of the code system that defines the meaning of the symbol in the code. * The identification of the code system that defines the meaning of the symbol in the code.
* </p> * </p>
*/ */
public String getSystem() { @Override
public String getSystem() {
return getSystemElement().getValue(); return getSystemElement().getValue();
} }
@ -171,7 +173,8 @@ public class CodingDt
* The identification of the code system that defines the meaning of the symbol in the code. * The identification of the code system that defines the meaning of the symbol in the code.
* </p> * </p>
*/ */
public CodingDt setSystem( String theUri) { @Override
public CodingDt setSystem(String theUri) {
mySystem = new UriDt(theUri); mySystem = new UriDt(theUri);
return this; return this;
} }
@ -248,7 +251,8 @@ public class CodingDt
* A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination) * A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination)
* </p> * </p>
*/ */
public CodeDt getCodeElement() { @Override
public CodeDt getCodeElement() {
if (myCode == null) { if (myCode == null) {
myCode = new CodeDt(); myCode = new CodeDt();
} }
@ -266,7 +270,8 @@ public class CodingDt
* A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination) * A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination)
* </p> * </p>
*/ */
public String getCode() { @Override
public String getCode() {
return getCodeElement().getValue(); return getCodeElement().getValue();
} }
@ -293,7 +298,8 @@ public class CodingDt
* A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination) * A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination)
* </p> * </p>
*/ */
public CodingDt setCode( String theCode) { @Override
public CodingDt setCode(String theCode) {
myCode = new CodeDt(theCode); myCode = new CodeDt(theCode);
return this; return this;
} }
@ -309,7 +315,8 @@ public class CodingDt
* A representation of the meaning of the code in the system, following the rules of the system * A representation of the meaning of the code in the system, following the rules of the system
* </p> * </p>
*/ */
public StringDt getDisplayElement() { @Override
public StringDt getDisplayElement() {
if (myDisplay == null) { if (myDisplay == null) {
myDisplay = new StringDt(); myDisplay = new StringDt();
} }
@ -327,7 +334,8 @@ public class CodingDt
* A representation of the meaning of the code in the system, following the rules of the system * A representation of the meaning of the code in the system, following the rules of the system
* </p> * </p>
*/ */
public String getDisplay() { @Override
public String getDisplay() {
return getDisplayElement().getValue(); return getDisplayElement().getValue();
} }
@ -354,7 +362,8 @@ public class CodingDt
* A representation of the meaning of the code in the system, following the rules of the system * A representation of the meaning of the code in the system, following the rules of the system
* </p> * </p>
*/ */
public CodingDt setDisplay( String theString) { @Override
public CodingDt setDisplay(String theString) {
myDisplay = new StringDt(theString); myDisplay = new StringDt(theString);
return this; return this;
} }
@ -423,4 +432,4 @@ public class CodingDt
} }

View File

@ -104,7 +104,8 @@ public class NarrativeDt extends BaseNarrativeDt {
* The actual narrative content, a stripped down version of XHTML * The actual narrative content, a stripped down version of XHTML
* </p> * </p>
*/ */
public XhtmlDt getDiv() { @Override
public XhtmlDt getDiv() {
if (myDiv == null) { if (myDiv == null) {
myDiv = new XhtmlDt(); myDiv = new XhtmlDt();
} }

View File

@ -193,7 +193,8 @@ public class QuantityDt
* The value of the measured amount. The value includes an implicit precision in the presentation of the value * The value of the measured amount. The value includes an implicit precision in the presentation of the value
* </p> * </p>
*/ */
public DecimalDt getValueElement() { @Override
public DecimalDt getValueElement() {
if (myValue == null) { if (myValue == null) {
myValue = new DecimalDt(); myValue = new DecimalDt();
} }
@ -264,7 +265,8 @@ public class QuantityDt
* The value of the measured amount. The value includes an implicit precision in the presentation of the value * The value of the measured amount. The value includes an implicit precision in the presentation of the value
* </p> * </p>
*/ */
public QuantityDt setValue( java.math.BigDecimal theValue) { @Override
public QuantityDt setValue(java.math.BigDecimal theValue) {
myValue = new DecimalDt(theValue); myValue = new DecimalDt(theValue);
return this; return this;
} }
@ -280,7 +282,8 @@ public class QuantityDt
* How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \&quot;&lt;\&quot; , then the real value is &lt; stated value * How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \&quot;&lt;\&quot; , then the real value is &lt; stated value
* </p> * </p>
*/ */
public BoundCodeDt<QuantityComparatorEnum> getComparatorElement() { @Override
public BoundCodeDt<QuantityComparatorEnum> getComparatorElement() {
if (myComparator == null) { if (myComparator == null) {
myComparator = new BoundCodeDt<QuantityComparatorEnum>(QuantityComparatorEnum.VALUESET_BINDER); myComparator = new BoundCodeDt<QuantityComparatorEnum>(QuantityComparatorEnum.VALUESET_BINDER);
} }
@ -406,7 +409,8 @@ public class QuantityDt
* The identification of the system that provides the coded form of the unit * The identification of the system that provides the coded form of the unit
* </p> * </p>
*/ */
public UriDt getSystemElement() { @Override
public UriDt getSystemElement() {
if (mySystem == null) { if (mySystem == null) {
mySystem = new UriDt(); mySystem = new UriDt();
} }
@ -451,7 +455,8 @@ public class QuantityDt
* The identification of the system that provides the coded form of the unit * The identification of the system that provides the coded form of the unit
* </p> * </p>
*/ */
public QuantityDt setSystem( String theUri) { @Override
public QuantityDt setSystem(String theUri) {
mySystem = new UriDt(theUri); mySystem = new UriDt(theUri);
return this; return this;
} }
@ -467,7 +472,8 @@ public class QuantityDt
* A computer processable form of the unit in some unit representation system * A computer processable form of the unit in some unit representation system
* </p> * </p>
*/ */
public CodeDt getCodeElement() { @Override
public CodeDt getCodeElement() {
if (myCode == null) { if (myCode == null) {
myCode = new CodeDt(); myCode = new CodeDt();
} }
@ -512,7 +518,8 @@ public class QuantityDt
* A computer processable form of the unit in some unit representation system * A computer processable form of the unit in some unit representation system
* </p> * </p>
*/ */
public QuantityDt setCode( String theCode) { @Override
public QuantityDt setCode(String theCode) {
myCode = new CodeDt(theCode); myCode = new CodeDt(theCode);
return this; return this;
} }
@ -520,4 +527,4 @@ public class QuantityDt
} }

View File

@ -162,7 +162,8 @@ public class ResourceReferenceDt
* A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources * A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources
* </p> * </p>
*/ */
public IdDt getReference() { @Override
public IdDt getReference() {
if (myReference == null) { if (myReference == null) {
myReference = new IdDt(); myReference = new IdDt();
} }
@ -183,6 +184,7 @@ public class ResourceReferenceDt
* A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources * A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources
* </p> * </p>
*/ */
@Override
public ResourceReferenceDt setReference(IdDt theValue) { public ResourceReferenceDt setReference(IdDt theValue) {
myReference = theValue; myReference = theValue;
return this; return this;
@ -196,7 +198,8 @@ public class ResourceReferenceDt
* A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources * A reference to a location at which the other resource is found. The reference may a relative reference, in which case it is relative to the service base URL, or an absolute URL that resolves to the location where the resource is found. The reference may be version specific or not. If the reference is not to a FHIR RESTful server, then it should be assumed to be version specific. Internal fragment references (start with '#') refer to contained resources
* </p> * </p>
*/ */
public ResourceReferenceDt setReference( String theId) { @Override
public ResourceReferenceDt setReference(String theId) {
myReference = new IdDt(theId); myReference = new IdDt(theId);
return this; return this;
} }
@ -240,7 +243,8 @@ public class ResourceReferenceDt
* Plain text narrative that identifies the resource in addition to the resource reference * Plain text narrative that identifies the resource in addition to the resource reference
* </p> * </p>
*/ */
public ResourceReferenceDt setDisplay( String theString) { @Override
public ResourceReferenceDt setDisplay(String theString) {
myDisplay = new StringDt(theString); myDisplay = new StringDt(theString);
return this; return this;
} }

View File

@ -59,6 +59,7 @@ public class ResourceBlock extends Child {
return getClassName(); return getClassName();
} }
@Override
public boolean isBlock() { public boolean isBlock() {
return true; return true;
} }

View File

@ -1,130 +1,131 @@
package ca.uhn.fhir.tinder.util; package ca.uhn.fhir.tinder.util;
import java.io.InputStream; import java.io.InputStream;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.Writer; import java.io.Writer;
import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMConfiguration;
import org.w3c.dom.DOMErrorHandler; import org.w3c.dom.DOMErrorHandler;
import org.w3c.dom.DOMImplementation; import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.bootstrap.DOMImplementationRegistry; import org.w3c.dom.bootstrap.DOMImplementationRegistry;
import org.w3c.dom.ls.DOMImplementationLS; import org.w3c.dom.ls.DOMImplementationLS;
import org.w3c.dom.ls.LSInput; import org.w3c.dom.ls.LSInput;
import org.w3c.dom.ls.LSOutput; import org.w3c.dom.ls.LSOutput;
import org.w3c.dom.ls.LSParser; import org.w3c.dom.ls.LSParser;
import org.w3c.dom.ls.LSResourceResolver; import org.w3c.dom.ls.LSResourceResolver;
import org.w3c.dom.ls.LSSerializer; import org.w3c.dom.ls.LSSerializer;
public class XMLUtils { public class XMLUtils {
private static DOMImplementation IMPL; private static DOMImplementation IMPL;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public synchronized static <T> T getDOMImpl() { public synchronized static <T> T getDOMImpl() {
if (IMPL == null) { if (IMPL == null) {
try { try {
DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
IMPL = registry.getDOMImplementation("LS 3.0"); IMPL = registry.getDOMImplementation("LS 3.0");
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
return (T) IMPL; return (T) IMPL;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static <T> T getDOMImplUncached() { public static <T> T getDOMImplUncached() {
try { try {
DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
return (T) registry.getDOMImplementation("LS 3.0"); return (T) registry.getDOMImplementation("LS 3.0");
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
} }
public static Document parse(String s) { public static Document parse(String s) {
return parse(s, false); return parse(s, false);
} }
public static Document parse(String s, boolean validateIfSchema) { public static Document parse(String s, boolean validateIfSchema) {
DOMImplementationLS impl = getDOMImpl(); DOMImplementationLS impl = getDOMImpl();
LSInput input = impl.createLSInput(); LSInput input = impl.createLSInput();
input.setStringData(s); input.setStringData(s);
return parse(input, validateIfSchema); return parse(input, validateIfSchema);
} }
public static Document parse(InputStream s, boolean validateIfSchema) { public static Document parse(InputStream s, boolean validateIfSchema) {
DOMImplementationLS impl = getDOMImpl(); DOMImplementationLS impl = getDOMImpl();
LSInput input = impl.createLSInput(); LSInput input = impl.createLSInput();
input.setByteStream(s); input.setByteStream(s);
return parse(input, validateIfSchema); return parse(input, validateIfSchema);
} }
private static Document parse(LSInput input, boolean validateIfSchema) { private static Document parse(LSInput input, boolean validateIfSchema) {
DOMImplementationLS impl = getDOMImpl(); DOMImplementationLS impl = getDOMImpl();
LSParser parser = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null); LSParser parser = impl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
DOMConfiguration config = parser.getDomConfig(); DOMConfiguration config = parser.getDomConfig();
config.setParameter("element-content-whitespace", false); config.setParameter("element-content-whitespace", false);
config.setParameter("namespaces", true); config.setParameter("namespaces", true);
config.setParameter("validate-if-schema", validateIfSchema); config.setParameter("validate-if-schema", validateIfSchema);
return parser.parse(input); return parser.parse(input);
} }
public static void validate(Document d, String schema, DOMErrorHandler handler) { public static void validate(Document d, String schema, DOMErrorHandler handler) {
DOMConfiguration config = d.getDomConfig(); DOMConfiguration config = d.getDomConfig();
config.setParameter("schema-type", "http://www.w3.org/2001/XMLSchema"); config.setParameter("schema-type", "http://www.w3.org/2001/XMLSchema");
config.setParameter("validate", true); config.setParameter("validate", true);
config.setParameter("schema-location", schema); config.setParameter("schema-location", schema);
config.setParameter("resource-resolver", new ClasspathResourceResolver()); config.setParameter("resource-resolver", new ClasspathResourceResolver());
config.setParameter("error-handler", handler); config.setParameter("error-handler", handler);
d.normalizeDocument(); d.normalizeDocument();
} }
public static String serialize(Document document, boolean prettyPrint) { public static String serialize(Document document, boolean prettyPrint) {
DOMImplementationLS impl = getDOMImpl(); DOMImplementationLS impl = getDOMImpl();
LSSerializer serializer = impl.createLSSerializer(); LSSerializer serializer = impl.createLSSerializer();
// document.normalizeDocument(); // document.normalizeDocument();
DOMConfiguration config = serializer.getDomConfig(); DOMConfiguration config = serializer.getDomConfig();
if (prettyPrint && config.canSetParameter("format-pretty-print", Boolean.TRUE)) { if (prettyPrint && config.canSetParameter("format-pretty-print", Boolean.TRUE)) {
config.setParameter("format-pretty-print", true); config.setParameter("format-pretty-print", true);
} }
config.setParameter("xml-declaration", true); config.setParameter("xml-declaration", true);
LSOutput output = impl.createLSOutput(); LSOutput output = impl.createLSOutput();
output.setEncoding("UTF-8"); output.setEncoding("UTF-8");
Writer writer = new StringWriter(); Writer writer = new StringWriter();
output.setCharacterStream(writer); output.setCharacterStream(writer);
serializer.write(document, output); serializer.write(document, output);
return writer.toString(); return writer.toString();
} }
public static Document emptyDocument(String title) { public static Document emptyDocument(String title) {
DOMImplementation impl = getDOMImpl(); DOMImplementation impl = getDOMImpl();
Document doc = impl.createDocument("urn:hl7-org:v2xml", title, null); Document doc = impl.createDocument("urn:hl7-org:v2xml", title, null);
return doc; return doc;
} }
/** /**
* This is an implementation of LSResourceResolver that can resolve XML schemas from the * This is an implementation of LSResourceResolver that can resolve XML schemas from the
* classpath * classpath
*/ */
private static class ClasspathResourceResolver implements LSResourceResolver { private static class ClasspathResourceResolver implements LSResourceResolver {
private DOMImplementationLS impl; private DOMImplementationLS impl;
ClasspathResourceResolver() { ClasspathResourceResolver() {
impl = getDOMImpl(); impl = getDOMImpl();
} }
public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, @Override
String baseURI) { public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId,
LSInput lsInput = impl.createLSInput(); String baseURI) {
InputStream is = getClass().getResourceAsStream("/" + systemId); LSInput lsInput = impl.createLSInput();
if (is == null) InputStream is = getClass().getResourceAsStream("/" + systemId);
return null; if (is == null)
lsInput.setByteStream(is); return null;
return lsInput; lsInput.setByteStream(is);
} return lsInput;
} }
}
}
}

View File

@ -24,6 +24,7 @@ package org.hl7.fhir.dstu2.model;
public interface IIdType extends IBase { public interface IIdType extends IBase {
@Override
boolean isEmpty(); boolean isEmpty();
/** /**

View File

@ -555,6 +555,10 @@
<developer> <developer>
<id>jaferkhan</id> <id>jaferkhan</id>
</developer> </developer>
<developer>
<id>CodeAndChoke</id>
<name>Long Nguyen</name>
</developer>
</developers> </developers>
<licenses> <licenses>

View File

@ -296,6 +296,20 @@
project has been fixed. Thanks to GitHub user @jaferkhan for the pull project has been fixed. Thanks to GitHub user @jaferkhan for the pull
request! request!
</action> </action>
<action type="add">
A docker compose script for the hapi-fhir-jpaserver-starter project was added. Thanks to
Long Nguyen for the pull request!
</action>
<action type="add" issue="1476">
A number of overridden methods in the HAPI FHIR codebase did not have the
@Override annotation. Thanks to Clayton Bodendein for cleaning this up!
</action>
<action type"add" issue="1373">
Plain server resource providers were not correctly matching methods that
had the _id search parameter if a client performed a request using a modifier
such as :not or :exact. Thanks to Petro Mykhailyshyn
for the pull request!
</action>
</release> </release>
<release version="4.0.3" date="2019-09-03" description="Igloo (Point Release)"> <release version="4.0.3" date="2019-09-03" description="Igloo (Point Release)">
<action type="fix"> <action type="fix">