update code generation
This commit is contained in:
parent
497b502a1c
commit
441f7b4e47
|
@ -581,20 +581,42 @@ public class PEBuilder {
|
|||
throw new DefinitionException("The discriminator type 'type' is not supported by the PEBuilder");
|
||||
case VALUE:
|
||||
String path = d.getPath();
|
||||
if (path.contains(".")) {
|
||||
throw new DefinitionException("The discriminator path '"+path+"' is not supported by the PEBuilder");
|
||||
}
|
||||
ElementDefinition ed = getChildElement(profile, definition, path);
|
||||
if (ed == null) {
|
||||
throw new DefinitionException("The discriminator path '"+path+"' could not be resolved by the PEBuilder");
|
||||
}
|
||||
if (!ed.hasFixed()) {
|
||||
throw new DefinitionException("The discriminator path '"+path+"' has no fixed value - this is not supported by the PEBuilder");
|
||||
// three things possible:
|
||||
// fixed, pattern, or binding
|
||||
if (ed.hasFixed()) {
|
||||
if (!ed.getFixed().isPrimitive()) {
|
||||
throw new DefinitionException("The discriminator path '"+path+"' has a fixed value that is not a primitive ("+ed.getFixed().fhirType()+") - this is not supported by the PEBuilder");
|
||||
}
|
||||
b.append(path+" = '"+ed.getFixed().primitiveValue()+"'");
|
||||
} else if (ed.hasPattern()) {
|
||||
throw new DefinitionException("The discriminator path '"+path+"' has a pattern on the element '"+ed.getId()+"' - this is not supported by the PEBuilder");
|
||||
} else if (ed.hasBinding()) {
|
||||
if (ed.getBinding().getStrength() != BindingStrength.REQUIRED) {
|
||||
throw new DefinitionException("The discriminator path '"+path+"' has a binding on the element '"+ed.getId()+"' but the strength is not required - this is not supported by the PEBuilder");
|
||||
} else {
|
||||
ValueSet vs = context.findTxResource(ValueSet.class, ed.getBinding().getValueSet());
|
||||
if (vs == null) {
|
||||
throw new DefinitionException("The discriminator path '"+path+"' has a binding on the element '"+ed.getId()+"' but the valueSet '"+ed.getBinding().getValueSet()+"' is not known - this is not supported by the PEBuilder");
|
||||
}
|
||||
ValueSetExpansionOutcome exp = context.expandVS(vs, true, false);
|
||||
if (exp.isOk()) {
|
||||
CommaSeparatedStringBuilder bs = new CommaSeparatedStringBuilder(" | ");
|
||||
for (ValueSetExpansionContainsComponent cc : exp.getValueset().getExpansion().getContains()) {
|
||||
bs.append("'"+cc.getCode()+"'");
|
||||
}
|
||||
b.append(path+" in ("+bs.toString()+")");
|
||||
} else {
|
||||
throw new DefinitionException("The discriminator path '"+path+"' has a binding on the element '"+ed.getId()+"' but the valueSet '"+ed.getBinding().getValueSet()+"' could not be expanded: "+exp.getError());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new DefinitionException("The discriminator path '"+path+"' has no fixed or pattern value or a binding on the element '"+ed.getId()+"' - this is not supported by the PEBuilder");
|
||||
|
||||
}
|
||||
if (!ed.getFixed().isPrimitive()) {
|
||||
throw new DefinitionException("The discriminator path '"+path+"' has a fixed value that is not a primitive ("+ed.getFixed().fhirType()+") - this is not supported by the PEBuilder");
|
||||
}
|
||||
b.append(path+" = '"+ed.getFixed().primitiveValue()+"'");
|
||||
break;
|
||||
case NULL:
|
||||
throw new DefinitionException("The discriminator type 'null' is not supported by the PEBuilder");
|
||||
|
@ -606,13 +628,26 @@ public class PEBuilder {
|
|||
}
|
||||
|
||||
private ElementDefinition getChildElement(StructureDefinition profile, ElementDefinition definition, String path) {
|
||||
List<ElementDefinition> elements = pu.getChildList(profile, definition);
|
||||
if (elements.size() == 0) {
|
||||
profile = definition.getTypeFirstRep().hasProfile() ? context.fetchResource(StructureDefinition.class, definition.getTypeFirstRep().getProfile().get(0).asStringValue()) :
|
||||
context.fetchTypeDefinition(definition.getTypeFirstRep().getWorkingCode());
|
||||
elements = pu.getChildList(profile, profile.getSnapshot().getElementFirstRep());
|
||||
}
|
||||
return getByName(elements, path);
|
||||
String head = path.contains(".") ? path.substring(0, path.indexOf(".")) : path;
|
||||
String tail = path.contains(".") ? path.substring(path.indexOf(".")+1) : null;
|
||||
ElementDefinition focus = definition;
|
||||
|
||||
do {
|
||||
List<ElementDefinition> elements = pu.getChildList(profile, focus);
|
||||
if (elements.size() == 0) {
|
||||
profile = focus.getTypeFirstRep().hasProfile() ? context.fetchResource(StructureDefinition.class, focus.getTypeFirstRep().getProfile().get(0).asStringValue()) :
|
||||
context.fetchTypeDefinition(focus.getTypeFirstRep().getWorkingCode());
|
||||
elements = pu.getChildList(profile, profile.getSnapshot().getElementFirstRep());
|
||||
}
|
||||
focus = getByName(elements, head);
|
||||
if (tail != null) {
|
||||
head = tail.contains(".") ? tail.substring(0, tail.indexOf(".")) : tail;
|
||||
tail = tail.contains(".") ? tail.substring(tail.indexOf(".")+1) : null;
|
||||
} else {
|
||||
head = null;
|
||||
}
|
||||
} while (head != null && focus != null);
|
||||
return focus;
|
||||
}
|
||||
|
||||
public List<Base> exec(Resource resource, Base data, String fhirpath) {
|
||||
|
|
|
@ -119,9 +119,9 @@ public class PECodeGenerator {
|
|||
public void genId() {
|
||||
if (isResource) {
|
||||
genField(true, "id", "String", "id", "", false, "", 0, 1, null);
|
||||
genAccessors(true, false, "id", "String", "", "String", "String", "Id", "Ids", false, "", false, false, null);
|
||||
genLoad(true, false, "id", "id", "IdType", "", "String", "String", "Id", "Ids", false, false, null, false);
|
||||
genSave(true, false, "id", "id", "IdType", "", "String", "String", "Id", "Ids", false, false, false, null, false);
|
||||
genAccessors(true, false, "id", "id", "String", "", "String", "String", "Id", "Ids", false, "", false, false, null);
|
||||
genLoad(true, false, "id", "id", "id", "IdType", "", "String", "String", "Id", "Ids", false, false, null, false);
|
||||
genSave(true, false, "id", "id", "id", "IdType", "", "String", "String", "Id", "Ids", false, false, false, null, false);
|
||||
genClear(false, "id", "String");
|
||||
}
|
||||
}
|
||||
|
@ -382,9 +382,9 @@ public class PECodeGenerator {
|
|||
if (isPrim && field.hasFixedValue()) {
|
||||
genFixed(name, ptype, field.getFixedValue());
|
||||
}
|
||||
genAccessors(isPrim, isAbstract, name, type, init, ptype, ltype, cname, csname, field.isList(), field.documentation(), field.hasFixedValue(), isEnum, field.definition());
|
||||
genLoad(isPrim, isAbstract, name, sname, type, init, ptype, ltype, cname, csname, field.isList(), field.hasFixedValue(), field.types().get(0), isEnum);
|
||||
genSave(isPrim, isAbstract, name, sname, type, init, ptype, ltype, cname, csname, field.isList(), field.hasFixedValue(), isExtension, field.types().get(0), isEnum);
|
||||
genAccessors(isPrim, isAbstract, name, field.name(), type, init, ptype, ltype, cname, csname, field.isList(), field.documentation(), field.hasFixedValue(), isEnum, field.definition());
|
||||
genLoad(isPrim, isAbstract, name, sname, field.name(), type, init, ptype, ltype, cname, csname, field.isList(), field.hasFixedValue(), field.types().get(0), isEnum);
|
||||
genSave(isPrim, isAbstract, name, sname, field.name(), type, init, ptype, ltype, cname, csname, field.isList(), field.hasFixedValue(), isExtension, field.types().get(0), isEnum);
|
||||
genClear(field.isList(), name, ptype);
|
||||
}
|
||||
} else {
|
||||
|
@ -404,9 +404,9 @@ public class PECodeGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
private void genLoad(boolean isPrim, boolean isAbstract, String name, String sname, String type, String init, String ptype, String ltype, String cname, String csname, boolean isList, boolean isFixed, PEType typeInfo, boolean isEnum) {
|
||||
private void genLoad(boolean isPrim, boolean isAbstract, String name, String sname, String fname, String type, String init, String ptype, String ltype, String cname, String csname, boolean isList, boolean isFixed, PEType typeInfo, boolean isEnum) {
|
||||
if (isList) {
|
||||
w(load, " for (PEInstance item : src.children(\""+sname+"\")) {");
|
||||
w(load, " for (PEInstance item : src.children(\""+fname+"\")) {");
|
||||
if ("BackboneElement".equals(type)) {
|
||||
w(load, " "+name+".add(("+type+") item.asElement());");
|
||||
} else {
|
||||
|
@ -414,59 +414,59 @@ public class PECodeGenerator {
|
|||
}
|
||||
w(load, " }");
|
||||
} else if (isEnum) {
|
||||
w(load, " if (src.hasChild(\""+name+"\")) {");
|
||||
w(load, " if (src.hasChild(\""+fname+"\")) {");
|
||||
if ("CodeableConcept".equals(typeInfo.getName())) {
|
||||
w(load, " "+name+" = "+type+".fromCodeableConcept((CodeableConcept) src.child(\""+name+"\").asDataType());");
|
||||
w(load, " "+name+" = "+type+".fromCodeableConcept((CodeableConcept) src.child(\""+fname+"\").asDataType());");
|
||||
} else if ("Coding".equals(typeInfo.getName())) {
|
||||
w(load, " "+name+" = "+type+".fromCoding((Coding) src.child(\""+name+"\").asDataType());");
|
||||
w(load, " "+name+" = "+type+".fromCoding((Coding) src.child(\""+fname+"\").asDataType());");
|
||||
} else {
|
||||
w(load, " "+name+" = "+type+".fromCode(src.child(\""+name+"\").asDataType().primitiveValue());");
|
||||
w(load, " "+name+" = "+type+".fromCode(src.child(\""+fname+"\").asDataType().primitiveValue());");
|
||||
}
|
||||
w(load, " }");
|
||||
} else if (isPrim) {
|
||||
w(load, " if (src.hasChild(\""+name+"\")) {");
|
||||
w(load, " if (src.hasChild(\""+fname+"\")) {");
|
||||
if ("CodeType".equals(type)) {
|
||||
// might be code or enum
|
||||
w(load, " "+name+" = src.child(\""+name+"\").asDataType().primitiveValue();");
|
||||
w(load, " "+name+" = src.child(\""+fname+"\").asDataType().primitiveValue();");
|
||||
} else {
|
||||
w(load, " "+name+" = (("+type+") src.child(\""+name+"\").asDataType()).getValue();");
|
||||
w(load, " "+name+" = (("+type+") src.child(\""+fname+"\").asDataType()).getValue();");
|
||||
}
|
||||
w(load, " }");
|
||||
} else if (typeInfo != null && typeInfo.getUrl() != null && !typeInfo.getUrl().startsWith("http://hl7.org/fhir/StructureDefinition")) {
|
||||
w(load, " if (src.hasChild(\""+name+"\")) {");
|
||||
w(load, " "+name+" = "+type+".fromSource(src.child(\""+name+"\"));");
|
||||
w(load, " if (src.hasChild(\""+fname+"\")) {");
|
||||
w(load, " "+name+" = "+type+".fromSource(src.child(\""+fname+"\"));");
|
||||
w(load, " }");
|
||||
} else {
|
||||
w(load, " if (src.hasChild(\""+name+"\")) {");
|
||||
w(load, " if (src.hasChild(\""+fname+"\")) {");
|
||||
if ("BackboneElement".equals(type)) {
|
||||
w(load, " "+name+" = ("+type+") src.child(\""+name+"\").asElement();");
|
||||
w(load, " "+name+" = ("+type+") src.child(\""+fname+"\").asElement();");
|
||||
} else if (Utilities.existsInList(type, workerContext.getResourceNames())) {
|
||||
w(load, " "+name+" = ("+type+") src.child(\""+name+"\").asResource();");
|
||||
w(load, " "+name+" = ("+type+") src.child(\""+fname+"\").asResource();");
|
||||
} else {
|
||||
w(load, " "+name+" = ("+type+") src.child(\""+name+"\").asDataType();");
|
||||
w(load, " "+name+" = ("+type+") src.child(\""+fname+"\").asDataType();");
|
||||
}
|
||||
w(load, " }");
|
||||
}
|
||||
}
|
||||
|
||||
private void genSave(boolean isPrim, boolean isAbstract, String name, String sname, String type, String init, String ptype, String ltype, String cname, String csname, boolean isList, boolean isFixed, boolean isExtension, PEType typeInfo, boolean isEnum) {
|
||||
w(save, " tgt.clear(\""+sname+"\");");
|
||||
private void genSave(boolean isPrim, boolean isAbstract, String name, String sname, String fname, String type, String init, String ptype, String ltype, String cname, String csname, boolean isList, boolean isFixed, boolean isExtension, PEType typeInfo, boolean isEnum) {
|
||||
w(save, " tgt.clear(\""+fname+"\");");
|
||||
if (isList) {
|
||||
w(save, " for ("+type+" item : "+name+") {");
|
||||
if (isExtension) {
|
||||
w(save, " tgt.makeChild(\""+sname+"\").data().setProperty(\"value[x]\", item);");
|
||||
w(save, " tgt.makeChild(\""+fname+"\").data().setProperty(\"value[x]\", item);");
|
||||
} else {
|
||||
w(save, " tgt.addChild(\""+sname+"\", item);");
|
||||
w(save, " tgt.addChild(\""+fname+"\", item);");
|
||||
}
|
||||
w(save, " }");
|
||||
} else if (isEnum) {
|
||||
w(save, " if ("+name+" != null) {");
|
||||
if ("CodeableConcept".equals(typeInfo.getName())) {
|
||||
w(save, " tgt.addChild(\""+sname+"\", "+name+".toCodeableConcept());");
|
||||
w(save, " tgt.addChild(\""+fname+"\", "+name+".toCodeableConcept());");
|
||||
} else if ("Coding".equals(typeInfo.getName())) {
|
||||
w(save, " tgt.addChild(\""+sname+"\", "+name+".toCoding());");
|
||||
w(save, " tgt.addChild(\""+fname+"\", "+name+".toCoding());");
|
||||
} else {
|
||||
w(save, " tgt.addChild(\""+sname+"\", "+name+".toCode());");
|
||||
w(save, " tgt.addChild(\""+fname+"\", "+name+".toCode());");
|
||||
}
|
||||
w(save, " }");
|
||||
} else if (isPrim) {
|
||||
|
@ -478,29 +478,29 @@ public class PECodeGenerator {
|
|||
w(save, " if ("+name+" != null) {");
|
||||
}
|
||||
if (isExtension) {
|
||||
w(save, " tgt.makeChild(\""+sname+"\").data().setProperty(\"value[x]\", new "+type+"("+name+"));");
|
||||
w(save, " tgt.makeChild(\""+fname+"\").data().setProperty(\"value[x]\", new "+type+"("+name+"));");
|
||||
} else if (Utilities.existsInList(type, "DateType", "InstantType", "DateTimeType")) {
|
||||
w(save, " tgt.addChild(\""+sname+"\", new "+type+"("+name+"));");
|
||||
w(save, " tgt.addChild(\""+fname+"\", new "+type+"("+name+"));");
|
||||
} else {
|
||||
w(save, " tgt.makeChild(\""+sname+"\").data().setProperty(\"value\", new "+type+"("+name+"));");
|
||||
w(save, " tgt.makeChild(\""+fname+"\").data().setProperty(\"value\", new "+type+"("+name+"));");
|
||||
}
|
||||
w(save, " }");
|
||||
} else if (typeInfo != null && typeInfo.getUrl() != null && !typeInfo.getUrl().startsWith("http://hl7.org/fhir/StructureDefinition")) {
|
||||
w(save, " if ("+name+" != null) {");
|
||||
w(save, " "+name+".save(tgt.makeChild(\""+sname+"\"), nulls);");
|
||||
w(save, " "+name+".save(tgt.makeChild(\""+fname+"\"), nulls);");
|
||||
w(save, " }");
|
||||
} else if (isExtension) {
|
||||
w(save, " if ("+name+" != null) {");
|
||||
w(save, " tgt.makeChild(\""+sname+"\").data().setProperty(\"value[x]\", "+name+");");
|
||||
w(save, " tgt.makeChild(\""+fname+"\").data().setProperty(\"value[x]\", "+name+");");
|
||||
w(save, " }");
|
||||
} else {
|
||||
w(save, " if ("+name+" != null) {");
|
||||
w(save, " tgt.addChild(\""+sname+"\", "+name+");");
|
||||
w(save, " tgt.addChild(\""+fname+"\", "+name+");");
|
||||
w(save, " }");
|
||||
}
|
||||
}
|
||||
|
||||
private void genAccessors(boolean isPrim, boolean isAbstract, String name, String type, String init, String ptype, String ltype, String cname, String csname, boolean isList, String shortDoco, boolean isFixed, boolean isEnum, ElementDefinition ed) {
|
||||
private void genAccessors(boolean isPrim, boolean isAbstract, String name, String fname, String type, String init, String ptype, String ltype, String cname, String csname, boolean isList, String shortDoco, boolean isFixed, boolean isEnum, ElementDefinition ed) {
|
||||
if (ed != null) {
|
||||
jdoc(accessors, ed.getDefinition(), 2, true);
|
||||
}
|
||||
|
|
|
@ -587,9 +587,6 @@ public class PEBuilder {
|
|||
throw new DefinitionException("The discriminator type 'type' is not supported by the PEBuilder");
|
||||
case VALUE:
|
||||
String path = d.getPath();
|
||||
if (path.contains(".")) {
|
||||
throw new DefinitionException("The discriminator path '"+path+"' is not supported by the PEBuilder");
|
||||
}
|
||||
ElementDefinition ed = getChildElement(profile, definition, path);
|
||||
if (ed == null) {
|
||||
throw new DefinitionException("The discriminator path '"+path+"' could not be resolved by the PEBuilder");
|
||||
|
@ -637,13 +634,26 @@ public class PEBuilder {
|
|||
}
|
||||
|
||||
private ElementDefinition getChildElement(StructureDefinition profile, ElementDefinition definition, String path) {
|
||||
List<ElementDefinition> elements = pu.getChildList(profile, definition);
|
||||
if (elements.size() == 0) {
|
||||
profile = definition.getTypeFirstRep().hasProfile() ? context.fetchResource(StructureDefinition.class, definition.getTypeFirstRep().getProfile().get(0).asStringValue()) :
|
||||
context.fetchTypeDefinition(definition.getTypeFirstRep().getWorkingCode());
|
||||
elements = pu.getChildList(profile, profile.getSnapshot().getElementFirstRep());
|
||||
}
|
||||
return getByName(elements, path);
|
||||
String head = path.contains(".") ? path.substring(0, path.indexOf(".")) : path;
|
||||
String tail = path.contains(".") ? path.substring(path.indexOf(".")+1) : null;
|
||||
ElementDefinition focus = definition;
|
||||
|
||||
do {
|
||||
List<ElementDefinition> elements = pu.getChildList(profile, focus);
|
||||
if (elements.size() == 0) {
|
||||
profile = focus.getTypeFirstRep().hasProfile() ? context.fetchResource(StructureDefinition.class, focus.getTypeFirstRep().getProfile().get(0).asStringValue()) :
|
||||
context.fetchTypeDefinition(focus.getTypeFirstRep().getWorkingCode());
|
||||
elements = pu.getChildList(profile, profile.getSnapshot().getElementFirstRep());
|
||||
}
|
||||
focus = getByName(elements, head);
|
||||
if (tail != null) {
|
||||
head = tail.contains(".") ? tail.substring(0, tail.indexOf(".")) : tail;
|
||||
tail = tail.contains(".") ? tail.substring(tail.indexOf(".")+1) : null;
|
||||
} else {
|
||||
head = null;
|
||||
}
|
||||
} while (head != null && focus != null);
|
||||
return focus;
|
||||
}
|
||||
|
||||
public List<Base> exec(Resource resource, Base data, String fhirpath) {
|
||||
|
|
|
@ -119,9 +119,9 @@ public class PECodeGenerator {
|
|||
public void genId() {
|
||||
if (isResource) {
|
||||
genField(true, "id", "String", "id", "", false, "", 0, 1, null);
|
||||
genAccessors(true, false, "id", "String", "", "String", "String", "Id", "Ids", false, "", false, false, null);
|
||||
genLoad(true, false, "id", "id", "IdType", "", "String", "String", "Id", "Ids", false, false, null, false);
|
||||
genSave(true, false, "id", "id", "IdType", "", "String", "String", "Id", "Ids", false, false, false, null, false);
|
||||
genAccessors(true, false, "id", "id", "String", "", "String", "String", "Id", "Ids", false, "", false, false, null);
|
||||
genLoad(true, false, "id", "id", "id", "IdType", "", "String", "String", "Id", "Ids", false, false, null, false);
|
||||
genSave(true, false, "id", "id", "id", "IdType", "", "String", "String", "Id", "Ids", false, false, false, null, false);
|
||||
genClear(false, "id", "String");
|
||||
}
|
||||
}
|
||||
|
@ -382,9 +382,9 @@ public class PECodeGenerator {
|
|||
if (isPrim && field.hasFixedValue()) {
|
||||
genFixed(name, ptype, field.getFixedValue());
|
||||
}
|
||||
genAccessors(isPrim, isAbstract, name, type, init, ptype, ltype, cname, csname, field.isList(), field.documentation(), field.hasFixedValue(), isEnum, field.definition());
|
||||
genLoad(isPrim, isAbstract, name, sname, type, init, ptype, ltype, cname, csname, field.isList(), field.hasFixedValue(), field.types().get(0), isEnum);
|
||||
genSave(isPrim, isAbstract, name, sname, type, init, ptype, ltype, cname, csname, field.isList(), field.hasFixedValue(), isExtension, field.types().get(0), isEnum);
|
||||
genAccessors(isPrim, isAbstract, name, field.name(), type, init, ptype, ltype, cname, csname, field.isList(), field.documentation(), field.hasFixedValue(), isEnum, field.definition());
|
||||
genLoad(isPrim, isAbstract, name, sname, field.name(), type, init, ptype, ltype, cname, csname, field.isList(), field.hasFixedValue(), field.types().get(0), isEnum);
|
||||
genSave(isPrim, isAbstract, name, sname, field.name(), type, init, ptype, ltype, cname, csname, field.isList(), field.hasFixedValue(), isExtension, field.types().get(0), isEnum);
|
||||
genClear(field.isList(), name, ptype);
|
||||
}
|
||||
} else {
|
||||
|
@ -404,9 +404,9 @@ public class PECodeGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
private void genLoad(boolean isPrim, boolean isAbstract, String name, String sname, String type, String init, String ptype, String ltype, String cname, String csname, boolean isList, boolean isFixed, PEType typeInfo, boolean isEnum) {
|
||||
private void genLoad(boolean isPrim, boolean isAbstract, String name, String sname, String fname, String type, String init, String ptype, String ltype, String cname, String csname, boolean isList, boolean isFixed, PEType typeInfo, boolean isEnum) {
|
||||
if (isList) {
|
||||
w(load, " for (PEInstance item : src.children(\""+sname+"\")) {");
|
||||
w(load, " for (PEInstance item : src.children(\""+fname+"\")) {");
|
||||
if ("BackboneElement".equals(type)) {
|
||||
w(load, " "+name+".add(("+type+") item.asElement());");
|
||||
} else {
|
||||
|
@ -414,59 +414,59 @@ public class PECodeGenerator {
|
|||
}
|
||||
w(load, " }");
|
||||
} else if (isEnum) {
|
||||
w(load, " if (src.hasChild(\""+name+"\")) {");
|
||||
w(load, " if (src.hasChild(\""+fname+"\")) {");
|
||||
if ("CodeableConcept".equals(typeInfo.getName())) {
|
||||
w(load, " "+name+" = "+type+".fromCodeableConcept((CodeableConcept) src.child(\""+name+"\").asDataType());");
|
||||
w(load, " "+name+" = "+type+".fromCodeableConcept((CodeableConcept) src.child(\""+fname+"\").asDataType());");
|
||||
} else if ("Coding".equals(typeInfo.getName())) {
|
||||
w(load, " "+name+" = "+type+".fromCoding((Coding) src.child(\""+name+"\").asDataType());");
|
||||
w(load, " "+name+" = "+type+".fromCoding((Coding) src.child(\""+fname+"\").asDataType());");
|
||||
} else {
|
||||
w(load, " "+name+" = "+type+".fromCode(src.child(\""+name+"\").asDataType().primitiveValue());");
|
||||
w(load, " "+name+" = "+type+".fromCode(src.child(\""+fname+"\").asDataType().primitiveValue());");
|
||||
}
|
||||
w(load, " }");
|
||||
} else if (isPrim) {
|
||||
w(load, " if (src.hasChild(\""+name+"\")) {");
|
||||
w(load, " if (src.hasChild(\""+fname+"\")) {");
|
||||
if ("CodeType".equals(type)) {
|
||||
// might be code or enum
|
||||
w(load, " "+name+" = src.child(\""+name+"\").asDataType().primitiveValue();");
|
||||
w(load, " "+name+" = src.child(\""+fname+"\").asDataType().primitiveValue();");
|
||||
} else {
|
||||
w(load, " "+name+" = (("+type+") src.child(\""+name+"\").asDataType()).getValue();");
|
||||
w(load, " "+name+" = (("+type+") src.child(\""+fname+"\").asDataType()).getValue();");
|
||||
}
|
||||
w(load, " }");
|
||||
} else if (typeInfo != null && typeInfo.getUrl() != null && !typeInfo.getUrl().startsWith("http://hl7.org/fhir/StructureDefinition")) {
|
||||
w(load, " if (src.hasChild(\""+name+"\")) {");
|
||||
w(load, " "+name+" = "+type+".fromSource(src.child(\""+name+"\"));");
|
||||
w(load, " if (src.hasChild(\""+fname+"\")) {");
|
||||
w(load, " "+name+" = "+type+".fromSource(src.child(\""+fname+"\"));");
|
||||
w(load, " }");
|
||||
} else {
|
||||
w(load, " if (src.hasChild(\""+name+"\")) {");
|
||||
w(load, " if (src.hasChild(\""+fname+"\")) {");
|
||||
if ("BackboneElement".equals(type)) {
|
||||
w(load, " "+name+" = ("+type+") src.child(\""+name+"\").asElement();");
|
||||
w(load, " "+name+" = ("+type+") src.child(\""+fname+"\").asElement();");
|
||||
} else if (Utilities.existsInList(type, workerContext.getResourceNames())) {
|
||||
w(load, " "+name+" = ("+type+") src.child(\""+name+"\").asResource();");
|
||||
w(load, " "+name+" = ("+type+") src.child(\""+fname+"\").asResource();");
|
||||
} else {
|
||||
w(load, " "+name+" = ("+type+") src.child(\""+name+"\").asDataType();");
|
||||
w(load, " "+name+" = ("+type+") src.child(\""+fname+"\").asDataType();");
|
||||
}
|
||||
w(load, " }");
|
||||
}
|
||||
}
|
||||
|
||||
private void genSave(boolean isPrim, boolean isAbstract, String name, String sname, String type, String init, String ptype, String ltype, String cname, String csname, boolean isList, boolean isFixed, boolean isExtension, PEType typeInfo, boolean isEnum) {
|
||||
w(save, " tgt.clear(\""+sname+"\");");
|
||||
private void genSave(boolean isPrim, boolean isAbstract, String name, String sname, String fname, String type, String init, String ptype, String ltype, String cname, String csname, boolean isList, boolean isFixed, boolean isExtension, PEType typeInfo, boolean isEnum) {
|
||||
w(save, " tgt.clear(\""+fname+"\");");
|
||||
if (isList) {
|
||||
w(save, " for ("+type+" item : "+name+") {");
|
||||
if (isExtension) {
|
||||
w(save, " tgt.makeChild(\""+sname+"\").data().setProperty(\"value[x]\", item);");
|
||||
w(save, " tgt.makeChild(\""+fname+"\").data().setProperty(\"value[x]\", item);");
|
||||
} else {
|
||||
w(save, " tgt.addChild(\""+sname+"\", item);");
|
||||
w(save, " tgt.addChild(\""+fname+"\", item);");
|
||||
}
|
||||
w(save, " }");
|
||||
} else if (isEnum) {
|
||||
w(save, " if ("+name+" != null) {");
|
||||
if ("CodeableConcept".equals(typeInfo.getName())) {
|
||||
w(save, " tgt.addChild(\""+sname+"\", "+name+".toCodeableConcept());");
|
||||
w(save, " tgt.addChild(\""+fname+"\", "+name+".toCodeableConcept());");
|
||||
} else if ("Coding".equals(typeInfo.getName())) {
|
||||
w(save, " tgt.addChild(\""+sname+"\", "+name+".toCoding());");
|
||||
w(save, " tgt.addChild(\""+fname+"\", "+name+".toCoding());");
|
||||
} else {
|
||||
w(save, " tgt.addChild(\""+sname+"\", "+name+".toCode());");
|
||||
w(save, " tgt.addChild(\""+fname+"\", "+name+".toCode());");
|
||||
}
|
||||
w(save, " }");
|
||||
} else if (isPrim) {
|
||||
|
@ -478,29 +478,29 @@ public class PECodeGenerator {
|
|||
w(save, " if ("+name+" != null) {");
|
||||
}
|
||||
if (isExtension) {
|
||||
w(save, " tgt.makeChild(\""+sname+"\").data().setProperty(\"value[x]\", new "+type+"("+name+"));");
|
||||
w(save, " tgt.makeChild(\""+fname+"\").data().setProperty(\"value[x]\", new "+type+"("+name+"));");
|
||||
} else if (Utilities.existsInList(type, "DateType", "InstantType", "DateTimeType")) {
|
||||
w(save, " tgt.addChild(\""+sname+"\", new "+type+"("+name+"));");
|
||||
w(save, " tgt.addChild(\""+fname+"\", new "+type+"("+name+"));");
|
||||
} else {
|
||||
w(save, " tgt.makeChild(\""+sname+"\").data().setProperty(\"value\", new "+type+"("+name+"));");
|
||||
w(save, " tgt.makeChild(\""+fname+"\").data().setProperty(\"value\", new "+type+"("+name+"));");
|
||||
}
|
||||
w(save, " }");
|
||||
} else if (typeInfo != null && typeInfo.getUrl() != null && !typeInfo.getUrl().startsWith("http://hl7.org/fhir/StructureDefinition")) {
|
||||
w(save, " if ("+name+" != null) {");
|
||||
w(save, " "+name+".save(tgt.makeChild(\""+sname+"\"), nulls);");
|
||||
w(save, " "+name+".save(tgt.makeChild(\""+fname+"\"), nulls);");
|
||||
w(save, " }");
|
||||
} else if (isExtension) {
|
||||
w(save, " if ("+name+" != null) {");
|
||||
w(save, " tgt.makeChild(\""+sname+"\").data().setProperty(\"value[x]\", "+name+");");
|
||||
w(save, " tgt.makeChild(\""+fname+"\").data().setProperty(\"value[x]\", "+name+");");
|
||||
w(save, " }");
|
||||
} else {
|
||||
w(save, " if ("+name+" != null) {");
|
||||
w(save, " tgt.addChild(\""+sname+"\", "+name+");");
|
||||
w(save, " tgt.addChild(\""+fname+"\", "+name+");");
|
||||
w(save, " }");
|
||||
}
|
||||
}
|
||||
|
||||
private void genAccessors(boolean isPrim, boolean isAbstract, String name, String type, String init, String ptype, String ltype, String cname, String csname, boolean isList, String shortDoco, boolean isFixed, boolean isEnum, ElementDefinition ed) {
|
||||
private void genAccessors(boolean isPrim, boolean isAbstract, String name, String fname, String type, String init, String ptype, String ltype, String cname, String csname, boolean isList, String shortDoco, boolean isFixed, boolean isEnum, ElementDefinition ed) {
|
||||
if (ed != null) {
|
||||
jdoc(accessors, ed.getDefinition(), 2, true);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package org.hl7.fhir.r5.test.profiles;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.formats.JsonParser;
|
||||
import org.hl7.fhir.r5.model.MedicinalProductDefinition;
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
import org.hl7.fhir.r5.test.profiles.codegen.DkCoreDeCprIdentifier;
|
||||
import org.hl7.fhir.r5.test.profiles.codegen.DkCorePatient;
|
||||
import org.hl7.fhir.r5.test.profiles.codegen.MedicinalProductDefinitionUvEpi;
|
||||
import org.hl7.fhir.r5.test.utils.TestPackageLoader;
|
||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||
|
@ -46,6 +49,13 @@ public class PECodeGenTests {
|
|||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testConstruct1() throws IOException {
|
||||
load();
|
||||
var patient = new DkCorePatient(ctxt).setDEcpr(new DkCoreDeCprIdentifier().setSystem(DkCoreDeCprIdentifier.DkCoreDeCPRValueSet.URNOID122081761613).setValue(UUID.randomUUID().toString()));
|
||||
var pat = patient.build(ctxt);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProfile() throws IOException {
|
||||
load();
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* A medicinal product in the final form which is suitable for administering to a
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* An identifier - identifies some entity uniquely and unambiguously. Typically
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* Electronic Product Information Bundle Document. A container for the collection
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* An identifier - identifies some entity uniquely and unambiguously. Typically
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* A single issue - either an indication, contraindication, interaction or an
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* A single issue - either an indication, contraindication, interaction or an
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* A single issue - either an indication, contraindication, interaction or an
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* A single issue - either an indication, contraindication, interaction or an
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* A single issue - either an indication, contraindication, interaction or an
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* A set of healthcare-related information that is assembled together into a single
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* Extension for the last date a Condition-instance was confirmed valid in its
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* Measurements and simple assertions made about a patient, device or other
|
||||
|
@ -203,8 +203,8 @@ public class DkCoreBasicObservation extends PEGeneratedBase {
|
|||
for (PEInstance item : src.children("performer")) {
|
||||
performers.add((Reference) item.asDataType());
|
||||
}
|
||||
if (src.hasChild("value")) {
|
||||
value = (Quantity) src.child("value").asDataType();
|
||||
if (src.hasChild("value[x]")) {
|
||||
value = (Quantity) src.child("value[x]").asDataType();
|
||||
}
|
||||
if (src.hasChild("dataAbsentReason")) {
|
||||
dataAbsentReason = (CodeableConcept) src.child("dataAbsentReason").asDataType();
|
||||
|
@ -322,9 +322,9 @@ public class DkCoreBasicObservation extends PEGeneratedBase {
|
|||
for (Reference item : performers) {
|
||||
tgt.addChild("performer", item);
|
||||
}
|
||||
tgt.clear("value");
|
||||
tgt.clear("value[x]");
|
||||
if (value != null) {
|
||||
tgt.addChild("value", value);
|
||||
tgt.addChild("value[x]", value);
|
||||
}
|
||||
tgt.clear("dataAbsentReason");
|
||||
if (dataAbsentReason != null) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* A clinical condition, problem, diagnosis, or other event, situation, issue, or
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* An identifier - identifies some entity uniquely and unambiguously. Typically
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* An identifier - identifies some entity uniquely and unambiguously. Typically
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* Measurements and simple assertions made about a patient, device or other
|
||||
|
@ -195,8 +195,8 @@ public class DkCoreObservation extends PEGeneratedBase {
|
|||
for (PEInstance item : src.children("performer")) {
|
||||
performers.add((Reference) item.asDataType());
|
||||
}
|
||||
if (src.hasChild("value")) {
|
||||
value = (Quantity) src.child("value").asDataType();
|
||||
if (src.hasChild("value[x]")) {
|
||||
value = (Quantity) src.child("value[x]").asDataType();
|
||||
}
|
||||
if (src.hasChild("dataAbsentReason")) {
|
||||
dataAbsentReason = (CodeableConcept) src.child("dataAbsentReason").asDataType();
|
||||
|
@ -310,9 +310,9 @@ public class DkCoreObservation extends PEGeneratedBase {
|
|||
for (Reference item : performers) {
|
||||
tgt.addChild("performer", item);
|
||||
}
|
||||
tgt.clear("value");
|
||||
tgt.clear("value[x]");
|
||||
if (value != null) {
|
||||
tgt.addChild("value", value);
|
||||
tgt.addChild("value[x]", value);
|
||||
}
|
||||
tgt.clear("dataAbsentReason");
|
||||
if (dataAbsentReason != null) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* A formally or informally recognized grouping of people or organizations formed
|
||||
|
@ -153,20 +153,20 @@ public class DkCoreOrganization extends PEGeneratedBase {
|
|||
for (PEInstance item : src.children("identifier")) {
|
||||
identifiers.add((Identifier) item.asDataType());
|
||||
}
|
||||
if (src.hasChild("EANID")) {
|
||||
EANID = GLNIdentifier.fromSource(src.child("EANID"));
|
||||
if (src.hasChild("EAN-ID")) {
|
||||
EANID = GLNIdentifier.fromSource(src.child("EAN-ID"));
|
||||
}
|
||||
if (src.hasChild("SORID")) {
|
||||
SORID = SORIdentifier.fromSource(src.child("SORID"));
|
||||
if (src.hasChild("SOR-ID")) {
|
||||
SORID = SORIdentifier.fromSource(src.child("SOR-ID"));
|
||||
}
|
||||
if (src.hasChild("KOMBITORGID")) {
|
||||
KOMBITORGID = KombitOrgIdentifier.fromSource(src.child("KOMBITORGID"));
|
||||
if (src.hasChild("KOMBIT-ORG-ID")) {
|
||||
KOMBITORGID = KombitOrgIdentifier.fromSource(src.child("KOMBIT-ORG-ID"));
|
||||
}
|
||||
if (src.hasChild("Ydernummer")) {
|
||||
Ydernummer = (Identifier) src.child("Ydernummer").asDataType();
|
||||
}
|
||||
if (src.hasChild("CVRID")) {
|
||||
CVRID = CVRIdentifier.fromSource(src.child("CVRID"));
|
||||
if (src.hasChild("CVR-ID")) {
|
||||
CVRID = CVRIdentifier.fromSource(src.child("CVR-ID"));
|
||||
}
|
||||
if (src.hasChild("Kommunekode")) {
|
||||
Kommunekode = (Identifier) src.child("Kommunekode").asDataType();
|
||||
|
@ -248,25 +248,25 @@ public class DkCoreOrganization extends PEGeneratedBase {
|
|||
for (Identifier item : identifiers) {
|
||||
tgt.addChild("identifier", item);
|
||||
}
|
||||
tgt.clear("EANID");
|
||||
tgt.clear("EAN-ID");
|
||||
if (EANID != null) {
|
||||
EANID.save(tgt.makeChild("EANID"), nulls);
|
||||
EANID.save(tgt.makeChild("EAN-ID"), nulls);
|
||||
}
|
||||
tgt.clear("SORID");
|
||||
tgt.clear("SOR-ID");
|
||||
if (SORID != null) {
|
||||
SORID.save(tgt.makeChild("SORID"), nulls);
|
||||
SORID.save(tgt.makeChild("SOR-ID"), nulls);
|
||||
}
|
||||
tgt.clear("KOMBITORGID");
|
||||
tgt.clear("KOMBIT-ORG-ID");
|
||||
if (KOMBITORGID != null) {
|
||||
KOMBITORGID.save(tgt.makeChild("KOMBITORGID"), nulls);
|
||||
KOMBITORGID.save(tgt.makeChild("KOMBIT-ORG-ID"), nulls);
|
||||
}
|
||||
tgt.clear("Ydernummer");
|
||||
if (Ydernummer != null) {
|
||||
tgt.addChild("Ydernummer", Ydernummer);
|
||||
}
|
||||
tgt.clear("CVRID");
|
||||
tgt.clear("CVR-ID");
|
||||
if (CVRID != null) {
|
||||
CVRID.save(tgt.makeChild("CVRID"), nulls);
|
||||
CVRID.save(tgt.makeChild("CVR-ID"), nulls);
|
||||
}
|
||||
tgt.clear("Kommunekode");
|
||||
if (Kommunekode != null) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* Demographics and other administrative information about an individual or animal
|
||||
|
@ -150,11 +150,11 @@ public class DkCorePatient extends PEGeneratedBase {
|
|||
if (src.hasChild("cpr")) {
|
||||
cpr = DkCoreCprIdentifier.fromSource(src.child("cpr"));
|
||||
}
|
||||
if (src.hasChild("xEcpr")) {
|
||||
xEcpr = DkCoreXeCprIdentifier.fromSource(src.child("xEcpr"));
|
||||
if (src.hasChild("x-ecpr")) {
|
||||
xEcpr = DkCoreXeCprIdentifier.fromSource(src.child("x-ecpr"));
|
||||
}
|
||||
if (src.hasChild("dEcpr")) {
|
||||
dEcpr = DkCoreDeCprIdentifier.fromSource(src.child("dEcpr"));
|
||||
if (src.hasChild("d-ecpr")) {
|
||||
dEcpr = DkCoreDeCprIdentifier.fromSource(src.child("d-ecpr"));
|
||||
}
|
||||
if (src.hasChild("official")) {
|
||||
official = (HumanName) src.child("official").asDataType();
|
||||
|
@ -243,13 +243,13 @@ public class DkCorePatient extends PEGeneratedBase {
|
|||
if (cpr != null) {
|
||||
cpr.save(tgt.makeChild("cpr"), nulls);
|
||||
}
|
||||
tgt.clear("xEcpr");
|
||||
tgt.clear("x-ecpr");
|
||||
if (xEcpr != null) {
|
||||
xEcpr.save(tgt.makeChild("xEcpr"), nulls);
|
||||
xEcpr.save(tgt.makeChild("x-ecpr"), nulls);
|
||||
}
|
||||
tgt.clear("dEcpr");
|
||||
tgt.clear("d-ecpr");
|
||||
if (dEcpr != null) {
|
||||
dEcpr.save(tgt.makeChild("dEcpr"), nulls);
|
||||
dEcpr.save(tgt.makeChild("d-ecpr"), nulls);
|
||||
}
|
||||
tgt.clear("official");
|
||||
if (official != null) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* A person who is directly or indirectly involved in the provisioning of
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* Information about a person that is involved in the care for a patient, but who
|
||||
|
@ -135,11 +135,11 @@ public class DkCoreRelatedPerson extends PEGeneratedBase {
|
|||
if (src.hasChild("cpr")) {
|
||||
cpr = DkCoreCprIdentifier.fromSource(src.child("cpr"));
|
||||
}
|
||||
if (src.hasChild("xEcpr")) {
|
||||
xEcpr = DkCoreXeCprIdentifier.fromSource(src.child("xEcpr"));
|
||||
if (src.hasChild("x-ecpr")) {
|
||||
xEcpr = DkCoreXeCprIdentifier.fromSource(src.child("x-ecpr"));
|
||||
}
|
||||
if (src.hasChild("dEcpr")) {
|
||||
dEcpr = DkCoreDeCprIdentifier.fromSource(src.child("dEcpr"));
|
||||
if (src.hasChild("d-ecpr")) {
|
||||
dEcpr = DkCoreDeCprIdentifier.fromSource(src.child("d-ecpr"));
|
||||
}
|
||||
if (src.hasChild("patient")) {
|
||||
patient = (Reference) src.child("patient").asDataType();
|
||||
|
@ -216,13 +216,13 @@ public class DkCoreRelatedPerson extends PEGeneratedBase {
|
|||
if (cpr != null) {
|
||||
cpr.save(tgt.makeChild("cpr"), nulls);
|
||||
}
|
||||
tgt.clear("xEcpr");
|
||||
tgt.clear("x-ecpr");
|
||||
if (xEcpr != null) {
|
||||
xEcpr.save(tgt.makeChild("xEcpr"), nulls);
|
||||
xEcpr.save(tgt.makeChild("x-ecpr"), nulls);
|
||||
}
|
||||
tgt.clear("dEcpr");
|
||||
tgt.clear("d-ecpr");
|
||||
if (dEcpr != null) {
|
||||
dEcpr.save(tgt.makeChild("dEcpr"), nulls);
|
||||
dEcpr.save(tgt.makeChild("d-ecpr"), nulls);
|
||||
}
|
||||
tgt.clear("patient");
|
||||
if (patient != null) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* An identifier - identifies some entity uniquely and unambiguously. Typically
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* An identifier - identifies some entity uniquely and unambiguously. Typically
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* An ingredient of a manufactured item or pharmaceutical product.
|
||||
|
@ -201,7 +201,7 @@ public class IngredientUvEpi extends PEGeneratedBase {
|
|||
if (src.hasChild("status")) {
|
||||
status = PublicationStatus.fromCode(src.child("status").asDataType().primitiveValue());
|
||||
}
|
||||
for (PEInstance item : src.children("_for")) {
|
||||
for (PEInstance item : src.children("for")) {
|
||||
_fors.add((Reference) item.asDataType());
|
||||
}
|
||||
if (src.hasChild("role")) {
|
||||
|
@ -273,9 +273,9 @@ public class IngredientUvEpi extends PEGeneratedBase {
|
|||
if (status != null) {
|
||||
tgt.addChild("status", status.toCode());
|
||||
}
|
||||
tgt.clear("_for");
|
||||
tgt.clear("for");
|
||||
for (Reference item : _fors) {
|
||||
tgt.addChild("_for", item);
|
||||
tgt.addChild("for", item);
|
||||
}
|
||||
tgt.clear("role");
|
||||
if (role != null) {
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* An identifier - identifies some entity uniquely and unambiguously. Typically
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* The definition and characteristics of a medicinal manufactured item, such as a
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* A medicinal product, being a substance or combination of substances that is
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* Identifier holding the official identifier for a danish municipality
|
||||
|
@ -57,16 +57,16 @@ public class MunicipalityCodes extends PEGeneratedBase {
|
|||
|
||||
public void load(PEInstance src) {
|
||||
clear();
|
||||
if (src.hasChild("value")) {
|
||||
value = (CodeableConcept) src.child("value").asDataType();
|
||||
if (src.hasChild("value[x]")) {
|
||||
value = (CodeableConcept) src.child("value[x]").asDataType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void save(PEInstance tgt, boolean nulls) {
|
||||
tgt.clear("value");
|
||||
tgt.clear("value[x]");
|
||||
if (value != null) {
|
||||
tgt.addChild("value", value);
|
||||
tgt.addChild("value[x]", value);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* Extension for the date where a condition lost focus in a specific clinical
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* A formally or informally recognized grouping of people or organizations formed
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* A medically related item or items, in a container or package.
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* An identifier - identifies some entity uniquely and unambiguously. Typically
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* Identifier holding the official organization identifier for a danish region
|
||||
|
@ -57,16 +57,16 @@ public class RegionalSubDivisionCodes extends PEGeneratedBase {
|
|||
|
||||
public void load(PEInstance src) {
|
||||
clear();
|
||||
if (src.hasChild("value")) {
|
||||
value = (CodeableConcept) src.child("value").asDataType();
|
||||
if (src.hasChild("value[x]")) {
|
||||
value = (CodeableConcept) src.child("value[x]").asDataType();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void save(PEInstance tgt, boolean nulls) {
|
||||
tgt.clear("value");
|
||||
tgt.clear("value[x]");
|
||||
if (value != null) {
|
||||
tgt.addChild("value", value);
|
||||
tgt.addChild("value[x]", value);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* Regulatory approval, clearance or licencing related to a regulated product,
|
||||
|
@ -143,8 +143,8 @@ public class RegulatedAuthorizationUvEpi extends PEGeneratedBase {
|
|||
for (PEInstance item : src.children("attachedDocument")) {
|
||||
attachedDocuments.add((Reference) item.asDataType());
|
||||
}
|
||||
if (src.hasChild("_case")) {
|
||||
_case = (BackboneElement) src.child("_case").asElement();
|
||||
if (src.hasChild("case")) {
|
||||
_case = (BackboneElement) src.child("case").asElement();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -223,9 +223,9 @@ public class RegulatedAuthorizationUvEpi extends PEGeneratedBase {
|
|||
for (Reference item : attachedDocuments) {
|
||||
tgt.addChild("attachedDocument", item);
|
||||
}
|
||||
tgt.clear("_case");
|
||||
tgt.clear("case");
|
||||
if (_case != null) {
|
||||
tgt.addChild("_case", _case);
|
||||
tgt.addChild("case", _case);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* An identifier - identifies some entity uniquely and unambiguously. Typically
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.hl7.fhir.r5.profilemodel.gen.MustSupport;
|
|||
import org.hl7.fhir.r5.profilemodel.gen.Definition;
|
||||
|
||||
|
||||
// Generated by the HAPI Java Profile Generator, 2/11/24, 10:50 pm
|
||||
// Generated by the HAPI Java Profile Generator, 5/11/24, 6:00 pm
|
||||
|
||||
/**
|
||||
* The detailed description of a substance, typically at a level beyond what is
|
||||
|
|
Loading…
Reference in New Issue