Merge pull request #987 from hapifhir/gg-202211-misc-fixes

Gg 202211 misc fixes
This commit is contained in:
Grahame Grieve 2022-11-15 07:11:34 +11:00 committed by GitHub
commit 54f2f2cd8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 714 additions and 50 deletions

View File

@ -449,11 +449,13 @@ public class ElementDefinition10_40 {
ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().copyElement(src, tgt);
if (src.hasStrength()) tgt.setStrengthElement(convertBindingStrength(src.getStrengthElement()));
if (src.hasDescriptionElement()) tgt.setDescriptionElement(String10_40.convertString(src.getDescriptionElement()));
if (src.hasValueSet()) {
org.hl7.fhir.r4.model.Type vs = ConversionContext10_40.INSTANCE.getVersionConvertor_10_40().convertType(src.getValueSet());
if (vs != null) {
tgt.setValueSet(vs instanceof org.hl7.fhir.r4.model.Reference ? ((org.hl7.fhir.r4.model.Reference) vs).getReference() : vs.primitiveValue());
tgt.setValueSet(VersionConvertorConstants.refToVS(tgt.getValueSet()));
}
}
return tgt;
}

View File

@ -311,7 +311,7 @@ public class ConceptMap14_30 {
static public ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) {
for (ConceptMapGroupComponent grp : map.getGroup()) {
if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts))
if (grp.hasSource() && grp.getSource().equals(srcs) && grp.getTarget().equals(tgts))
return grp;
}
ConceptMapGroupComponent grp = map.addGroup();

View File

@ -360,9 +360,10 @@ public class ElementDefinition14_40 {
if (src.hasTarget()) {
for (org.hl7.fhir.r4.model.UriType u : src.getTargetProfile()) {
tgt.addProfile(u.getValue());
String baseName = u.getValue().toLowerCase();
if (baseName.contains("reference") && !baseName.contains("documentreference"))
throw new Error("2016May Target profile contains the word 'reference':" + u);
// disabled 2022-11-11 - gdg - I don't see what value this is bringing anywhere?
// String baseName = u.getValue().toLowerCase();
// if (baseName.contains("reference") && !baseName.contains("documentreference"))
// throw new Error("2016May Target profile contains the word 'reference':" + u);
}
for (org.hl7.fhir.r4.model.UriType u : src.getProfile()) {
if (src.getCode().equals("Reference")) {

View File

@ -320,7 +320,7 @@ public class ConceptMap14_40 {
static public ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) {
for (ConceptMapGroupComponent grp : map.getGroup()) {
if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts))
if (grp.hasSource() && grp.getSource().equals(srcs) && grp.getTarget().equals(tgts))
return grp;
}
ConceptMapGroupComponent grp = map.addGroup();

View File

@ -320,7 +320,7 @@ public class ImplementationGuide14_40 {
static public org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List<ImplementationGuide.ImplementationGuidePackageComponent> definition, String id) {
for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition)
if (t.getId().equals(id))
if (t.hasId() && t.getId().equals(id))
return t;
org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent();
t.setName("Default Package");

View File

@ -169,6 +169,8 @@ public class Type14_50 {
return UnsignedInt14_50.convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src);
if (src instanceof org.hl7.fhir.r5.model.IntegerType)
return Integer14_50.convertInteger((org.hl7.fhir.r5.model.IntegerType) src);
if (src instanceof org.hl7.fhir.r5.model.Integer64Type)
return Integer14_50.convertInteger64((org.hl7.fhir.r5.model.Integer64Type) src);
if (src instanceof org.hl7.fhir.r5.model.UuidType)
return Uuid14_50.convertUuid((org.hl7.fhir.r5.model.UuidType) src);
if (src instanceof org.hl7.fhir.r5.model.UriType) return Uri14_50.convertUri((org.hl7.fhir.r5.model.UriType) src);

View File

@ -15,4 +15,25 @@ public class Integer14_50 {
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
return tgt;
}
public static org.hl7.fhir.r5.model.Integer64Type convertInteger64(org.hl7.fhir.dstu2016may.model.IntegerType src) throws FHIRException {
org.hl7.fhir.r5.model.Integer64Type tgt = src.hasValue() ? new org.hl7.fhir.r5.model.Integer64Type(src.getValueAsString()) : new org.hl7.fhir.r5.model.Integer64Type();
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
return tgt;
}
public static org.hl7.fhir.dstu2016may.model.IntegerType convertInteger64(org.hl7.fhir.r5.model.Integer64Type src) throws FHIRException {
org.hl7.fhir.dstu2016may.model.IntegerType tgt = new org.hl7.fhir.dstu2016may.model.IntegerType();
if (src.hasValue()) {
try {
tgt.setValueAsString(src.getValueAsString());
} catch (Exception e) {
// nothing?
tgt.setValueAsString("0");
}
}
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
return tgt;
}
}

View File

@ -329,7 +329,7 @@ public class ConceptMap14_50 {
static public ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) {
for (ConceptMapGroupComponent grp : map.getGroup()) {
if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts))
if (grp.hasSource() && grp.getSource().equals(srcs) && grp.getTarget().equals(tgts))
return grp;
}
ConceptMapGroupComponent grp = map.addGroup();

View File

@ -321,7 +321,7 @@ public class ImplementationGuide14_50 {
static public org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List<ImplementationGuide.ImplementationGuidePackageComponent> definition, String id) {
for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition)
if (t.getId().equals(id))
if (t.hasId() && t.getId().equals(id))
return t;
org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent();
t.setName("Default Package");

View File

@ -286,7 +286,7 @@ public class ImplementationGuide30_40 {
static public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent findPackage(List<ImplementationGuide.ImplementationGuidePackageComponent> definition, String id) {
for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : definition)
if (t.getId().equals(id))
if (t.hasId() && t.getId().equals(id))
return t;
org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t1 = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent();
t1.setName("Default Package");

View File

@ -41,8 +41,6 @@ public class CompartmentDefinition30_50 {
tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext())
tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction())
tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
if (src.hasCode())
tgt.setCodeElement(convertCompartmentType(src.getCodeElement()));
if (src.hasSearch())
@ -79,8 +77,6 @@ public class CompartmentDefinition30_50 {
tgt.setPurposeElement(MarkDown30_50.convertMarkdown(src.getPurposeElement()));
for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext())
tgt.addUseContext(UsageContext30_50.convertUsageContext(t));
for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction())
tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept(t));
if (src.hasCode())
tgt.setCodeElement(convertCompartmentType(src.getCodeElement()));
if (src.hasSearch())

View File

@ -222,6 +222,8 @@ public class Type40_50 {
return UnsignedInt40_50.convertUnsignedInt((org.hl7.fhir.r5.model.UnsignedIntType) src);
if (src instanceof org.hl7.fhir.r5.model.IntegerType)
return Integer40_50.convertInteger((org.hl7.fhir.r5.model.IntegerType) src);
if (src instanceof org.hl7.fhir.r5.model.Integer64Type)
return Integer40_50.convertInteger64((org.hl7.fhir.r5.model.Integer64Type) src);
if (src instanceof org.hl7.fhir.r5.model.UrlType) return Url40_50.convertUrl((org.hl7.fhir.r5.model.UrlType) src);
if (src instanceof org.hl7.fhir.r5.model.UuidType)
return Uuid40_50.convertUuid((org.hl7.fhir.r5.model.UuidType) src);

View File

@ -15,4 +15,25 @@ public class Integer40_50 {
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
return tgt;
}
public static org.hl7.fhir.r5.model.Integer64Type convertInteger64(org.hl7.fhir.r4.model.IntegerType src) throws FHIRException {
org.hl7.fhir.r5.model.Integer64Type tgt = src.hasValue() ? new org.hl7.fhir.r5.model.Integer64Type(src.getValueAsString()) : new org.hl7.fhir.r5.model.Integer64Type();
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
return tgt;
}
public static org.hl7.fhir.r4.model.IntegerType convertInteger64(org.hl7.fhir.r5.model.Integer64Type src) throws FHIRException {
org.hl7.fhir.r4.model.IntegerType tgt = new org.hl7.fhir.r4.model.IntegerType();
if (src.hasValue()) {
try {
tgt.setValueAsString(src.getValueAsString());
} catch (Exception e) {
// nothing?
tgt.setValueAsString("0");
}
}
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
return tgt;
}
}

View File

@ -2516,7 +2516,7 @@ public class ImplementationGuide43_50 {
org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent tgt = new org.hl7.fhir.r5.model.ImplementationGuide.ImplementationGuideDefinitionParameterComponent();
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
if (src.hasCode())
tgt.getCode().setCode(src.getCode().toCode());
tgt.getCode().setCode(src.getCode());
if (src.hasValue())
tgt.setValueElement(String43_50.convertString(src.getValueElement()));
return tgt;

View File

@ -0,0 +1,594 @@
package org.hl7.fhir.convertors.misc.xver;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_30;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_40;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_30;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_40;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_50;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
import org.hl7.fhir.convertors.misc.xver.CorePackageVersionConvertor.BaseConvertor;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
import org.hl7.fhir.utilities.json.JsonUtilities;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.NpmPackage.NpmPackageFolder;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
public class CorePackageVersionConvertor {
public interface IContentConvertor {
byte[] convert(byte[] cnt) throws IOException;
}
public class BaseConvertor {
protected String version;
public BaseConvertor(String version) {
super();
this.version = version;
}
}
public class ContentConverter3to4 extends BaseConvertor implements IContentConvertor {
public ContentConverter3to4(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.dstu3.model.Resource r3 = new org.hl7.fhir.dstu3.formats.JsonParser().parse(cnt);
if (r3 instanceof org.hl7.fhir.dstu3.model.MetadataResource) {
org.hl7.fhir.dstu3.model.MetadataResource cr = (org.hl7.fhir.dstu3.model.MetadataResource) r3;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
org.hl7.fhir.r4.model.Resource r4 = VersionConvertorFactory_30_40.convertResource(r3);
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(r4);
}
}
public class ContentConverter2to4 extends BaseConvertor implements IContentConvertor {
public ContentConverter2to4(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.dstu2.model.Resource r2 = new org.hl7.fhir.dstu2.formats.JsonParser().parse(cnt);
org.hl7.fhir.r4.model.Resource r4 = VersionConvertorFactory_10_40.convertResource(r2);
if (r4 instanceof org.hl7.fhir.r4.model.MetadataResource) {
org.hl7.fhir.r4.model.MetadataResource cr = (org.hl7.fhir.r4.model.MetadataResource) r4;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(r4);
}
}
public class ContentConverter2Bto4 extends BaseConvertor implements IContentConvertor {
public ContentConverter2Bto4(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.dstu2016may.model.Resource r2 = new org.hl7.fhir.dstu2016may.formats.JsonParser().parse(cnt);
org.hl7.fhir.r4.model.Resource r4 = VersionConvertorFactory_14_40.convertResource(r2);
if (r4 instanceof org.hl7.fhir.r4.model.MetadataResource) {
org.hl7.fhir.r4.model.MetadataResource cr = (org.hl7.fhir.r4.model.MetadataResource) r4;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(r4);
}
}
public class ContentConverter5to4 extends BaseConvertor implements IContentConvertor {
public ContentConverter5to4(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.r5.model.Resource r5 = new org.hl7.fhir.r5.formats.JsonParser().parse(cnt);
if (r5 instanceof org.hl7.fhir.r5.model.MetadataResource) {
org.hl7.fhir.r5.model.MetadataResource cr = (org.hl7.fhir.r5.model.MetadataResource) r5;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
org.hl7.fhir.r4.model.Resource r4 = VersionConvertorFactory_40_50.convertResource(r5);
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(r4);
}
}
public class ContentConverter4to3 extends BaseConvertor implements IContentConvertor {
public ContentConverter4to3(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.r4.model.Resource r4 = new org.hl7.fhir.r4.formats.JsonParser().parse(cnt);
if (r4 instanceof org.hl7.fhir.r4.model.MessageDefinition) {
return null;
}
if (r4 instanceof org.hl7.fhir.r4.model.GraphDefinition) {
return null;
}
if (r4 instanceof org.hl7.fhir.r4.model.TerminologyCapabilities) {
return null;
}
if (r4 instanceof org.hl7.fhir.r4.model.MetadataResource) {
org.hl7.fhir.r4.model.MetadataResource cr = (org.hl7.fhir.r4.model.MetadataResource) r4;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
org.hl7.fhir.dstu3.model.Resource r3 = VersionConvertorFactory_30_40.convertResource(r4);
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(r3);
}
}
public class ContentConverter2to3 extends BaseConvertor implements IContentConvertor {
public ContentConverter2to3(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.dstu2.model.Resource r2 = new org.hl7.fhir.dstu2.formats.JsonParser().parse(cnt);
org.hl7.fhir.dstu3.model.Resource r3 = VersionConvertorFactory_10_30.convertResource(r2);
if (r3 instanceof org.hl7.fhir.dstu3.model.MetadataResource) {
org.hl7.fhir.dstu3.model.MetadataResource cr = (org.hl7.fhir.dstu3.model.MetadataResource) r3;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(r3);
}
}
public class ContentConverter2Bto3 extends BaseConvertor implements IContentConvertor {
public ContentConverter2Bto3(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.dstu2016may.model.Resource r2 = new org.hl7.fhir.dstu2016may.formats.JsonParser().parse(cnt);
if (r2 instanceof org.hl7.fhir.dstu2016may.model.StructureMap) {
return null;
}
org.hl7.fhir.dstu3.model.Resource r3 = VersionConvertorFactory_14_30.convertResource(r2);
if (r3 instanceof org.hl7.fhir.dstu3.model.MetadataResource) {
org.hl7.fhir.dstu3.model.MetadataResource cr = (org.hl7.fhir.dstu3.model.MetadataResource) r3;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(r3);
}
}
public class ContentConverter5to3 extends BaseConvertor implements IContentConvertor {
public ContentConverter5to3(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.r5.model.Resource r5 = new org.hl7.fhir.r5.formats.JsonParser().parse(cnt);
if (r5 instanceof org.hl7.fhir.r5.model.TerminologyCapabilities) {
return null;
}
if (r5 instanceof org.hl7.fhir.r5.model.MetadataResource) {
org.hl7.fhir.r5.model.MetadataResource cr = (org.hl7.fhir.r5.model.MetadataResource) r5;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
org.hl7.fhir.dstu3.model.Resource r3 = VersionConvertorFactory_30_50.convertResource(r5);
return new org.hl7.fhir.dstu3.formats.JsonParser().composeBytes(r3);
}
}
public class ContentConverter3to5 extends BaseConvertor implements IContentConvertor {
public ContentConverter3to5(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.dstu3.model.Resource r3 = new org.hl7.fhir.dstu3.formats.JsonParser().parse(cnt);
if (r3 instanceof org.hl7.fhir.dstu3.model.MetadataResource) {
org.hl7.fhir.dstu3.model.MetadataResource cr = (org.hl7.fhir.dstu3.model.MetadataResource) r3;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
org.hl7.fhir.r5.model.Resource r5 = VersionConvertorFactory_30_50.convertResource(r3);
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(r5);
}
}
public class ContentConverter2to5 extends BaseConvertor implements IContentConvertor {
public ContentConverter2to5(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.dstu2.model.Resource r2 = new org.hl7.fhir.dstu2.formats.JsonParser().parse(cnt);
org.hl7.fhir.r5.model.Resource r5 = VersionConvertorFactory_10_50.convertResource(r2);
if (r5 instanceof org.hl7.fhir.r5.model.MetadataResource) {
org.hl7.fhir.r5.model.MetadataResource cr = (org.hl7.fhir.r5.model.MetadataResource) r5;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(r5);
}
}
public class ContentConverter2Bto5 extends BaseConvertor implements IContentConvertor {
public ContentConverter2Bto5(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.dstu2016may.model.Resource r2 = new org.hl7.fhir.dstu2016may.formats.JsonParser().parse(cnt);
org.hl7.fhir.r5.model.Resource r5 = VersionConvertorFactory_14_50.convertResource(r2);
if (r5 instanceof org.hl7.fhir.r5.model.MetadataResource) {
org.hl7.fhir.r5.model.MetadataResource cr = (org.hl7.fhir.r5.model.MetadataResource) r5;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(r5);
}
}
public class ContentConverter4to5 extends BaseConvertor implements IContentConvertor {
public ContentConverter4to5(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.r4.model.Resource r4 = new org.hl7.fhir.r4.formats.JsonParser().parse(cnt);
if (r4 instanceof org.hl7.fhir.r4.model.MetadataResource) {
org.hl7.fhir.r4.model.MetadataResource cr = (org.hl7.fhir.r4.model.MetadataResource) r4;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
org.hl7.fhir.r5.model.Resource r5 = VersionConvertorFactory_40_50.convertResource(r4);
return new org.hl7.fhir.r5.formats.JsonParser().composeBytes(r5);
}
}
public class ContentConverter5to2 extends BaseConvertor implements IContentConvertor {
public ContentConverter5to2(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.r5.model.Resource r5 = new org.hl7.fhir.r5.formats.JsonParser().parse(cnt);
if (r5 instanceof org.hl7.fhir.r5.model.MetadataResource) {
org.hl7.fhir.r5.model.MetadataResource cr = (org.hl7.fhir.r5.model.MetadataResource) r5;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
org.hl7.fhir.dstu2.model.Resource r2 = VersionConvertorFactory_10_50.convertResource(r5);
return new org.hl7.fhir.dstu2.formats.JsonParser().composeBytes(r2);
}
}
public class ContentConverter5to2B extends BaseConvertor implements IContentConvertor {
public ContentConverter5to2B(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.r5.model.Resource r5 = new org.hl7.fhir.r5.formats.JsonParser().parse(cnt);
if (r5 instanceof org.hl7.fhir.r5.model.MessageDefinition) {
return null;
}
if (r5 instanceof org.hl7.fhir.r5.model.GraphDefinition) {
return null;
}
if (r5 instanceof org.hl7.fhir.r5.model.TerminologyCapabilities) {
return null;
}
if (r5 instanceof org.hl7.fhir.r5.model.MetadataResource) {
org.hl7.fhir.r5.model.MetadataResource cr = (org.hl7.fhir.r5.model.MetadataResource) r5;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
org.hl7.fhir.dstu2016may.model.Resource r2 = VersionConvertorFactory_14_50.convertResource(r5);
return new org.hl7.fhir.dstu2016may.formats.JsonParser().composeBytes(r2);
}
}
public class ContentConverter4to2 extends BaseConvertor implements IContentConvertor {
public ContentConverter4to2(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.r4.model.Resource r4 = new org.hl7.fhir.r4.formats.JsonParser().parse(cnt);
if (r4 instanceof org.hl7.fhir.r4.model.MetadataResource) {
org.hl7.fhir.r4.model.MetadataResource cr = (org.hl7.fhir.r4.model.MetadataResource) r4;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
org.hl7.fhir.dstu2.model.Resource r2 = VersionConvertorFactory_10_40.convertResource(r4);
return new org.hl7.fhir.dstu2.formats.JsonParser().composeBytes(r2);
}
}
public class ContentConverter4to2B extends BaseConvertor implements IContentConvertor {
public ContentConverter4to2B(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.r4.model.Resource r4 = new org.hl7.fhir.r4.formats.JsonParser().parse(cnt);
if (r4 instanceof org.hl7.fhir.r4.model.MessageDefinition) {
return null;
}
if (r4 instanceof org.hl7.fhir.r4.model.GraphDefinition) {
return null;
}
if (r4 instanceof org.hl7.fhir.r4.model.TerminologyCapabilities) {
return null;
}
if (r4 instanceof org.hl7.fhir.r4.model.MetadataResource) {
org.hl7.fhir.r4.model.MetadataResource cr = (org.hl7.fhir.r4.model.MetadataResource) r4;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
org.hl7.fhir.dstu2016may.model.Resource r2 = VersionConvertorFactory_14_40.convertResource(r4);
return new org.hl7.fhir.dstu2016may.formats.JsonParser().composeBytes(r2);
}
}
public class ContentConverter3to2 extends BaseConvertor implements IContentConvertor {
public ContentConverter3to2(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.dstu3.model.Resource r3 = new org.hl7.fhir.dstu3.formats.JsonParser().parse(cnt);
if (r3 instanceof org.hl7.fhir.dstu3.model.MetadataResource) {
org.hl7.fhir.dstu3.model.MetadataResource cr = (org.hl7.fhir.dstu3.model.MetadataResource) r3;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
org.hl7.fhir.dstu2.model.Resource r2 = VersionConvertorFactory_10_30.convertResource(r3);
return new org.hl7.fhir.dstu2.formats.JsonParser().composeBytes(r2);
}
}
public class ContentConverter3to2B extends BaseConvertor implements IContentConvertor {
public ContentConverter3to2B(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.dstu3.model.Resource r3 = new org.hl7.fhir.dstu3.formats.JsonParser().parse(cnt);
if (r3 instanceof org.hl7.fhir.dstu3.model.StructureMap) {
return null;
}
if (r3 instanceof org.hl7.fhir.dstu3.model.MetadataResource) {
org.hl7.fhir.dstu3.model.MetadataResource cr = (org.hl7.fhir.dstu3.model.MetadataResource) r3;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
org.hl7.fhir.dstu2016may.model.Resource r2 = VersionConvertorFactory_14_30.convertResource(r3);
return new org.hl7.fhir.dstu2016may.formats.JsonParser().composeBytes(r2);
}
}
public class ContentConverter4to4 extends BaseConvertor implements IContentConvertor {
public ContentConverter4to4(String version) {
super(version);
}
@Override
public byte[] convert(byte[] cnt) throws IOException {
org.hl7.fhir.r4.model.Resource r4 = new org.hl7.fhir.r4.formats.JsonParser().parse(cnt);
if (r4 instanceof org.hl7.fhir.r4.model.MetadataResource) {
org.hl7.fhir.r4.model.MetadataResource cr = (org.hl7.fhir.r4.model.MetadataResource) r4;
if (!cr.hasVersion()) {
cr.setVersion(version);
}
}
return new org.hl7.fhir.r4.formats.JsonParser().composeBytes(r4);
}
}
public static void main(String[] args) throws Exception {
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r2b.core.tgz"), "3.0.1");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r2b.core.tgz"), "4.0.1");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r2b.core.tgz"), "4.3.0");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r2b.core.tgz"), "5.0.0");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r3.core.tgz"), "1.4.0");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r3.core.tgz"), "4.0.1");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r3.core.tgz"), "4.3.0");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r3.core.tgz"), "5.0.0");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r4.core.tgz"), "1.4.0");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r4.core.tgz"), "3.0.1");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r4.core.tgz"), "4.3.0");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r4.core.tgz"), "5.0.0");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r4b.core.tgz"), "1.4.0");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r4b.core.tgz"), "3.0.1");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r4b.core.tgz"), "4.0.1");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r4b.core.tgz"), "5.0.0");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r5.core.tgz"), "1.4.0");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r5.core.tgz"), "3.0.1");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r5.core.tgz"), "4.0.1");
new CorePackageVersionConvertor().execute(Utilities.path(args[0], "hl7.fhir.r5.core.tgz"), "4.3.0");
}
public void execute(String packageSource, String versionTarget) throws Exception {
// open the existing package
// chose the version converter
// build a new package
System.out.println("Convert "+packageSource+" to "+versionTarget);
NpmPackage src = NpmPackage.fromPackage(new FileInputStream(packageSource));
IContentConvertor conv = contentConvertorFactory(src.fhirVersion(), versionTarget);
NpmPackage dst = NpmPackage.empty();
for (NpmPackageFolder folder : src.getFolders().values()) {
for (String s : folder.getContent().keySet()) {
byte[] cnt = folder.getContent().get(s);
if (s.endsWith(".json")) {
if (s.equals("package.json")) {
cnt = convertPackage(cnt, versionTarget);
} else {
String sJ = new String(cnt);
if (sJ.contains("\"resourceType\"") && !s.equals(".index.json") && !s.endsWith(".schema.json")) {
try {
cnt = conv.convert(cnt);
} catch (Exception e) {
throw new Exception("Error processing "+folder.getName()+"/"+s+": "+e.getMessage(), e);
}
} else {
// nothing
}
}
if (cnt != null) {
dst.addFile(folder.getName(), s, cnt, null);
}
} else {
dst.addFile(folder.getName(), s, cnt, null);
}
}
}
dst.save(new FileOutputStream(Utilities.changeFileExt(packageSource, ".as."+VersionUtilities.getNameForVersion(versionTarget).toLowerCase()+".tgz")));
}
private IContentConvertor contentConvertorFactory(String fhirVersion, String versionTarget) throws Exception {
if (VersionUtilities.isR3Ver(fhirVersion)) {
if (VersionUtilities.isR4Ver(versionTarget) || VersionUtilities.isR4BVer(versionTarget)) {
return new ContentConverter3to4(fhirVersion);
} else if (VersionUtilities.isR5Ver(versionTarget)) {
return new ContentConverter3to5(fhirVersion);
} else if (VersionUtilities.isR2Ver(versionTarget)) {
return new ContentConverter3to2(fhirVersion);
} else if (VersionUtilities.isR2BVer(versionTarget)) {
return new ContentConverter3to2B(fhirVersion);
}
} else if (VersionUtilities.isR2Ver(fhirVersion)) {
if (VersionUtilities.isR4Ver(versionTarget) || VersionUtilities.isR4BVer(versionTarget)) {
return new ContentConverter2to4(fhirVersion);
} else if (VersionUtilities.isR5Ver(versionTarget)) {
return new ContentConverter2to5(fhirVersion);
} else if (VersionUtilities.isR3Ver(versionTarget)) {
return new ContentConverter2to3(fhirVersion);
}
} else if (VersionUtilities.isR2BVer(fhirVersion)) {
if (VersionUtilities.isR4Ver(versionTarget) || VersionUtilities.isR4BVer(versionTarget)) {
return new ContentConverter2Bto4(fhirVersion);
} else if (VersionUtilities.isR5Ver(versionTarget)) {
return new ContentConverter2Bto5(fhirVersion);
} else if (VersionUtilities.isR3Ver(versionTarget)) {
return new ContentConverter2Bto3(fhirVersion);
}
} else if (VersionUtilities.isR4Ver(fhirVersion)) {
if (VersionUtilities.isR3Ver(versionTarget)) {
return new ContentConverter4to3(fhirVersion);
} else if (VersionUtilities.isR5Ver(versionTarget)) {
return new ContentConverter4to5(fhirVersion);
} else if (VersionUtilities.isR2Ver(versionTarget)) {
return new ContentConverter4to2(fhirVersion);
} else if (VersionUtilities.isR4BVer(versionTarget)) {
return new ContentConverter4to4(fhirVersion);
} else if (VersionUtilities.isR2BVer(versionTarget)) {
return new ContentConverter4to2B(fhirVersion);
}
} else if (VersionUtilities.isR4BVer(fhirVersion)) {
if (VersionUtilities.isR3Ver(versionTarget)) {
return new ContentConverter4to3(fhirVersion);
} else if (VersionUtilities.isR5Ver(versionTarget)) {
return new ContentConverter4to5(fhirVersion);
} else if (VersionUtilities.isR4Ver(versionTarget)) {
return new ContentConverter4to4(fhirVersion);
} else if (VersionUtilities.isR2Ver(versionTarget)) {
return new ContentConverter4to2(fhirVersion);
} else if (VersionUtilities.isR2BVer(versionTarget)) {
return new ContentConverter4to2B(fhirVersion);
}
} else if (VersionUtilities.isR5Ver(fhirVersion)) {
if (VersionUtilities.isR4Ver(versionTarget) || VersionUtilities.isR4BVer(versionTarget)) {
return new ContentConverter5to4(fhirVersion);
} else if (VersionUtilities.isR3Ver(versionTarget)) {
return new ContentConverter5to3(fhirVersion);
} else if (VersionUtilities.isR2Ver(versionTarget)) {
return new ContentConverter5to2(fhirVersion);
} else if (VersionUtilities.isR2BVer(versionTarget)) {
return new ContentConverter5to2B(fhirVersion);
}
}
throw new Exception("Unable to convert from "+fhirVersion+" to "+versionTarget);
}
private byte[] convertPackage(byte[] cnt, String version) throws IOException {
JsonObject json = JsonTrackingParser.parseJson(cnt);
json.remove("fhir-version-list");
JsonArray vl = new JsonArray();
json.add("fhirVersions", vl);
vl.add(version);
json.addProperty("name", JsonUtilities.str(json, "name")+".as."+VersionUtilities.getNameForVersion(version).toLowerCase());
json.addProperty("title", JsonUtilities.str(json, "title")+" (as Version "+VersionUtilities.getNameForVersion(version).toLowerCase()+")");
return JsonTrackingParser.write(json).getBytes(StandardCharsets.UTF_8);
}
}

View File

@ -4680,6 +4680,7 @@ public class ProfileUtilities extends TranslatingUtilities {
case PROFILE: return t.getPath()+"/@profile";
case TYPE: return t.getPath()+"/@type";
case VALUE: return t.getPath();
case PATTERN: return t.getPath();
case EXISTS: return t.getPath(); // determination of value vs. exists is based on whether there's only 2 slices - one with minOccurs=1 and other with maxOccur=0
default: throw new FHIRException("Unable to represent "+t.getType().toCode()+":"+t.getPath()+" in R2");
}

View File

@ -22,12 +22,12 @@
</natures>
<filteredResources>
<filter>
<id>1662504185037</id>
<id>1668080803768</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>

View File

@ -15842,7 +15842,7 @@ public class JsonParser extends JsonParserBase {
protected void parseImplementationGuideDefinitionParameterComponentProperties(JsonObject json, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws IOException, FHIRFormatError {
parseBackboneElementProperties(json, res);
if (json.has("code"))
res.setCodeElement(parseEnumeration(json.get("code").getAsString(), ImplementationGuide.GuideParameterCode.NULL, new ImplementationGuide.GuideParameterCodeEnumFactory()));
res.setCodeElement(parseString(json.get("code").getAsString()));
if (json.has("_code"))
parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
if (json.has("value"))
@ -46799,8 +46799,8 @@ public class JsonParser extends JsonParserBase {
protected void composeImplementationGuideDefinitionParameterComponentProperties(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
composeBackboneElementProperties(element);
if (element.hasCodeElement()) {
composeEnumerationCore("code", element.getCodeElement(), new ImplementationGuide.GuideParameterCodeEnumFactory(), false);
composeEnumerationExtras("code", element.getCodeElement(), new ImplementationGuide.GuideParameterCodeEnumFactory(), false);
composeStringCore("code", element.getCodeElement(), false);
composeStringExtras("code", element.getCodeElement(), false);
}
if (element.hasValueElement()) {
composeStringCore("value", element.getValueElement(), false);

View File

@ -12577,7 +12577,7 @@ public class RdfParser extends RdfParserBase {
}
composeBackboneElement(t, "parameter", name, element, index);
if (element.hasCodeElement()) {
composeEnum(t, "ImplementationGuideDefinitionParameterComponent", "code", element.getCodeElement(), -1);
composeString(t, "ImplementationGuideDefinitionParameterComponent", "code", element.getCodeElement(), -1);
}
if (element.hasValueElement()) {
composeString(t, "ImplementationGuideDefinitionParameterComponent", "value", element.getValueElement(), -1);

View File

@ -13779,7 +13779,7 @@ public class XmlParser extends XmlParserBase {
protected boolean parseImplementationGuideDefinitionParameterComponentContent(int eventType, XmlPullParser xpp, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws XmlPullParserException, IOException, FHIRFormatError {
if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) {
res.setCodeElement(parseEnumeration(xpp, ImplementationGuide.GuideParameterCode.NULL, new ImplementationGuide.GuideParameterCodeEnumFactory()));
res.setCodeElement(parseString(xpp));
} else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) {
res.setValueElement(parseString(xpp));
} else if (!parseBackboneElementContent(eventType, xpp, res)){
@ -40194,7 +40194,7 @@ public class XmlParser extends XmlParserBase {
protected void composeImplementationGuideDefinitionParameterComponentElements(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
composeBackboneElementElements(element);
if (element.hasCodeElement())
composeEnumeration("code", element.getCodeElement(), new ImplementationGuide.GuideParameterCodeEnumFactory());
composeString("code", element.getCodeElement());
if (element.hasValueElement()) {
composeString("value", element.getValueElement());
}

View File

@ -8282,10 +8282,9 @@ public class ImplementationGuide extends CanonicalResource {
/**
* apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.
*/
@Child(name = "code", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
@Child(name = "code", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
@Description(shortDefinition="apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template", formalDefinition="apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template." )
@ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/guide-parameter-code")
protected Enumeration<GuideParameterCode> code;
protected StringType code;
/**
* Value for named type.
@ -8306,21 +8305,21 @@ public class ImplementationGuide extends CanonicalResource {
/**
* Constructor
*/
public ImplementationGuideDefinitionParameterComponent(GuideParameterCode code, String value) {
public ImplementationGuideDefinitionParameterComponent(StringType code, StringType value) {
super();
this.setCode(code);
this.setValue(value);
this.code = code;
this.value = value;
}
/**
* @return {@link #code} (apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
*/
public Enumeration<GuideParameterCode> getCodeElement() {
public StringType getCodeElement() {
if (this.code == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ImplementationGuideDefinitionParameterComponent.code");
else if (Configuration.doAutoCreate())
this.code = new Enumeration<GuideParameterCode>(new GuideParameterCodeEnumFactory()); // bb
this.code = new StringType(); // bb
return this.code;
}
@ -8335,7 +8334,7 @@ public class ImplementationGuide extends CanonicalResource {
/**
* @param value {@link #code} (apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
*/
public ImplementationGuideDefinitionParameterComponent setCodeElement(Enumeration<GuideParameterCode> value) {
public ImplementationGuideDefinitionParameterComponent setCodeElement(StringType value) {
this.code = value;
return this;
}
@ -8343,16 +8342,16 @@ public class ImplementationGuide extends CanonicalResource {
/**
* @return apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.
*/
public GuideParameterCode getCode() {
public String getCode() {
return this.code == null ? null : this.code.getValue();
}
/**
* @param value apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.
*/
public ImplementationGuideDefinitionParameterComponent setCode(GuideParameterCode value) {
public ImplementationGuideDefinitionParameterComponent setCode(String value) {
if (this.code == null)
this.code = new Enumeration<GuideParameterCode>(new GuideParameterCodeEnumFactory());
this.code = new StringType();
this.code.setValue(value);
return this;
}
@ -8404,14 +8403,14 @@ public class ImplementationGuide extends CanonicalResource {
protected void listChildren(List<Property> children) {
super.listChildren(children);
children.add(new Property("code", "code", "apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.", 0, 1, code));
children.add(new Property("code", "string", "apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.", 0, 1, code));
children.add(new Property("value", "string", "Value for named type.", 0, 1, value));
}
@Override
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
switch (_hash) {
case 3059181: /*code*/ return new Property("code", "code", "apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.", 0, 1, code);
case 3059181: /*code*/ return new Property("code", "string", "apply | path-resource | path-pages | path-tx-cache | expansion-parameter | rule-broken-links | generate-xml | generate-json | generate-turtle | html-template.", 0, 1, code);
case 111972721: /*value*/ return new Property("value", "string", "Value for named type.", 0, 1, value);
default: return super.getNamedProperty(_hash, _name, _checkValid);
}
@ -8432,8 +8431,7 @@ public class ImplementationGuide extends CanonicalResource {
public Base setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case 3059181: // code
value = new GuideParameterCodeEnumFactory().fromType(TypeConvertor.castToCode(value));
this.code = (Enumeration) value; // Enumeration<GuideParameterCode>
this.code = TypeConvertor.castToString(value); // StringType
return value;
case 111972721: // value
this.value = TypeConvertor.castToString(value); // StringType
@ -8446,8 +8444,7 @@ public class ImplementationGuide extends CanonicalResource {
@Override
public Base setProperty(String name, Base value) throws FHIRException {
if (name.equals("code")) {
value = new GuideParameterCodeEnumFactory().fromType(TypeConvertor.castToCode(value));
this.code = (Enumeration) value; // Enumeration<GuideParameterCode>
this.code = TypeConvertor.castToString(value); // StringType
} else if (name.equals("value")) {
this.value = TypeConvertor.castToString(value); // StringType
} else
@ -8468,7 +8465,7 @@ public class ImplementationGuide extends CanonicalResource {
@Override
public String[] getTypesForProperty(int hash, String name) throws FHIRException {
switch (hash) {
case 3059181: /*code*/ return new String[] {"code"};
case 3059181: /*code*/ return new String[] {"string"};
case 111972721: /*value*/ return new String[] {"string"};
default: return super.getTypesForProperty(hash, name);
}

View File

@ -45,7 +45,7 @@ public class IGHelper {
public static String readStringParameter(ImplementationGuideDefinitionComponent ig, String name) {
for (ImplementationGuideDefinitionParameterComponent p : ig.getParameter()) {
if (name == p.getCode().toCode()) {
if (name == p.getCode()) {
return p.getValue();
}
}
@ -59,19 +59,19 @@ public class IGHelper {
public static void setParameter(ImplementationGuideDefinitionComponent ig, String name, String value) {
for (ImplementationGuideDefinitionParameterComponent p : ig.getParameter()) {
if (name == p.getCode().toCode()) {
if (name == p.getCode()) {
p.setValue(value);
return;
}
}
ImplementationGuideDefinitionParameterComponent p = ig.addParameter();
p.setCode(org.hl7.fhir.r4b.model.ImplementationGuide.GuideParameterCode.fromCode(name));
p.setCode(name);
p.setValue(value);
}
public static void addParameter(ImplementationGuideDefinitionComponent ig, String name, String value) {
ImplementationGuideDefinitionParameterComponent p = ig.addParameter();
p.setCode(org.hl7.fhir.r4b.model.ImplementationGuide.GuideParameterCode.fromCode(name));
p.setCode(name);
p.setValue(value);
}

View File

@ -570,12 +570,25 @@ public class VersionUtilities {
case "1.4" : return "http://hl7.org/fhir/DSTU2";
case "3.0" : return "http://hl7.org/fhir/STU3";
case "4.0" : return "http://hl7.org/fhir/R4";
case "4.5" : return "http://build.fhir.org";
case "4.3" : return "http://hl7.org/fhir/R4B";
case "5.0" : return "http://build.fhir.org";
default:
return "http://hl7.org/fhir";
}
}
public static String getNameForVersion(String v) {
switch (getMajMin(v)) {
case "1.0" : return "R2";
case "1.4" : return "R2B";
case "3.0" : return "R3";
case "4.0" : return "R4";
case "4.3" : return "R4B";
case "5.0" : return "R5";
default:
return "R?";
}
}
}

View File

@ -283,6 +283,14 @@ public class NpmPackage {
return retVal;
}
/**
* Factory method that starts a new empty package using the given PackageGenerator to create the manifest
*/
public static NpmPackage empty() {
NpmPackage retVal = new NpmPackage();
return retVal;
}
public Map<String, Object> getUserData() {
return userData;
}
@ -1061,6 +1069,12 @@ public class NpmPackage {
if (!folder.types.containsKey(type))
folder.types.put(type, new ArrayList<>());
folder.types.get(type).add(name);
if ("package".equals(folderName) && "package.json".equals(name)) {
try {
npm = JsonTrackingParser.parseJson(cnt);
} catch (IOException e) {
}
}
}
public void loadAllFiles() throws IOException {