Adding version option to ignore bundle entry in conversion advisors (#492)

This commit is contained in:
Mark Iantorno 2021-05-07 14:50:40 -04:00 committed by GitHub
parent 5a11851ec7
commit 9a82457b36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 480 additions and 328 deletions

View File

@ -7,6 +7,7 @@
* Issue 484 https://github.com/hapifhir/org.hl7.fhir.core/issues/484
* Adding Kotlin to the build process
* random cleaning up in convertors
* Adding version option to ignore bundle entry in conversion advisors
* Validator: Load code systems from known packages on the fly
* Validator: better handle invalid v3 dates
* Renderer: Render OperationDefinition.InputProfile and OutputProfile

View File

@ -1,83 +0,0 @@
package org.hl7.fhir.convertors.advisors;
/*
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 org.hl7.fhir.exceptions.FHIRException;
/**
* This interface is passed into the version conversion routines when on of the
* converters is producing or converting R3 resources.
*
* The interface allows users of the code to
* 1. manage the life cycle of new resources created (or needed) during the conversion process
* 2. manage how unknown content etc is handled
*
* @author grahame
*
*/
public interface VersionConvertorAdvisor30 {
/**
* when processing a bundle, and converting from R3 to R2 whether to ignore an entry in the bundle.
* typically, return true when it's a resource that isn't handled, and you don't care.
*
* by default, always return false unless you know why not do this
*
* todo: why only R2? generalise this to all targets
*
* @param src
* @return
*/
boolean ignoreEntry(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src);
/**
* In R2, code systems are internal to value sets, but in subsequent versions, they
* exist as separate resources. The convertor will create the code system, and then
* call this routine for the host to decide what to do with it
*
* It can make it a contained resource, or it can put it somewhere else
*
* @param tgtcs
* @param source
* @throws FHIRException
*/
void handleCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem tgtcs, org.hl7.fhir.dstu3.model.ValueSet source) throws FHIRException;
/**
* when converting from R3 to R2, and converting a value set, the convertor will need
* to find the code system a value set is referring to, so it can include it inline.
*
* This routine should find the actual resource
*
* @param src
* @return
* @throws FHIRException
*/
org.hl7.fhir.dstu3.model.CodeSystem getCodeSystem(org.hl7.fhir.dstu3.model.ValueSet src) throws FHIRException;
}

View File

@ -1,84 +0,0 @@
package org.hl7.fhir.convertors.advisors;
/*
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 org.hl7.fhir.exceptions.FHIRException;
/**
* This interface is passed into the version conversion routines when on of the
* converters is producing or converting R4 resources.
*
* The interface allows users of the code to
* 1. manage the life cycle of new resources created (or needed) during the conversion process
* 2. manage how unknown content etc is handled
*
* @author grahame
*
*/
public interface VersionConvertorAdvisor40 {
/**
* when processing a bundle, and converting from R4 to R2 whether to ignore an entry in the bundle.
* typically, return true when it's a resource that isn't handled, and you don't care.
*
* by default, always return false unless you know why not do this
*
* todo: why only R2? generalise this to all targets
*
* @param src
* @return
*/
boolean ignoreEntry(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src);
/**
* In R2, code systems are internal to value sets, but in subsequent versions, they
* exist as separate resources. The convertor will create the code system, and then
* call this routine for the host to decide what to do with it
*
* It can make it a contained resource, or it can put it somewhere else
*
* @param tgtcs
* @param source
* @throws FHIRException
*/
void handleCodeSystem(org.hl7.fhir.r4.model.CodeSystem tgtcs, org.hl7.fhir.r4.model.ValueSet source) throws FHIRException;
/**
* when converting from R4 to R2, and converting a value set, the convertor will need
* to find the code system a value set is referring to, so it can include it inline.
*
* This routine should find the actual resource
*
* @param src
* @return
* @throws FHIRException
*/
org.hl7.fhir.r4.model.CodeSystem getCodeSystem(org.hl7.fhir.r4.model.ValueSet src) throws FHIRException;
}

View File

@ -1,71 +0,0 @@
package org.hl7.fhir.convertors.advisors;
/*
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 org.hl7.fhir.exceptions.FHIRException;
public interface VersionConvertorAdvisor50 {
/**
* when processing a bundle, and converting from R5 to R2 whether to ignore an entry in the bundle.
* typically, return true when it's a resource that isn't handled, and you don't care.
*
* by default, always return false unless you know why not do this
*
* todo: why only R2? generalise this to all targets
*
* @param src
* @return
*/
boolean ignoreEntry(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src);
/**
* In R2, code systems are internal to value sets, but in subsequent versions, they
* exist as separate resources. The convertor will create the code system, and then
* call this routine for the host to decide what to do with it
*
* It can make it a contained resource, or it can put it somewhere else
*
* @param tgtcs
* @param source
* @throws FHIRException
*/
void handleCodeSystem(org.hl7.fhir.r5.model.CodeSystem tgtcs, org.hl7.fhir.r5.model.ValueSet source) throws FHIRException;
/**
* when converting from R5 to R2, and converting a value set, the convertor will need
* to find the code system a value set is referring to, so it can include it inline.
*
* This routine should find the actual resource
*
* @param src
* @return
* @throws FHIRException
*/
org.hl7.fhir.r5.model.CodeSystem getCodeSystem(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException;
}

View File

@ -1,8 +1,9 @@
package org.hl7.fhir.convertors.conv10_30;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.FhirPublication;
public class Bundle10_30 {
@ -45,7 +46,7 @@ public class Bundle10_30 {
public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src, VersionConvertorAdvisor30 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
if (advisor.ignoreEntry(src))
if (advisor.ignoreEntry(src, FhirPublication.DSTU2))
return null;
org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent();
VersionConvertor_10_30.copyElement(src, tgt);

View File

@ -1,8 +1,9 @@
package org.hl7.fhir.convertors.conv10_30;
import java.util.List;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.dstu2.model.ValueSet;
import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode;

View File

@ -1,8 +1,9 @@
package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.FhirPublication;
public class Bundle10_40 {
@ -64,7 +65,7 @@ public class Bundle10_40 {
public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src, VersionConvertorAdvisor40 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
if (advisor.ignoreEntry(src))
if (advisor.ignoreEntry(src, FhirPublication.DSTU2))
return null;
org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent();
VersionConvertor_10_40.copyElement(src, tgt);

View File

@ -1,8 +1,9 @@
package org.hl7.fhir.convertors.conv10_40;
import java.util.List;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.dstu2.model.ValueSet;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.BooleanType;

View File

@ -1,8 +1,9 @@
package org.hl7.fhir.convertors.conv10_50;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.FhirPublication;
public class Bundle10_50 {
@ -64,7 +65,7 @@ public class Bundle10_50 {
public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src, VersionConvertorAdvisor50 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
if (advisor.ignoreEntry(src))
if (advisor.ignoreEntry(src, FhirPublication.DSTU2))
return null;
org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent();
VersionConvertor_10_50.copyElement(src, tgt);

View File

@ -1,8 +1,9 @@
package org.hl7.fhir.convertors.conv10_50;
import java.util.List;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.dstu2.model.ValueSet;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.BooleanType;

View File

@ -37,8 +37,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_14_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.dstu2016may.formats.JsonParser;
import org.hl7.fhir.dstu2016may.formats.XmlParser;
import org.hl7.fhir.dstu2016may.model.Resource;
@ -54,6 +54,7 @@ import org.hl7.fhir.r4.model.StructureDefinition;
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.r4.model.UriType;
import org.hl7.fhir.r4.model.ValueSet;
import org.hl7.fhir.r5.model.FhirPublication;
public class R2016MayToR4Loader extends BaseLoaderR4 implements IContextResourceLoader, VersionConvertorAdvisor40 {
@ -112,7 +113,7 @@ public class R2016MayToR4Loader extends BaseLoaderR4 implements IContextResource
}
@Override
public boolean ignoreEntry(BundleEntryComponent src) {
public boolean ignoreEntry(BundleEntryComponent src, FhirPublication publication) {
return false;
}

View File

@ -37,25 +37,18 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_14_50;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.dstu2016may.formats.JsonParser;
import org.hl7.fhir.dstu2016may.formats.XmlParser;
import org.hl7.fhir.dstu2016may.model.Resource;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.conformance.ProfileUtilities;
import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.r5.model.*;
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r5.model.Bundle.BundleType;
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r5.model.CanonicalResource;
import org.hl7.fhir.r5.model.CanonicalType;
import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet;
public class R2016MayToR5Loader extends BaseLoaderR5 implements VersionConvertorAdvisor50 {
@ -155,7 +148,7 @@ public class R2016MayToR5Loader extends BaseLoaderR5 implements VersionConvertor
}
@Override
public boolean ignoreEntry(BundleEntryComponent src) {
public boolean ignoreEntry(BundleEntryComponent src, FhirPublication publication) {
return false;
}

View File

@ -36,8 +36,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.dstu2.formats.JsonParser;
import org.hl7.fhir.dstu2.formats.XmlParser;
import org.hl7.fhir.dstu2.model.Resource;
@ -51,6 +51,7 @@ import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.dstu3.model.UriType;
import org.hl7.fhir.dstu3.model.ValueSet;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.FhirPublication;
public class R2ToR3Loader extends BaseLoaderR3 implements VersionConvertorAdvisor30 {
@ -107,7 +108,7 @@ public class R2ToR3Loader extends BaseLoaderR3 implements VersionConvertorAdviso
}
@Override
public boolean ignoreEntry(BundleEntryComponent src) {
public boolean ignoreEntry(BundleEntryComponent src, FhirPublication publication) {
return false;
}

View File

@ -37,8 +37,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.dstu2.formats.JsonParser;
import org.hl7.fhir.dstu2.formats.XmlParser;
import org.hl7.fhir.dstu2.model.Resource;
@ -52,6 +52,7 @@ import org.hl7.fhir.r4.model.StructureDefinition;
import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.r4.model.UriType;
import org.hl7.fhir.r4.model.ValueSet;
import org.hl7.fhir.r5.model.FhirPublication;
public class R2ToR4Loader extends BaseLoaderR4 implements VersionConvertorAdvisor40 {
@ -109,7 +110,7 @@ public class R2ToR4Loader extends BaseLoaderR4 implements VersionConvertorAdviso
}
@Override
public boolean ignoreEntry(BundleEntryComponent src) {
public boolean ignoreEntry(BundleEntryComponent src, FhirPublication publication) {
return false;
}

View File

@ -37,25 +37,18 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.dstu2.formats.JsonParser;
import org.hl7.fhir.dstu2.formats.XmlParser;
import org.hl7.fhir.dstu2.model.Resource;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.r5.model.*;
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r5.model.Bundle.BundleType;
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r5.model.CanonicalResource;
import org.hl7.fhir.r5.model.CanonicalType;
import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet;
public class R2ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor50 {
@ -154,7 +147,7 @@ public class R2ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader
}
@Override
public boolean ignoreEntry(BundleEntryComponent src) {
public boolean ignoreEntry(BundleEntryComponent src, FhirPublication publication) {
return false;
}

View File

@ -37,8 +37,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_30_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.dstu3.formats.JsonParser;
import org.hl7.fhir.dstu3.formats.XmlParser;
import org.hl7.fhir.dstu3.model.Resource;
@ -120,7 +120,7 @@ public class R3ToR4Loader extends BaseLoaderR4 implements IContextResourceLoader
}
@Override
public boolean ignoreEntry(BundleEntryComponent src) {
public boolean ignoreEntry(BundleEntryComponent src, org.hl7.fhir.r5.model.FhirPublication publication) {
return false;
}

View File

@ -37,25 +37,18 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_30_50;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.dstu3.formats.JsonParser;
import org.hl7.fhir.dstu3.formats.XmlParser;
import org.hl7.fhir.dstu3.model.Resource;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.r5.model.*;
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r5.model.Bundle.BundleType;
import org.hl7.fhir.r5.model.CanonicalResource;
import org.hl7.fhir.r5.model.CanonicalType;
import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet;
public class R3ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor50 {
@ -157,7 +150,7 @@ public class R3ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader
}
@Override
public boolean ignoreEntry(BundleEntryComponent src) {
public boolean ignoreEntry(BundleEntryComponent src, FhirPublication publication) {
return false;
}

View File

@ -37,25 +37,18 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_40_50;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.formats.JsonParser;
import org.hl7.fhir.r4.formats.XmlParser;
import org.hl7.fhir.r4.model.Resource;
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.r5.model.*;
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r5.model.Bundle.BundleType;
import org.hl7.fhir.r5.model.CanonicalResource;
import org.hl7.fhir.r5.model.CanonicalType;
import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet;
public class R4ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader, VersionConvertorAdvisor50 {
@ -157,7 +150,7 @@ public class R4ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader
}
@Override
public boolean ignoreEntry(BundleEntryComponent src) {
public boolean ignoreEntry(BundleEntryComponent src, FhirPublication publication) {
return false;
}

View File

@ -41,19 +41,11 @@ import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.formats.JsonParser;
import org.hl7.fhir.r5.formats.XmlParser;
import org.hl7.fhir.r5.model.Resource;
import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.r5.model.*;
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r5.model.Bundle.BundleType;
import org.hl7.fhir.r5.model.CanonicalResource;
import org.hl7.fhir.r5.model.CanonicalType;
import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.ElementDefinition;
import org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.r5.model.UriType;
import org.hl7.fhir.r5.model.ValueSet;
public class R5ToR5Loader extends BaseLoaderR5 implements VersionConvertorAdvisor50 {
@ -153,7 +145,7 @@ public class R5ToR5Loader extends BaseLoaderR5 implements VersionConvertorAdviso
}
@Override
public boolean ignoreEntry(BundleEntryComponent src) {
public boolean ignoreEntry(BundleEntryComponent src, FhirPublication publication) {
return false;
}

View File

@ -38,9 +38,8 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Date;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.dstu2.model.Resource;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.dstu3.formats.IParser.OutputStyle;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent;
@ -48,6 +47,7 @@ import org.hl7.fhir.dstu3.model.Bundle.BundleType;
import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.ValueSet;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.FhirPublication;
import org.hl7.fhir.utilities.Utilities;
public class IGPackConverter102 implements VersionConvertorAdvisor30 {
@ -85,7 +85,7 @@ public class IGPackConverter102 implements VersionConvertorAdvisor30 {
}
@Override
public boolean ignoreEntry(BundleEntryComponent src) {
public boolean ignoreEntry(BundleEntryComponent src, FhirPublication publication) {
return false;
}

View File

@ -1,7 +1,5 @@
package org.hl7.fhir.convertors.misc;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@ -33,16 +31,16 @@ import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.dstu2.model.Resource;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.ValueSet;
import org.hl7.fhir.r5.model.FhirPublication;
public class IGR2ConvertorAdvisor implements VersionConvertorAdvisor40 {
@Override
public boolean ignoreEntry(BundleEntryComponent src) {
public boolean ignoreEntry(BundleEntryComponent src, FhirPublication publication) {
return false;
}

View File

@ -1,7 +1,5 @@
package org.hl7.fhir.convertors.misc;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
@ -33,16 +31,16 @@ import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.dstu2.model.Resource;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.r5.model.Bundle.BundleEntryComponent;
import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.FhirPublication;
import org.hl7.fhir.r5.model.ValueSet;
public class IGR2ConvertorAdvisor5 implements VersionConvertorAdvisor50 {
@Override
public boolean ignoreEntry(BundleEntryComponent src) {
public boolean ignoreEntry(BundleEntryComponent src, FhirPublication publication) {
return false;
}

View File

@ -5,11 +5,12 @@ import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.CodeSystem;
import org.hl7.fhir.r4.model.ValueSet;
import org.hl7.fhir.r5.model.FhirPublication;
class PR2Handler implements VersionConvertorAdvisor40 {
@Override
public boolean ignoreEntry(Bundle.BundleEntryComponent src) {
public boolean ignoreEntry(Bundle.BundleEntryComponent src, FhirPublication publication) {
return false;
}

View File

@ -0,0 +1,90 @@
package org.hl7.fhir.convertors.advisors
import org.hl7.fhir.dstu3.model.Bundle
import org.hl7.fhir.dstu3.model.CodeSystem
import org.hl7.fhir.dstu3.model.ValueSet
import org.hl7.fhir.exceptions.FHIRException
import org.hl7.fhir.r5.model.FhirPublication
/*
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.
*/ /**
* This interface is passed into the version conversion routines when on of the
* converters is producing or converting R3 resources.
*
* The interface allows users of the code to
* 1. manage the life cycle of new resources created (or needed) during the conversion process
* 2. manage how unknown content etc is handled
*
* @author grahame
*/
interface VersionConvertorAdvisor30 {
/**
* When processing a bundle during conversion, we can choose whether to ignore an entry in the bundle. We return
* true when it's a resource that isn't handled, and you don't want to convert.
*
* Different conversions require differing behaviors, so users can determine how they want to handle conversion
* for different target [FhirPublication] versions by switching on the the passed in version.
*
* If implementing this advisor, by default, always return false unless you have a specific reason not to convert
* a [Bundle.BundleEntryComponent].
*
* @param src [Bundle.BundleEntryComponent] to ignore
* @param targetVersion [FhirPublication] of the target version
* @return [Boolean] True, if we are going to ignore this [Bundle.BundleEntryComponent] in this conversion operation.
*/
fun ignoreEntry(src: Bundle.BundleEntryComponent?, targetVersion: FhirPublication): Boolean
/**
* In R2, code systems are internal to value sets, but in subsequent versions, they
* exist as separate resources. The convertor will create the code system, and then
* call this routine for the host to decide what to do with it
*
* It can make it a contained resource, or it can put it somewhere else
*
* @param tgtcs
* @param source
* @throws FHIRException
*/
@Throws(FHIRException::class)
fun handleCodeSystem(tgtcs: CodeSystem?, source: ValueSet?)
/**
* when converting from R3 to R2, and converting a value set, the convertor will need
* to find the code system a value set is referring to, so it can include it inline.
*
* This routine should find the actual resource
*
* @param src
* @return
* @throws FHIRException
*/
@Throws(FHIRException::class)
fun getCodeSystem(src: ValueSet?): CodeSystem?
}

View File

@ -0,0 +1,90 @@
package org.hl7.fhir.convertors.advisors
import org.hl7.fhir.exceptions.FHIRException
import org.hl7.fhir.r4.model.Bundle
import org.hl7.fhir.r4.model.CodeSystem
import org.hl7.fhir.r4.model.ValueSet
import org.hl7.fhir.r5.model.FhirPublication
/*
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.
*/ /**
* This interface is passed into the version conversion routines when on of the
* converters is producing or converting R4 resources.
*
* The interface allows users of the code to
* 1. manage the life cycle of new resources created (or needed) during the conversion process
* 2. manage how unknown content etc is handled
*
* @author grahame
*/
interface VersionConvertorAdvisor40 {
/**
* When processing a bundle during conversion, we can choose whether to ignore an entry in the bundle. We return
* true when it's a resource that isn't handled, and you don't want to convert.
*
* Different conversions require differing behaviors, so users can determine how they want to handle conversion
* for different target [FhirPublication] versions by switching on the the passed in version.
*
* If implementing this advisor, by default, always return false unless you have a specific reason not to convert
* a [Bundle.BundleEntryComponent].
*
* @param src [Bundle.BundleEntryComponent] to ignore
* @param targetVersion [FhirPublication] of the target version
* @return [Boolean] True, if we are going to ignore this [Bundle.BundleEntryComponent] in this conversion operation.
*/
fun ignoreEntry(src: Bundle.BundleEntryComponent?, targetVersion: FhirPublication): Boolean
/**
* In R2, code systems are internal to value sets, but in subsequent versions, they
* exist as separate resources. The convertor will create the code system, and then
* call this routine for the host to decide what to do with it
*
* It can make it a contained resource, or it can put it somewhere else
*
* @param tgtcs
* @param source
* @throws FHIRException
*/
@Throws(FHIRException::class)
fun handleCodeSystem(tgtcs: CodeSystem?, source: ValueSet?)
/**
* when converting from R4 to R2, and converting a value set, the convertor will need
* to find the code system a value set is referring to, so it can include it inline.
*
* This routine should find the actual resource
*
* @param src
* @return
* @throws FHIRException
*/
@Throws(FHIRException::class)
fun getCodeSystem(src: ValueSet?): CodeSystem?
}

View File

@ -0,0 +1,81 @@
package org.hl7.fhir.convertors.advisors
import org.hl7.fhir.exceptions.FHIRException
import org.hl7.fhir.r5.model.Bundle
import org.hl7.fhir.r5.model.CodeSystem
import org.hl7.fhir.r5.model.FhirPublication
import org.hl7.fhir.r5.model.ValueSet
/*
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.
*/
interface VersionConvertorAdvisor50 {
/**
* When processing a bundle during conversion, we can choose whether to ignore an entry in the bundle. We return
* true when it's a resource that isn't handled, and you don't want to convert.
*
* Different conversions require differing behaviors, so users can determine how they want to handle conversion
* for different target [FhirPublication] versions by switching on the the passed in version.
*
* If implementing this advisor, by default, always return false unless you have a specific reason not to convert
* a [Bundle.BundleEntryComponent].
*
* @param src [Bundle.BundleEntryComponent] to ignore
* @param targetVersion [FhirPublication] of the target version
* @return [Boolean] True, if we are going to ignore this [Bundle.BundleEntryComponent] in this conversion operation.
*/
fun ignoreEntry(src: Bundle.BundleEntryComponent?, targetVersion: FhirPublication): Boolean
/**
* In R2, code systems are internal to value sets, but in subsequent versions, they
* exist as separate resources. The convertor will create the code system, and then
* call this routine for the host to decide what to do with it
*
* It can make it a contained resource, or it can put it somewhere else
*
* @param tgtcs
* @param source
* @throws FHIRException
*/
@Throws(FHIRException::class)
fun handleCodeSystem(tgtcs: CodeSystem?, source: ValueSet?)
/**
* when converting from R5 to R2, and converting a value set, the convertor will need
* to find the code system a value set is referring to, so it can include it inline.
*
* This routine should find the actual resource
*
* @param src
* @return
* @throws FHIRException
*/
@Throws(FHIRException::class)
fun getCodeSystem(src: ValueSet?): CodeSystem?
}

View File

@ -1,7 +1,7 @@
package org.hl7.fhir.convertors.conv10_30;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.loaders.R2ToR3Loader;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

View File

@ -1,7 +1,7 @@
package org.hl7.fhir.convertors.conv10_30;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.loaders.R2ToR3Loader;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;

View File

@ -1,7 +1,7 @@
package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;

View File

@ -1,7 +1,7 @@
package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;

View File

@ -1,7 +1,7 @@
package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;

View File

@ -1,7 +1,7 @@
package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;

View File

@ -1,7 +1,7 @@
package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;

View File

@ -0,0 +1,34 @@
package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
import org.hl7.fhir.r4.formats.JsonParser;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.io.InputStream;
public class ValueSet10_40Test {
@Test
@DisplayName("Test 10_40 ValueSet conversion")
public void testValueSetConversion() throws IOException {
InputStream dstu2_input = this.getClass().getResourceAsStream("/0_valueset_vision_base_codes_10.json");
InputStream r4_exepected_input = this.getClass().getResourceAsStream("/0_valueset_vision_base_codes_40.json");
org.hl7.fhir.dstu2.model.ValueSet dstu2 = (org.hl7.fhir.dstu2.model.ValueSet) new org.hl7.fhir.dstu2.formats.JsonParser().parse(dstu2_input);
VersionConvertorAdvisor40 advisor = new IGR2ConvertorAdvisor();
org.hl7.fhir.r4.model.Resource r4_actual = VersionConvertor_10_40.convertResource(dstu2, advisor);
org.hl7.fhir.r4.formats.JsonParser r4_parser = new org.hl7.fhir.r4.formats.JsonParser();
JsonParser parser = new JsonParser();
String composeString = parser.composeString(r4_actual);
org.hl7.fhir.r4.model.Resource r4_expected = r4_parser.parse(r4_exepected_input);
Assertions.assertTrue(r4_expected.equalsDeep(r4_actual),
"Failed comparing\n" + r4_parser.composeString(r4_actual) + "\nand\n" + r4_parser.composeString(r4_expected));
}
}

View File

@ -0,0 +1,75 @@
{
"resourceType": "ValueSet",
"id": "vision-base-codes",
"meta": {
"lastUpdated": "2015-10-24T07:41:03.495+11:00",
"profile": [
"http://hl7.org/fhir/StructureDefinition/valueset-shareable-definition"
]
},
"text": {
"status": "generated",
"div": "<div><h2>VisionBase</h2><p>A coded concept listing the base codes.</p><p>This value set has an inline code system http://hl7.org/fhir/vision-base-codes, which defines the following codes:</p><table class=\"codes\"><tr><td><b>Code</b></td><td><b>Display</b></td><td><b>Definition</b></td></tr><tr><td>up<a name=\"up\"> </a></td><td>Up</td><td>top</td></tr><tr><td>down<a name=\"down\"> </a></td><td>Down</td><td>bottom</td></tr><tr><td>in<a name=\"in\"> </a></td><td>In</td><td>inner edge</td></tr><tr><td>out<a name=\"out\"> </a></td><td>Out</td><td>outer edge</td></tr></table></div>"
},
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/valueset-oid",
"valueUri": "urn:oid:2.16.840.1.113883.4.642.2.345"
}
],
"url": "http://hl7.org/fhir/ValueSet/vision-base-codes",
"version": "1.0.2",
"name": "VisionBase",
"status": "draft",
"experimental": false,
"publisher": "HL7 (FHIR Project)",
"contact": [
{
"telecom": [
{
"system": "other",
"value": "http://hl7.org/fhir"
},
{
"system": "email",
"value": "fhir@lists.hl7.org"
}
]
}
],
"date": "2015-10-24T07:41:03+11:00",
"description": "A coded concept listing the base codes.",
"codeSystem": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/valueset-oid",
"valueUri": "urn:oid:2.16.840.1.113883.4.642.1.345"
}
],
"system": "http://hl7.org/fhir/vision-base-codes",
"version": "1.0.2",
"caseSensitive": true,
"concept": [
{
"code": "up",
"display": "Up",
"definition": "top"
},
{
"code": "down",
"display": "Down",
"definition": "bottom"
},
{
"code": "in",
"display": "In",
"definition": "inner edge"
},
{
"code": "out",
"display": "Out",
"definition": "outer edge"
}
]
}
}

View File

@ -0,0 +1,49 @@
{
"resourceType": "ValueSet",
"id": "vision-base-codes",
"meta": {
"lastUpdated": "2015-10-23T16:41:03.495-04:00",
"profile": [
"http://hl7.org/fhir/StructureDefinition/valueset-shareable-definition"
]
},
"text": {
"status": "generated",
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><h2>VisionBase</h2><p>A coded concept listing the base codes.</p><p>This value set has an inline code system http://hl7.org/fhir/vision-base-codes, which defines the following codes:</p><table class=\"codes\"><tr><td><b>Code</b></td><td><b>Display</b></td><td><b>Definition</b></td></tr><tr><td>up<a name=\"up\"> </a></td><td>Up</td><td>top</td></tr><tr><td>down<a name=\"down\"> </a></td><td>Down</td><td>bottom</td></tr><tr><td>in<a name=\"in\"> </a></td><td>In</td><td>inner edge</td></tr><tr><td>out<a name=\"out\"> </a></td><td>Out</td><td>outer edge</td></tr></table></div>"
},
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/valueset-oid",
"valueUri": "urn:oid:2.16.840.1.113883.4.642.2.345"
}
],
"url": "http://hl7.org/fhir/ValueSet/vision-base-codes",
"version": "1.0.2",
"name": "VisionBase",
"status": "draft",
"experimental": false,
"date": "2015-10-24T07:41:03+11:00",
"publisher": "HL7 (FHIR Project)",
"contact": [
{
"telecom": [
{
"system": "other",
"value": "http://hl7.org/fhir"
},
{
"system": "email",
"value": "fhir@lists.hl7.org"
}
]
}
],
"description": "A coded concept listing the base codes.",
"compose": {
"include": [
{
"system": "http://hl7.org/fhir/vision-base-codes"
}
]
}
}

View File

@ -34,11 +34,11 @@ package org.hl7.fhir.validation;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.convertors.VersionConvertor_14_50;
import org.hl7.fhir.convertors.VersionConvertor_30_50;
import org.hl7.fhir.convertors.VersionConvertor_40_50;
import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50;
import org.hl7.fhir.exceptions.FHIRException;
/**
@ -104,7 +104,7 @@ public class NativeHostServices {
private class NH_10_50_Advisor implements VersionConvertorAdvisor50 {
@Override
public boolean ignoreEntry(BundleEntryComponent src) {
public boolean ignoreEntry(BundleEntryComponent src, FhirPublication publication) {
return false;
}