This commit is contained in:
James 2017-04-18 07:12:45 -04:00
parent 9a51323e03
commit 1df2de0667
1035 changed files with 20418 additions and 20444 deletions

View File

@ -2,8 +2,8 @@ package example;
import org.hl7.fhir.convertors.NullVersionConverterAdvisor;
import org.hl7.fhir.convertors.VersionConvertorAdvisor;
import org.hl7.fhir.convertors.VersionConvertor_10_20;
import org.hl7.fhir.convertors.VersionConvertor_14_20;
import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.convertors.VersionConvertor_14_30;
import org.hl7.fhir.exceptions.FHIRException;
public class ConverterExamples {
@ -13,7 +13,7 @@ public class ConverterExamples {
//START SNIPPET: 1020
// Create a converter
VersionConvertorAdvisor advisor = new NullVersionConverterAdvisor();
VersionConvertor_10_20 converter = new VersionConvertor_10_20(advisor);
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();
@ -33,7 +33,7 @@ public class ConverterExamples {
input.setTitle("My title");
// Convert the resource
org.hl7.fhir.dstu3.model.Questionnaire output = VersionConvertor_14_20.convertQuestionnaire(input);
org.hl7.fhir.dstu3.model.Questionnaire output = VersionConvertor_14_30.convertQuestionnaire(input);
String context = output.getTitle();
//END SNIPPET: 1420
}

View File

@ -1,26 +1,5 @@
package org.hl7.fhir.convertors;
/*
* #%L
* HAPI FHIR - Converter
* %%
* Copyright (C) 2014 - 2017 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;

View File

@ -1,33 +1,12 @@
package org.hl7.fhir.convertors;
/*
* #%L
* HAPI FHIR - Converter
* %%
* Copyright (C) 2014 - 2017 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.util.ArrayList;
import java.util.List;
import org.apache.commons.codec.binary.Base64;
import org.hl7.fhir.instance.model.CodeableConcept;
import org.hl7.fhir.instance.model.Reference;
import org.hl7.fhir.dstu2.utils.ToolingExtensions;
import org.hl7.fhir.instance.utils.ToolingExtensions;
import org.hl7.fhir.dstu3.conformance.ProfileUtilities;
import org.hl7.fhir.dstu3.model.Annotation;
import org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction;
@ -38,6 +17,7 @@ import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent;
import org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority;
import org.hl7.fhir.dstu3.model.ConceptMap;
import org.hl7.fhir.dstu3.model.ContactDetail;
import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent;
import org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent;
import org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus;
@ -87,11 +67,11 @@ import org.hl7.fhir.utilities.Utilities;
// Generated on Thu, Apr 7, 2016 02:14+1000 for FHIR v1.4.0
public class VersionConvertor_10_20 {
public class VersionConvertor_10_30 {
public VersionConvertorAdvisor advisor;
public VersionConvertor_10_20(VersionConvertorAdvisor advisor) {
public VersionConvertor_10_30(VersionConvertorAdvisor advisor) {
super();
this.advisor = advisor;
}
@ -1915,7 +1895,7 @@ public class VersionConvertor_10_20 {
copyResource(src, tgt);
tgt.setText(convertNarrative(src.getText()));
for (org.hl7.fhir.dstu3.model.Resource t : src.getContained())
tgt.getContained().add(convertResource(t));
tgt.addContained(convertResource(t));
for (org.hl7.fhir.dstu3.model.Extension t : src.getExtension())
tgt.addExtension(convertExtension(t));
for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension())
@ -10339,7 +10319,7 @@ public class VersionConvertor_10_20 {
tgt.setDate(src.getDate());
tgt.setPublisher(src.getPublisher());
for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
tgt.addTelecom(convertContactPoint(t));
tgt.addContact(convertQuestionnaireContactComponent(t));
org.hl7.fhir.instance.model.Questionnaire.GroupComponent root = src.getGroup();
tgt.setTitle(root.getTitle());
for (org.hl7.fhir.instance.model.Coding t : root.getConcept())
@ -10362,8 +10342,9 @@ public class VersionConvertor_10_20 {
if (src.hasDate())
tgt.setDate(src.getDate());
tgt.setPublisher(src.getPublisher());
for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom())
tgt.addTelecom(convertContactPoint(t));
for (ContactDetail t : src.getContact())
for (org.hl7.fhir.dstu3.model.ContactPoint t1 : t.getTelecom())
tgt.addTelecom(convertContactPoint(t1));
org.hl7.fhir.instance.model.Questionnaire.GroupComponent root = tgt.getGroup();
root.setTitle(src.getTitle());
for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) {
@ -10379,23 +10360,32 @@ public class VersionConvertor_10_20 {
return tgt;
}
public org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus src) throws FHIRException {
public org.hl7.fhir.dstu3.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.instance.model.ContactPoint src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail();
copyElement(src, tgt);
tgt.addTelecom(convertContactPoint(src));
return tgt;
}
private static org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus src) throws FHIRException {
if (src == null)
return null;
switch (src) {
case DRAFT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.DRAFT;
case PUBLISHED: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.PUBLISHED;
case RETIRED: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.RETIRED;
default: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.NULL;
case DRAFT: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT;
case PUBLISHED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE;
case RETIRED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED;
default: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL;
}
}
public org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus src) throws FHIRException {
private static org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException {
if (src == null)
return null;
switch (src) {
case DRAFT: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.DRAFT;
case PUBLISHED: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.PUBLISHED;
case ACTIVE: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.PUBLISHED;
case RETIRED: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.RETIRED;
default: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.NULL;
}
@ -10964,7 +10954,7 @@ public class VersionConvertor_10_20 {
tgt.setBase(t.asStringValue());
tgt.setType(convertSearchParamType(src.getType()));
tgt.setDescription(src.getDescription());
org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression());
org.hl7.fhir.instance.utils.ToolingExtensions.setStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression());
tgt.setXpath(src.getXpath());
tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage()));
for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget())
@ -11204,7 +11194,7 @@ public class VersionConvertor_10_20 {
return null;
switch (src) {
case DATATYPE:
if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown"))
if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown", "xhtml"))
return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE;
else
return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE;

View File

@ -1,26 +1,5 @@
package org.hl7.fhir.convertors;
/*
* #%L
* HAPI FHIR - Converter
* %%
* Copyright (C) 2014 - 2017 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.
@ -64,12 +43,14 @@ import org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator;
import org.hl7.fhir.dstu3.model.ConceptMap;
import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent;
import org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent;
import org.hl7.fhir.dstu3.model.ContactDetail;
import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent;
import org.hl7.fhir.dstu3.model.Enumeration;
import org.hl7.fhir.dstu3.model.Timing.EventTiming;
import org.hl7.fhir.dstu3.model.UsageContext;
import org.hl7.fhir.exceptions.FHIRException;
public class VersionConvertor_14_20 {
public class VersionConvertor_14_30 {
private static void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.dstu3.model.Element tgt) throws FHIRException {
if (src.hasId())
@ -4973,12 +4954,12 @@ public class VersionConvertor_14_20 {
if (src.hasPublisher())
tgt.setPublisher(src.getPublisher());
for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom())
tgt.addTelecom(convertContactPoint(t));
tgt.addContact(convertQuestionnaireContactComponent(t));
for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext())
// if (isJurisdiction(t))
// tgt.addJurisdiction(convertCodeableConcept(t));
// else
tgt.addUseContext(convertCodeableConcept(t));
if (isJurisdiction(t))
tgt.addJurisdiction(convertCodeableConcept(t));
else
tgt.addUseContext(convertCodeableConceptToUsageContext(t));
if (src.hasTitle())
tgt.setTitle(src.getTitle());
for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept())
@ -5006,12 +4987,13 @@ public class VersionConvertor_14_20 {
tgt.setDate(src.getDate());
if (src.hasPublisher())
tgt.setPublisher(src.getPublisher());
for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom())
tgt.addTelecom(convertContactPoint(t));
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getUseContext())
for (ContactDetail t : src.getContact())
for (org.hl7.fhir.dstu3.model.ContactPoint t1 : t.getTelecom())
tgt.addTelecom(convertContactPoint(t1));
for (UsageContext t : src.getUseContext())
tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept()));
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction())
tgt.addUseContext(convertCodeableConcept(t));
// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction())
// tgt.addUseContext(convertCodeableConcept(t));
if (src.hasTitle())
tgt.setTitle(src.getTitle());
for (org.hl7.fhir.dstu3.model.Coding t : src.getCode())
@ -5023,23 +5005,33 @@ public class VersionConvertor_14_20 {
return tgt;
}
private static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus src) throws FHIRException {
public static org.hl7.fhir.dstu3.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail();
copyElement(src, tgt);
tgt.addTelecom(convertContactPoint(src));
return tgt;
}
private static org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus src) throws FHIRException {
if (src == null)
return null;
switch (src) {
case DRAFT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.DRAFT;
case PUBLISHED: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.PUBLISHED;
case RETIRED: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.RETIRED;
default: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.NULL;
case DRAFT: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT;
case PUBLISHED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE;
case RETIRED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED;
default: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL;
}
}
private static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus src) throws FHIRException {
private static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException {
if (src == null)
return null;
switch (src) {
case DRAFT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.DRAFT;
case PUBLISHED: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.PUBLISHED;
case ACTIVE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.PUBLISHED;
case RETIRED: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.RETIRED;
default: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.NULL;
}

View File

@ -1,19 +1,17 @@
package org.hl7.fhir.convertors;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import org.hl7.fhir.dstu2016may.model.Observation;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.Reference;
import org.junit.Test;
public class VersionConvertor_10_20Test {
public class VersionConvertor_10_30Test {
@Test
public void testConvert() throws FHIRException {
VersionConvertorAdvisor advisor = new NullVersionConverterAdvisor();
VersionConvertor_10_20 converter = new VersionConvertor_10_20(advisor);
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"));

View File

@ -5,7 +5,7 @@ import static org.junit.Assert.assertEquals;
import org.hl7.fhir.exceptions.FHIRException;
import org.junit.Test;
public class VersionConvertor_14_20Test {
public class VersionConvertor_14_30Test {
@Test
public void testConvert() throws FHIRException {
@ -13,7 +13,7 @@ public class VersionConvertor_14_20Test {
org.hl7.fhir.dstu2016may.model.Questionnaire input = new org.hl7.fhir.dstu2016may.model.Questionnaire();
input.setTitle("My title");
org.hl7.fhir.dstu3.model.Questionnaire output = VersionConvertor_14_20.convertQuestionnaire(input);
org.hl7.fhir.dstu3.model.Questionnaire output = VersionConvertor_14_30.convertQuestionnaire(input);
String context = output.getTitle();
assertEquals("My title", context);

View File

@ -11,16 +11,21 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.hl7.fhir.dstu3.model.*;
import org.hl7.fhir.dstu3.model.AllergyIntolerance;
import org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory;
import org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus;
import org.hl7.fhir.dstu3.model.AuditEvent;
import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode;
import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.dstu3.model.Observation;
import org.hl7.fhir.dstu3.model.StringType;
import org.hl7.fhir.dstu3.model.ValueSet;
import org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent;
import org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.dstu3.model.ValueSet.FilterOperator;
import org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent;
import org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent;
import org.hl7.fhir.dstu3.model.codesystems.AllergyIntoleranceCategory;
import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.After;
import org.junit.AfterClass;
@ -29,7 +34,6 @@ import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import ca.uhn.fhir.jpa.dao.BaseHapiFhirSystemDao;
import ca.uhn.fhir.jpa.dao.DaoConfig;
import ca.uhn.fhir.jpa.dao.IFhirResourceDaoCodeSystem.LookupCodeResult;
import ca.uhn.fhir.jpa.dao.SearchParameterMap;
@ -1007,7 +1011,7 @@ public class FhirResourceDaoDstu3TerminologyTest extends BaseJpaDstu3Test {
createLocalCsAndVs();
AuditEvent aeIn1 = new AuditEvent();
aeIn1.getType().setSystem("http://nema.org/dicom/dicm").setCode("110102");
aeIn1.getType().setSystem("http://dicom.nema.org/resources/ontology/DCM").setCode("110102");
IIdType idIn1 = myAuditEventDao.create(aeIn1, mySrd).getId().toUnqualifiedVersionless();
AuditEvent aeIn2 = new AuditEvent();

View File

@ -4,6 +4,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
@ -600,7 +601,7 @@ public class Element extends Base {
remove.add(child);
}
children.removeAll(remove);
children.sort(new ElementSortComparator(this, this.property));
Collections.sort(children, new ElementSortComparator(this, this.property));
}
}
@ -619,8 +620,9 @@ public class Element extends Base {
public int compare(Element e0, Element e1) {
int i0 = find(e0);
int i1 = find(e1);
return Integer.compare(i0, i1);
return (i0 < i1) ? -1 : ((i0 == i1) ? 0 : 1);
}
private int find(Element e0) {
int i = e0.elementProperty != null ? children.indexOf(e0.elementProperty.getDefinition()) : children.indexOf(e0.property.getDefinition());
return i;

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