Working
This commit is contained in:
parent
9a51323e03
commit
1df2de0667
|
@ -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
|
||||
}
|
||||
|
|
|
@ -1,38 +1,17 @@
|
|||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
package org.hl7.fhir.convertors;
|
||||
|
||||
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);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -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"));
|
|
@ -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);
|
|
@ -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();
|
||||
|
|
|
@ -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
Loading…
Reference in New Issue