Use HL7 FHIR Core Structures (#1382)

* Ongoing work on core structures suport

* Ongoing work on this merge

* Ongoing work to clean up structures

* Credit for #1179

* Address compile issues

* Latest changes

* Work on parallel execution

* Work on getting tests passing

* Add H2 to migrator

* Test fix
This commit is contained in:
James Agnew 2019-07-14 10:16:40 -04:00 committed by GitHub
parent 534c71c1d5
commit 120b93f204
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4370 changed files with 1088 additions and 2061849 deletions

View File

@ -0,0 +1,3 @@
1549576047000
(?:[^/]+/)*?[^/]*?
META-INF(?:$|/.+)

View File

@ -13,8 +13,8 @@ public class ConverterExamples {
VersionConvertor_10_30 converter = new VersionConvertor_10_30(advisor);
// Create an input resource to convert
org.hl7.fhir.instance.model.Observation input = new org.hl7.fhir.instance.model.Observation();
input.setEncounter(new org.hl7.fhir.instance.model.Reference("Encounter/123"));
org.hl7.fhir.dstu2.model.Observation input = new org.hl7.fhir.dstu2.model.Observation();
input.setEncounter(new org.hl7.fhir.dstu2.model.Reference("Encounter/123"));
// Convert the resource
org.hl7.fhir.dstu3.model.Observation output = converter.convertObservation(input);

View File

@ -36,7 +36,7 @@ public enum FhirVersionEnum {
DSTU2("ca.uhn.fhir.model.dstu2.FhirDstu2", null, false, new Version("1.0.2")),
DSTU2_HL7ORG("org.hl7.fhir.instance.FhirDstu2Hl7Org", DSTU2, true, new Version("1.0.2")),
DSTU2_HL7ORG("org.hl7.fhir.dstu2.hapi.ctx.FhirDstu2Hl7Org", DSTU2, true, new Version("1.0.2")),
DSTU2_1("org.hl7.fhir.dstu2016may.hapi.ctx.FhirDstu2_1", null, true, new Version("1.4.0")),

View File

@ -81,4 +81,18 @@ public enum TemporalPrecisionEnum {
return myCalendarConstant;
}
/**
* Given the standard string representation - YYYY-DD-MMTHH:NN:SS.SSS - how long is the string for the stated precision?
*/
public int stringLength() {
switch (this) {
case YEAR: return 4;
case MONTH: return 7;
case DAY: return 10;
case MINUTE: return 16;
case SECOND: return 19;
case MILLI: return 23;
}
return 0; // ??
}
}

View File

@ -77,7 +77,7 @@ public interface IQuery<Y> extends IBaseQuery<IQuery<Y>>, IClientExecutable<IQue
IQuery<Y> limitTo(int theLimitTo);
/**
* Request that the client return the specified bundle type, e.g. <code>org.hl7.fhir.instance.model.Bundle.class</code>
* Request that the client return the specified bundle type, e.g. <code>org.hl7.fhir.dstu2.model.Bundle.class</code>
* or <code>ca.uhn.fhir.model.dstu2.resource.Bundle.class</code>
*/
<B extends IBaseBundle> IQuery<B> returnBundle(Class<B> theClass);

View File

@ -21,10 +21,10 @@ package ca.uhn.fhir.cli;
*/
import org.hl7.fhir.instance.hapi.validation.IValidationSupport;
import org.hl7.fhir.instance.model.StructureDefinition;
import org.hl7.fhir.instance.model.ValueSet;
import org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent;
import org.hl7.fhir.dstu2.model.StructureDefinition;
import org.hl7.fhir.dstu2.model.ValueSet;
import org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent;
import org.hl7.fhir.instance.model.api.IBaseResource;
import ca.uhn.fhir.context.FhirContext;

View File

@ -164,7 +164,7 @@ public class ValidateCommand extends BaseCommand {
}
if (localProfileResource != null) {
org.hl7.fhir.instance.model.StructureDefinition convertedSd = FhirContext.forDstu2Hl7Org().newXmlParser().parseResource(org.hl7.fhir.instance.model.StructureDefinition.class, ctx.newXmlParser().encodeResourceToString(localProfileResource));
org.hl7.fhir.dstu2.model.StructureDefinition convertedSd = FhirContext.forDstu2Hl7Org().newXmlParser().parseResource(org.hl7.fhir.dstu2.model.StructureDefinition.class, ctx.newXmlParser().encodeResourceToString(localProfileResource));
instanceValidator.setStructureDefintion(convertedSd);
}
if (theCommandLine.hasOption("r")) {

View File

@ -10,7 +10,8 @@
</parent>
<artifactId>hapi-fhir-converter</artifactId>
<packaging>bundle</packaging>
<!-- TODO: BND changed to jar temporarily -->
<packaging>jar</packaging>
<dependencies>
<dependency>
@ -18,6 +19,11 @@
<artifactId>hapi-fhir-base</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>org.hl7.fhir.convertors</artifactId>
<version>${fhir_core_version}</version>
</dependency>
<!-- Server -->
<dependency>
@ -75,6 +81,11 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
</dependency>
<!-- Testing -->
<dependency>
<groupId>ch.qos.logback</groupId>
@ -141,6 +152,10 @@
</resource>
</resources>
<plugins>
<!--
TODO: BND
With this enabled, JAR file contains a bunch of .class files that
seem to get copied in from org.hl7.fhir.convertors
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
@ -155,6 +170,7 @@
</instructions>
</configuration>
</plugin>
-->
</plugins>
</build>
</project>

View File

@ -121,11 +121,11 @@ public class VersionedApiConverterInterceptor extends InterceptorAdapter {
return true;
}
private org.hl7.fhir.instance.model.Resource toDstu2(IBaseResource theResponseResource) {
private org.hl7.fhir.dstu2.model.Resource toDstu2(IBaseResource theResponseResource) {
if (theResponseResource instanceof IResource) {
return (org.hl7.fhir.instance.model.Resource) myCtxDstu2Hl7Org.newJsonParser().parseResource(myCtxDstu2.newJsonParser().encodeResourceToString(theResponseResource));
return (org.hl7.fhir.dstu2.model.Resource) myCtxDstu2Hl7Org.newJsonParser().parseResource(myCtxDstu2.newJsonParser().encodeResourceToString(theResponseResource));
}
return (org.hl7.fhir.instance.model.Resource) theResponseResource;
return (org.hl7.fhir.dstu2.model.Resource) theResponseResource;
}
private Resource toDstu3(IBaseResource theResponseResource) {

View File

@ -1,282 +0,0 @@
package org.hl7.fhir.convertors;
/*-
* #%L
* HAPI FHIR - Converter
* %%
* Copyright (C) 2014 - 2019 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.xml.XMLUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
public class CDAUtilities {
private Document doc;
public CDAUtilities(InputStream stream) throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
DocumentBuilder builder = factory.newDocumentBuilder();
doc = builder.parse(stream);
basicChecks();
}
private void basicChecks() throws Exception {
Element e = doc.getDocumentElement();
rule(e.getNamespaceURI().equals("urn:hl7-org:v3"), "CDA namespace must be ");
rule(e.getNodeName().equals("ClinicalDocument"), "CDA root name must be ClinicalDocument");
}
private void rule(boolean test, String message) throws Exception {
if (!test)
throw new Exception(message);
}
public Element getElement() {
return doc.getDocumentElement();
}
public void checkTemplateId(Element e, String templateId) throws Exception {
rule(hasTemplateId(e, templateId), "Template Id '"+templateId+"' not found");
}
public Element getChild(Element e, String[] names) throws Exception {
for (String n : names) {
if (e == null)
return null;
e = getChild(e, n);
}
return e;
}
public Element getChild(Element element, String name) throws Exception {
if (element == null)
return null;
Element e = null;
Node n = element.getFirstChild();
while (n != null) {
if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name)) {
if (e == null) {
e = (Element) n;
} else {
throw new Exception("multiple matches found for "+name);
}
}
n = n.getNextSibling();
}
return e;
}
public Element getChildByAttribute(Element element, String name, String attrname, String value) throws Exception {
if (element == null)
return null;
Element e = null;
Node n = element.getFirstChild();
while (n != null) {
if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name) && value.equals(((Element) n).getAttribute(attrname))) {
if (e == null) {
e = (Element) n;
} else {
throw new Exception("multiple matches found for "+name);
}
}
n = n.getNextSibling();
}
return e;
}
public List<Element> getChildren(Element element, String name) {
List<Element> l = new ArrayList<Element>();
if (element != null) {
Node n = element.getFirstChild();
while (n != null) {
if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name)) {
l.add((Element) n);
}
n = n.getNextSibling();
}
}
return l;
}
public Element getDescendent(Element element, String path) throws Exception {
String[] p = path.split("\\/");
return getDescendent(element, p);
}
public Element getDescendent(Element e, String[] path) throws Exception {
for (String n : path) {
if (e == null)
return e;
e = getChild(e, n);
}
return e;
}
public boolean hasTemplateId(Element e, String tid) {
if (e == null)
return false;
boolean found = false;
Node n = e.getFirstChild();
while (n != null && !found) {
if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals("templateId") && tid.equals(((Element) n).getAttribute("root")))
found = true;
n = n.getNextSibling();
}
return found;
}
public String getStatus(Element act) throws Exception {
if (act == null)
return null;
Element sc = getChild(act, "statusCode");
if (sc == null)
return null;
else
return sc.getAttribute("code");
}
public String getSeverity(Element observation) throws Exception {
for (Element e : getChildren(observation, "entryRelationship")) {
Element child = getChild(e, "observation");
if (hasTemplateId(child, "2.16.840.1.113883.10.20.22.4.8"))
return getChild(child, "value").getAttribute("code");
}
return null;
}
public String showTemplateIds(Element element) {
List<Element> list = getChildren(element, "templateId");
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
for (Element e : list) {
if (e.hasAttribute("extension"))
b.append(e.getAttribute("root")+"::"+e.getAttribute("extension"));
else
b.append(e.getAttribute("root"));
}
return b.toString();
}
public Element getlastChild(Element e) {
Node n = e.getLastChild();
while (n != null && n.getNodeType() != Node.ELEMENT_NODE)
n = n.getPreviousSibling();
return n == null ? null : (Element) n;
}
/**
* This method looks up an object by it's id, and only returns it if has a child by the given name
* (resolving identifier based cross references)
*
* @param id
* @param childName
* @return
* @throws Exception
*/
public Element getById(Element id, String childName) throws Exception {
return getById(doc.getDocumentElement(), id, childName);
}
private Element getById(Element e, Element id, String childName) throws Exception {
Element c = XMLUtil.getFirstChild(e);
while (c != null) {
Element i = getChild(c, "id");
if (i != null && matchesAsId(i, id) && getChild(c, childName) != null)
return c;
Element m = getById(c, id, childName);
if (m != null)
return m;
c = XMLUtil.getNextSibling(c);
}
return null;
}
private boolean matchesAsId(Element i1, Element i2) {
String r1 = i1.getAttribute("root");
String r2 = i2.getAttribute("root");
String e1 = i1.getAttribute("extension");
String e2 = i2.getAttribute("extension");
return (r1 != null && r1.equals(r2)) && ((e1 == null && e2 == null) || (e1 != null && e1.equals(e2)));
}
public Element getByXmlId(String id) {
return getByXmlId(doc.getDocumentElement(), id);
}
private Element getByXmlId(Element e, String value) {
Element c = XMLUtil.getFirstChild(e);
while (c != null) {
String id = c.getAttribute("ID");
if (id != null && id.equals(value))
return c;
Element m = getByXmlId(c, value);
if (m != null)
return m;
c = XMLUtil.getNextSibling(c);
}
return null;
}
}

View File

@ -1,34 +0,0 @@
package org.hl7.fhir.convertors;
/*-
* #%L
* HAPI FHIR - Converter
* %%
* Copyright (C) 2014 - 2019 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
public class CcdaExtensions {
public final static String DAF_NAME_RACE = "http://hl7.org/fhir/StructureDefinition/us-core-race";
public final static String DAF_NAME_ETHNICITY = "http://hl7.org/fhir/StructureDefinition/us-core-ethnicity";
public final static String BASE = "http://hl7.org/ccda";
public final static String NAME_RELIGION = BASE+"/religious-affiliation";
public final static String NAME_BIRTHPLACE = BASE+"birthplace";
public final static String NAME_LANG_PROF = BASE+"proficiency-level";
}

View File

@ -1,648 +0,0 @@
package org.hl7.fhir.convertors;
/*-
* #%L
* HAPI FHIR - Converter
* %%
* Copyright (C) 2014 - 2019 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.hl7.fhir.dstu3.model.Address;
import org.hl7.fhir.dstu3.model.Address.AddressUse;
import org.hl7.fhir.dstu3.model.CodeableConcept;
import org.hl7.fhir.dstu3.model.Coding;
import org.hl7.fhir.dstu3.model.ContactPoint;
import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem;
import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse;
import org.hl7.fhir.dstu3.model.DateTimeType;
import org.hl7.fhir.dstu3.model.DateType;
import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender;
import org.hl7.fhir.dstu3.model.Factory;
import org.hl7.fhir.dstu3.model.HumanName;
import org.hl7.fhir.dstu3.model.HumanName.NameUse;
import org.hl7.fhir.dstu3.model.Identifier;
import org.hl7.fhir.dstu3.model.InstantType;
import org.hl7.fhir.dstu3.model.Period;
import org.hl7.fhir.dstu3.model.Quantity;
import org.hl7.fhir.dstu3.model.Range;
import org.hl7.fhir.dstu3.model.SimpleQuantity;
import org.hl7.fhir.dstu3.model.StringType;
import org.hl7.fhir.dstu3.model.Timing;
import org.hl7.fhir.dstu3.model.Timing.EventTiming;
import org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent;
import org.hl7.fhir.dstu3.model.Timing.UnitsOfTime;
import org.hl7.fhir.dstu3.model.Type;
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
import org.hl7.fhir.utilities.OIDUtils;
import org.hl7.fhir.utilities.Utilities;
import org.fhir.ucum.UcumService;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
public class Convert {
private CDAUtilities cda;
private UcumService ucumSvc;
private Set<String> oids = new HashSet<String>();
private String defaultTimezone;
private boolean generateMissingExtensions;
public Convert(CDAUtilities cda, UcumService ucumSvc, String defaultTimezone) {
super();
this.cda = cda;
this.ucumSvc = ucumSvc;
this.defaultTimezone = defaultTimezone;
}
public Identifier makeIdentifierFromII(Element e) throws Exception {
Identifier id = new Identifier();
String r = e.getAttribute("root");
String ex;
if (e.hasAttribute("extension") && Utilities.noString(e.getAttribute("extension"))) {
if (generateMissingExtensions)
ex = UUID.randomUUID().toString();
else
throw new Exception("Broken identifier - extension is blank");
} else
ex = e.getAttribute("extension");
if (Utilities.noString(ex)) {
id.setSystem("urn:ietf:rfc:3986");
if (isGuid(r))
id.setValue("urn:uuid:"+r);
else if (UriForOid(r) != null)
id.setValue(UriForOid(r));
else
id.setValue(UriForOid(r));
} else {
if (isGuid(r))
id.setSystem("urn:uuid:"+r);
else if (UriForOid(r) != null)
id.setSystem(UriForOid(r));
else
id.setSystem("urn:oid:"+r);
id.setValue(ex);
}
return id;
}
public String makeURIfromII(Element e) {
String r = e.getAttribute("root");
if (Utilities.noString(e.getAttribute("extension"))) {
if (isGuid(r))
return "urn:uuid:"+r;
else if (UriForOid(r) != null)
return UriForOid(r);
else
return UriForOid(r);
} else {
if (isGuid(r))
return "urn:uuid:"+r+"::"+e.getAttribute("extension");
else if (UriForOid(r) != null)
return UriForOid(r)+"::"+e.getAttribute("extension");
else
return "urn:oid:"+r+"::"+e.getAttribute("extension");
}
}
private String UriForOid(String r) {
String uri = OIDUtils.getUriForOid(r);
if (uri != null)
return uri;
else {
oids.add(r);
return "urn:oid:"+r;
}
}
public boolean isGuid(String r) {
return r.matches("[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}");
}
public InstantType makeInstantFromTS(Element child) throws Exception {
InstantType i = InstantType.parseV3(child.getAttribute("value"));
return i;
}
public CodeableConcept makeCodeableConceptFromCD(Element cv) throws Exception {
if (cv == null)
return null;
CodeableConcept cc = new CodeableConcept();
cc.addCoding(makeCodingFromCV(cv));
for (Element e : cda.getChildren(cv, "translation"))
cc.addCoding(makeCodingFromCV(e));
if (cda.getChild(cv, "originalText") != null) {
Element ote = cda.getChild(cv, "originalText");
// if (cda.getChild(ote, "reference") != null) {
// if (cda.getChild(ote, "reference").getAttribute("value").startsWith("#")) {
// Element t = cda.getByXmlId(cda.getChild(ote, "reference").getAttribute("value").substring(1));
// String ot = t.getTextContent().trim();
// cc.setText(Utilities.noString(ot) ? null : ot);
// } else
// throw new Exception("external references not handled yet "+cda.getChild(ote, "reference").getAttribute("value"));
// } else {
String ot = ote.getTextContent().trim();
cc.setText(Utilities.noString(ot) ? null : ot);
//}
}
return cc;
}
public Coding makeCodingFromCV(Element cd) throws Exception {
if (cd == null || Utilities.noString(cd.getAttribute("code")))
return null;
Coding c = new Coding();
c.setCode(cd.getAttribute("code"));
c.setDisplay(cd.getAttribute("displayName"));
String r = cd.getAttribute("codeSystem");
String uri = getUriForOID(r);
if (uri != null)
c.setSystem(uri);
else if (isGuid(r))
c.setSystem("urn:uuid:"+r);
else if (UriForOid(r) != null)
c.setSystem(UriForOid(r));
else
c.setSystem("urn:oid:"+r);
return c;
}
private String getUriForOID(String r) {
if (r.equals("2.16.840.1.113883.6.1"))
return "http://loinc.org";
if (r.equals("2.16.840.1.113883.6.96"))
return "http://snomed.info/sct";
return null;
}
public Address makeAddressFromAD(Element e) {
if (e == null)
return null;
Address a = new Address();
String use = e.getAttribute("use");
if (use != null) {
if (use.equals("H") || use.equals("HP") || use.equals("HV"))
a.setUse(AddressUse.HOME);
else if (use.equals("WP") || use.equals("DIR") || use.equals("PUB"))
a.setUse(AddressUse.WORK);
else if (use.equals("TMP"))
a.setUse(AddressUse.TEMP);
else if (use.equals("BAD"))
a.setUse(AddressUse.OLD);
}
Node n = e.getFirstChild();
while (n != null) {
if (n.getNodeType() == Node.ELEMENT_NODE) {
String v = n.getTextContent();
if (n.getLocalName().equals("additionalLocator"))
a.getLine().add(makeString(v));
// else if (e.getLocalName().equals("unitID"))
// else if (e.getLocalName().equals("unitType"))
else if (n.getLocalName().equals("deliveryAddressLine"))
a.getLine().add(makeString(v));
// else if (e.getLocalName().equals("deliveryInstallationType"))
// else if (e.getLocalName().equals("deliveryInstallationArea"))
// else if (e.getLocalName().equals("deliveryInstallationQualifier"))
// else if (e.getLocalName().equals("deliveryMode"))
// else if (e.getLocalName().equals("deliveryModeIdentifier"))
else if (n.getLocalName().equals("streetAddressLine"))
a.getLine().add(makeString(v));
// else if (e.getLocalName().equals("houseNumber"))
// else if (e.getLocalName().equals("buildingNumberSuffix"))
// else if (e.getLocalName().equals("postBox"))
// else if (e.getLocalName().equals("houseNumberNumeric"))
// else if (e.getLocalName().equals("streetName"))
// else if (e.getLocalName().equals("streetNameBase"))
// else if (e.getLocalName().equals("streetNameType"))
else if (n.getLocalName().equals("direction"))
a.getLine().add(makeString(v));
else if (n.getLocalName().equals("careOf"))
a.getLine().add(makeString(v));
// else if (e.getLocalName().equals("censusTract"))
else if (n.getLocalName().equals("country"))
a.setCountry(v);
//else if (e.getLocalName().equals("county"))
else if (n.getLocalName().equals("city"))
a.setCity(v);
// else if (e.getLocalName().equals("delimiter"))
// else if (e.getLocalName().equals("precinct"))
else if (n.getLocalName().equals("state"))
a.setState(v);
else if (n.getLocalName().equals("postalCode"))
a.setPostalCode(v);
}
n = n.getNextSibling();
}
return a;
}
public StringType makeString(String v) {
StringType s = new StringType();
s.setValue(v);
return s;
}
public ContactPoint makeContactFromTEL(Element e) throws Exception {
if (e == null)
return null;
if (e.hasAttribute("nullFlavor"))
return null;
ContactPoint c = new ContactPoint();
String use = e.getAttribute("use");
if (use != null) {
if (use.equals("H") || use.equals("HP") || use.equals("HV"))
c.setUse(ContactPointUse.HOME);
else if (use.equals("WP") || use.equals("DIR") || use.equals("PUB"))
c.setUse(ContactPointUse.WORK);
else if (use.equals("TMP"))
c.setUse(ContactPointUse.TEMP);
else if (use.equals("BAD"))
c.setUse(ContactPointUse.OLD);
}
if (e.getAttribute("value") != null) {
String[] url = e.getAttribute("value").split(":");
if (url.length == 1) {
c.setValue(url[0].trim());
c.setSystem(ContactPointSystem.PHONE);
} else {
if (url[0].equals("tel"))
c.setSystem(ContactPointSystem.PHONE);
else if (url[0].equals("mailto"))
c.setSystem(ContactPointSystem.EMAIL);
else if (e.getAttribute("value").contains(":"))
c.setSystem(ContactPointSystem.OTHER);
else
c.setSystem(ContactPointSystem.PHONE);
c.setValue(url[1].trim());
}
}
return c;
}
public HumanName makeNameFromEN(Element e) {
if (e == null)
return null;
HumanName hn = new HumanName();
String use = e.getAttribute("use");
if (use != null) {
if (use.equals("L"))
hn.setUse(NameUse.USUAL);
else if (use.equals("C"))
hn.setUse(NameUse.OFFICIAL);
else if (use.equals("P") || use.equals("A"))
hn.setUse(NameUse.ANONYMOUS);
else if (use.equals("TMP"))
hn.setUse(NameUse.TEMP);
else if (use.equals("BAD"))
hn.setUse(NameUse.OLD);
}
Node n = e.getFirstChild();
while (n != null) {
if (n.getNodeType() == Node.ELEMENT_NODE) {
String v = n.getTextContent();
if (n.getLocalName().equals("family"))
hn.setFamilyElement(makeString(v));
else if (n.getLocalName().equals("given"))
hn.getGiven().add(makeString(v));
else if (n.getLocalName().equals("prefix"))
hn.getPrefix().add(makeString(v));
else if (n.getLocalName().equals("suffix"))
hn.getSuffix().add(makeString(v));
}
n = n.getNextSibling();
}
return hn;
}
public DateTimeType makeDateTimeFromTS(Element ts) throws Exception {
if (ts == null)
return null;
String v = ts.getAttribute("value");
if (Utilities.noString(v))
return null;
if (v.length() > 8 && !hasTimezone(v))
v += defaultTimezone;
DateTimeType d = DateTimeType.parseV3(v);
return d;
}
private boolean hasTimezone(String v) {
return v.contains("+") || v.contains("-") || v.endsWith("Z");
}
public DateType makeDateFromTS(Element ts) throws Exception {
if (ts == null)
return null;
String v = ts.getAttribute("value");
if (Utilities.noString(v))
return null;
DateType d = DateType.parseV3(v);
return d;
}
public Period makePeriodFromIVL(Element ivl) throws Exception {
if (ivl == null)
return null;
Period p = new Period();
Element low = cda.getChild(ivl, "low");
if (low != null)
p.setStartElement(makeDateTimeFromTS(low));
Element high = cda.getChild(ivl, "high");
if (high != null)
p.setEndElement(makeDateTimeFromTS(high));
if (p.getStartElement() != null || p.getEndElement() != null)
return p;
else
return null;
}
// this is a weird one - where CDA has an IVL, and FHIR has a date
public DateTimeType makeDateTimeFromIVL(Element ivl) throws Exception {
if (ivl == null)
return null;
if (ivl.hasAttribute("value"))
return makeDateTimeFromTS(ivl);
Element high = cda.getChild(ivl, "high");
if (high != null)
return makeDateTimeFromTS(high);
Element low = cda.getChild(ivl, "low");
if (low != null)
return makeDateTimeFromTS(low);
return null;
}
public Type makeStringFromED(Element e) throws Exception {
if (e == null)
return null;
if (cda.getChild(e, "reference") != null) {
if (cda.getChild(e, "reference").getAttribute("value").startsWith("#")) {
Element t = cda.getByXmlId(cda.getChild(e, "reference").getAttribute("value").substring(1));
String ot = t.getTextContent().trim();
return Utilities.noString(ot) ? null : Factory.newString_(ot);
} else
throw new Exception("external references not handled yet "+cda.getChild(e, "reference").getAttribute("value"));
}
return Factory.newString_(e.getTextContent());
}
public Type makeTypeFromANY(Element e) throws Exception {
if (e == null)
return null;
String t = e.getAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "type");
if (Utilities.noString(t))
throw new Exception("Missing type on RIM attribute with type any");
if (t.equals("CD") || t.equals("CE"))
return makeCodeableConceptFromCD(e);
else if (t.equals("ST"))
return makeStringFromED(e);
else
throw new Exception("Not done yet (type = "+t+")");
}
public Type makeMatchingTypeFromIVL(Element ivl) throws Exception {
if (ivl == null)
return null;
if (ivl.getAttribute("value") != null)
return makeDateTimeFromIVL(ivl);
if (cda.getChild(ivl, "low") != null || cda.getChild(ivl, "high") != null )
return makePeriodFromIVL(ivl);
throw new Exception("not handled yet");
}
public Type makeCodeableConceptFromNullFlavor(String nf) throws Exception {
// Some nullFlavors have explicit values in value sets. This can only be called where there aren't.
if (nf == null || "".equals(nf))
return null;
if ("NI".equals(nf))
return null; // there's no code for this
if ("NA".equals(nf))
return Factory.newCodeableConcept("unsupported", "http://hl7.org/fhir/data-absent-reason", "Unsupported"); // todo: is this reasonable? Why else would you use N/A?
if ("UNK".equals(nf))
return Factory.newCodeableConcept("unknown", "http://hl7.org/fhir/data-absent-reason", "Unknown");
if ("ASKU".equals(nf))
return Factory.newCodeableConcept("asked", "http://hl7.org/fhir/data-absent-reason", "Asked/Unknown");
if ("NAV".equals(nf))
return Factory.newCodeableConcept("temp", "http://hl7.org/fhir/data-absent-reason", "Temporarily Unavailable");
if ("NASK".equals(nf))
return Factory.newCodeableConcept("notasked", "http://hl7.org/fhir/data-absent-reason", "Not Asked");
if ("MSK".equals(nf))
return Factory.newCodeableConcept("masked", "http://hl7.org/fhir/data-absent-reason", "Masked");
if ("OTH".equals(nf))
return null; // well, what should be done?
return null; // well, what should be done?
}
public Range makeRangeFromIVLPQ(Element ivlpq) throws Exception {
if (ivlpq == null)
return null;
Element low = cda.getChild(ivlpq, "low");
Element high = cda.getChild(ivlpq, "high");
if (low == null && high == null)
return null;
Range r = new Range();
r.setLow(makeSimpleQuantityFromPQ(low, ivlpq.getAttribute("unit")));
r.setHigh(makeSimpleQuantityFromPQ(high, ivlpq.getAttribute("unit")));
return r;
}
public Quantity makeQuantityFromPQ(Element pq) throws Exception {
return makeQuantityFromPQ(pq, null);
}
public Quantity makeQuantityFromPQ(Element pq, String units) throws Exception {
if (pq == null)
return null;
Quantity qty = new Quantity();
String n = pq.getAttribute("value").replace(",", "").trim();
try {
qty.setValue(new BigDecimal(n));
} catch (Exception e) {
throw new Exception("Unable to process value '"+n+"'", e);
}
units = Utilities.noString(pq.getAttribute("unit")) ? units : pq.getAttribute("unit");
if (!Utilities.noString(units)) {
if (ucumSvc == null || ucumSvc.validate(units) != null)
qty.setUnit(units);
else {
qty.setCode(units);
qty.setSystem("http://unitsofmeasure.org");
qty.setUnit(ucumSvc.getCommonDisplay(units));
}
}
return qty;
}
public SimpleQuantity makeSimpleQuantityFromPQ(Element pq, String units) throws Exception {
if (pq == null)
return null;
SimpleQuantity qty = new SimpleQuantity();
String n = pq.getAttribute("value").replace(",", "").trim();
try {
qty.setValue(new BigDecimal(n));
} catch (Exception e) {
throw new Exception("Unable to process value '"+n+"'", e);
}
units = Utilities.noString(pq.getAttribute("unit")) ? units : pq.getAttribute("unit");
if (!Utilities.noString(units)) {
if (ucumSvc == null || ucumSvc.validate(units) != null)
qty.setUnit(units);
else {
qty.setCode(units);
qty.setSystem("http://unitsofmeasure.org");
qty.setUnit(ucumSvc.getCommonDisplay(units));
}
}
return qty;
}
public AdministrativeGender makeGenderFromCD(Element cd) throws Exception {
String code = cd.getAttribute("code");
String system = cd.getAttribute("codeSystem");
if ("2.16.840.1.113883.5.1".equals(system)) {
if ("F".equals(code))
return AdministrativeGender.FEMALE;
if ("M".equals(code))
return AdministrativeGender.MALE;
}
throw new Exception("Unable to read Gender "+system+"::"+code);
}
/*
/entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:EIVL_TS]: 389
/entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:EIVL_TS]/event: 389
/entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:IVL_TS]: 33470
/entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:IVL_TS]/high: 20566
/entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:IVL_TS]/high[nullFlavor:NA]: 9581
/entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:IVL_TS]/low: 32501
/entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:IVL_TS]/low[nullFlavor:UNK]: 969
/entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:PIVL_TS]: 17911
/entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:PIVL_TS]/period: 17911
*/
public Type makeSomethingFromGTS(List<Element> children) throws Exception {
if (children.isEmpty())
return null;
if (children.size() == 1) {
String type = children.get(0).getAttribute("xsi:type");
if (type.equals("IVL_TS"))
return makePeriodFromIVL(children.get(0));
else
throw new Exception("Unknown GTS type '"+type+"'");
}
CommaSeparatedStringBuilder t = new CommaSeparatedStringBuilder();
for (Element c : children)
t.append(c.getAttribute("xsi:type"));
if (t.toString().equals("IVL_TS, PIVL_TS"))
return makeTimingFromBoundedPIVL(children.get(0), children.get(1));
if (t.toString().equals("IVL_TS, EIVL_TS"))
return makeTimingFromBoundedEIVL(children.get(0), children.get(1));
throw new Exception("Unknown GTS pattern '"+t.toString()+"'");
}
private Type makeTimingFromBoundedEIVL(Element ivl, Element eivl) throws Exception {
Timing t = new Timing();
t.setRepeat(new TimingRepeatComponent());
Element e = cda.getChild(eivl, "event");
t.getRepeat().setBounds(makePeriodFromIVL(ivl));
t.getRepeat().addWhen(convertEventTiming(e.getAttribute("code")));
return t;
}
private EventTiming convertEventTiming(String e) throws Exception {
if ("HS".equals(e))
return EventTiming.HS;
throw new Exception("Unknown event "+e);
}
private Timing makeTimingFromBoundedPIVL(Element ivl, Element pivl) throws Exception {
Timing t = new Timing();
t.setRepeat(new TimingRepeatComponent());
Element p = cda.getChild(pivl, "period");
t.getRepeat().setBounds(makePeriodFromIVL(ivl));
t.getRepeat().setPeriod(new BigDecimal(p.getAttribute("value")));
t.getRepeat().setPeriodUnit(convertTimeUnit(p.getAttribute("unit")));
return t;
}
private UnitsOfTime convertTimeUnit(String u) throws Exception {
if ("h".equals(u))
return UnitsOfTime.H;
if ("d".equals(u))
return UnitsOfTime.D;
if ("w".equals(u))
return UnitsOfTime.WK;
throw new Exception("Unknown unit of time "+u);
}
public Set<String> getOids() {
return oids;
}
public boolean isGenerateMissingExtensions() {
return generateMissingExtensions;
}
public void setGenerateMissingExtensions(boolean generateMissingExtensions) {
this.generateMissingExtensions = generateMissingExtensions;
}
}

View File

@ -1,26 +0,0 @@
package org.hl7.fhir.convertors;
/*-
* #%L
* HAPI FHIR - Converter
* %%
* Copyright (C) 2014 - 2019 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
public class ConverterBase {
}

View File

@ -1,209 +0,0 @@
package org.hl7.fhir.convertors;
/*-
* #%L
* HAPI FHIR - Converter
* %%
* Copyright (C) 2014 - 2019 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.hl7.fhir.dstu3.formats.IParser.OutputStyle;
import org.hl7.fhir.dstu3.formats.XmlParser;
import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemHierarchyMeaning;
import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.dstu3.model.Coding;
import org.hl7.fhir.dstu3.model.DateTimeType;
import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus;
import org.hl7.fhir.dstu3.model.Identifier;
import org.hl7.fhir.dstu3.model.ValueSet;
import org.hl7.fhir.dstu3.terminologies.CodeSystemUtilities;
import org.hl7.fhir.utilities.xml.XMLUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
* This is defined as a prototype ClaML importer
*
* @author Grahame
*
*/
public class ICPC2Importer {
public static void main(String[] args) {
try {
ICPC2Importer r = new ICPC2Importer();
r.setSourceFileName("c:\\temp\\ICPC-2e-v5.0.xml");
r.setTargetFileNameCS("C:\\temp\\icpc2.xml");
r.setTargetFileNameVS("C:\\temp\\icpc2-vs.xml");
r.go();
System.out.println("Completed OK");
} catch (Exception e) {
e.printStackTrace();
}
}
private String sourceFileName; // the ICPC2 ClaML file
private String targetFileNameVS; // the value set to produce
private String targetFileNameCS; // the value set to produce
public ICPC2Importer() {
super();
}
public ICPC2Importer(String sourceFileName, String targetFileNameCS, String targetFileNameVS) {
super();
this.sourceFileName = sourceFileName;
this.targetFileNameCS = targetFileNameCS;
this.targetFileNameVS = targetFileNameVS;
}
public String getSourceFileName() {
return sourceFileName;
}
public void setSourceFileName(String sourceFileName) {
this.sourceFileName = sourceFileName;
}
public String getTargetFileNameCS() {
return targetFileNameCS;
}
public void setTargetFileNameCS(String targetFileName) {
this.targetFileNameCS = targetFileName;
}
public String getTargetFileNameVS() {
return targetFileNameVS;
}
public void setTargetFileNameVS(String targetFileName) {
this.targetFileNameVS = targetFileName;
}
public void go() throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(false);
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(new FileInputStream(sourceFileName));
ValueSet vs = new ValueSet();
vs.setUrl("http://hl7.org/fhir/sid/icpc2/vs");
Element title = XMLUtil.getNamedChild(doc.getDocumentElement(), "Title");
vs.setVersion(title.getAttribute("version"));
vs.setName(title.getAttribute("name"));
vs.setImmutable(true);
Element identifier = XMLUtil.getNamedChild(doc.getDocumentElement(), "Identifier");
vs.setPublisher(identifier.getAttribute("authority"));
vs.addIdentifier(new Identifier().setValue(identifier.getAttribute("uid")));
List<Element> authors = new ArrayList<Element>();
XMLUtil.getNamedChildren(XMLUtil.getNamedChild(doc.getDocumentElement(), "Authors"), "Author", authors);
for (Element a : authors)
if (!a.getAttribute("name").contains("+"))
vs.addContact().setName(a.getTextContent());
vs.setCopyright("The copyright of ICPC, both in hard copy and in electronic form, is owned by Wonca. See http://www.kith.no/templates/kith_WebPage____1110.aspx");
vs.setStatus(PublicationStatus.ACTIVE);
vs.setDateElement(new DateTimeType(title.getAttribute("date")));
vs.getCompose().addInclude().setSystem("http://hl7.org/fhir/sid/icpc2");
CodeSystem cs = new CodeSystem();
cs.setUrl("http://hl7.org/fhir/sid/icpc2");
cs.setVersion(title.getAttribute("version"));
cs.setName(title.getAttribute("name"));
identifier = XMLUtil.getNamedChild(doc.getDocumentElement(), "Identifier");
cs.setPublisher(identifier.getAttribute("authority"));
cs.setIdentifier(new Identifier().setValue(identifier.getAttribute("uid")));
cs.setHierarchyMeaning(CodeSystemHierarchyMeaning.CLASSIFIEDWITH);
authors = new ArrayList<Element>();
XMLUtil.getNamedChildren(XMLUtil.getNamedChild(doc.getDocumentElement(), "Authors"), "Author", authors);
for (Element a : authors)
if (!a.getAttribute("name").contains("+"))
cs.addContact().setName(a.getTextContent());
cs.setCopyright("The copyright of ICPC, both in hard copy and in electronic form, is owned by Wonca. See http://www.kith.no/templates/kith_WebPage____1110.aspx");
cs.setStatus(PublicationStatus.ACTIVE);
cs.setDateElement(new DateTimeType(title.getAttribute("date")));
cs.setValueSet(vs.getUrl());
Map<String, ConceptDefinitionComponent> concepts = new HashMap<String, ConceptDefinitionComponent>();
List<Element> classes = new ArrayList<Element>();
XMLUtil.getNamedChildren(doc.getDocumentElement(), "Class", classes);
for (Element cls : classes) {
processClass(cls, concepts, cs);
}
XmlParser xml = new XmlParser();
xml.setOutputStyle(OutputStyle.PRETTY);
xml.compose(new FileOutputStream(targetFileNameVS), vs);
xml.compose(new FileOutputStream(targetFileNameCS), cs);
}
private void processClass(Element cls, Map<String, ConceptDefinitionComponent> concepts, CodeSystem define) {
ConceptDefinitionComponent concept = new ConceptDefinitionComponent();
concept.setCode(cls.getAttribute("code"));
concept.setDefinition(getRubric(cls, "preferred"));
String s = getRubric(cls, "shortTitle");
if (s != null && !s.equals(concept.getDefinition()))
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("shortTitle")).setValue(s);
s = getRubric(cls, "inclusion");
if (s != null)
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("inclusion")).setValue(s);
s = getRubric(cls, "exclusion");
if (s != null)
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("exclusion")).setValue(s);
s = getRubric(cls, "criteria");
if (s != null)
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("criteria")).setValue(s);
s = getRubric(cls, "consider");
if (s != null)
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("consider")).setValue(s);
s = getRubric(cls, "note");
if (s != null)
concept.addDesignation().setUse(new Coding().setSystem("http://hl7.org/fhir/sid/icpc2/rubrics").setCode("note")).setValue(s);
concepts.put(concept.getCode(), concept);
List<Element> children = new ArrayList<Element>();
XMLUtil.getNamedChildren(cls, "SubClass", children);
if (children.size() > 0)
CodeSystemUtilities.setNotSelectable(define, concept);
Element parent = XMLUtil.getNamedChild(cls, "SuperClass");
if (parent == null) {
define.addConcept(concept);
} else {
ConceptDefinitionComponent p = concepts.get(parent.getAttribute("code"));
p.getConcept().add(concept);
}
}
private String getRubric(Element cls, String kind) {
List<Element> rubrics = new ArrayList<Element>();
XMLUtil.getNamedChildren(cls, "Rubric", rubrics);
for (Element r : rubrics) {
if (r.getAttribute("kind").equals(kind))
return XMLUtil.getNamedChild(r, "Label").getTextContent();
}
return null;
}
}

View File

@ -1,51 +0,0 @@
package org.hl7.fhir.convertors;
/*
* #%L
* HAPI FHIR - Converter
* %%
* Copyright (C) 2014 - 2019 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.ValueSet;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.Resource;
public class NullVersionConverterAdvisor implements VersionConvertorAdvisor {
@Override
public boolean ignoreEntry(BundleEntryComponent theSrc) {
return false;
}
@Override
public Resource convert(org.hl7.fhir.dstu3.model.Resource theResource) throws FHIRException {
return null;
}
@Override
public void handleCodeSystem(CodeSystem theTgtcs, ValueSet theSource) {
//nothing
}
@Override
public CodeSystem getCodeSystem(ValueSet theSrc) {
return null;
}
}

View File

@ -24,7 +24,7 @@ import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.ValueSet;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.Resource;
import org.hl7.fhir.dstu2.model.Resource;
public class NullVersionConverterAdvisor30 implements VersionConvertorAdvisor30 {

View File

@ -21,7 +21,7 @@ package org.hl7.fhir.convertors;
*/
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.Resource;
import org.hl7.fhir.dstu2.model.Resource;
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.ValueSet;
@ -33,6 +33,11 @@ public class NullVersionConverterAdvisor40 implements VersionConvertorAdvisor40
return null;
}
@Override
public org.hl7.fhir.dstu2016may.model.Resource convertR2016May(org.hl7.fhir.r4.model.Resource theResource) throws FHIRException {
return null;
}
@Override
public org.hl7.fhir.dstu3.model.Resource convertR3(org.hl7.fhir.r4.model.Resource resource) throws FHIRException {
return null;

View File

@ -1,38 +0,0 @@
package org.hl7.fhir.convertors;
/*-
* #%L
* HAPI FHIR - Converter
* %%
* Copyright (C) 2014 - 2019 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.ValueSet;
import org.hl7.fhir.exceptions.FHIRException;
public interface VersionConvertorAdvisor {
boolean ignoreEntry(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src);
// called ?
org.hl7.fhir.instance.model.Resource convert(org.hl7.fhir.dstu3.model.Resource resource) throws FHIRException;
// called when an r2 value set has a codeSystem in it
void handleCodeSystem(CodeSystem tgtcs, ValueSet source);
CodeSystem getCodeSystem(ValueSet src);
}

View File

@ -1,35 +0,0 @@
package org.hl7.fhir.convertors;
/*-
* #%L
* HAPI FHIR - Converter
* %%
* Copyright (C) 2014 - 2019 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.hl7.fhir.exceptions.FHIRException;
public interface VersionConvertorAdvisor30 {
boolean ignoreEntry(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src);
// called ?
org.hl7.fhir.instance.model.Resource convert(org.hl7.fhir.dstu3.model.Resource resource) throws FHIRException;
// called when an r2 value set has a codeSystem in it
void handleCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem tgtcs, org.hl7.fhir.dstu3.model.ValueSet source);
org.hl7.fhir.dstu3.model.CodeSystem getCodeSystem(org.hl7.fhir.dstu3.model.ValueSet src);
}

View File

@ -1,36 +0,0 @@
package org.hl7.fhir.convertors;
/*-
* #%L
* HAPI FHIR - Converter
* %%
* Copyright (C) 2014 - 2019 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.hl7.fhir.exceptions.FHIRException;
public interface VersionConvertorAdvisor40 {
boolean ignoreEntry(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src);
// called ?
org.hl7.fhir.instance.model.Resource convertR2(org.hl7.fhir.r4.model.Resource resource) throws FHIRException;
org.hl7.fhir.dstu3.model.Resource convertR3(org.hl7.fhir.r4.model.Resource resource) throws FHIRException;
// called when an r2 value set has a codeSystem in it
void handleCodeSystem(org.hl7.fhir.r4.model.CodeSystem tgtcs, org.hl7.fhir.r4.model.ValueSet source);
org.hl7.fhir.r4.model.CodeSystem getCodeSystem(org.hl7.fhir.r4.model.ValueSet src);
}

View File

@ -1,89 +0,0 @@
package org.hl7.fhir.convertors;
/*-
* #%L
* HAPI FHIR - Converter
* %%
* Copyright (C) 2014 - 2019 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
public class VersionConvertorConstants {
public final static String IG_DEPENDSON_PACKAGE_EXTENSION = "http://hl7.org/fhir/4.0/StructureDefinition/extension-ImplentationGuide.dependency.packageId";
public final static String IG_DEPENDSON_VERSION_EXTENSION = "http://hl7.org/fhir/4.0/StructureDefinition/extension-ImplentationGuide.dependency.version";
public final static String MODIFIER_REASON_EXTENSION = "http://hl7.org/fhir/4.0/StructureDefinition/extension-ElementDefinition.isModifierReason";
public final static String MODIFIER_TAKEN = "http://hl7.org/fhir/4.0/StructureDefinition/extension-MedicationStatment.taken";
public final static String MODIFIER_REASON_LEGACY = "No Modifier Reason provideed in previous versions of FHIR";
public static String refToVS(String url) {
if (url == null)
return null;
if (url.equals("http://www.genenames.org"))
return "http://hl7.org/fhir/ValueSet/genenames";
else if (url.equals("http://varnomen.hgvs.org/"))
return "http://hl7.org/fhir/ValueSet/variants";
else if (url.equals("http://www.ncbi.nlm.nih.gov/nuccore?db=nuccore"))
return "http://hl7.org/fhir/ValueSet/ref-sequences";
else if (url.equals("http://www.ensembl.org/"))
return "http://hl7.org/fhir/ValueSet/ensembl";
else if (url.equals("http://www.ncbi.nlm.nih.gov/clinvar/variation"))
return "http://hl7.org/fhir/ValueSet/clinvar";
else if (url.equals("http://cancer.sanger.ac.uk/cancergenome/projects/cosmic/"))
return "http://hl7.org/fhir/ValueSet/cosmic";
else if (url.equals("http://www.ncbi.nlm.nih.gov/projects/SNP/"))
return "http://hl7.org/fhir/ValueSet/bbsnp";
else if (url.equals("http://www.sequenceontology.org/"))
return "http://hl7.org/fhir/ValueSet/sequenceontology";
else if (url.equals("http://www.ebi.ac.uk/"))
return "http://hl7.org/fhir/ValueSet/allelename";
else if (url.equals("https://www.iso.org/iso-4217-currency-codes.html"))
return "http://hl7.org/fhir/ValueSet/currencies";
else if (url.equals("http://www.rfc-editor.org/bcp/bcp13.txt"))
return "http://hl7.org/fhir/ValueSet/mimetypes";
else
return url;
}
public static String vsToRef(String url) {
if (url == null)
return null;
if (url.equals("http://hl7.org/fhir/ValueSet/genenames"))
return "http://www.genenames.org";
else if (url.equals("http://hl7.org/fhir/ValueSet/variants"))
return "http://varnomen.hgvs.org/";
else if (url.equals("http://hl7.org/fhir/ValueSet/ref-sequences"))
return "http://www.ncbi.nlm.nih.gov/nuccore?db=nuccore";
else if (url.equals("http://hl7.org/fhir/ValueSet/ensembl"))
return "http://www.ensembl.org/";
else if (url.equals("http://hl7.org/fhir/ValueSet/clinvar"))
return "http://www.ncbi.nlm.nih.gov/clinvar/variation";
else if (url.equals("http://hl7.org/fhir/ValueSet/cosmic"))
return "http://cancer.sanger.ac.uk/cancergenome/projects/cosmic/";
else if (url.equals("http://hl7.org/fhir/ValueSet/bbsnp"))
return "http://www.ncbi.nlm.nih.gov/projects/SNP/";
else if (url.equals("http://hl7.org/fhir/ValueSet/sequenceontology"))
return "http://www.sequenceontology.org/";
else if (url.equals("http://hl7.org/fhir/ValueSet/allelename"))
return "http://www.ebi.ac.uk/";
else if (url.equals("http://hl7.org/fhir/ValueSet/currencies"))
return "https://www.iso.org/iso-4217-currency-codes.html";
else if (url.equals("http://hl7.org/fhir/ValueSet/mimetypes"))
return "http://www.rfc-editor.org/bcp/bcp13.txt";
else
return null;
}
}

View File

@ -4,7 +4,7 @@ import static org.junit.Assert.assertEquals;
import org.hl7.fhir.dstu3.model.*;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.Resource;
import org.hl7.fhir.dstu2.model.Resource;
import org.junit.Test;
import java.util.Collections;
@ -18,8 +18,8 @@ public class VersionConvertor_10_30Test {
NullVersionConverterAdvisor30 advisor = new NullVersionConverterAdvisor30();
VersionConvertor_10_30 converter = new VersionConvertor_10_30(advisor);
org.hl7.fhir.instance.model.Observation input = new org.hl7.fhir.instance.model.Observation();
input.setEncounter(new org.hl7.fhir.instance.model.Reference("Encounter/123"));
org.hl7.fhir.dstu2.model.Observation input = new org.hl7.fhir.dstu2.model.Observation();
input.setEncounter(new org.hl7.fhir.dstu2.model.Reference("Encounter/123"));
org.hl7.fhir.dstu3.model.Observation output = converter.convertObservation(input);
String context = output.getContext().getReference();

View File

@ -94,26 +94,6 @@
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-utilities</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-utilities</artifactId>
<version>${project.version}</version>
<classifier>sources</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-utilities</artifactId>
<version>${project.version}</version>
<classifier>javadoc</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>

View File

@ -23,6 +23,7 @@ package ca.uhn.fhir.igpacks.parser;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.parser.LenientErrorHandler;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.util.StopWatch;
@ -93,7 +94,9 @@ public abstract class BaseIgPackParser<T> {
if (entry.getName().equals(igResourceName)) {
parsed = FhirContext.forDstu3().newJsonParser().parseResource(ImplementationGuide.class, nextReader);
} else {
parsed = myCtx.newJsonParser().parseResource(nextReader);
LenientErrorHandler errorHandler = new LenientErrorHandler();
errorHandler.setErrorOnInvalidValue(false);
parsed = myCtx.newJsonParser().setParserErrorHandler(errorHandler).parseResource(nextReader);
}
candidateResources.put(entry.getName(), parsed);

View File

@ -22,9 +22,9 @@ package ca.uhn.fhir.igpacks.parser;
import ca.uhn.fhir.context.FhirContext;
import org.hl7.fhir.instance.hapi.validation.IValidationSupport;
import org.hl7.fhir.instance.model.ConceptMap;
import org.hl7.fhir.instance.model.StructureDefinition;
import org.hl7.fhir.instance.model.ValueSet;
import org.hl7.fhir.dstu2.model.ConceptMap;
import org.hl7.fhir.dstu2.model.StructureDefinition;
import org.hl7.fhir.dstu2.model.ValueSet;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;

View File

@ -34,6 +34,7 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.dstu2.hapi.rest.server.ServerConformanceProvider;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.slf4j.LoggerFactory;
@ -67,7 +68,7 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
private org.hl7.fhir.r4.model.CapabilityStatement myR4CapabilityStatement;
private org.hl7.fhir.dstu3.model.CapabilityStatement myDstu3CapabilityStatement;
private org.hl7.fhir.dstu2016may.model.Conformance myDstu2_1Conformance;
private org.hl7.fhir.instance.model.Conformance myDstu2Hl7OrgConformance;
private org.hl7.fhir.dstu2.model.Conformance myDstu2Hl7OrgConformance;
private ca.uhn.fhir.model.dstu2.resource.Conformance myDstu2Conformance;
private boolean myInitialized;
@ -145,7 +146,7 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
myDstu2_1Conformance = dstu2_1ServerConformanceProvider.getServerConformance(null, null);
break;
case DSTU2_HL7ORG:
org.hl7.fhir.instance.conf.ServerConformanceProvider dstu2Hl7OrgServerConformanceProvider = new org.hl7.fhir.instance.conf.ServerConformanceProvider(serverConfiguration);
ServerConformanceProvider dstu2Hl7OrgServerConformanceProvider = new ServerConformanceProvider(serverConfiguration);
myDstu2Hl7OrgConformance = dstu2Hl7OrgServerConformanceProvider.getServerConformance(null, null);
break;
case DSTU2:
@ -305,7 +306,7 @@ public abstract class AbstractJaxRsConformanceProvider extends AbstractJaxRsProv
case DSTU2_1:
return Class.class.cast(org.hl7.fhir.dstu2016may.model.Conformance.class);
case DSTU2_HL7ORG:
return Class.class.cast(org.hl7.fhir.instance.model.Conformance.class);
return Class.class.cast(org.hl7.fhir.dstu2.model.Conformance.class);
case DSTU2:
return Class.class.cast(ca.uhn.fhir.model.dstu2.resource.Conformance.class);
default:

View File

@ -221,7 +221,7 @@ public class JaxRsRequest extends RequestDetails {
result.setId(new org.hl7.fhir.dstu2016may.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion)));
break;
case DSTU2_HL7ORG:
result.setId(new org.hl7.fhir.instance.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion)));
result.setId(new org.hl7.fhir.dstu2.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion)));
break;
case DSTU2:
result.setId(new ca.uhn.fhir.model.primitive.IdDt(myServer.getBaseForRequest(), UrlUtil.unescape(myId), UrlUtil.unescape(myVersion)));
@ -241,7 +241,7 @@ public class JaxRsRequest extends RequestDetails {
result.setId(new org.hl7.fhir.dstu2016may.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId)));
break;
case DSTU2_HL7ORG:
result.setId(new org.hl7.fhir.instance.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId)));
result.setId(new org.hl7.fhir.dstu2.model.IdType(myServer.getBaseForRequest(), UrlUtil.unescape(myId)));
break;
case DSTU2:
result.setId(new ca.uhn.fhir.model.primitive.IdDt(myServer.getBaseForRequest(), UrlUtil.unescape(myId)));
@ -265,7 +265,7 @@ public class JaxRsRequest extends RequestDetails {
result.setId(new org.hl7.fhir.dstu2016may.model.IdType(contentLocation));
break;
case DSTU2_HL7ORG:
result.setId(new org.hl7.fhir.instance.model.IdType(contentLocation));
result.setId(new org.hl7.fhir.dstu2.model.IdType(contentLocation));
break;
case DSTU2:
result.setId(new ca.uhn.fhir.model.primitive.IdDt(contentLocation));

View File

@ -1,7 +1,7 @@
package ca.uhn.fhir.jaxrs.server.test;
import ca.uhn.fhir.jaxrs.server.AbstractJaxRsResourceProvider;
import org.hl7.fhir.instance.model.Patient;
import org.hl7.fhir.dstu2.model.Patient;
/**
* A dummy patient provider exposing no methods

View File

@ -8,7 +8,7 @@ import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.hl7.fhir.instance.model.*;
import org.hl7.fhir.dstu2.model.*;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.mockito.Mockito;

View File

@ -591,9 +591,10 @@
<plugins>
<plugin>
<groupId>de.jpdigital</groupId>
<artifactId>hibernate52-ddl-maven-plugin</artifactId>
<artifactId>hibernate54-ddl-maven-plugin</artifactId>
<configuration>
<dialects>
<param>h2</param>
<param>derby_10_7</param>
<param>postgresql92</param>
<param>mysql57</param>

View File

@ -9,7 +9,7 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Sets;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.time.DateUtils;
import org.hl7.fhir.instance.model.Subscription;
import org.hl7.fhir.dstu2.model.Subscription;
import org.hl7.fhir.r4.model.Bundle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -61,7 +61,7 @@ public class FhirResourceDaoQuestionnaireResponseDstu2 extends FhirResourceDaoDs
@PostConstruct
public void initialize() {
try {
Class.forName("org.hl7.fhir.instance.model.QuestionnaireResponse");
Class.forName("org.hl7.fhir.dstu2.model.QuestionnaireResponse");
myValidateResponses = true;
} catch (ClassNotFoundException e) {
myValidateResponses = Boolean.FALSE;

View File

@ -137,7 +137,7 @@ public class FhirResourceDaoValueSetDstu2 extends FhirResourceDaoDstu2<ValueSet>
}
ValueSet source;
org.hl7.fhir.instance.model.ValueSet defaultValueSet = myDefaultProfileValidationSupport.fetchResource(myRiCtx, org.hl7.fhir.instance.model.ValueSet.class, theUri);
org.hl7.fhir.dstu2.model.ValueSet defaultValueSet = myDefaultProfileValidationSupport.fetchResource(myRiCtx, org.hl7.fhir.dstu2.model.ValueSet.class, theUri);
if (defaultValueSet != null) {
source = getContext().newJsonParser().parseResource(ValueSet.class, myRiCtx.newJsonParser().encodeResourceToString(defaultValueSet));
} else {
@ -172,7 +172,7 @@ public class FhirResourceDaoValueSetDstu2 extends FhirResourceDaoDstu2<ValueSet>
private ValueSet loadValueSetForExpansion(IIdType theId, RequestDetails theRequest) {
if (theId.getValue().startsWith("http://hl7.org/fhir/")) {
org.hl7.fhir.instance.model.ValueSet valueSet = myValidationSupport.fetchResource(myRiCtx, org.hl7.fhir.instance.model.ValueSet.class, theId.getValue());
org.hl7.fhir.dstu2.model.ValueSet valueSet = myValidationSupport.fetchResource(myRiCtx, org.hl7.fhir.dstu2.model.ValueSet.class, theId.getValue());
if (valueSet != null) {
return getContext().newJsonParser().parseResource(ValueSet.class, myRiCtx.newJsonParser().encodeResourceToString(valueSet));
}

View File

@ -6,11 +6,11 @@ import ca.uhn.fhir.model.dstu2.resource.Questionnaire;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.param.UriParam;
import org.hl7.fhir.instance.model.IdType;
import org.hl7.fhir.instance.model.StructureDefinition;
import org.hl7.fhir.instance.model.ValueSet;
import org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent;
import org.hl7.fhir.dstu2.model.IdType;
import org.hl7.fhir.dstu2.model.StructureDefinition;
import org.hl7.fhir.dstu2.model.ValueSet;
import org.hl7.fhir.dstu2.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.dstu2.model.ValueSet.ValueSetExpansionComponent;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

View File

@ -48,7 +48,7 @@ import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.provider.dstu2.ServerConformanceProvider;
import ca.uhn.fhir.util.CoverageIgnore;
import ca.uhn.fhir.util.ExtensionConstants;
import org.hl7.fhir.instance.model.Subscription;
import org.hl7.fhir.dstu2.model.Subscription;
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
import static org.apache.commons.lang3.StringUtils.isNotBlank;

View File

@ -153,7 +153,7 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se
massage(retVal);
if (myDaoConfig.getSupportedSubscriptionTypes().contains(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.WEBSOCKET)) {
if (myDaoConfig.getSupportedSubscriptionTypes().contains(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET)) {
if (isNotBlank(myDaoConfig.getWebsocketContextPath())) {
Extension websocketExtension = new Extension();
websocketExtension.setUrl(Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL);

View File

@ -151,7 +151,7 @@ public class JpaConformanceProviderR4 extends org.hl7.fhir.r4.hapi.rest.server.S
}
}
if (myDaoConfig.getSupportedSubscriptionTypes().contains(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.WEBSOCKET)) {
if (myDaoConfig.getSupportedSubscriptionTypes().contains(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET)) {
if (isNotBlank(myDaoConfig.getWebsocketContextPath())) {
Extension websocketExtension = new Extension();
websocketExtension.setUrl(Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL);

View File

@ -41,7 +41,7 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.util.SubscriptionUtil;
import com.google.common.annotations.VisibleForTesting;
import org.hl7.fhir.instance.model.Subscription;
import org.hl7.fhir.dstu2.model.Subscription;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.slf4j.Logger;

View File

@ -25,7 +25,7 @@ import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.jpa.subscription.module.cache.SubscriptionLoader;
import ca.uhn.fhir.jpa.subscription.module.cache.SubscriptionRegistry;
import com.google.common.annotations.VisibleForTesting;
import org.hl7.fhir.instance.model.Subscription;
import org.hl7.fhir.dstu2.model.Subscription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -48,7 +48,7 @@ import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.hl7.fhir.instance.model.IdType;
import org.hl7.fhir.dstu2.model.IdType;
import org.hl7.fhir.instance.model.api.IBaseParameters;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;

View File

@ -20,9 +20,9 @@ package ca.uhn.fhir.jpa.term;
* #L%
*/
import org.hl7.fhir.instance.hapi.validation.IValidationSupport;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.hapi.validation.IValidationSupport;
import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.ConceptMap;
import org.hl7.fhir.r4.model.ValueSet;
@ -38,18 +38,18 @@ public class HapiTerminologySvcDstu2 extends BaseHapiTerminologySvcImpl {
@Autowired
private IValidationSupport myValidationSupport;
private void addAllChildren(String theSystemString, org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent theCode, List<VersionIndependentConcept> theListToPopulate) {
private void addAllChildren(String theSystemString, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent theCode, List<VersionIndependentConcept> theListToPopulate) {
if (isNotBlank(theCode.getCode())) {
theListToPopulate.add(new VersionIndependentConcept(theSystemString, theCode.getCode()));
}
for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent nextChild : theCode.getConcept()) {
for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent nextChild : theCode.getConcept()) {
addAllChildren(theSystemString, nextChild, theListToPopulate);
}
}
private boolean addTreeIfItContainsCode(String theSystemString, org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent theNext, String theCode, List<VersionIndependentConcept> theListToPopulate) {
private boolean addTreeIfItContainsCode(String theSystemString, org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent theNext, String theCode, List<VersionIndependentConcept> theListToPopulate) {
boolean foundCodeInChild = false;
for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent nextChild : theNext.getConcept()) {
for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent nextChild : theNext.getConcept()) {
foundCodeInChild |= addTreeIfItContainsCode(theSystemString, nextChild, theCode, theListToPopulate);
}
@ -91,9 +91,9 @@ public class HapiTerminologySvcDstu2 extends BaseHapiTerminologySvcImpl {
throw new UnsupportedOperationException();
}
private void findCodesAbove(org.hl7.fhir.instance.model.ValueSet theSystem, String theSystemString, String theCode, List<VersionIndependentConcept> theListToPopulate) {
List<org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent> conceptList = theSystem.getCodeSystem().getConcept();
for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent next : conceptList) {
private void findCodesAbove(org.hl7.fhir.dstu2.model.ValueSet theSystem, String theSystemString, String theCode, List<VersionIndependentConcept> theListToPopulate) {
List<org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent> conceptList = theSystem.getCodeSystem().getConcept();
for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent next : conceptList) {
addTreeIfItContainsCode(theSystemString, next, theCode, theListToPopulate);
}
}
@ -101,20 +101,20 @@ public class HapiTerminologySvcDstu2 extends BaseHapiTerminologySvcImpl {
@Override
public List<VersionIndependentConcept> findCodesAboveUsingBuiltInSystems(String theSystem, String theCode) {
ArrayList<VersionIndependentConcept> retVal = new ArrayList<>();
org.hl7.fhir.instance.model.ValueSet system = myValidationSupport.fetchCodeSystem(myContext, theSystem);
org.hl7.fhir.dstu2.model.ValueSet system = myValidationSupport.fetchCodeSystem(myContext, theSystem);
if (system != null) {
findCodesAbove(system, theSystem, theCode, retVal);
}
return retVal;
}
private void findCodesBelow(org.hl7.fhir.instance.model.ValueSet theSystem, String theSystemString, String theCode, List<VersionIndependentConcept> theListToPopulate) {
List<org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent> conceptList = theSystem.getCodeSystem().getConcept();
private void findCodesBelow(org.hl7.fhir.dstu2.model.ValueSet theSystem, String theSystemString, String theCode, List<VersionIndependentConcept> theListToPopulate) {
List<org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent> conceptList = theSystem.getCodeSystem().getConcept();
findCodesBelow(theSystemString, theCode, theListToPopulate, conceptList);
}
private void findCodesBelow(String theSystemString, String theCode, List<VersionIndependentConcept> theListToPopulate, List<org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent> conceptList) {
for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent next : conceptList) {
private void findCodesBelow(String theSystemString, String theCode, List<VersionIndependentConcept> theListToPopulate, List<org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent> conceptList) {
for (org.hl7.fhir.dstu2.model.ValueSet.ConceptDefinitionComponent next : conceptList) {
if (theCode.equals(next.getCode())) {
addAllChildren(theSystemString, next, theListToPopulate);
} else {
@ -126,7 +126,7 @@ public class HapiTerminologySvcDstu2 extends BaseHapiTerminologySvcImpl {
@Override
public List<VersionIndependentConcept> findCodesBelowUsingBuiltInSystems(String theSystem, String theCode) {
ArrayList<VersionIndependentConcept> retVal = new ArrayList<>();
org.hl7.fhir.instance.model.ValueSet system = myValidationSupport.fetchCodeSystem(myContext, theSystem);
org.hl7.fhir.dstu2.model.ValueSet system = myValidationSupport.fetchCodeSystem(myContext, theSystem);
if (system != null) {
findCodesBelow(system, theSystem, theCode, retVal);
}

View File

@ -348,13 +348,13 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
* If any of this ever fails, it means that one of the OperationOutcome issue severity codes has changed code value across versions. We store the string as a constant, so something will need to
* be fixed.
*/
assertEquals(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_ERROR);
assertEquals(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_ERROR);
assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_ERROR);
assertEquals(ca.uhn.fhir.model.dstu2.valueset.IssueSeverityEnum.ERROR.getCode(), BaseHapiFhirResourceDao.OO_SEVERITY_ERROR);
assertEquals(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_INFO);
assertEquals(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_INFO);
assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_INFO);
assertEquals(ca.uhn.fhir.model.dstu2.valueset.IssueSeverityEnum.INFORMATION.getCode(), BaseHapiFhirResourceDao.OO_SEVERITY_INFO);
assertEquals(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_WARN);
assertEquals(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_WARN);
assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_WARN);
assertEquals(ca.uhn.fhir.model.dstu2.valueset.IssueSeverityEnum.WARNING.getCode(), BaseHapiFhirResourceDao.OO_SEVERITY_WARN);
}

View File

@ -602,13 +602,13 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
* If any of this ever fails, it means that one of the OperationOutcome issue severity codes has changed code value across versions. We store the string as a constant, so something will need to
* be fixed.
*/
assertEquals(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirDao.OO_SEVERITY_ERROR);
assertEquals(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirDao.OO_SEVERITY_ERROR);
assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_ERROR);
assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirDao.OO_SEVERITY_ERROR);
assertEquals(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirDao.OO_SEVERITY_INFO);
assertEquals(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirDao.OO_SEVERITY_INFO);
assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_INFO);
assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirDao.OO_SEVERITY_INFO);
assertEquals(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirDao.OO_SEVERITY_WARN);
assertEquals(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirDao.OO_SEVERITY_WARN);
assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_WARN);
assertEquals(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirDao.OO_SEVERITY_WARN);
}

View File

@ -756,13 +756,13 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
* If any of this ever fails, it means that one of the OperationOutcome issue severity codes has changed code value across versions. We store the string as a constant, so something will need to
* be fixed.
*/
assertEquals(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirDao.OO_SEVERITY_ERROR);
assertEquals(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirDao.OO_SEVERITY_ERROR);
assertEquals(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_ERROR);
assertEquals(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR.toCode(), BaseHapiFhirDao.OO_SEVERITY_ERROR);
assertEquals(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirDao.OO_SEVERITY_INFO);
assertEquals(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirDao.OO_SEVERITY_INFO);
assertEquals(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_INFO);
assertEquals(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION.toCode(), BaseHapiFhirDao.OO_SEVERITY_INFO);
assertEquals(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirDao.OO_SEVERITY_WARN);
assertEquals(org.hl7.fhir.dstu2.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirDao.OO_SEVERITY_WARN);
assertEquals(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirResourceDao.OO_SEVERITY_WARN);
assertEquals(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING.toCode(), BaseHapiFhirDao.OO_SEVERITY_WARN);
}

View File

@ -7,7 +7,7 @@ import ca.uhn.fhir.jpa.subscription.module.cache.SubscriptionRegistry;
import ca.uhn.fhir.jpa.subscription.module.subscriber.email.IEmailSender;
import ca.uhn.fhir.jpa.subscription.module.subscriber.email.JavaMailEmailSender;
import ca.uhn.fhir.jpa.subscription.module.subscriber.email.SubscriptionDeliveringEmailSubscriber;
import org.hl7.fhir.instance.model.Subscription;
import org.hl7.fhir.dstu2.model.Subscription;
import org.hl7.fhir.instance.model.api.IIdType;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -9,7 +9,7 @@ import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory;
import ca.uhn.fhir.jpa.util.DerbyTenSevenHapiFhirDialect;
import org.apache.commons.dbcp2.BasicDataSource;
import org.hl7.fhir.instance.model.Subscription;
import org.hl7.fhir.dstu2.model.Subscription;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -57,7 +57,7 @@ public class FhirServerConfig extends BaseJavaConfigDstu3 {
* A URL to a remote database could also be placed here, along with login credentials and other properties supported by BasicDataSource.
*/
@Bean(destroyMethod = "close")
public DataSource dataSource() {
public BasicDataSource dataSource() {
BasicDataSource retVal = new BasicDataSource();
retVal.setDriver(new org.apache.derby.jdbc.EmbeddedDriver());
retVal.setUrl("jdbc:derby:directory:target/jpaserver_derby_files;create=true");
@ -97,7 +97,6 @@ public class FhirServerConfig extends BaseJavaConfigDstu3 {
/**
* Do some fancy logging to create a nice access log that has details about each incoming request.
* @return
*/
public LoggingInterceptor loggingInterceptor() {
LoggingInterceptor retVal = new LoggingInterceptor();

View File

@ -45,8 +45,8 @@
<!-- Test Database -->
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<!--<dependency>

View File

@ -39,6 +39,7 @@ import java.sql.SQLException;
public enum DriverTypeEnum {
H2_EMBEDDED("org.h2.Driver", false),
DERBY_EMBEDDED("org.apache.derby.jdbc.EmbeddedDriver", true),
MARIADB_10_1("org.mariadb.jdbc.Driver", false),

View File

@ -53,8 +53,11 @@ public class AddColumnTask extends BaseTableColumnTypeTask<AddColumnTask> {
break;
case MSSQL_2012:
case ORACLE_12C:
case H2_EMBEDDED:
sql = "alter table " + getTableName() + " add " + getColumnName() + " " + typeStatement;
break;
default:
throw new IllegalStateException();
}
ourLog.info("Adding column {} of type {} to table {}", getColumnName(), getSqlType(), getTableName());

View File

@ -75,10 +75,13 @@ public class AddForeignKeyTask extends BaseTableColumnTask<AddForeignKeyTask> {
break;
case POSTGRES_9_4:
case DERBY_EMBEDDED:
case H2_EMBEDDED:
case ORACLE_12C:
case MSSQL_2012:
sql = "alter table " + getTableName() + " add constraint " + myConstraintName + " foreign key (" + getColumnName() + ") references " + myForeignTableName;
break;
default:
throw new IllegalStateException();
}

View File

@ -65,6 +65,7 @@ public class AddIdGeneratorTask extends BaseTask<AddIdGeneratorTask> {
}
break;
case DERBY_EMBEDDED:
case H2_EMBEDDED:
sql = "create sequence " + myGeneratorName + " start with 1 increment by 50";
break;
case POSTGRES_9_4:
@ -76,6 +77,8 @@ public class AddIdGeneratorTask extends BaseTask<AddIdGeneratorTask> {
case MSSQL_2012:
sql = "create sequence " + myGeneratorName + " start with 1 increment by 50";
break;
default:
throw new IllegalStateException();
}
if (isNotBlank(sql)) {

View File

@ -84,6 +84,7 @@ public class AddTableByColumnTask extends BaseTableTask<AddTableByColumnTask> {
case POSTGRES_9_4:
case ORACLE_12C:
case MSSQL_2012:
case H2_EMBEDDED:
break;
}

View File

@ -39,6 +39,7 @@ public abstract class BaseTableColumnTypeTask<T extends BaseTableTask> extends B
* Constructor
*/
BaseTableColumnTypeTask() {
setColumnType(ColumnTypeEnum.INT, DriverTypeEnum.H2_EMBEDDED, "integer");
setColumnType(ColumnTypeEnum.INT, DriverTypeEnum.DERBY_EMBEDDED, "integer");
setColumnType(ColumnTypeEnum.INT, DriverTypeEnum.MARIADB_10_1, "integer");
setColumnType(ColumnTypeEnum.INT, DriverTypeEnum.MYSQL_5_7, "integer");
@ -46,6 +47,7 @@ public abstract class BaseTableColumnTypeTask<T extends BaseTableTask> extends B
setColumnType(ColumnTypeEnum.INT, DriverTypeEnum.ORACLE_12C, "number(10,0)");
setColumnType(ColumnTypeEnum.INT, DriverTypeEnum.POSTGRES_9_4, "int4");
setColumnType(ColumnTypeEnum.FLOAT, DriverTypeEnum.H2_EMBEDDED, "float");
setColumnType(ColumnTypeEnum.FLOAT, DriverTypeEnum.DERBY_EMBEDDED, "float");
setColumnType(ColumnTypeEnum.FLOAT, DriverTypeEnum.MARIADB_10_1, "float");
setColumnType(ColumnTypeEnum.FLOAT, DriverTypeEnum.MYSQL_5_7, "float");
@ -53,6 +55,7 @@ public abstract class BaseTableColumnTypeTask<T extends BaseTableTask> extends B
setColumnType(ColumnTypeEnum.FLOAT, DriverTypeEnum.ORACLE_12C, "float");
setColumnType(ColumnTypeEnum.FLOAT, DriverTypeEnum.POSTGRES_9_4, "float");
setColumnType(ColumnTypeEnum.LONG, DriverTypeEnum.H2_EMBEDDED, "bigint");
setColumnType(ColumnTypeEnum.LONG, DriverTypeEnum.DERBY_EMBEDDED, "bigint");
setColumnType(ColumnTypeEnum.LONG, DriverTypeEnum.MARIADB_10_1, "bigint");
setColumnType(ColumnTypeEnum.LONG, DriverTypeEnum.MYSQL_5_7, "bigint");
@ -60,6 +63,7 @@ public abstract class BaseTableColumnTypeTask<T extends BaseTableTask> extends B
setColumnType(ColumnTypeEnum.LONG, DriverTypeEnum.ORACLE_12C, "number(19,0)");
setColumnType(ColumnTypeEnum.LONG, DriverTypeEnum.POSTGRES_9_4, "int8");
setColumnType(ColumnTypeEnum.STRING, DriverTypeEnum.H2_EMBEDDED, "varchar(?)");
setColumnType(ColumnTypeEnum.STRING, DriverTypeEnum.DERBY_EMBEDDED, "varchar(?)");
setColumnType(ColumnTypeEnum.STRING, DriverTypeEnum.MARIADB_10_1, "varchar(?)");
setColumnType(ColumnTypeEnum.STRING, DriverTypeEnum.MYSQL_5_7, "varchar(?)");
@ -67,6 +71,7 @@ public abstract class BaseTableColumnTypeTask<T extends BaseTableTask> extends B
setColumnType(ColumnTypeEnum.STRING, DriverTypeEnum.ORACLE_12C, "varchar2(?)");
setColumnType(ColumnTypeEnum.STRING, DriverTypeEnum.POSTGRES_9_4, "varchar(?)");
setColumnType(ColumnTypeEnum.DATE_TIMESTAMP, DriverTypeEnum.H2_EMBEDDED, "timestamp");
setColumnType(ColumnTypeEnum.DATE_TIMESTAMP, DriverTypeEnum.DERBY_EMBEDDED, "timestamp");
setColumnType(ColumnTypeEnum.DATE_TIMESTAMP, DriverTypeEnum.MARIADB_10_1, "datetime(6)");
setColumnType(ColumnTypeEnum.DATE_TIMESTAMP, DriverTypeEnum.MYSQL_5_7, "datetime(6)");
@ -74,6 +79,7 @@ public abstract class BaseTableColumnTypeTask<T extends BaseTableTask> extends B
setColumnType(ColumnTypeEnum.DATE_TIMESTAMP, DriverTypeEnum.ORACLE_12C, "timestamp");
setColumnType(ColumnTypeEnum.DATE_TIMESTAMP, DriverTypeEnum.POSTGRES_9_4, "timestamp");
setColumnType(ColumnTypeEnum.BOOLEAN, DriverTypeEnum.H2_EMBEDDED, "boolean");
setColumnType(ColumnTypeEnum.BOOLEAN, DriverTypeEnum.DERBY_EMBEDDED, "boolean");
setColumnType(ColumnTypeEnum.BOOLEAN, DriverTypeEnum.MSSQL_2012, "bit");
setColumnType(ColumnTypeEnum.BOOLEAN, DriverTypeEnum.MARIADB_10_1, "bit");

View File

@ -65,6 +65,7 @@ public class DropIndexTask extends BaseTableTask<DropIndexTask> {
case MARIADB_10_1:
sql = "alter table " + getTableName() + " drop index " + myIndexName;
break;
case H2_EMBEDDED:
case DERBY_EMBEDDED:
sql = "drop index " + myIndexName;
break;
@ -83,6 +84,7 @@ public class DropIndexTask extends BaseTableTask<DropIndexTask> {
break;
case POSTGRES_9_4:
case DERBY_EMBEDDED:
case H2_EMBEDDED:
case ORACLE_12C:
sql = "drop index " + myIndexName;
break;

View File

@ -89,6 +89,18 @@ public class ModifyColumnTask extends BaseTableColumnTypeTask<ModifyColumnTask>
case MSSQL_2012:
sql = "alter table " + getTableName() + " alter column " + getColumnName() + " " + type + notNull;
break;
case H2_EMBEDDED:
if (!alreadyOfCorrectType) {
sql = "alter table " + getTableName() + " alter column " + getColumnName() + " type " + type;
}
if (!alreadyCorrectNullable) {
if (isNullable()) {
sqlNotNull = "alter table " + getTableName() + " alter column " + getColumnName() + " drop not null";
} else {
sqlNotNull = "alter table " + getTableName() + " alter column " + getColumnName() + " set not null";
}
}
break;
default:
throw new IllegalStateException("Dont know how to handle " + getDriverType());
}

View File

@ -78,6 +78,11 @@ public class RenameColumnTask extends BaseTableTask<RenameColumnTask> {
case ORACLE_12C:
sql = "ALTER TABLE " + getTableName() + " RENAME COLUMN " + myOldName + " TO " + myNewName;
break;
case H2_EMBEDDED:
sql = "ALTER TABLE " + getTableName() + " ALTER COLUMN " + myOldName + " RENAME TO " + myNewName;
break;
default:
throw new IllegalStateException();
}
ourLog.info("Renaming column {} on table {} to {}", myOldName, getTableName(), myNewName);

View File

@ -16,7 +16,7 @@ public class AddTableTest extends BaseTest {
AddTableRawSqlTask task = new AddTableRawSqlTask();
task.setTableName("SOMETABLE");
task.addSql(DriverTypeEnum.DERBY_EMBEDDED, "create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))");
task.addSql(DriverTypeEnum.H2_EMBEDDED, "create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))");
getMigrator().addTask(task);
getMigrator().migrate();
@ -31,7 +31,7 @@ public class AddTableTest extends BaseTest {
AddTableRawSqlTask task = new AddTableRawSqlTask();
task.setTableName("SOMETABLE");
task.addSql(DriverTypeEnum.DERBY_EMBEDDED, "create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))");
task.addSql(DriverTypeEnum.H2_EMBEDDED, "create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))");
getMigrator().addTask(task);
getMigrator().migrate();

View File

@ -106,8 +106,8 @@ public class ArbitrarySqlTaskTest extends BaseTest {
};
migrator
.forVersion(VersionEnum.V3_5_0)
.executeRawSql(DriverTypeEnum.DERBY_EMBEDDED, "delete from TEST_UPDATE_TASK where RES_TYPE = 'Patient'")
.executeRawSql(DriverTypeEnum.DERBY_EMBEDDED, "delete from TEST_UPDATE_TASK where RES_TYPE = 'Encounter'");
.executeRawSql(DriverTypeEnum.H2_EMBEDDED, "delete from TEST_UPDATE_TASK where RES_TYPE = 'Patient'")
.executeRawSql(DriverTypeEnum.H2_EMBEDDED, "delete from TEST_UPDATE_TASK where RES_TYPE = 'Encounter'");
getMigrator().addTasks(migrator.getTasks(VersionEnum.V3_3_0, VersionEnum.V3_6_0));
getMigrator().migrate();

View File

@ -50,13 +50,15 @@ public class BaseTest {
@Before()
public void before() {
myUrl = "jdbc:derby:memory:database " + (ourDatabaseUrl++) + ";create=true";
org.h2.Driver.class.toString();
myConnectionProperties = DriverTypeEnum.DERBY_EMBEDDED.newConnectionProperties(myUrl, "SA", "SA");
myUrl = "jdbc:h2:mem:database" + (ourDatabaseUrl++);
myConnectionProperties = DriverTypeEnum.H2_EMBEDDED.newConnectionProperties(myUrl, "SA", "SA");
myMigrator = new Migrator();
myMigrator.setConnectionUrl(myUrl);
myMigrator.setDriverType(DriverTypeEnum.DERBY_EMBEDDED);
myMigrator.setDriverType(DriverTypeEnum.H2_EMBEDDED);
myMigrator.setUsername("SA");
myMigrator.setPassword("SA");
}

View File

@ -13,8 +13,8 @@ public class DropIndexTest extends BaseTest {
@Test
public void testIndexAlreadyExists() throws SQLException {
executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))");
executeSql("create unique index IDX_ANINDEX on SOMETABLE (PID, TEXTCOL)");
executeSql("create unique index IDX_DIFINDEX on SOMETABLE (TEXTCOL)");
executeSql("create index IDX_ANINDEX on SOMETABLE (PID, TEXTCOL)");
executeSql("create index IDX_DIFINDEX on SOMETABLE (TEXTCOL)");
DropIndexTask task = new DropIndexTask();
task.setDescription("Drop an index");
@ -30,7 +30,41 @@ public class DropIndexTest extends BaseTest {
@Test
public void testIndexDoesntAlreadyExist() throws SQLException {
executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))");
executeSql("create unique index IDX_DIFINDEX on SOMETABLE (TEXTCOL)");
executeSql("create index IDX_DIFINDEX on SOMETABLE (TEXTCOL)");
DropIndexTask task = new DropIndexTask();
task.setDescription("Drop an index");
task.setIndexName("IDX_ANINDEX");
task.setTableName("SOMETABLE");
getMigrator().addTask(task);
getMigrator().migrate();
assertThat(JdbcUtils.getIndexNames(getConnectionProperties(), "SOMETABLE"), contains("IDX_DIFINDEX"));
}
@Test
public void testConstraintAlreadyExists() throws SQLException {
executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))");
executeSql("create index IDX_ANINDEX on SOMETABLE (PID, TEXTCOL)");
executeSql("create index IDX_DIFINDEX on SOMETABLE (TEXTCOL)");
DropIndexTask task = new DropIndexTask();
task.setDescription("Drop an index");
task.setIndexName("IDX_ANINDEX");
task.setTableName("SOMETABLE");
getMigrator().addTask(task);
getMigrator().migrate();
assertThat(JdbcUtils.getIndexNames(getConnectionProperties(), "SOMETABLE"), contains("IDX_DIFINDEX"));
}
@Test
public void testConstraintDoesntAlreadyExist() throws SQLException {
executeSql("create table SOMETABLE (PID bigint not null, TEXTCOL varchar(255))");
executeSql("create index IDX_DIFINDEX on SOMETABLE (TEXTCOL)");
DropIndexTask task = new DropIndexTask();
task.setDescription("Drop an index");

View File

@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.model.entity;
import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.Subscription;
import org.hl7.fhir.dstu2.model.Subscription;
import java.util.Arrays;
import java.util.Collections;

View File

@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.subscription.module.cache;
* #L%
*/
import org.hl7.fhir.instance.model.Subscription;
import org.hl7.fhir.dstu2.model.Subscription;
public class SubscriptionConstants {

View File

@ -9,9 +9,8 @@ import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.validation.ResultSeverityEnum;
import ca.uhn.fhirtest.interceptor.PublicSecurityInterceptor;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.lang3.time.DateUtils;
import org.hibernate.dialect.PostgreSQL94Dialect;
import org.hl7.fhir.instance.model.Subscription;
import org.hl7.fhir.dstu2.model.Subscription;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@ -10,9 +10,8 @@ import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.validation.ResultSeverityEnum;
import ca.uhn.fhirtest.interceptor.PublicSecurityInterceptor;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.lang3.time.DateUtils;
import org.hibernate.dialect.PostgreSQL94Dialect;
import org.hl7.fhir.instance.model.Subscription;
import org.hl7.fhir.dstu2.model.Subscription;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;

View File

@ -10,9 +10,8 @@ import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.validation.ResultSeverityEnum;
import ca.uhn.fhirtest.interceptor.PublicSecurityInterceptor;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.lang3.time.DateUtils;
import org.hibernate.dialect.PostgreSQL94Dialect;
import org.hl7.fhir.instance.model.Subscription;
import org.hl7.fhir.dstu2.model.Subscription;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;

View File

@ -22,10 +22,15 @@
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-utilities</artifactId>
<version>${project.version}</version>
<artifactId>org.hl7.fhir.dstu2016may</artifactId>
<version>${fhir_core_version}</version>
</dependency>
<dependency>
<groupId>org.fhir</groupId>
<artifactId>ucum</artifactId>
<optional>true</optional>
</dependency>
<!--
Test dependencies on other optional parts of HAPI
-->
@ -69,13 +74,7 @@
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>xpp3</groupId>
<artifactId>xpp3_min</artifactId>
<version>1.1.4c</version>
</dependency>
<!--
<!--
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>

View File

@ -11,7 +11,6 @@ import org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent;
import org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import java.io.InputStream;
import java.io.InputStreamReader;
@ -274,7 +273,7 @@ public class DefaultProfileValidationSupport implements IValidationSupport {
}
}
return new CodeValidationResult(IssueSeverity.WARNING, "Unknown code: " + theCodeSystem + " / " + theCode);
return new CodeValidationResult(OperationOutcome.IssueSeverity.WARNING, "Unknown code: " + theCodeSystem + " / " + theCode);
}
}

View File

@ -3,6 +3,8 @@ package org.hl7.fhir.dstu2016may.hapi.validation;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import org.hl7.fhir.dstu2016may.model.*;
import org.hl7.fhir.dstu2016may.utils.INarrativeGenerator;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import java.util.ArrayList;
import java.util.Arrays;
@ -17,16 +19,7 @@ import org.apache.commons.lang3.Validate;
import org.hl7.fhir.dstu2016may.formats.IParser;
import org.hl7.fhir.dstu2016may.formats.ParserType;
import org.hl7.fhir.dstu2016may.hapi.validation.IValidationSupport.CodeValidationResult;
import org.hl7.fhir.dstu2016may.model.CodeSystem;
import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.dstu2016may.model.CodeType;
import org.hl7.fhir.dstu2016may.model.CodeableConcept;
import org.hl7.fhir.dstu2016may.model.Coding;
import org.hl7.fhir.dstu2016may.model.ConceptMap;
import org.hl7.fhir.dstu2016may.model.Resource;
import org.hl7.fhir.dstu2016may.model.ResourceType;
import org.hl7.fhir.dstu2016may.model.StructureDefinition;
import org.hl7.fhir.dstu2016may.model.ValueSet;
import org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent;
import org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent;
@ -127,12 +120,12 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
}
@Override
public IResourceValidator newValidator() {
public IParser newXmlParser() {
throw new UnsupportedOperationException();
}
@Override
public IParser newXmlParser() {
public INarrativeGenerator getNarrativeGenerator(String theS, String theS1) {
throw new UnsupportedOperationException();
}
@ -141,6 +134,11 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
throw new UnsupportedOperationException();
}
@Override
public StructureDefinition fetchTypeDefinition(String typeName) {
return fetchResource(org.hl7.fhir.dstu2016may.model.StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/" + typeName);
}
@Override
public boolean supportsSystem(String theSystem) {
if (myValidationSupport == null) {
@ -152,9 +150,9 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
@Override
public Set<String> typeTails() {
return new HashSet<String>(Arrays.asList("Integer", "UnsignedInt", "PositiveInt", "Decimal", "DateTime", "Date", "Time", "Instant", "String", "Uri", "Oid", "Uuid", "Id", "Boolean", "Code",
"Markdown", "Base64Binary", "Coding", "CodeableConcept", "Attachment", "Identifier", "Quantity", "SampledData", "Range", "Period", "Ratio", "HumanName", "Address", "ContactPoint",
"Timing", "Reference", "Annotation", "Signature", "Meta"));
return new HashSet<>(Arrays.asList("Integer", "UnsignedInt", "PositiveInt", "Decimal", "DateTime", "Date", "Time", "Instant", "String", "Uri", "Oid", "Uuid", "Id", "Boolean", "Code",
"Markdown", "Base64Binary", "Coding", "CodeableConcept", "Attachment", "Identifier", "Quantity", "SampledData", "Range", "Period", "Ratio", "HumanName", "Address", "ContactPoint",
"Timing", "Reference", "Annotation", "Signature", "Meta"));
}
@Override
@ -183,7 +181,10 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
if (result == null) {
return null;
}
return new ValidationResult(result.getSeverity(), result.getMessage(), result.asConceptDefinition());
ConceptDefinitionComponent definition = result.asConceptDefinition();
String message = result.getMessage();
OperationOutcome.IssueSeverity severity = result.getSeverity();
return new ValidationResult(severity, message, definition);
}
@Override
@ -212,7 +213,7 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
if (isNotBlank(theSystem)) {
CodeSystem system = fetchCodeSystem(theSystem);
if (system == null) {
return new ValidationResult(IssueSeverity.INFORMATION, "Code " + theSystem + "/" + theCode + " was not validated because the code system is not present");
return new ValidationResult(OperationOutcome.IssueSeverity.INFORMATION, "Code " + theSystem + "/" + theCode + " was not validated because the code system is not present");
}
if (system.hasCaseSensitive()) {
@ -261,7 +262,7 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander
}
}
return new ValidationResult(IssueSeverity.ERROR, "Unknown code[" + theCode + "] in system[" + theSystem + "]");
return new ValidationResult(OperationOutcome.IssueSeverity.ERROR, "Unknown code[" + theCode + "] in system[" + theSystem + "]");
}
@Override

View File

@ -4,6 +4,7 @@ import java.util.List;
import org.hl7.fhir.dstu2016may.model.CodeSystem;
import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.dstu2016may.model.OperationOutcome;
import org.hl7.fhir.dstu2016may.model.ValueSet;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.dstu2016may.model.StructureDefinition;
@ -15,7 +16,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.IContextValidationSupport;
public interface IValidationSupport
extends ca.uhn.fhir.context.support.IContextValidationSupport<ConceptSetComponent, ValueSetExpansionComponent, StructureDefinition, CodeSystem, ConceptDefinitionComponent, IssueSeverity> {
extends ca.uhn.fhir.context.support.IContextValidationSupport<ConceptSetComponent, ValueSetExpansionComponent, StructureDefinition, CodeSystem, ConceptDefinitionComponent, OperationOutcome.IssueSeverity> {
/**
* Expands the given portion of a ValueSet
@ -99,17 +100,17 @@ public interface IValidationSupport
@Override
CodeValidationResult validateCode(FhirContext theContext, String theCodeSystem, String theCode, String theDisplay);
public class CodeValidationResult extends IContextValidationSupport.CodeValidationResult<ConceptDefinitionComponent, IssueSeverity> {
public class CodeValidationResult extends IContextValidationSupport.CodeValidationResult<ConceptDefinitionComponent, OperationOutcome.IssueSeverity> {
public CodeValidationResult(ConceptDefinitionComponent theNext) {
super(theNext);
}
public CodeValidationResult(IssueSeverity theSeverity, String theMessage) {
public CodeValidationResult(OperationOutcome.IssueSeverity theSeverity, String theMessage) {
super(theSeverity, theMessage);
}
public CodeValidationResult(IssueSeverity severity, String message, ConceptDefinitionComponent definition) {
public CodeValidationResult(OperationOutcome.IssueSeverity severity, String message, ConceptDefinitionComponent definition) {
super(severity, message, definition);
}

View File

@ -18,50 +18,21 @@ import org.hl7.fhir.dstu2016may.metamodel.Manager.FhirFormat;
import org.hl7.fhir.dstu2016may.metamodel.ParserBase;
import org.hl7.fhir.dstu2016may.metamodel.ParserBase.ValidationPolicy;
import org.hl7.fhir.dstu2016may.metamodel.XmlParser;
import org.hl7.fhir.dstu2016may.model.Address;
import org.hl7.fhir.dstu2016may.model.Attachment;
import org.hl7.fhir.dstu2016may.model.Bundle;
import org.hl7.fhir.dstu2016may.model.*;
import org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.dstu2016may.model.CodeSystem;
import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.dstu2016may.model.CodeableConcept;
import org.hl7.fhir.dstu2016may.model.Coding;
import org.hl7.fhir.dstu2016may.model.ContactPoint;
import org.hl7.fhir.dstu2016may.model.DateType;
import org.hl7.fhir.dstu2016may.model.DomainResource;
import org.hl7.fhir.dstu2016may.model.ElementDefinition;
import org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity;
import org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent;
import org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent;
import org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength;
import org.hl7.fhir.dstu2016may.model.ExpressionNode;
import org.hl7.fhir.dstu2016may.model.Extension;
import org.hl7.fhir.dstu2016may.model.HumanName;
import org.hl7.fhir.dstu2016may.model.Identifier;
import org.hl7.fhir.dstu2016may.model.IntegerType;
import org.hl7.fhir.dstu2016may.model.Period;
import org.hl7.fhir.dstu2016may.model.Quantity;
import org.hl7.fhir.dstu2016may.model.Questionnaire;
import org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent;
import org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent;
import org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.dstu2016may.model.Range;
import org.hl7.fhir.dstu2016may.model.Ratio;
import org.hl7.fhir.dstu2016may.model.Reference;
import org.hl7.fhir.dstu2016may.model.Resource;
import org.hl7.fhir.dstu2016may.model.SampledData;
import org.hl7.fhir.dstu2016may.model.StringType;
import org.hl7.fhir.dstu2016may.model.StructureDefinition;
import org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext;
import org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent;
import org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule;
import org.hl7.fhir.dstu2016may.model.TimeType;
import org.hl7.fhir.dstu2016may.model.Timing;
import org.hl7.fhir.dstu2016may.model.Type;
import org.hl7.fhir.dstu2016may.model.UriType;
import org.hl7.fhir.dstu2016may.model.ValueSet;
import org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent;
import org.hl7.fhir.dstu2016may.utils.FHIRPathEngine;
import org.hl7.fhir.dstu2016may.utils.IWorkerContext;
@ -345,9 +316,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
txTime = txTime + (System.nanoTime() - t);
if (s == null || s.isOk())
return true;
if (s.getSeverity() == IssueSeverity.INFORMATION)
if (s.getSeverity() == OperationOutcome.IssueSeverity.INFORMATION)
hint(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage());
else if (s.getSeverity() == IssueSeverity.WARNING)
else if (s.getSeverity() == OperationOutcome.IssueSeverity.WARNING)
warning(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage());
else
return rule(errors, IssueType.CODEINVALID, element.line(), element.col(), path, s == null, s.getMessage());

Some files were not shown because too many files have changed in this diff Show More