Merge branch 'master' of https://github.com/hapifhir/org.hl7.fhir.core
This commit is contained in:
commit
654f505c0b
|
@ -86,6 +86,13 @@
|
|||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.16</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- JUnit Jupiter -->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package org.hl7.fhir.convertors;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class SourceElementComponentWrapper<T> {
|
||||
public T comp;
|
||||
public String source;
|
||||
public String target;
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package org.hl7.fhir.convertors;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class SpecPackage {
|
||||
private Map<String, ValueSet> valuesets = new HashMap<String, ValueSet>();
|
||||
private Map<String, ValueSet> expansions = new HashMap<String, ValueSet>();
|
||||
private Map<String, StructureDefinition> types = new HashMap<String, StructureDefinition>();
|
||||
private Map<String, StructureDefinition> resources = new HashMap<String, StructureDefinition>();
|
||||
private Map<String, StructureDefinition> extensions = new HashMap<String, StructureDefinition>();
|
||||
private Map<String, StructureDefinition> profiles = new HashMap<String, StructureDefinition>();
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package org.hl7.fhir.convertors;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class StringReplacement {
|
||||
public String source;
|
||||
public String replacement;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package org.hl7.fhir.convertors;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import org.hl7.fhir.dstu3.context.SimpleWorkerContext;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class TransformContextR2R3 {
|
||||
private SimpleWorkerContext context;
|
||||
private String id;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package org.hl7.fhir.convertors;
|
||||
|
||||
public interface TypeLinkProvider {
|
||||
String getLink(String var1);
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl;
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor30;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BaseAdvisor_10_30 extends BaseAdvisor30<org.hl7.fhir.dstu2.model.Extension> {
|
||||
|
||||
private final List<CodeSystem> cslist = new ArrayList<>();
|
||||
private final List<String> ignoredUrls = new ArrayList<>(Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"));
|
||||
|
||||
public BaseAdvisor_10_30() {}
|
||||
|
||||
public BaseAdvisor_10_30(Boolean failFast) {
|
||||
this.failFast = failFast;
|
||||
}
|
||||
|
||||
public final List<CodeSystem> getCslist() {
|
||||
return this.cslist;
|
||||
}
|
||||
|
||||
public boolean ignoreExtension(@NotNull String path, @NotNull String url) {
|
||||
return this.ignoredUrls.contains(url);
|
||||
}
|
||||
|
||||
public void handleCodeSystem(@NotNull CodeSystem tgtcs, @NotNull ValueSet source) {
|
||||
tgtcs.setId(source.getId());
|
||||
tgtcs.setValueSet(source.getUrl());
|
||||
this.cslist.add(tgtcs);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl;
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor40;
|
||||
import org.hl7.fhir.r4.model.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BaseAdvisor_10_40 extends BaseAdvisor40<org.hl7.fhir.dstu2.model.Extension> {
|
||||
|
||||
private final List<CodeSystem> cslist = new ArrayList<>();
|
||||
private final List<String> ignoredUrls = new ArrayList<>(Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"));
|
||||
private final List<Class<?>> ignoredExtensionTypes = new ArrayList<>(Collections.singletonList(Expression.class));
|
||||
|
||||
public BaseAdvisor_10_40() {}
|
||||
|
||||
public BaseAdvisor_10_40(Boolean failFast) {
|
||||
this.failFast = failFast;
|
||||
}
|
||||
|
||||
public final List<CodeSystem> getCslist() {
|
||||
return this.cslist;
|
||||
}
|
||||
|
||||
public boolean ignoreExtension(@NotNull String path, @NotNull String url) {
|
||||
return this.ignoredUrls.contains(url);
|
||||
}
|
||||
|
||||
public boolean ignoreType(@NotNull String path, @NotNull Type type) {
|
||||
return ignoredExtensionTypes.contains(type.getClass());
|
||||
}
|
||||
|
||||
public void handleCodeSystem(@NotNull CodeSystem tgtcs, @NotNull ValueSet source) {
|
||||
tgtcs.setId(source.getId());
|
||||
tgtcs.setValueSet(source.getUrl());
|
||||
this.cslist.add(tgtcs);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl;
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor50;
|
||||
import org.hl7.fhir.dstu2.model.Extension;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.DataType;
|
||||
import org.hl7.fhir.r5.model.Expression;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BaseAdvisor_10_50 extends BaseAdvisor50<org.hl7.fhir.dstu2.model.Extension> {
|
||||
|
||||
private final List<CodeSystem> cslist = new ArrayList<>();
|
||||
private final List<String> ignoredUrls = new ArrayList<>(Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"));
|
||||
private final List<Class<?>> ignoredExtensionTypes = new ArrayList<>(Collections.singletonList(Expression.class));
|
||||
|
||||
public BaseAdvisor_10_50() {}
|
||||
|
||||
public BaseAdvisor_10_50(Boolean failFast) {
|
||||
this.failFast = failFast;
|
||||
}
|
||||
|
||||
public final List<CodeSystem> getCslist() {
|
||||
return this.cslist;
|
||||
}
|
||||
|
||||
public boolean ignoreExtension(@NotNull String path, @NotNull String url) {
|
||||
return this.ignoredUrls.contains(url);
|
||||
}
|
||||
|
||||
public boolean ignoreType(@NotNull String path, @NotNull DataType type) {
|
||||
return ignoredExtensionTypes.contains(type.getClass());
|
||||
}
|
||||
|
||||
public void handleCodeSystem(@NotNull CodeSystem tgtcs, @NotNull ValueSet source) {
|
||||
tgtcs.setId(source.getId());
|
||||
tgtcs.setValueSet(source.getUrl());
|
||||
this.cslist.add(tgtcs);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl;
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor30;
|
||||
import org.hl7.fhir.dstu2016may.model.Extension;
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem;
|
||||
import org.hl7.fhir.dstu3.model.ValueSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BaseAdvisor_14_30 extends BaseAdvisor30<org.hl7.fhir.dstu2016may.model.Extension> {
|
||||
|
||||
private final List<CodeSystem> cslist = new ArrayList<>();
|
||||
private final List<String> ignoredUrls = new ArrayList<>(Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"));
|
||||
|
||||
public BaseAdvisor_14_30() {}
|
||||
|
||||
public BaseAdvisor_14_30(Boolean failFast) {
|
||||
this.failFast = failFast;
|
||||
}
|
||||
|
||||
public final List<CodeSystem> getCslist() {
|
||||
return this.cslist;
|
||||
}
|
||||
|
||||
public boolean ignoreExtension(@NotNull String path, @NotNull String url) {
|
||||
return this.ignoredUrls.contains(url);
|
||||
}
|
||||
|
||||
public void handleCodeSystem(@NotNull CodeSystem tgtcs, @NotNull ValueSet source) {
|
||||
tgtcs.setId(source.getId());
|
||||
tgtcs.setValueSet(source.getUrl());
|
||||
this.cslist.add(tgtcs);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl;
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor40;
|
||||
import org.hl7.fhir.r4.model.CodeSystem;
|
||||
import org.hl7.fhir.r4.model.Expression;
|
||||
import org.hl7.fhir.r4.model.Type;
|
||||
import org.hl7.fhir.r4.model.ValueSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BaseAdvisor_14_40 extends BaseAdvisor40<org.hl7.fhir.dstu2016may.model.Extension> {
|
||||
|
||||
private final List<CodeSystem> cslist = new ArrayList<>();
|
||||
private final List<String> ignoredUrls = new ArrayList<>(Collections.singletonList("http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"));
|
||||
private final List<Class<?>> ignoredExtensionTypes = new ArrayList<>(Collections.singletonList(Expression.class));
|
||||
|
||||
public BaseAdvisor_14_40() {}
|
||||
|
||||
public BaseAdvisor_14_40(Boolean failFast) {
|
||||
this.failFast = failFast;
|
||||
}
|
||||
|
||||
public final List<CodeSystem> getCslist() {
|
||||
return this.cslist;
|
||||
}
|
||||
|
||||
public boolean ignoreExtension(@NotNull String path, @NotNull String url) {
|
||||
return this.ignoredUrls.contains(url);
|
||||
}
|
||||
|
||||
public boolean ignoreType(@NotNull String path, @NotNull Type type) {
|
||||
return ignoredExtensionTypes.contains(type.getClass());
|
||||
}
|
||||
|
||||
public void handleCodeSystem(@NotNull CodeSystem tgtcs, @NotNull ValueSet source) {
|
||||
tgtcs.setId(source.getId());
|
||||
tgtcs.setValueSet(source.getUrl());
|
||||
this.cslist.add(tgtcs);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl;
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor50;
|
||||
import org.hl7.fhir.dstu2.model.Extension;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.DataType;
|
||||
import org.hl7.fhir.r5.model.Expression;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BaseAdvisor_14_50 extends BaseAdvisor50<org.hl7.fhir.dstu2016may.model.Extension> {
|
||||
|
||||
private final List<CodeSystem> cslist = new ArrayList<>();
|
||||
|
||||
public BaseAdvisor_14_50() {}
|
||||
|
||||
public BaseAdvisor_14_50(Boolean failFast) {
|
||||
this.failFast = failFast;
|
||||
}
|
||||
|
||||
public final List<CodeSystem> getCslist() {
|
||||
return this.cslist;
|
||||
}
|
||||
|
||||
public void handleCodeSystem(@NotNull CodeSystem tgtcs, @NotNull ValueSet source) {
|
||||
tgtcs.setId(source.getId());
|
||||
tgtcs.setValueSet(source.getUrl());
|
||||
this.cslist.add(tgtcs);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl;
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor40;
|
||||
import org.hl7.fhir.r4.model.CodeSystem;
|
||||
import org.hl7.fhir.r4.model.Expression;
|
||||
import org.hl7.fhir.r4.model.Type;
|
||||
import org.hl7.fhir.r4.model.ValueSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class BaseAdvisor_30_40 extends BaseAdvisor40<org.hl7.fhir.dstu3.model.Extension> {
|
||||
|
||||
private final List<CodeSystem> cslist = new ArrayList<>();
|
||||
|
||||
public BaseAdvisor_30_40() {}
|
||||
|
||||
public BaseAdvisor_30_40(Boolean failFast) {
|
||||
this.failFast = failFast;
|
||||
}
|
||||
|
||||
public final List<CodeSystem> getCslist() {
|
||||
return this.cslist;
|
||||
}
|
||||
|
||||
public void handleCodeSystem(@NotNull CodeSystem tgtcs, @NotNull ValueSet source) {
|
||||
tgtcs.setId(source.getId());
|
||||
tgtcs.setValueSet(source.getUrl());
|
||||
this.cslist.add(tgtcs);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl;
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor50;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BaseAdvisor_30_50 extends BaseAdvisor50<org.hl7.fhir.dstu3.model.Extension> {
|
||||
|
||||
private final List<CodeSystem> cslist = new ArrayList<>();
|
||||
|
||||
public final List<CodeSystem> getCslist() {
|
||||
return this.cslist;
|
||||
}
|
||||
|
||||
public BaseAdvisor_30_50() {}
|
||||
|
||||
public BaseAdvisor_30_50(Boolean failFast) {
|
||||
this.failFast = failFast;
|
||||
}
|
||||
|
||||
public void handleCodeSystem(@NotNull CodeSystem tgtcs, @NotNull ValueSet source) {
|
||||
tgtcs.setId(source.getId());
|
||||
tgtcs.setValueSet(source.getUrl());
|
||||
this.cslist.add(tgtcs);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl;
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor50;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BaseAdvisor_40_50 extends BaseAdvisor50<org.hl7.fhir.r4.model.Extension> {
|
||||
|
||||
private final List<CodeSystem> cslist = new ArrayList<>();
|
||||
|
||||
public BaseAdvisor_40_50() {}
|
||||
|
||||
public BaseAdvisor_40_50(Boolean failFast) {
|
||||
this.failFast = failFast;
|
||||
}
|
||||
|
||||
public final List<CodeSystem> getCslist() {
|
||||
return this.cslist;
|
||||
}
|
||||
|
||||
public void handleCodeSystem(@NotNull CodeSystem tgtcs, @NotNull ValueSet source) {
|
||||
tgtcs.setId(source.getId());
|
||||
tgtcs.setValueSet(source.getUrl());
|
||||
this.cslist.add(tgtcs);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package org.hl7.fhir.convertors.advisors.interfaces;
|
||||
|
||||
public abstract class BaseAdvisor {
|
||||
public boolean failFast = true;
|
||||
public boolean failFastOnNullOrUnknownEntry() {
|
||||
return this.failFast;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package org.hl7.fhir.convertors.advisors.interfaces;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.IBaseExtension;
|
||||
import org.hl7.fhir.dstu3.model.*;
|
||||
import org.hl7.fhir.r5.model.FhirPublication;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class BaseAdvisor30<T extends IBaseExtension> extends BaseAdvisor {
|
||||
|
||||
public boolean ignoreEntry(@NotNull Bundle.BundleEntryComponent src, @NotNull FhirPublication publication) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void handleCodeSystem(@NotNull CodeSystem tgtcs, @NotNull ValueSet source) throws FHIRException { }
|
||||
|
||||
public CodeSystem getCodeSystem(@NotNull ValueSet src) throws FHIRException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean ignoreExtension(@NotNull String path, @NotNull Extension ext) throws FHIRException {
|
||||
return ((ext.getUrl() != null) && (this.ignoreExtension(path, ext.getUrl()))
|
||||
|| (this.ignoreType(path, ext.getValue())));
|
||||
}
|
||||
|
||||
public boolean ignoreExtension(@NotNull String path, @NotNull T ext) throws FHIRException {
|
||||
return ((ext.getUrl() != null) && this.ignoreExtension(path, ext.getUrl()))
|
||||
|| (this.ignoreType(path, ext.getValue()));
|
||||
}
|
||||
|
||||
public boolean ignoreExtension(@NotNull String path, @NotNull String url) throws FHIRException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean ignoreType(@NotNull String path, @NotNull Type type) throws FHIRException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean ignoreType(@NotNull String path, @NotNull Object type) throws FHIRException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean useAdvisorForExtension(@NotNull String path, @NotNull Extension ext) throws FHIRException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean useAdvisorForExtension(@NotNull String path, @NotNull T ext) throws FHIRException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void handleExtension(@NotNull String path, @NotNull Extension src, @NotNull T tgt) throws FHIRException { }
|
||||
|
||||
public void handleExtension(@NotNull String path, @NotNull T src, @NotNull Extension tgt) throws FHIRException { }
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package org.hl7.fhir.convertors.advisors.interfaces;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.IBaseExtension;
|
||||
import org.hl7.fhir.r4.model.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class BaseAdvisor40<T extends IBaseExtension> extends BaseAdvisor {
|
||||
|
||||
public boolean ignoreEntry(@NotNull Bundle.BundleEntryComponent src, @NotNull org.hl7.fhir.r5.model.FhirPublication targetVersion) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void handleCodeSystem(@NotNull CodeSystem tgtcs, @NotNull ValueSet source) throws FHIRException { }
|
||||
|
||||
public CodeSystem getCodeSystem(@NotNull ValueSet src) throws FHIRException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean ignoreExtension(@NotNull String path, @NotNull Extension ext) throws FHIRException {
|
||||
return ((ext.getUrl() != null) && (this.ignoreExtension(path, ext.getUrl()))
|
||||
|| (this.ignoreType(path, ext.getValue())));
|
||||
}
|
||||
|
||||
public boolean ignoreExtension(@NotNull String path, @NotNull T ext) throws FHIRException {
|
||||
return ((ext.getUrl() != null) && this.ignoreExtension(path, ext.getUrl()))
|
||||
|| (this.ignoreType(path, ext.getValue()));
|
||||
}
|
||||
|
||||
public boolean ignoreExtension(@NotNull String path, @NotNull String url) throws FHIRException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean ignoreType(@NotNull String path, @NotNull Type type) throws FHIRException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean ignoreType(@NotNull String path, @NotNull Object type) throws FHIRException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean useAdvisorForExtension(@NotNull String path, @NotNull Extension ext) throws FHIRException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean useAdvisorForExtension(@NotNull String path, @NotNull T ext) throws FHIRException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void handleExtension(@NotNull String path, @NotNull Extension src, @NotNull T tgt) throws FHIRException { }
|
||||
|
||||
public void handleExtension(@NotNull String path, @NotNull T src, @NotNull Extension tgt) throws FHIRException { }
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package org.hl7.fhir.convertors.advisors.interfaces;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.IBaseExtension;
|
||||
import org.hl7.fhir.r5.model.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class BaseAdvisor50<T extends IBaseExtension> extends BaseAdvisor {
|
||||
|
||||
public boolean ignoreEntry(@NotNull Bundle.BundleEntryComponent src, @NotNull FhirPublication targetVersion) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void handleCodeSystem(@NotNull CodeSystem tgtcs, @NotNull ValueSet source) throws FHIRException { }
|
||||
|
||||
public CodeSystem getCodeSystem(@NotNull ValueSet src) throws FHIRException {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean ignoreExtension(@NotNull String path, @NotNull Extension ext) throws FHIRException {
|
||||
return ((ext.getUrl() != null) && (this.ignoreExtension(path, ext.getUrl()))
|
||||
|| (this.ignoreType(path, ext.getValue())));
|
||||
}
|
||||
|
||||
public boolean ignoreExtension(@NotNull String path, @NotNull T ext) throws FHIRException {
|
||||
return ((ext.getUrl() != null) && this.ignoreExtension(path, ext.getUrl()))
|
||||
|| (this.ignoreType(path, ext.getValue()));
|
||||
}
|
||||
|
||||
public boolean ignoreExtension(@NotNull String path, @NotNull String url) throws FHIRException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean ignoreType(@NotNull String path, @NotNull DataType type) throws FHIRException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean ignoreType(@NotNull String path, @NotNull Object type) throws FHIRException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean useAdvisorForExtension(@NotNull String path, @NotNull Extension ext) throws FHIRException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean useAdvisorForExtension(@NotNull String path, @NotNull T ext) throws FHIRException {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void handleExtension(@NotNull String path, @NotNull Extension src, @NotNull T tgt) throws FHIRException { }
|
||||
|
||||
public void handleExtension(@NotNull String path, @NotNull T src, @NotNull Extension tgt) throws FHIRException { }
|
||||
}
|
|
@ -49,6 +49,7 @@ 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;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class IGPackConverter102 extends BaseAdvisor_10_30 {
|
||||
|
||||
|
@ -85,18 +86,18 @@ public class IGPackConverter102 extends BaseAdvisor_10_30 {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreEntry(BundleEntryComponent src, FhirPublication publication) {
|
||||
public boolean ignoreEntry(@NotNull BundleEntryComponent src, @NotNull FhirPublication publication) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleCodeSystem(CodeSystem tgtcs, ValueSet vs) {
|
||||
public void handleCodeSystem(@NotNull CodeSystem tgtcs, @NotNull ValueSet vs) {
|
||||
cslist.addEntry().setFullUrl(tgtcs.getUrl()).setResource(tgtcs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodeSystem getCodeSystem(ValueSet src) {
|
||||
public CodeSystem getCodeSystem(@NotNull ValueSet src) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -32,10 +32,11 @@ package org.hl7.fhir.convertors.misc;
|
|||
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_40;
|
||||
import org.hl7.fhir.r4.model.CodeSystem;
|
||||
import org.hl7.fhir.r4.model.ValueSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class IGR2ConvertorAdvisor extends BaseAdvisor_10_40 {
|
||||
@Override
|
||||
public void handleCodeSystem(CodeSystem cs, ValueSet vs) {
|
||||
public void handleCodeSystem(@NotNull CodeSystem cs, @NotNull ValueSet vs) {
|
||||
cs.setId(vs.getId());
|
||||
}
|
||||
}
|
|
@ -33,11 +33,12 @@ package org.hl7.fhir.convertors.misc;
|
|||
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50;
|
||||
import org.hl7.fhir.r5.model.CodeSystem;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class IGR2ConvertorAdvisor5 extends BaseAdvisor_10_50 {
|
||||
|
||||
@Override
|
||||
public void handleCodeSystem(CodeSystem cs, ValueSet vs) {
|
||||
public void handleCodeSystem(@NotNull CodeSystem cs, @NotNull ValueSet vs) {
|
||||
cs.setId(vs.getId());
|
||||
}
|
||||
}
|
|
@ -6,6 +6,7 @@ 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;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class PR2Handler extends BaseAdvisor_10_40 {
|
||||
|
||||
|
@ -15,12 +16,12 @@ class PR2Handler extends BaseAdvisor_10_40 {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void handleCodeSystem(CodeSystem tgtcs, ValueSet source) throws FHIRException {
|
||||
public void handleCodeSystem(@NotNull CodeSystem tgtcs, @NotNull ValueSet source) throws FHIRException {
|
||||
throw new Error("Not done yet");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CodeSystem getCodeSystem(ValueSet src) throws FHIRException {
|
||||
public CodeSystem getCodeSystem(@NotNull ValueSet src) throws FHIRException {
|
||||
throw new Error("Not done yet");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
package org.hl7.fhir.convertors
|
||||
|
||||
data class SourceElementComponentWrapper<A>(
|
||||
var comp: A,
|
||||
var source: String,
|
||||
var target: String
|
||||
)
|
|
@ -1,14 +0,0 @@
|
|||
package org.hl7.fhir.convertors
|
||||
|
||||
import org.hl7.fhir.r5.model.StructureDefinition
|
||||
import org.hl7.fhir.r5.model.ValueSet
|
||||
import java.util.HashMap
|
||||
|
||||
data class SpecPackage (
|
||||
var valuesets: Map<String, ValueSet> = HashMap(),
|
||||
var expansions: Map<String, ValueSet> = HashMap(),
|
||||
var types: Map<String, StructureDefinition> = HashMap(),
|
||||
var resources: Map<String, StructureDefinition> = HashMap(),
|
||||
var extensions: Map<String, StructureDefinition> = HashMap(),
|
||||
var profiles: Map<String, StructureDefinition> = HashMap()
|
||||
)
|
|
@ -1,3 +0,0 @@
|
|||
package org.hl7.fhir.convertors
|
||||
|
||||
data class StringReplacement(var source: String, var replacement: String)
|
|
@ -1,6 +0,0 @@
|
|||
package org.hl7.fhir.convertors
|
||||
|
||||
import org.hl7.fhir.dstu3.context.SimpleWorkerContext
|
||||
|
||||
data class TransformContextR2R3(val context: SimpleWorkerContext, val id: String)
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
package org.hl7.fhir.convertors
|
||||
|
||||
interface TypeLinkProvider {
|
||||
fun getLink(typeName: String?): String?
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor30
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor30
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor30
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem
|
||||
import org.hl7.fhir.dstu3.model.ValueSet
|
||||
import java.util.*
|
||||
|
||||
open class BaseAdvisor_10_30(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor30, CodeSystemAdvisor30,
|
||||
ExtensionAdvisor30<org.hl7.fhir.dstu2.model.Extension> {
|
||||
|
||||
val cslist = ArrayList<CodeSystem>()
|
||||
|
||||
private val ignoredUrls = listOf(
|
||||
"http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown",
|
||||
)
|
||||
|
||||
override fun failFastOnNullOrUnknownEntry(): Boolean {
|
||||
return failFast
|
||||
}
|
||||
|
||||
override fun ignoreExtension(path: String, url: String): Boolean {
|
||||
return ignoredUrls.contains(url)
|
||||
}
|
||||
|
||||
override fun handleCodeSystem(tgtcs: CodeSystem, source: ValueSet) {
|
||||
tgtcs.id = source.id
|
||||
tgtcs.valueSet = source.url
|
||||
cslist.add(tgtcs)
|
||||
}
|
||||
}
|
|
@ -1,50 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor40
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor40
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor40
|
||||
import org.hl7.fhir.r4.model.CodeSystem
|
||||
import org.hl7.fhir.r4.model.Expression
|
||||
import org.hl7.fhir.r4.model.Type
|
||||
import org.hl7.fhir.r4.model.ValueSet
|
||||
import java.util.*
|
||||
|
||||
open class BaseAdvisor_10_40(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor40, CodeSystemAdvisor40,
|
||||
ExtensionAdvisor40<org.hl7.fhir.dstu2.model.Extension> {
|
||||
|
||||
val cslist = ArrayList<CodeSystem>()
|
||||
|
||||
private val ignoredUrls = listOf(
|
||||
//todo put only in capabilty statement
|
||||
//todo methods to convert extension should always take path
|
||||
"http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown",
|
||||
)
|
||||
|
||||
private val ignoredExtensionTypes = listOf(
|
||||
Expression::class.java,
|
||||
)
|
||||
|
||||
override fun failFastOnNullOrUnknownEntry(): Boolean {
|
||||
return failFast
|
||||
}
|
||||
|
||||
//todo path - Observation.value
|
||||
// "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown"
|
||||
//
|
||||
override fun ignoreExtension(path: String, url: String): Boolean {
|
||||
return ignoredUrls.contains(url)
|
||||
}
|
||||
|
||||
|
||||
override fun ignoreType(path: String, type: Type): Boolean {
|
||||
return ignoredExtensionTypes.contains(type::class.java)
|
||||
}
|
||||
|
||||
override fun handleCodeSystem(tgtcs: CodeSystem, source: ValueSet) {
|
||||
tgtcs.id = source.id
|
||||
tgtcs.valueSet = source.url
|
||||
cslist.add(tgtcs)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor50
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor50
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor50
|
||||
import org.hl7.fhir.r5.model.CodeSystem
|
||||
import org.hl7.fhir.r5.model.DataType
|
||||
import org.hl7.fhir.r5.model.Expression
|
||||
import org.hl7.fhir.r5.model.ValueSet
|
||||
import java.util.*
|
||||
|
||||
open class BaseAdvisor_10_50(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor50, CodeSystemAdvisor50,
|
||||
ExtensionAdvisor50<org.hl7.fhir.dstu2.model.Extension> {
|
||||
|
||||
val cslist = ArrayList<CodeSystem>()
|
||||
|
||||
private val ignoredUrls = listOf(
|
||||
"http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown",
|
||||
)
|
||||
|
||||
private val ignoredExtensionTypes = listOf(
|
||||
Expression::class.java,
|
||||
)
|
||||
|
||||
override fun failFastOnNullOrUnknownEntry(): Boolean {
|
||||
return failFast
|
||||
}
|
||||
|
||||
override fun ignoreExtension(path: String, url: String): Boolean {
|
||||
return ignoredUrls.contains(url)
|
||||
}
|
||||
|
||||
override fun ignoreType(path: String, type: DataType): Boolean {
|
||||
return ignoredExtensionTypes.contains(type::class.java)
|
||||
}
|
||||
|
||||
override fun handleCodeSystem(tgtcs: CodeSystem, source: ValueSet) {
|
||||
tgtcs.id = source.id
|
||||
tgtcs.valueSet = source.url
|
||||
cslist.add(tgtcs)
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor30
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor30
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor30
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem
|
||||
import org.hl7.fhir.dstu3.model.ValueSet
|
||||
import java.util.*
|
||||
|
||||
open class BaseAdvisor_14_30(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor30, CodeSystemAdvisor30,
|
||||
ExtensionAdvisor30<org.hl7.fhir.dstu2016may.model.Extension> {
|
||||
|
||||
val cslist = ArrayList<CodeSystem>()
|
||||
|
||||
private val ignoredUrls = listOf(
|
||||
"http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown",
|
||||
)
|
||||
|
||||
override fun failFastOnNullOrUnknownEntry(): Boolean {
|
||||
return failFast
|
||||
}
|
||||
|
||||
override fun ignoreExtension(path: String, url: String): Boolean {
|
||||
return ignoredUrls.contains(url)
|
||||
}
|
||||
|
||||
override fun handleCodeSystem(tgtcs: CodeSystem, source: ValueSet) {
|
||||
tgtcs.id = source.id
|
||||
tgtcs.valueSet = source.url
|
||||
cslist.add(tgtcs)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor40
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor40
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor40
|
||||
import org.hl7.fhir.r4.model.CodeSystem
|
||||
import org.hl7.fhir.r4.model.Expression
|
||||
import org.hl7.fhir.r4.model.Type
|
||||
import org.hl7.fhir.r4.model.ValueSet
|
||||
import java.util.*
|
||||
|
||||
open class BaseAdvisor_14_40(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor40, CodeSystemAdvisor40,
|
||||
ExtensionAdvisor40<org.hl7.fhir.dstu2016may.model.Extension> {
|
||||
|
||||
val cslist = ArrayList<CodeSystem>()
|
||||
|
||||
private val ignoredUrls = listOf(
|
||||
"http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown",
|
||||
)
|
||||
|
||||
private val ignoredExtensionTypes = listOf(
|
||||
Expression::class.java,
|
||||
)
|
||||
|
||||
override fun failFastOnNullOrUnknownEntry(): Boolean {
|
||||
return failFast
|
||||
}
|
||||
|
||||
override fun ignoreExtension(path: String, url: String): Boolean {
|
||||
return ignoredUrls.contains(url)
|
||||
}
|
||||
|
||||
override fun ignoreType(path: String, type: Type): Boolean {
|
||||
return ignoredExtensionTypes.contains(type::class.java)
|
||||
}
|
||||
|
||||
override fun handleCodeSystem(tgtcs: org.hl7.fhir.r4.model.CodeSystem, source: ValueSet) {
|
||||
tgtcs.id = source.id
|
||||
tgtcs.valueSet = source.url
|
||||
cslist.add(tgtcs)
|
||||
}
|
||||
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor50
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor50
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor50
|
||||
import org.hl7.fhir.r5.model.CodeSystem
|
||||
import org.hl7.fhir.r5.model.ValueSet
|
||||
import java.util.*
|
||||
|
||||
open class BaseAdvisor_14_50(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor50, CodeSystemAdvisor50,
|
||||
ExtensionAdvisor50<org.hl7.fhir.dstu2016may.model.Extension> {
|
||||
|
||||
val cslist = ArrayList<CodeSystem>()
|
||||
|
||||
override fun failFastOnNullOrUnknownEntry(): Boolean {
|
||||
return failFast
|
||||
}
|
||||
|
||||
override fun handleCodeSystem(tgtcs: CodeSystem, source: ValueSet) {
|
||||
tgtcs.id = source.id
|
||||
tgtcs.valueSet = source.url
|
||||
cslist.add(tgtcs)
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor40
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor40
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor40
|
||||
import org.hl7.fhir.r4.model.CodeSystem
|
||||
import org.hl7.fhir.r4.model.ValueSet
|
||||
import java.util.*
|
||||
|
||||
open class BaseAdvisor_30_40(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor40, CodeSystemAdvisor40,
|
||||
ExtensionAdvisor40<org.hl7.fhir.dstu3.model.Extension> {
|
||||
|
||||
val cslist = ArrayList<CodeSystem>()
|
||||
|
||||
override fun failFastOnNullOrUnknownEntry(): Boolean {
|
||||
return failFast
|
||||
}
|
||||
|
||||
override fun handleCodeSystem(tgtcs: CodeSystem, srcvs: ValueSet) {
|
||||
tgtcs.id = srcvs.id
|
||||
tgtcs.valueSet = srcvs.url
|
||||
cslist.add(tgtcs)
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor50
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor50
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor50
|
||||
import org.hl7.fhir.r5.model.CodeSystem
|
||||
import org.hl7.fhir.r5.model.ValueSet
|
||||
import java.util.*
|
||||
|
||||
open class BaseAdvisor_30_50(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor50, CodeSystemAdvisor50,
|
||||
ExtensionAdvisor50<org.hl7.fhir.dstu3.model.Extension> {
|
||||
|
||||
val cslist = ArrayList<CodeSystem>()
|
||||
|
||||
override fun failFastOnNullOrUnknownEntry(): Boolean {
|
||||
return failFast
|
||||
}
|
||||
|
||||
override fun handleCodeSystem(tgtcs: CodeSystem, source: ValueSet) {
|
||||
tgtcs.id = source.id
|
||||
tgtcs.valueSet = source.url
|
||||
cslist.add(tgtcs)
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.impl
|
||||
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.BaseAdvisor
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.bundle.BundleAdvisor50
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.codesystem.CodeSystemAdvisor50
|
||||
import org.hl7.fhir.convertors.advisors.interfaces.extension.ExtensionAdvisor50
|
||||
import org.hl7.fhir.r5.model.CodeSystem
|
||||
import org.hl7.fhir.r5.model.ValueSet
|
||||
import java.util.*
|
||||
|
||||
open class BaseAdvisor_40_50(val failFast: Boolean = true) : BaseAdvisor, BundleAdvisor50, CodeSystemAdvisor50,
|
||||
ExtensionAdvisor50<org.hl7.fhir.r4.model.Extension> {
|
||||
|
||||
val cslist = ArrayList<CodeSystem>()
|
||||
|
||||
override fun failFastOnNullOrUnknownEntry(): Boolean {
|
||||
return failFast
|
||||
}
|
||||
|
||||
override fun handleCodeSystem(tgtcs: CodeSystem, source: ValueSet) {
|
||||
tgtcs.id = source.id
|
||||
tgtcs.valueSet = source.url
|
||||
cslist.add(tgtcs)
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.interfaces
|
||||
|
||||
interface BaseAdvisor {
|
||||
|
||||
/**
|
||||
* During conversion, we may be provided with a null, or unknown Resource. This method returns true if the implementer
|
||||
* wants to fail fast in an unknown or null state.
|
||||
*/
|
||||
@JvmDefault
|
||||
fun failFastOnNullOrUnknownEntry(): Boolean
|
||||
}
|
|
@ -1,63 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.interfaces.bundle
|
||||
|
||||
import org.hl7.fhir.dstu3.model.Bundle
|
||||
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 BundleAdvisor30 {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@JvmDefault
|
||||
fun ignoreEntry(src: Bundle.BundleEntryComponent, targetVersion: FhirPublication): Boolean {
|
||||
return false
|
||||
}
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.interfaces.bundle
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException
|
||||
import org.hl7.fhir.r4.model.*
|
||||
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 BundleAdvisor40 {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@JvmDefault
|
||||
fun ignoreEntry(src: Bundle.BundleEntryComponent, targetVersion: FhirPublication): Boolean {
|
||||
return false
|
||||
}
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.interfaces.bundle
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException
|
||||
import org.hl7.fhir.r5.model.Expression
|
||||
import org.hl7.fhir.r5.model.Extension
|
||||
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 BundleAdvisor50 {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
@JvmDefault
|
||||
fun ignoreEntry(src: Bundle.BundleEntryComponent?, targetVersion: FhirPublication): Boolean {
|
||||
return false
|
||||
}
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.interfaces.codesystem
|
||||
|
||||
import org.hl7.fhir.dstu3.model.CodeSystem
|
||||
import org.hl7.fhir.dstu3.model.ValueSet
|
||||
import org.hl7.fhir.exceptions.FHIRException
|
||||
import java.util.ArrayList
|
||||
|
||||
/*
|
||||
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 CodeSystemAdvisor30 {
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@JvmDefault
|
||||
@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
|
||||
*/
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun getCodeSystem(src: ValueSet): CodeSystem? {
|
||||
return null
|
||||
}
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.interfaces.codesystem
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException
|
||||
import org.hl7.fhir.r4.model.*
|
||||
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 CodeSystemAdvisor40 {
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@JvmDefault
|
||||
@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
|
||||
*/
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun getCodeSystem(src: ValueSet?): CodeSystem? {
|
||||
return null
|
||||
}
|
||||
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.interfaces.codesystem
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException
|
||||
import org.hl7.fhir.r5.model.Expression
|
||||
import org.hl7.fhir.r5.model.Extension
|
||||
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 CodeSystemAdvisor50 {
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
@JvmDefault
|
||||
@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
|
||||
*/
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun getCodeSystem(src: ValueSet): CodeSystem? {
|
||||
return null
|
||||
}
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.interfaces.extension
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException
|
||||
import org.hl7.fhir.instance.model.api.IBaseExtension
|
||||
import org.hl7.fhir.dstu3.model.Extension
|
||||
import org.hl7.fhir.dstu3.model.Type
|
||||
|
||||
/**
|
||||
* When converting an Extension from R4, value types support in the source version are not always supported
|
||||
* in the target version. For example, if when converting a source R4 Extension to DSTU2, the [Expression] type in the
|
||||
* source is not supported in the target version.
|
||||
*
|
||||
* The default behavior for such conversions of this type is to treat the operation as a 'lossy' conversion,
|
||||
* ignoring all non-supported fields. However, if identified ahead of time, developers can utilize a convertor
|
||||
* advisor to process these unsupported [Extension] as they see fit.
|
||||
*
|
||||
*/
|
||||
interface ExtensionAdvisor30<T: IBaseExtension<T,*>> {
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun ignoreExtension(path: String, ext: Extension): Boolean {
|
||||
return ignoreExtension(path, ext.url) || ignoreType(path, ext.value)
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun ignoreExtension(path: String, ext: T): Boolean {
|
||||
return ignoreExtension(path, ext.url) || ignoreType(path, ext.value)
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun ignoreExtension(path: String, url: String): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun ignoreType(path: String, type: Any): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun ignoreType(path: String, type: Type): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun useAdvisorForExtension(path: String, ext: Extension): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun useAdvisorForExtension(path: String, ext: T): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun handleExtension(path: String, src: Extension, tgt: T) {
|
||||
// Override to add code to handle specific extensions
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun handleExtension(path: String, src: T, tgt: Extension) {
|
||||
// Override to add code to handle specific extensions
|
||||
}
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.interfaces.extension
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException
|
||||
import org.hl7.fhir.instance.model.api.IBaseExtension
|
||||
import org.hl7.fhir.r4.model.Extension
|
||||
import org.hl7.fhir.r4.model.Type
|
||||
|
||||
/**
|
||||
* When converting an Extension from R4, value types support in the source version are not always supported
|
||||
* in the target version. For example, if when converting a source R4 Extension to DSTU2, the [Expression] type in the
|
||||
* source is not supported in the target version.
|
||||
*
|
||||
* The default behavior for such conversions of this type is to treat the operation as a 'lossy' conversion,
|
||||
* ignoring all non-supported fields. However, if identified ahead of time, developers can utilize a convertor
|
||||
* advisor to process these unsupported [Extension] as they see fit.
|
||||
*
|
||||
*/
|
||||
interface ExtensionAdvisor40<T : IBaseExtension<T, *>> {
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun ignoreExtension(path: String, ext: Extension): Boolean {
|
||||
return ext.url?.let { ignoreExtension(path, ext.url) } ?: false || ext.value?.let { ignoreType(path, ext.value) } ?: false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun ignoreExtension(path: String, ext: T): Boolean {
|
||||
return ext.url?.let { ignoreExtension(path, ext.url) } ?: false || ext.value?.let { ignoreType(path, ext.value) } ?: false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun ignoreExtension(path: String, url: String): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun ignoreType(path: String, type: Any): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun ignoreType(path: String, type: Type): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun useAdvisorForExtension(path: String, ext: Extension): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun useAdvisorForExtension(path: String, ext: T): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun handleExtension(path: String, src: Extension, tgt: T) {
|
||||
// Override to add code to handle specific extensions
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun handleExtension(path: String, src: T, tgt: Extension) {
|
||||
// Override to add code to handle specific extensions
|
||||
}
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.interfaces.extension
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException
|
||||
import org.hl7.fhir.instance.model.api.IBaseExtension
|
||||
import org.hl7.fhir.r5.model.DataType
|
||||
import org.hl7.fhir.r5.model.Extension
|
||||
|
||||
/**
|
||||
* When converting an Extension from R4, value types support in the source version are not always supported
|
||||
* in the target version. For example, if when converting a source R4 Extension to DSTU2, the [Expression] type in the
|
||||
* source is not supported in the target version.
|
||||
*
|
||||
* The default behavior for such conversions of this type is to treat the operation as a 'lossy' conversion,
|
||||
* ignoring all non-supported fields. However, if identified ahead of time, developers can utilize a convertor
|
||||
* advisor to process these unsupported [Extension] as they see fit.
|
||||
*
|
||||
*/
|
||||
interface ExtensionAdvisor50<T: IBaseExtension<T, *>> {
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun ignoreExtension(path: String, ext: Extension): Boolean {
|
||||
return ext.url?.let { ignoreExtension(path, ext.url) } ?: false || ext.value?.let { ignoreType(path, ext.value) } ?: false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun ignoreExtension(path: String, ext: T): Boolean {
|
||||
return ext.url?.let { ignoreExtension(path, ext.url) } ?: false || ext.value?.let { ignoreType(path, ext.value) } ?: false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun ignoreExtension(path: String, url: String): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun ignoreType(path: String, type: DataType): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun ignoreType(path: String, type: Any): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun useAdvisorForExtension(path: String, ext: Extension): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun useAdvisorForExtension(path: String, ext: T): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun handleExtension(path: String, src: Extension, tgt: T) {
|
||||
// Override to add code to handle specific extensions
|
||||
}
|
||||
|
||||
@JvmDefault
|
||||
@Throws(FHIRException::class)
|
||||
fun handleExtension(path: String, src: T, tgt: Extension) {
|
||||
// Override to add code to handle specific extensions
|
||||
}
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
package org.hl7.fhir.convertors.loaders
|
||||
|
||||
class BaseLoader {
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package org.hl7.fhir.convertors.advisors.support;
|
||||
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_40;
|
||||
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_40;
|
||||
import org.hl7.fhir.dstu2.model.StringType;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.IBaseExtension;
|
||||
import org.hl7.fhir.r4.model.Expression;
|
||||
import org.hl7.fhir.r4.model.Extension;
|
||||
import org.hl7.fhir.r4.model.Type;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public final class ExpressionAdvisor40 extends BaseAdvisor_10_40 {
|
||||
public boolean useAdvisorForExtension(@NotNull String path, @NotNull Extension ext) throws FHIRException {
|
||||
return ext.hasValue() && ext.getValue() instanceof Expression;
|
||||
}
|
||||
|
||||
public void handleExtension(@NotNull String path, @NotNull Extension src, @NotNull org.hl7.fhir.dstu2.model.Extension tgt) throws FHIRException {
|
||||
if (src.getValue() instanceof Expression) {
|
||||
StringType type = new StringType();
|
||||
if (src.getValue() == null) {
|
||||
throw new NullPointerException("null cannot be cast to non-null type org.hl7.fhir.r4.model.Expression");
|
||||
} else {
|
||||
type.setValueAsString(((Expression)src.getValue()).getExpression());
|
||||
tgt.setValue((org.hl7.fhir.dstu2.model.Type)type);
|
||||
if (src.hasUrlElement()) {
|
||||
tgt.setUrlElement(VersionConvertor_10_40.convertUri(src.getUrlElement()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new FHIRException("Unknown extension type passed in to custom convertor method.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.support
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_40
|
||||
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_40
|
||||
import org.hl7.fhir.dstu2.model.StringType
|
||||
import org.hl7.fhir.exceptions.FHIRException
|
||||
import org.hl7.fhir.r4.model.Expression
|
||||
import org.hl7.fhir.r4.model.Extension
|
||||
|
||||
class ExpressionAdvisor40 : BaseAdvisor_10_40() {
|
||||
|
||||
@Throws(FHIRException::class)
|
||||
override fun useAdvisorForExtension(path: String, ext: Extension): Boolean {
|
||||
return ext.hasValue() && ext.value is Expression
|
||||
}
|
||||
|
||||
@Throws(FHIRException::class)
|
||||
override fun handleExtension(path:String, src: Extension, tgt: org.hl7.fhir.dstu2.model.Extension) {
|
||||
when {
|
||||
(src.value is Expression) -> {
|
||||
val type = StringType()
|
||||
type.valueAsString = (src.value as Expression).expression
|
||||
tgt.setValue(type)
|
||||
if (src.hasUrlElement()) tgt.urlElement = VersionConvertor_10_40.convertUri(src.urlElement)
|
||||
}
|
||||
else -> throw FHIRException("Unknown extension type passed in to custom convertor method.")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package org.hl7.fhir.convertors.advisors.support;
|
||||
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_40;
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_50;
|
||||
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_40;
|
||||
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50;
|
||||
import org.hl7.fhir.dstu2.model.Extension;
|
||||
import org.hl7.fhir.dstu2.model.StringType;
|
||||
import org.hl7.fhir.dstu2.model.Type;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.IBaseExtension;
|
||||
import org.hl7.fhir.r5.model.DataType;
|
||||
import org.hl7.fhir.r5.model.Expression;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ExpressionAdvisor50 extends BaseAdvisor_10_50 {
|
||||
|
||||
public boolean useAdvisorForExtension(@NotNull String path, @NotNull org.hl7.fhir.r5.model.Extension ext) {
|
||||
return ext.hasValue() && ext.getValue() instanceof org.hl7.fhir.r5.model.Expression;
|
||||
}
|
||||
|
||||
public void handleExtension(@NotNull String path, @NotNull org.hl7.fhir.r5.model.Extension src, @NotNull org.hl7.fhir.dstu2.model.Extension tgt) {
|
||||
if (src.getValue() instanceof org.hl7.fhir.r5.model.Expression) {
|
||||
StringType type = new StringType();
|
||||
if (src.getValue() == null) {
|
||||
throw new NullPointerException("null cannot be cast to non-null type org.hl7.fhir.r5.model.Expression");
|
||||
} else {
|
||||
type.setValueAsString(((Expression) src.getValue()).getExpression());
|
||||
tgt.setValue((Type)type);
|
||||
if (src.hasUrlElement()) {
|
||||
tgt.setUrlElement(VersionConvertor_10_50.convertUri(src.getUrlElement()));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new FHIRException("Unknown extension type passed in to custom convertor method.");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package org.hl7.fhir.convertors.advisors.support
|
||||
|
||||
import org.hl7.fhir.convertors.VersionConvertor_10_50
|
||||
import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50
|
||||
import org.hl7.fhir.dstu2.model.StringType
|
||||
import org.hl7.fhir.exceptions.FHIRException
|
||||
import org.hl7.fhir.r5.model.Expression
|
||||
import org.hl7.fhir.r5.model.Extension
|
||||
|
||||
open class ExpressionAdvisor50 : BaseAdvisor_10_50() {
|
||||
|
||||
override fun useAdvisorForExtension(path: String, ext: org.hl7.fhir.dstu2.model.Extension): Boolean {
|
||||
return super.useAdvisorForExtension(path, ext)
|
||||
}
|
||||
|
||||
override fun useAdvisorForExtension(path: String, ext: Extension): Boolean {
|
||||
return ext.hasValue() && ext.value is Expression
|
||||
}
|
||||
|
||||
override fun handleExtension(path: String, src: Extension, tgt: org.hl7.fhir.dstu2.model.Extension) {
|
||||
when {
|
||||
(src.value is Expression) -> {
|
||||
val type = StringType()
|
||||
type.valueAsString = (src.value as Expression).expression
|
||||
tgt.setValue(type)
|
||||
if (src.hasUrlElement()) tgt.urlElement = VersionConvertor_10_50.convertUri(src.urlElement)
|
||||
}
|
||||
else -> throw FHIRException("Unknown extension type passed in to custom convertor method.")
|
||||
}
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ public class StructureDefinition30_50Test {
|
|||
InputStream dstu3_expected_output = this.getClass().getResourceAsStream("/0_structuredefinition_30.json");
|
||||
|
||||
org.hl7.fhir.r5.model.StructureDefinition r5_actual = (org.hl7.fhir.r5.model.StructureDefinition) new org.hl7.fhir.r5.formats.JsonParser().parse(r5_input);
|
||||
org.hl7.fhir.dstu3.model.Resource dstu3_conv = VersionConvertor_30_50.convertResource(r5_actual, true);
|
||||
org.hl7.fhir.dstu3.model.Resource dstu3_conv = VersionConvertor_30_50.convertResource(r5_actual);
|
||||
|
||||
org.hl7.fhir.dstu3.formats.JsonParser dstu3_parser = new org.hl7.fhir.dstu3.formats.JsonParser();
|
||||
org.hl7.fhir.dstu3.model.Resource dstu3_expected = dstu3_parser.parse(dstu3_expected_output);
|
||||
|
|
|
@ -76,6 +76,7 @@ import org.hl7.fhir.utilities.VersionUtilities;
|
|||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* This class allows you to host the java validator in another service, and use the services it has in a wider context. The way it works is
|
||||
|
@ -103,10 +104,10 @@ public class NativeHostServices {
|
|||
|
||||
private class NH_10_50_Advisor extends BaseAdvisor_10_50 {
|
||||
@Override
|
||||
public void handleCodeSystem(CodeSystem tgtcs, ValueSet source) throws FHIRException {}
|
||||
public void handleCodeSystem(@NotNull CodeSystem tgtcs, @NotNull ValueSet source) throws FHIRException {}
|
||||
|
||||
@Override
|
||||
public CodeSystem getCodeSystem(ValueSet src) throws FHIRException {
|
||||
public CodeSystem getCodeSystem(@NotNull ValueSet src) throws FHIRException {
|
||||
throw new FHIRException("Code systems cannot be handled at this time"); // what to do? need thread local storage?
|
||||
}
|
||||
}
|
||||
|
|
73
pom.xml
73
pom.xml
|
@ -19,13 +19,12 @@
|
|||
|
||||
<properties>
|
||||
<hapi_fhir_version>5.1.0</hapi_fhir_version>
|
||||
<validator_test_case_version>1.1.64-SNAPSHOT</validator_test_case_version>
|
||||
<validator_test_case_version>1.1.63</validator_test_case_version>
|
||||
<junit_jupiter_version>5.7.1</junit_jupiter_version>
|
||||
<junit_platform_launcher_version>1.7.1</junit_platform_launcher_version>
|
||||
<maven_surefire_version>3.0.0-M4</maven_surefire_version>
|
||||
<jacoco_version>0.8.5</jacoco_version>
|
||||
<info_cqframework_version>1.5.1</info_cqframework_version>
|
||||
<kotlin.version>1.5.0</kotlin.version>
|
||||
</properties>
|
||||
|
||||
<name>HL7 Core Artifacts</name>
|
||||
|
@ -82,17 +81,6 @@
|
|||
<version>1.2.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jdk8</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-test</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
|
@ -168,41 +156,6 @@
|
|||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<version>1.5.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<args>
|
||||
<arg>-Xjvm-default=all</arg>
|
||||
</args>
|
||||
<sourceDirs>
|
||||
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
|
||||
<sourceDir>${project.basedir}/src/main/java</sourceDir>
|
||||
</sourceDirs>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-compile</id>
|
||||
<goals> <goal>test-compile</goal> </goals>
|
||||
<configuration>
|
||||
<args>
|
||||
<arg>-Xjvm-default=all</arg>
|
||||
</args>
|
||||
<sourceDirs>
|
||||
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
|
||||
<sourceDir>${project.basedir}/src/test/java</sourceDir>
|
||||
</sourceDirs>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
@ -411,30 +364,6 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-compile</id>
|
||||
<phase>test-compile</phase>
|
||||
<goals>
|
||||
<goal>test-compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<jvmTarget>1.8</jvmTarget>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
|
Loading…
Reference in New Issue