map, String fn) throws FHIRFormatError, FileNotFoundException, IOException {
Bundle bundle = (Bundle) new XmlParser().parse(new FileInputStream(fn));
for (BundleEntryComponent be : bundle.getEntry()) {
@@ -213,9 +159,9 @@ public class SpecDifferenceEvaluator {
public void getDiffAsJson(JsonObject json, StructureDefinition rev) throws IOException {
this.linker = null;
- StructureDefinition orig = original.resources.get(checkRename(rev.getName()));
+ StructureDefinition orig = original.getResources().get(checkRename(rev.getName()));
if (orig == null)
- orig = original.types.get(checkRename(rev.getName()));
+ orig = original.getTypes().get(checkRename(rev.getName()));
JsonArray types = new JsonArray();
json.add("types", types);
types.add(new JsonPrimitive(rev.getName()));
@@ -228,12 +174,12 @@ public class SpecDifferenceEvaluator {
compareJson(type, orig, rev);
}
}
-
+
public void getDiffAsXml(Document doc, Element xml, StructureDefinition rev) throws IOException {
this.linker = null;
- StructureDefinition orig = original.resources.get(checkRename(rev.getName()));
+ StructureDefinition orig = original.getResources().get(checkRename(rev.getName()));
if (orig == null)
- orig = original.types.get(checkRename(rev.getName()));
+ orig = original.getTypes().get(checkRename(rev.getName()));
Element type = doc.createElement("type");
type.setAttribute("name", rev.getName());
xml.appendChild(type);
@@ -244,15 +190,15 @@ public class SpecDifferenceEvaluator {
compareXml(doc, type, orig, rev);
}
}
-
+
public void getDiffAsJson(JsonObject json) throws IOException {
this.linker = null;
JsonArray types = new JsonArray();
json.add("types", types);
-
- for (String s : sorted(revision.types.keySet())) {
- StructureDefinition orig = original.types.get(s);
- StructureDefinition rev = revision.types.get(s);
+
+ for (String s : sorted(revision.getTypes().keySet())) {
+ StructureDefinition orig = original.getTypes().get(s);
+ StructureDefinition rev = revision.getTypes().get(s);
types.add(new JsonPrimitive(rev.getName()));
JsonObject type = new JsonObject();
json.add(rev.getName(), type);
@@ -268,9 +214,9 @@ public class SpecDifferenceEvaluator {
compareJson(type, orig, rev);
}
}
- for (String s : sorted(original.types.keySet())) {
- StructureDefinition orig = original.types.get(s);
- StructureDefinition rev = revision.types.get(s);
+ for (String s : sorted(original.getTypes().keySet())) {
+ StructureDefinition orig = original.getTypes().get(s);
+ StructureDefinition rev = revision.getTypes().get(s);
if (rev == null) {
types.add(new JsonPrimitive(orig.getName()));
JsonObject type = new JsonObject();
@@ -278,10 +224,10 @@ public class SpecDifferenceEvaluator {
type.addProperty("status", "deleted");
}
}
-
- for (String s : sorted(revision.resources.keySet())) {
- StructureDefinition orig = original.resources.get(checkRename(s));
- StructureDefinition rev = revision.resources.get(s);
+
+ for (String s : sorted(revision.getResources().keySet())) {
+ StructureDefinition orig = original.getResources().get(checkRename(s));
+ StructureDefinition rev = revision.getResources().get(s);
types.add(new JsonPrimitive(rev.getName()));
JsonObject type = new JsonObject();
json.add(rev.getName(), type);
@@ -291,24 +237,24 @@ public class SpecDifferenceEvaluator {
compareJson(type, orig, rev);
}
}
- for (String s : sorted(original.resources.keySet())) {
- StructureDefinition orig = original.resources.get(s);
- StructureDefinition rev = revision.resources.get(s);
+ for (String s : sorted(original.getResources().keySet())) {
+ StructureDefinition orig = original.getResources().get(s);
+ StructureDefinition rev = revision.getResources().get(s);
if (rev == null) {
types.add(new JsonPrimitive(orig.getName()));
JsonObject type = new JsonObject();
json.add(orig.getName(), type);
type.addProperty("status", "deleted");
}
- }
+ }
}
-
+
public void getDiffAsXml(Document doc, Element xml) throws IOException {
this.linker = null;
-
- for (String s : sorted(revision.types.keySet())) {
- StructureDefinition orig = original.types.get(s);
- StructureDefinition rev = revision.types.get(s);
+
+ for (String s : sorted(revision.getTypes().keySet())) {
+ StructureDefinition orig = original.getTypes().get(s);
+ StructureDefinition rev = revision.getTypes().get(s);
Element type = doc.createElement("type");
type.setAttribute("name", rev.getName());
xml.appendChild(type);
@@ -324,9 +270,9 @@ public class SpecDifferenceEvaluator {
compareXml(doc, type, orig, rev);
}
}
- for (String s : sorted(original.types.keySet())) {
- StructureDefinition orig = original.types.get(s);
- StructureDefinition rev = revision.types.get(s);
+ for (String s : sorted(original.getTypes().keySet())) {
+ StructureDefinition orig = original.getTypes().get(s);
+ StructureDefinition rev = revision.getTypes().get(s);
if (rev == null) {
Element type = doc.createElement("type");
type.setAttribute("name", orig.getName());
@@ -334,10 +280,10 @@ public class SpecDifferenceEvaluator {
type.setAttribute("status", "deleted");
}
}
-
- for (String s : sorted(revision.resources.keySet())) {
- StructureDefinition orig = original.resources.get(checkRename(s));
- StructureDefinition rev = revision.resources.get(s);
+
+ for (String s : sorted(revision.getResources().keySet())) {
+ StructureDefinition orig = original.getResources().get(checkRename(s));
+ StructureDefinition rev = revision.getResources().get(s);
Element type = doc.createElement("type");
type.setAttribute("name", rev.getName());
xml.appendChild(type);
@@ -347,82 +293,82 @@ public class SpecDifferenceEvaluator {
compareXml(doc, type, orig, rev);
}
}
- for (String s : sorted(original.resources.keySet())) {
- StructureDefinition orig = original.resources.get(s);
- StructureDefinition rev = revision.resources.get(s);
+ for (String s : sorted(original.getResources().keySet())) {
+ StructureDefinition orig = original.getResources().get(s);
+ StructureDefinition rev = revision.getResources().get(s);
if (rev == null) {
Element type = doc.createElement("type");
type.setAttribute("name", orig.getName());
xml.appendChild(type);
type.setAttribute("status", "deleted");
}
- }
+ }
}
-
+
public String getDiffAsHtml(TypeLinkProvider linker, StructureDefinition rev) throws IOException {
this.linker = linker;
- StructureDefinition orig = original.resources.get(checkRename(rev.getName()));
+ StructureDefinition orig = original.getResources().get(checkRename(rev.getName()));
if (orig == null)
- orig = original.types.get(checkRename(rev.getName()));
+ orig = original.getTypes().get(checkRename(rev.getName()));
if (orig == null)
- return "This "+rev.getKind().toCode()+" did not exist in Release 2
";
+ return "This " + rev.getKind().toCode() + " did not exist in Release 2
";
else {
start();
compare(orig, rev);
- return new XhtmlComposer(false, true).compose(tbl)+"\r\nSee the Full Difference for further information
\r\n";
+ return new XhtmlComposer(false, true).compose(tbl) + "\r\nSee the Full Difference for further information
\r\n";
}
}
-
+
public String getDiffAsHtml(TypeLinkProvider linker) throws IOException {
this.linker = linker;
start();
-
+
header("Types");
- for (String s : sorted(revision.types.keySet())) {
- StructureDefinition orig = original.types.get(s);
- StructureDefinition rev = revision.types.get(s);
+ for (String s : sorted(revision.getTypes().keySet())) {
+ StructureDefinition orig = original.getTypes().get(s);
+ StructureDefinition rev = revision.getTypes().get(s);
if (orig == null) {
markNew(rev.getName(), true, false, false);
} else if (rev.getKind() == StructureDefinitionKind.PRIMITIVETYPE) {
markNoChanges(rev.getName(), true);
} else if (rev.hasDerivation() && orig.hasDerivation() && rev.getDerivation() != orig.getDerivation()) {
- markChanged(rev.getName(), "Changed from a "+orig.getDerivation().toCode()+" to a "+rev.getDerivation().toCode(), true);
+ markChanged(rev.getName(), "Changed from a " + orig.getDerivation().toCode() + " to a " + rev.getDerivation().toCode(), true);
} else {
compare(orig, rev);
}
}
- for (String s : sorted(original.types.keySet())) {
- StructureDefinition orig = original.types.get(s);
- StructureDefinition rev = revision.types.get(s);
+ for (String s : sorted(original.getTypes().keySet())) {
+ StructureDefinition orig = original.getTypes().get(s);
+ StructureDefinition rev = revision.getTypes().get(s);
if (rev == null)
markDeleted(orig.getName(), true);
}
-
+
header("Resources");
- for (String s : sorted(revision.resources.keySet())) {
- StructureDefinition orig = original.resources.get(checkRename(s));
- StructureDefinition rev = revision.resources.get(s);
+ for (String s : sorted(revision.getResources().keySet())) {
+ StructureDefinition orig = original.getResources().get(checkRename(s));
+ StructureDefinition rev = revision.getResources().get(s);
if (orig == null) {
markNew(rev.getName(), true, true, false);
} else {
compare(orig, rev);
}
}
- for (String s : sorted(original.resources.keySet())) {
- StructureDefinition orig = original.resources.get(s);
- StructureDefinition rev = revision.resources.get(s);
+ for (String s : sorted(original.getResources().keySet())) {
+ StructureDefinition orig = original.getResources().get(s);
+ StructureDefinition rev = revision.getResources().get(s);
if (rev == null)
markDeleted(orig.getName(), true);
}
-
+
return new XhtmlComposer(false, true).compose(tbl);
}
-
+
private Object checkRename(String s) {
if (renames.containsKey(s))
return renames.get(s);
- else
+ else
return s;
}
@@ -432,40 +378,41 @@ public class SpecDifferenceEvaluator {
Collections.sort(list);
return list;
}
+
private void header(String title) {
tbl.addTag("tr").setAttribute("class", "diff-title").addTag("td").setAttribute("colspan", "2").addText(title);
}
-
+
private void start() {
tbl = new XhtmlNode(NodeType.Element, "table");
tbl.setAttribute("class", "grid");
-
+
}
-
+
private void markNoChanges(String name, boolean item) {
XhtmlNode tr = tbl.addTag("tr").setAttribute("class", item ? "diff-item" : "diff-entry");
XhtmlNode left = tr.addTag("td").setAttribute("class", "diff-left");
XhtmlNode right = tr.addTag("td").setAttribute("class", "diff-right");
String link = linker == null ? null : linker.getLink(name);
- if (link!= null)
+ if (link != null)
left.addTag("a").setAttribute("href", link).addText(name);
else
left.addText(name);
right.span("opacity: 0.5", null).addText("(No Changes)");
}
-
+
private void markChanged(String name, String change, boolean item) {
XhtmlNode tr = tbl.addTag("tr").setAttribute("class", item ? "diff-item" : "diff-entry");
XhtmlNode left = tr.addTag("td").setAttribute("class", "diff-left");
XhtmlNode right = tr.addTag("td").setAttribute("class", "diff-right");
String link = linker == null ? null : linker.getLink(name);
- if (link!= null)
+ if (link != null)
left.addTag("a").setAttribute("href", link).addText(name);
else
left.addText(name);
right.ul().li().addText(change);
}
-
+
private void markDeleted(String name, boolean item) {
XhtmlNode tr = tbl.addTag("tr").setAttribute("class", item ? "diff-del-item" : "diff-del");
XhtmlNode left = tr.addTag("td").setAttribute("class", "diff-left");
@@ -473,20 +420,20 @@ public class SpecDifferenceEvaluator {
left.addText(name);
right.ul().li().addText("deleted");
}
-
+
private void markNew(String name, boolean item, boolean res, boolean mand) {
XhtmlNode tr = tbl.addTag("tr").setAttribute("class", item ? "diff-new-item" : "diff-new");
XhtmlNode left = tr.addTag("td").setAttribute("class", "diff-left");
XhtmlNode right = tr.addTag("td").setAttribute("class", "diff-right");
String link = linker == null ? null : linker.getLink(name);
- if (link!= null)
+ if (link != null)
left.addTag("a").setAttribute("href", link).addText(name);
else
left.addText(name);
if (!res && mand)
- right.ul().li().b().addText("Added Mandatory Element");
+ right.ul().li().b().addText("Added Mandatory Element");
else
- right.ul().li().addText(res ? "Added Resource" : !name.contains(".") ? "Added Type" : mand ? "Added Mandatory Element " : "Added Element" );
+ right.ul().li().addText(res ? "Added Resource" : !name.contains(".") ? "Added Type" : mand ? "Added Mandatory Element " : "Added Element");
}
private void compare(StructureDefinition orig, StructureDefinition rev) {
@@ -494,7 +441,7 @@ public class SpecDifferenceEvaluator {
XhtmlNode tr = tbl.addTag("tr").setAttribute("class", "diff-item");
XhtmlNode left = tr.addTag("td").setAttribute("class", "diff-left");
String link = linker == null ? null : linker.getLink(rev.getName());
- if (link!= null)
+ if (link != null)
left.addTag("a").setAttribute("href", link).addText(rev.getName());
else
left.addText(rev.getName());
@@ -504,9 +451,9 @@ public class SpecDifferenceEvaluator {
boolean changed = false;
if (!orig.getName().equals(rev.getName())) {
changed = true;
- right.ul().li().addText("Name Changed from "+orig.getName()+" to "+rev.getName());
+ right.ul().li().addText("Name Changed from " + orig.getName() + " to " + rev.getName());
}
- for (ElementDefinition ed : rev.getDifferential().getElement()) {
+ for (ElementDefinition ed : rev.getDifferential().getElement()) {
ElementDefinition oed = getMatchingElement(rev.getName(), orig.getDifferential().getElement(), ed);
if (oed != null) {
ed.setUserData("match", oed);
@@ -518,65 +465,64 @@ public class SpecDifferenceEvaluator {
ElementDefinition oed = (ElementDefinition) ed.getUserData("match");
if (oed == null) {
changed = true;
- markNew(ed.getPath(), false, false, ed.getMin() > 0);
- } else
+ markNew(ed.getPath(), false, false, ed.getMin() > 0);
+ } else
changed = compareElement(ed, oed) || changed;
}
-
+
List dels = new ArrayList();
-
+
for (ElementDefinition ed : orig.getDifferential().getElement()) {
if (ed.getUserData("match") == null) {
changed = true;
boolean marked = false;
for (String s : dels)
- if (ed.getPath().startsWith(s+"."))
+ if (ed.getPath().startsWith(s + "."))
marked = true;
if (!marked) {
dels.add(ed.getPath());
- markDeleted(ed.getPath(), false);
+ markDeleted(ed.getPath(), false);
}
}
}
if (!changed)
right.ul().li().addText("No Changes");
-
- for (ElementDefinition ed : rev.getDifferential().getElement())
+
+ for (ElementDefinition ed : rev.getDifferential().getElement())
ed.clearUserData("match");
- for (ElementDefinition ed : orig.getDifferential().getElement())
+ for (ElementDefinition ed : orig.getDifferential().getElement())
ed.clearUserData("match");
-
+
}
private ElementDefinition getMatchingElement(String tn, List list, ElementDefinition target) {
// now, look for matches by name (ignoring slicing for now)
String tp = mapPath(tn, target.getPath());
if (tp.endsWith("[x]"))
- tp = tp.substring(0, tp.length()-4);
+ tp = tp.substring(0, tp.length() - 4);
for (ElementDefinition ed : list) {
String p = ed.getPath();
if (p.endsWith("[x]"))
- p = p.substring(0, p.length()-4);
+ p = p.substring(0, p.length() - 4);
if (p.equals(tp))
return ed;
}
return null;
}
-
+
/**
* change from rev to original. TODO: make this a config file somewhere?
- *
+ *
* @param tn
- * @param name
* @return
*/
private String mapPath(String tn, String path) {
if (renames.containsKey(path))
return renames.get(path);
for (String r : renames.keySet()) {
- if (path.startsWith(r+"."))
- return renames.get(r)+"."+path.substring(r.length()+1);
+ if (path.startsWith(r + "."))
+ return renames.get(r) + "." + path.substring(r.length() + 1);
}
return path;
}
@@ -590,44 +536,43 @@ public class SpecDifferenceEvaluator {
boolean renamed = false;
if (!rn.equals(on) && rev.getPath().contains(".")) {
if (rp.equals(op))
- b.append("Renamed from "+on+" to " +rn);
+ b.append("Renamed from " + on + " to " + rn);
else
- b.append("Moved from "+orig.getPath()+" to " +rn);
+ b.append("Moved from " + orig.getPath() + " to " + rn);
renamed = true;
- }
- else if (!rev.getPath().equals(orig.getPath())) {
+ } else if (!rev.getPath().equals(orig.getPath())) {
if (!moveAlreadyNoted(rev.getPath(), orig.getPath())) {
noteMove(rev.getPath(), orig.getPath());
- b.append("Moved from "+head(orig.getPath())+" to " +head(rev.getPath()));
+ b.append("Moved from " + head(orig.getPath()) + " to " + head(rev.getPath()));
renamed = true;
}
}
-
+
if (rev.getMin() != orig.getMin())
- b.append("Min Cardinality changed from "+Integer.toString(orig.getMin())+" to " +Integer.toString(rev.getMin()));
+ b.append("Min Cardinality changed from " + Integer.toString(orig.getMin()) + " to " + Integer.toString(rev.getMin()));
if (!rev.getMax().equals(orig.getMax()))
- b.append("Max Cardinality changed from "+orig.getMax()+" to " +rev.getMax());
-
+ b.append("Max Cardinality changed from " + orig.getMax() + " to " + rev.getMax());
+
analyseTypes(b, rev, orig);
-
- if (hasBindingToNote(rev) || hasBindingToNote(orig)) {
+
+ if (hasBindingToNote(rev) || hasBindingToNote(orig)) {
String s = compareBindings(rev, orig);
if (!Utilities.noString(s))
b.append(s);
}
-
+
if (rev.hasDefaultValue() || orig.hasDefaultValue()) {
- if (!rev.hasDefaultValue())
- b.append("Default Value "+describeValue(orig.getDefaultValue())+" removed");
+ if (!rev.hasDefaultValue())
+ b.append("Default Value " + describeValue(orig.getDefaultValue()) + " removed");
else if (!orig.hasDefaultValue())
- b.append("Default Value "+describeValue(rev.getDefaultValue())+" added");
- else {
+ b.append("Default Value " + describeValue(rev.getDefaultValue()) + " added");
+ else {
// do not use Base.compare here, because it is subject to type differences
String s1 = describeValue(orig.getDefaultValue());
String s2 = describeValue(rev.getDefaultValue());
if (!s1.equals(s2))
- b.append("Default Value changed from "+s1+" to "+s2);
+ b.append("Default Value changed from " + s1 + " to " + s2);
}
}
@@ -646,7 +591,7 @@ public class SpecDifferenceEvaluator {
XhtmlNode ul = null;
for (String s : b.toString().split("\\r?\\n")) {
if (!Utilities.noString(s)) {
- if (ul == null)
+ if (ul == null)
ul = right.addTag("ul");
XhtmlNode li = ul.addTag("li").notPretty();
if (s.contains("`")) {
@@ -654,7 +599,7 @@ public class SpecDifferenceEvaluator {
boolean code = true;
li.addText(p[0]);
for (int i = 1; i < p.length; i++) {
- if (code)
+ if (code)
li.addTag("code").addText(p[i]);
else
li.addText(p[i]);
@@ -667,13 +612,13 @@ public class SpecDifferenceEvaluator {
}
return b.length() > 0;
}
-
+
private void noteMove(String revpath, String origpath) {
- moves.add(revpath+"="+origpath);
+ moves.add(revpath + "=" + origpath);
}
private boolean moveAlreadyNoted(String revpath, String origpath) {
- if (moves.contains(revpath+"="+origpath))
+ if (moves.contains(revpath + "=" + origpath))
return true;
if (!revpath.contains(".") || !origpath.contains("."))
return false;
@@ -683,16 +628,16 @@ public class SpecDifferenceEvaluator {
@SuppressWarnings("rawtypes")
private String describeValue(DataType v) {
if (v instanceof PrimitiveType) {
- return "\""+((PrimitiveType) v).asStringValue()+"\"";
+ return "\"" + ((PrimitiveType) v).asStringValue() + "\"";
}
return "{complex}";
}
private String compareBindings(ElementDefinition rev, ElementDefinition orig) {
if (!hasBindingToNote(rev)) {
- return "Remove Binding "+describeBinding(orig);
+ return "Remove Binding " + describeBinding(orig);
} else if (!hasBindingToNote(orig)) {
- return "Add Binding "+describeBinding(rev);
+ return "Add Binding " + describeBinding(rev);
} else {
return compareBindings(rev.getBinding(), orig.getBinding());
}
@@ -701,14 +646,14 @@ public class SpecDifferenceEvaluator {
private String compareBindings(ElementDefinitionBindingComponent rev, ElementDefinitionBindingComponent orig) {
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder("\r\n");
if (rev.getStrength() != orig.getStrength())
- b.append("Change binding strength from "+orig.getStrength().toCode()+" to "+rev.getStrength().toCode());
+ b.append("Change binding strength from " + orig.getStrength().toCode() + " to " + rev.getStrength().toCode());
if (!Base.compareDeep(rev.getValueSet(), orig.getValueSet(), false))
- b.append("Change value set from "+describeReference(orig.getValueSet())+" to "+describeReference(rev.getValueSet()));
+ b.append("Change value set from " + describeReference(orig.getValueSet()) + " to " + describeReference(rev.getValueSet()));
if (!maxValueSetsMatch(rev, orig))
- b.append("Change max value set from "+describeMax(orig)+" to "+describeMax(rev));
+ b.append("Change max value set from " + describeMax(orig) + " to " + describeMax(rev));
if (rev.getStrength() == BindingStrength.REQUIRED && orig.getStrength() == BindingStrength.REQUIRED) {
- ValueSet vrev = getValueSet(rev.getValueSet(), revision.expansions);
- ValueSet vorig = getValueSet(rev.getValueSet(), original.expansions);
+ ValueSet vrev = getValueSet(rev.getValueSet(), revision.getExpansions());
+ ValueSet vorig = getValueSet(rev.getValueSet(), original.getExpansions());
CommaSeparatedStringBuilder br = new CommaSeparatedStringBuilder();
int ir = 0;
CommaSeparatedStringBuilder bo = new CommaSeparatedStringBuilder();
@@ -717,40 +662,40 @@ public class SpecDifferenceEvaluator {
for (ValueSetExpansionContainsComponent cc : vorig.getExpansion().getContains()) {
if (!hasCode(vrev, cc)) {
io++;
- bo.append("`"+Utilities.escapeXml(cc.getCode())+"`");
+ bo.append("`" + Utilities.escapeXml(cc.getCode()) + "`");
}
}
for (ValueSetExpansionContainsComponent cc : vrev.getExpansion().getContains()) {
if (!hasCode(vorig, cc)) {
ir++;
- br.append("`"+Utilities.escapeXml(cc.getCode())+"`");
+ br.append("`" + Utilities.escapeXml(cc.getCode()) + "`");
}
}
}
- if (io > 0)
- b.append("Remove "+Utilities.pluralize("Code", io)+" "+bo);
- if (ir > 0)
- b.append("Add "+Utilities.pluralize("Code", ir)+" "+br);
-
+ if (io > 0)
+ b.append("Remove " + Utilities.pluralize("Code", io) + " " + bo);
+ if (ir > 0)
+ b.append("Add " + Utilities.pluralize("Code", ir) + " " + br);
+
}
if (rev.getStrength() == BindingStrength.EXTENSIBLE && orig.getStrength() == BindingStrength.EXTENSIBLE) {
- ValueSet vrev = getValueSet(rev.getValueSet(), revision.valuesets);
- ValueSet vorig = getValueSet(orig.getValueSet(), original.valuesets);
+ ValueSet vrev = getValueSet(rev.getValueSet(), revision.getValuesets());
+ ValueSet vorig = getValueSet(orig.getValueSet(), original.getValuesets());
if (vrev != null && vrev.hasCompose() && vrev.getCompose().getInclude().size() == 1 && vrev.getCompose().getIncludeFirstRep().hasSystem() &&
- vorig != null && vorig.hasCompose() && vorig.getCompose().getInclude().size() == 1 && vorig.getCompose().getIncludeFirstRep().hasSystem()) {
+ vorig != null && vorig.hasCompose() && vorig.getCompose().getInclude().size() == 1 && vorig.getCompose().getIncludeFirstRep().hasSystem()) {
if (!vorig.getCompose().getIncludeFirstRep().getSystem().equals(vrev.getCompose().getIncludeFirstRep().getSystem())) {
- b.append("Change code system for extensibly bound codes from \""+vorig.getCompose().getIncludeFirstRep().getSystem()+"\" to \""+vrev.getCompose().getIncludeFirstRep().getSystem()+"\"");
+ b.append("Change code system for extensibly bound codes from \"" + vorig.getCompose().getIncludeFirstRep().getSystem() + "\" to \"" + vrev.getCompose().getIncludeFirstRep().getSystem() + "\"");
}
}
}
-
+
return b.toString();
}
-
+
private String describeMax(ElementDefinitionBindingComponent orig) {
if (!orig.hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
return "n/a";
- return "`"+ToolingExtensions.readStringExtension(orig, ToolingExtensions.EXT_MAX_VALUESET)+"`";
+ return "`" + ToolingExtensions.readStringExtension(orig, ToolingExtensions.EXT_MAX_VALUESET) + "`";
}
private boolean maxValueSetsMatch(ElementDefinitionBindingComponent rev, ElementDefinitionBindingComponent orig) {
@@ -766,14 +711,14 @@ public class SpecDifferenceEvaluator {
private String describeBinding(ElementDefinition orig) {
if (orig.getBinding().hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
- return "`"+orig.getBinding().getValueSet()+"` ("+orig.getBinding().getStrength().toCode()+"), max =`"+ ToolingExtensions.readStringExtension(orig.getBinding(), ToolingExtensions.EXT_MAX_VALUESET)+"`";
+ return "`" + orig.getBinding().getValueSet() + "` (" + orig.getBinding().getStrength().toCode() + "), max =`" + ToolingExtensions.readStringExtension(orig.getBinding(), ToolingExtensions.EXT_MAX_VALUESET) + "`";
else
- return "`"+orig.getBinding().getValueSet()+"` ("+orig.getBinding().getStrength().toCode()+")";
+ return "`" + orig.getBinding().getValueSet() + "` (" + orig.getBinding().getStrength().toCode() + ")";
}
private void describeBinding(JsonObject element, String name, ElementDefinition orig) {
JsonObject binding = new JsonObject();
- element.add(name, binding);
+ element.add(name, binding);
binding.addProperty("reference", describeReference(orig.getBinding().getValueSet()));
binding.addProperty("strength", orig.getBinding().getStrength().toCode());
if (orig.getBinding().hasExtension(ToolingExtensions.EXT_MAX_VALUESET))
@@ -807,7 +752,7 @@ public class SpecDifferenceEvaluator {
return ve;
}
}
- }
+ }
return null;
}
@@ -824,32 +769,32 @@ public class SpecDifferenceEvaluator {
private boolean hasBindingToNote(ElementDefinition ed) {
return ed.hasBinding() &&
- (ed.getBinding().getStrength() == BindingStrength.EXTENSIBLE || ed.getBinding().getStrength() == BindingStrength.REQUIRED || ed.getBinding().hasExtension(ToolingExtensions.EXT_MAX_VALUESET)) &&
- ed.getBinding().hasValueSet();
+ (ed.getBinding().getStrength() == BindingStrength.EXTENSIBLE || ed.getBinding().getStrength() == BindingStrength.REQUIRED || ed.getBinding().hasExtension(ToolingExtensions.EXT_MAX_VALUESET)) &&
+ ed.getBinding().hasValueSet();
}
private String tail(String path) {
- return path.contains(".") ? path.substring(path.lastIndexOf(".")+1) : path;
+ return path.contains(".") ? path.substring(path.lastIndexOf(".") + 1) : path;
}
-
+
private String head(String path) {
return path.contains(".") ? path.substring(0, path.lastIndexOf(".")) : path;
}
-
+
private void analyseTypes(CommaSeparatedStringBuilder bp, ElementDefinition rev, ElementDefinition orig) {
if (rev.getType().size() == 1 && orig.getType().size() == 1) {
String r = describeType(rev.getType().get(0));
if (Utilities.noString(r) && Utilities.existsInList(rev.getId(), "Element.id"))
- r = "string";
+ r = "string";
if (Utilities.noString(r) && Utilities.existsInList(rev.getId(), "Extension.url"))
- r = "uri";
+ r = "uri";
String o = describeType(orig.getType().get(0));
if (r == null && o == null)
- System.out.println("null @ "+rev.getPath());
- if (r.contains("(") && o.contains("(") && r.startsWith(o.substring(0, o.indexOf("(")+1))) {
+ System.out.println("null @ " + rev.getPath());
+ if (r.contains("(") && o.contains("(") && r.startsWith(o.substring(0, o.indexOf("(") + 1))) {
compareParameters(bp, rev.getType().get(0), orig.getType().get(0));
} else if (!r.equals(o))
- bp.append("Type changed from "+o+" to "+r);
+ bp.append("Type changed from " + o + " to " + r);
} else {
CommaSeparatedStringBuilder removed = new CommaSeparatedStringBuilder();
CommaSeparatedStringBuilder added = new CommaSeparatedStringBuilder();
@@ -869,34 +814,34 @@ public class SpecDifferenceEvaluator {
}
}
if (added.length() > 0)
- bp.append("Add "+Utilities.pluralize("Type", added.count())+" "+added.toString());
+ bp.append("Add " + Utilities.pluralize("Type", added.count()) + " " + added.toString());
if (removed.length() > 0)
- bp.append("Remove "+Utilities.pluralize("Type", removed.count())+" "+removed.toString());
+ bp.append("Remove " + Utilities.pluralize("Type", removed.count()) + " " + removed.toString());
if (retargetted.length() > 0)
bp.append(retargetted.toString());
}
}
-
+
private void compareParameters(CommaSeparatedStringBuilder bp, TypeRefComponent tr, TypeRefComponent tm) {
List added = new ArrayList<>();
List removed = new ArrayList<>();
-
+
for (CanonicalType p : tr.getTargetProfile()) {
if (!hasParam(tm, p.asStringValue())) {
added.add(trimNS(p.asStringValue()));
}
}
-
+
for (CanonicalType p : tm.getTargetProfile()) {
if (!hasParam(tr, p.asStringValue())) {
removed.add(trimNS(p.asStringValue()));
}
}
-
+
if (!added.isEmpty())
- bp.append("Type " +tr.getWorkingCode()+": Added Target "+Utilities.pluralize("Type", added.size())+" "+csv(added));
+ bp.append("Type " + tr.getWorkingCode() + ": Added Target " + Utilities.pluralize("Type", added.size()) + " " + csv(added));
if (!removed.isEmpty())
- bp.append("Type " +tr.getWorkingCode()+": Removed Target "+Utilities.pluralize("Type", removed.size())+" "+csv(removed));
+ bp.append("Type " + tr.getWorkingCode() + ": Removed Target " + Utilities.pluralize("Type", removed.size()) + " " + csv(removed));
}
private String trimNS(String v) {
@@ -922,7 +867,7 @@ public class SpecDifferenceEvaluator {
private boolean isAbstractType(String code) {
return Utilities.existsInList(code, "Element", "BackboneElement");
}
-
+
private boolean hasType(List types, TypeRefComponent tr) {
for (TypeRefComponent t : types) {
if (t.getWorkingCode().equals(tr.getWorkingCode())) {
@@ -932,7 +877,7 @@ public class SpecDifferenceEvaluator {
}
return false;
}
-
+
private TypeRefComponent getType(List types, TypeRefComponent tr) {
for (TypeRefComponent t : types) {
if (t.getWorkingCode().equals(tr.getWorkingCode())) {
@@ -941,9 +886,9 @@ public class SpecDifferenceEvaluator {
}
return null;
}
-
+
private String describeType(TypeRefComponent tr) {
- if (!tr.hasProfile() && !tr.hasTargetProfile())
+ if (!tr.hasProfile() && !tr.hasTargetProfile())
return tr.getWorkingCode();
else if (Utilities.existsInList(tr.getWorkingCode(), "Reference", "canonical")) {
StringBuilder b = new StringBuilder(tr.getWorkingCode());
@@ -952,7 +897,7 @@ public class SpecDifferenceEvaluator {
for (UriType u : tr.getTargetProfile()) {
if (first)
first = false;
- else
+ else
b.append(" | ");
if (u.getValue().startsWith("http://hl7.org/fhir/StructureDefinition/"))
b.append(u.getValue().substring(40));
@@ -969,7 +914,7 @@ public class SpecDifferenceEvaluator {
for (UriType u : tr.getTargetProfile()) {
if (first)
first = false;
- else
+ else
b.append(" | ");
b.append(u.getValue());
}
@@ -980,17 +925,17 @@ public class SpecDifferenceEvaluator {
}
public void saveR4AsR5(ZipGenerator zip, FhirFormat fmt) throws IOException {
- for (StructureDefinition t : original.types.values())
+ for (StructureDefinition t : original.getTypes().values())
saveResource(zip, t, fmt);
- for (StructureDefinition t : original.resources.values())
+ for (StructureDefinition t : original.getResources().values())
saveResource(zip, t, fmt);
- for (StructureDefinition t : original.profiles.values())
+ for (StructureDefinition t : original.getProfiles().values())
saveResource(zip, t, fmt);
- for (StructureDefinition t : original.extensions.values())
+ for (StructureDefinition t : original.getExtensions().values())
saveResource(zip, t, fmt);
- for (ValueSet t : original.valuesets.values())
+ for (ValueSet t : original.getValuesets().values())
saveResource(zip, t, fmt);
- for (ValueSet t : original.expansions.values())
+ for (ValueSet t : original.getExpansions().values())
saveResource(zip, t, fmt);
}
@@ -1000,7 +945,7 @@ public class SpecDifferenceEvaluator {
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(bs, t);
else
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(bs, t);
- zip.addBytes(t.fhirType()+"-"+t.getId()+"."+fmt.getExtension(), bs.toByteArray(), true);
+ zip.addBytes(t.fhirType() + "-" + t.getId() + "." + fmt.getExtension(), bs.toByteArray(), true);
}
private void compareJson(JsonObject type, StructureDefinition orig, StructureDefinition rev) {
@@ -1011,7 +956,7 @@ public class SpecDifferenceEvaluator {
changed = true;
type.addProperty("old-name", orig.getName());
}
- for (ElementDefinition ed : rev.getDifferential().getElement()) {
+ for (ElementDefinition ed : rev.getDifferential().getElement()) {
ElementDefinition oed = getMatchingElement(rev.getName(), orig.getDifferential().getElement(), ed);
if (oed != null) {
ed.setUserData("match", oed);
@@ -1026,18 +971,18 @@ public class SpecDifferenceEvaluator {
JsonObject element = new JsonObject();
elements.add(ed.getPath(), element);
element.addProperty("status", "new");
- } else
+ } else
changed = compareElementJson(elements, ed, oed) || changed;
}
-
+
List dels = new ArrayList();
-
+
for (ElementDefinition ed : orig.getDifferential().getElement()) {
if (ed.getUserData("match") == null) {
changed = true;
boolean marked = false;
for (String s : dels)
- if (ed.getPath().startsWith(s+"."))
+ if (ed.getPath().startsWith(s + "."))
marked = true;
if (!marked) {
dels.add(ed.getPath());
@@ -1050,17 +995,17 @@ public class SpecDifferenceEvaluator {
if (elements.entrySet().size() > 0)
type.add("elements", elements);
-
+
if (changed)
type.addProperty("status", "changed");
else
type.addProperty("status", "no-change");
-
- for (ElementDefinition ed : rev.getDifferential().getElement())
+
+ for (ElementDefinition ed : rev.getDifferential().getElement())
ed.clearUserData("match");
- for (ElementDefinition ed : orig.getDifferential().getElement())
+ for (ElementDefinition ed : orig.getDifferential().getElement())
ed.clearUserData("match");
-
+
}
private void compareXml(Document doc, Element type, StructureDefinition orig, StructureDefinition rev) {
@@ -1070,7 +1015,7 @@ public class SpecDifferenceEvaluator {
changed = true;
type.setAttribute("old-name", orig.getName());
}
- for (ElementDefinition ed : rev.getDifferential().getElement()) {
+ for (ElementDefinition ed : rev.getDifferential().getElement()) {
ElementDefinition oed = getMatchingElement(rev.getName(), orig.getDifferential().getElement(), ed);
if (oed != null) {
ed.setUserData("match", oed);
@@ -1086,18 +1031,18 @@ public class SpecDifferenceEvaluator {
element.setAttribute("path", ed.getPath());
type.appendChild(element);
element.setAttribute("status", "new");
- } else
+ } else
changed = compareElementXml(doc, type, ed, oed) || changed;
}
-
+
List dels = new ArrayList();
-
+
for (ElementDefinition ed : orig.getDifferential().getElement()) {
if (ed.getUserData("match") == null) {
changed = true;
boolean marked = false;
for (String s : dels)
- if (ed.getPath().startsWith(s+"."))
+ if (ed.getPath().startsWith(s + "."))
marked = true;
if (!marked) {
dels.add(ed.getPath());
@@ -1108,28 +1053,28 @@ public class SpecDifferenceEvaluator {
}
}
}
-
+
if (changed)
type.setAttribute("status", "changed");
else
type.setAttribute("status", "no-change");
-
- for (ElementDefinition ed : rev.getDifferential().getElement())
+
+ for (ElementDefinition ed : rev.getDifferential().getElement())
ed.clearUserData("match");
- for (ElementDefinition ed : orig.getDifferential().getElement())
+ for (ElementDefinition ed : orig.getDifferential().getElement())
ed.clearUserData("match");
-
+
}
private boolean compareElementJson(JsonObject elements, ElementDefinition rev, ElementDefinition orig) {
JsonObject element = new JsonObject();
-
+
String rn = tail(rev.getPath());
String on = tail(orig.getPath());
-
+
if (!rn.equals(on) && rev.getPath().contains("."))
element.addProperty("old-name", on);
-
+
if (rev.getMin() != orig.getMin()) {
element.addProperty("old-min", orig.getMin());
element.addProperty("new-min", rev.getMin());
@@ -1139,20 +1084,20 @@ public class SpecDifferenceEvaluator {
element.addProperty("old-max", orig.getMax());
element.addProperty("new-max", rev.getMax());
}
-
+
analyseTypes(element, rev, orig);
-
- if (hasBindingToNote(rev) || hasBindingToNote(orig)) {
+
+ if (hasBindingToNote(rev) || hasBindingToNote(orig)) {
compareBindings(element, rev, orig);
}
-
+
if (rev.hasDefaultValue() || orig.hasDefaultValue()) {
boolean changed = true;
- if (!rev.hasDefaultValue())
+ if (!rev.hasDefaultValue())
element.addProperty("default", "removed");
else if (!orig.hasDefaultValue())
element.addProperty("default", "added");
- else {
+ else {
String s1 = describeValue(orig.getDefaultValue());
String s2 = describeValue(rev.getDefaultValue());
if (!s1.equals(s2))
@@ -1182,16 +1127,16 @@ public class SpecDifferenceEvaluator {
return true;
}
}
-
+
private boolean compareElementXml(Document doc, Element type, ElementDefinition rev, ElementDefinition orig) {
Element element = doc.createElement("element");
-
+
String rn = tail(rev.getPath());
String on = tail(orig.getPath());
-
+
if (!rn.equals(on) && rev.getPath().contains("."))
element.setAttribute("old-name", on);
-
+
if (rev.getMin() != orig.getMin()) {
element.setAttribute("old-min", Integer.toString(orig.getMin()));
element.setAttribute("new-min", Integer.toString(rev.getMin()));
@@ -1201,20 +1146,20 @@ public class SpecDifferenceEvaluator {
element.setAttribute("old-max", orig.getMax());
element.setAttribute("new-max", rev.getMax());
}
-
+
analyseTypes(doc, element, rev, orig);
-
- if (hasBindingToNote(rev) || hasBindingToNote(orig)) {
+
+ if (hasBindingToNote(rev) || hasBindingToNote(orig)) {
compareBindings(doc, element, rev, orig);
}
-
+
if (rev.hasDefaultValue() || orig.hasDefaultValue()) {
boolean changed = true;
- if (!rev.hasDefaultValue())
+ if (!rev.hasDefaultValue())
element.setAttribute("default", "removed");
else if (!orig.hasDefaultValue())
element.setAttribute("default", "added");
- else {
+ else {
String s1 = describeValue(orig.getDefaultValue());
String s2 = describeValue(rev.getDefaultValue());
if (!s1.equals(s2))
@@ -1245,7 +1190,7 @@ public class SpecDifferenceEvaluator {
return true;
}
}
-
+
private void analyseTypes(JsonObject element, ElementDefinition rev, ElementDefinition orig) {
JsonArray oa = new JsonArray();
JsonArray ra = new JsonArray();
@@ -1253,10 +1198,10 @@ public class SpecDifferenceEvaluator {
if (rev.getType().size() == 1 && orig.getType().size() == 1) {
String r = describeType(rev.getType().get(0));
if (Utilities.noString(r) && Utilities.existsInList(rev.getId(), "Element.id", "Extension.url"))
- r = "string";
+ r = "string";
String o = describeType(orig.getType().get(0));
if (Utilities.noString(o) && Utilities.existsInList(orig.getId(), "Element.id", "Extension.url"))
- o = "string";
+ o = "string";
if (!o.equals(r)) {
oa.add(new JsonPrimitive(o));
ra.add(new JsonPrimitive(r));
@@ -1283,37 +1228,37 @@ public class SpecDifferenceEvaluator {
if (ra.size() > 0)
element.add("added-types", ra);
}
-
+
private void compareParameters(JsonObject element, TypeRefComponent tr, TypeRefComponent tm) {
JsonArray added = new JsonArray();
JsonArray removed = new JsonArray();
-
+
for (CanonicalType p : tr.getTargetProfile()) {
if (!hasParam(tm, p.asStringValue())) {
added.add(new JsonPrimitive(p.asStringValue()));
}
}
-
+
for (CanonicalType p : tm.getTargetProfile()) {
if (!hasParam(tr, p.asStringValue())) {
removed.add(new JsonPrimitive(p.asStringValue()));
}
}
-
+
if (added.size() > 0)
- element.add(tr.getWorkingCode()+"-target-added", added);
+ element.add(tr.getWorkingCode() + "-target-added", added);
if (removed.size() > 0)
- element.add(tr.getWorkingCode()+"-target-removed", removed);
+ element.add(tr.getWorkingCode() + "-target-removed", removed);
}
-
+
private void analyseTypes(Document doc, Element element, ElementDefinition rev, ElementDefinition orig) {
if (rev.getType().size() == 1 && orig.getType().size() == 1) {
String r = describeType(rev.getType().get(0));
if (Utilities.noString(r) && Utilities.existsInList(rev.getId(), "Element.id", "Extension.url"))
- r = "string";
+ r = "string";
String o = describeType(orig.getType().get(0));
if (Utilities.noString(o) && Utilities.existsInList(orig.getId(), "Element.id", "Extension.url"))
- o = "string";
+ o = "string";
if (!o.equals(r)) {
element.appendChild(makeElementWithAttribute(doc, "removed-type", "name", o));
element.appendChild(makeElementWithAttribute(doc, "added-type", "name", r));
@@ -1335,22 +1280,22 @@ public class SpecDifferenceEvaluator {
}
}
}
-
+
private void compareParameters(Document doc, Element element, TypeRefComponent tr, TypeRefComponent tm) {
-
+
for (CanonicalType p : tr.getTargetProfile()) {
if (!hasParam(tm, p.asStringValue())) {
- element.appendChild(makeElementWithAttribute(doc, tr.getWorkingCode()+"-target-added", "name", p.asStringValue()));
+ element.appendChild(makeElementWithAttribute(doc, tr.getWorkingCode() + "-target-added", "name", p.asStringValue()));
}
}
-
+
for (CanonicalType p : tm.getTargetProfile()) {
if (!hasParam(tr, p.asStringValue())) {
- element.appendChild(makeElementWithAttribute(doc, tr.getWorkingCode()+"-target-removed", "name", p.asStringValue()));
+ element.appendChild(makeElementWithAttribute(doc, tr.getWorkingCode() + "-target-removed", "name", p.asStringValue()));
}
- }
+ }
}
-
+
private Node makeElementWithAttribute(Document doc, String name, String aname, String content) {
Element e = doc.createElement(name);
e.setAttribute(aname, content);
@@ -1389,8 +1334,8 @@ public class SpecDifferenceEvaluator {
if (rev.getStrength() == BindingStrength.REQUIRED && orig.getStrength() == BindingStrength.REQUIRED) {
JsonArray oa = new JsonArray();
JsonArray ra = new JsonArray();
- ValueSet vrev = getValueSet(rev.getValueSet(), revision.expansions);
- ValueSet vorig = getValueSet(rev.getValueSet(), original.expansions);
+ ValueSet vrev = getValueSet(rev.getValueSet(), revision.getExpansions());
+ ValueSet vorig = getValueSet(rev.getValueSet(), original.getExpansions());
if (vrev != null && vorig != null) {
for (ValueSetExpansionContainsComponent cc : vorig.getExpansion().getContains()) {
if (!hasCode(vrev, cc))
@@ -1420,7 +1365,7 @@ public class SpecDifferenceEvaluator {
}
return false;
}
-
+
private void compareBindings(Document doc, Element element, ElementDefinition rev, ElementDefinition orig) {
if (!hasBindingToNote(rev)) {
element.setAttribute("binding-status", "removed");
@@ -1445,13 +1390,13 @@ public class SpecDifferenceEvaluator {
element.setAttribute("binding-valueset-changed", "true");
res = true;
}
- if (!maxValueSetsMatch(rev, orig)){
+ if (!maxValueSetsMatch(rev, orig)) {
element.setAttribute("max-valueset-changed", "true");
res = true;
}
if (rev.getStrength() == BindingStrength.REQUIRED && orig.getStrength() == BindingStrength.REQUIRED) {
- ValueSet vrev = getValueSet(rev.getValueSet(), revision.expansions);
- ValueSet vorig = getValueSet(rev.getValueSet(), original.expansions);
+ ValueSet vrev = getValueSet(rev.getValueSet(), revision.getExpansions());
+ ValueSet vorig = getValueSet(rev.getValueSet(), original.getExpansions());
boolean changed = false;
if (vrev != null && vorig != null) {
for (ValueSetExpansionContainsComponent cc : vorig.getExpansion().getContains()) {
@@ -1474,5 +1419,4 @@ public class SpecDifferenceEvaluator {
}
return res;
}
-
}
\ No newline at end of file
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConversionService.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConversionService.java
index 6e55637bf..07443ae8b 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConversionService.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConversionService.java
@@ -1,33 +1,33 @@
package org.hl7.fhir.convertors;
-/*
- Copyright (c) 2011+, HL7, Inc.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of HL7 nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
- */
+/*
+ Copyright (c) 2011+, HL7, Inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of HL7 nor the names of its contributors may be used to
+ endorse or promote products derived from this software without specific
+ prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+ */
@@ -235,7 +235,7 @@ public class VersionConversionService {
throw new FHIRException("Conversion from R3 to 2016May version is not supported for resources of type "+src.fhirType());
case R4:
if (useJava && VersionConvertor_30_40.convertsResource(src.fhirType()))
- return saveResource40(VersionConvertor_30_40.convertResource(src, false), dstFormat, style);
+ return saveResource40(VersionConvertor_30_40.convertResource(src), dstFormat, style);
else
throw new FHIRException("todo: use script based conversion....");
case STU3: return saveResource30(src, dstFormat, style);
@@ -259,7 +259,7 @@ public class VersionConversionService {
case R4: return saveResource40(src, dstFormat, style);
case STU3:
if (useJava && VersionConvertor_30_40.convertsResource(src.fhirType()))
- return saveResource30(VersionConvertor_30_40.convertResource(src, false), dstFormat, style);
+ return saveResource30(VersionConvertor_30_40.convertResource(src), dstFormat, style);
else
throw new FHIRException("todo: use script based conversion....");
default: throw new FHIRException("FHIR Version 'unknown' is not supported by the inter-version convertor");
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor30.java
deleted file mode 100644
index d43a785f1..000000000
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor30.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.hl7.fhir.convertors;
-
-/*
- Copyright (c) 2011+, HL7, Inc.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of HL7 nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
- */
-
-
-
-import org.hl7.fhir.exceptions.FHIRException;
-
-public interface VersionConvertorAdvisor30 {
- boolean ignoreEntry(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src);
-
- // called ?
- org.hl7.fhir.dstu2.model.Resource convert(org.hl7.fhir.dstu3.model.Resource resource) throws FHIRException;
-
- // called when an r2 value set has a codeSystem in it
- void handleCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem tgtcs, org.hl7.fhir.dstu3.model.ValueSet source) throws FHIRException;
-
- org.hl7.fhir.dstu3.model.CodeSystem getCodeSystem(org.hl7.fhir.dstu3.model.ValueSet src) throws FHIRException;
-}
\ No newline at end of file
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor40.java
deleted file mode 100644
index 0f6e2cae4..000000000
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor40.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.hl7.fhir.convertors;
-
-/*
- Copyright (c) 2011+, HL7, Inc.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of HL7 nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
- */
-
-
-
-import org.hl7.fhir.exceptions.FHIRException;
-
-public interface VersionConvertorAdvisor40 {
- boolean ignoreEntry(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src);
-
- // called ?
- org.hl7.fhir.dstu2.model.Resource convertR2(org.hl7.fhir.r4.model.Resource resource) throws FHIRException;
- org.hl7.fhir.dstu2016may.model.Resource convertR2016May(org.hl7.fhir.r4.model.Resource resource) throws FHIRException;
- org.hl7.fhir.dstu3.model.Resource convertR3(org.hl7.fhir.r4.model.Resource resource) throws FHIRException;
-
- // called when an r2 value set has a codeSystem in it
- void handleCodeSystem(org.hl7.fhir.r4.model.CodeSystem tgtcs, org.hl7.fhir.r4.model.ValueSet source) throws FHIRException;
-
- org.hl7.fhir.r4.model.CodeSystem getCodeSystem(org.hl7.fhir.r4.model.ValueSet src) throws FHIRException;
-}
\ No newline at end of file
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor50.java
deleted file mode 100644
index 0c697173a..000000000
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor50.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.hl7.fhir.convertors;
-
-/*
- Copyright (c) 2011+, HL7, Inc.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of HL7 nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
- */
-
-
-
-import org.hl7.fhir.exceptions.FHIRException;
-
-public interface VersionConvertorAdvisor50 {
- boolean ignoreEntry(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src);
-
- // called ?
- org.hl7.fhir.dstu2.model.Resource convertR2(org.hl7.fhir.r5.model.Resource resource) throws FHIRException;
- org.hl7.fhir.dstu2016may.model.Resource convertR2016May(org.hl7.fhir.r5.model.Resource resource) throws FHIRException;
- org.hl7.fhir.dstu3.model.Resource convertR3(org.hl7.fhir.r5.model.Resource resource) throws FHIRException;
- org.hl7.fhir.r4.model.Resource convertR4(org.hl7.fhir.r5.model.Resource resource) throws FHIRException;
-
- // called when an r2 value set has a codeSystem in it
- void handleCodeSystem(org.hl7.fhir.r5.model.CodeSystem tgtcs, org.hl7.fhir.r5.model.ValueSet source) throws FHIRException;
-
- org.hl7.fhir.r5.model.CodeSystem getCodeSystem(org.hl7.fhir.r5.model.ValueSet src) throws FHIRException;
-}
\ No newline at end of file
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorResourceNameMapper.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorResourceNameMapper.java
index 0971a78de..31f434984 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorResourceNameMapper.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertorResourceNameMapper.java
@@ -43,7 +43,7 @@ public class VersionConvertorResourceNameMapper {
case "DeviceComponent" : return null;
case "DeviceMetric" : return org.hl7.fhir.r5.model.DeviceMetric.class.getSimpleName();
case "DeviceRequest" : return org.hl7.fhir.r5.model.DeviceRequest.class.getSimpleName();
- case "DeviceUseStatement" : return org.hl7.fhir.r5.model.DeviceUseStatement.class.getSimpleName();
+ case "DeviceUseStatement" : return org.hl7.fhir.r5.model.DeviceUsage.class.getSimpleName();
case "DiagnosticReport" : return org.hl7.fhir.r5.model.DiagnosticReport.class.getSimpleName();
case "DocumentManifest" : return org.hl7.fhir.r5.model.DocumentManifest.class.getSimpleName();
case "DocumentReference" : return org.hl7.fhir.r5.model.DocumentReference.class.getSimpleName();
@@ -169,7 +169,7 @@ public class VersionConvertorResourceNameMapper {
case "DeviceDefinition" : return null;
case "DeviceMetric" : return org.hl7.fhir.dstu3.model.DeviceMetric.class.getSimpleName();
case "DeviceRequest" : return org.hl7.fhir.dstu3.model.DeviceRequest.class.getSimpleName();
- case "DeviceUseStatement" : return org.hl7.fhir.dstu3.model.DeviceUseStatement.class.getSimpleName();
+ case "DeviceUsage" : return org.hl7.fhir.dstu3.model.DeviceUseStatement.class.getSimpleName();
case "DiagnosticReport" : return org.hl7.fhir.dstu3.model.DiagnosticReport.class.getSimpleName();
case "DocumentManifest" : return org.hl7.fhir.dstu3.model.DocumentManifest.class.getSimpleName();
case "DocumentReference" : return org.hl7.fhir.dstu3.model.DocumentReference.class.getSimpleName();
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_30.java
index d169a697b..3060d1e03 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_30.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_30.java
@@ -1,5 +1,6 @@
package org.hl7.fhir.convertors;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_30;
import org.hl7.fhir.convertors.conv10_30.*;
import org.hl7.fhir.dstu2.model.CodeableConcept;
import org.hl7.fhir.dstu2.utils.ToolingExtensions;
@@ -7,7 +8,6 @@ import org.hl7.fhir.dstu3.conformance.ProfileUtilities;
import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent;
-import org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent;
import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent;
import org.hl7.fhir.dstu3.terminologies.CodeSystemUtilities;
import org.hl7.fhir.exceptions.FHIRException;
@@ -46,7 +46,7 @@ import java.util.stream.Collectors;
POSSIBILITY OF SUCH DAMAGE.
*/
-public class VersionConvertor_10_30 {
+public class VersionConvertor_10_30 extends VersionConvertor_Base {
public static void copyElement(org.hl7.fhir.dstu2.model.Element src, org.hl7.fhir.dstu3.model.Element tgt) throws FHIRException {
tgt.setId(src.getId());
for (org.hl7.fhir.dstu2.model.Extension e : src.getExtension()) {
@@ -2351,19 +2351,6 @@ public class VersionConvertor_10_30 {
return tgt;
}
- static public class SourceElementComponentWrapper {
- public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) {
- super();
- this.source = source;
- this.target = target;
- this.comp = comp;
- }
-
- public String source;
- public String target;
- public org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent comp;
- }
-
public static org.hl7.fhir.dstu3.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException {
org.hl7.fhir.dstu3.model.UsageContext result = new org.hl7.fhir.dstu3.model.UsageContext();
result.setValue(convertCodeableConcept(t));
@@ -2738,7 +2725,7 @@ public class VersionConvertor_10_30 {
return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem()));
}
- public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src, VersionConvertorAdvisor30 advisor) throws FHIRException {
+ public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src, BaseAdvisor_10_30 advisor) throws FHIRException {
if (src == null || src.isEmpty()) return null;
if (src instanceof org.hl7.fhir.dstu2.model.Parameters)
return Parameters10_30.convertParameters((org.hl7.fhir.dstu2.model.Parameters) src);
@@ -2889,7 +2876,7 @@ public class VersionConvertor_10_30 {
throw new FHIRException("Unknown resource " + src.fhirType());
}
- public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src, VersionConvertorAdvisor30 advisor) throws FHIRException {
+ public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src, BaseAdvisor_10_30 advisor) throws FHIRException {
if (src == null || src.isEmpty()) return null;
if (src instanceof org.hl7.fhir.dstu3.model.Parameters)
return Parameters10_30.convertParameters((org.hl7.fhir.dstu3.model.Parameters) src);
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java
index 2010fde30..c57d41949 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java
@@ -1,5 +1,6 @@
package org.hl7.fhir.convertors;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_40;
import org.hl7.fhir.convertors.conv10_40.*;
import org.hl7.fhir.dstu2.model.CodeableConcept;
import org.hl7.fhir.dstu2.model.Parameters;
@@ -9,20 +10,17 @@ import org.hl7.fhir.dstu2.model.Reference;
import org.hl7.fhir.dstu2.utils.ToolingExtensions;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.conformance.ProfileUtilities;
-import org.hl7.fhir.r4.model.CanonicalType;
-import org.hl7.fhir.r4.model.CodeSystem;
+import org.hl7.fhir.r4.model.*;
import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent;
-import org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent;
import org.hl7.fhir.r4.model.Dosage.DosageDoseAndRateComponent;
import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent;
import org.hl7.fhir.r4.model.Immunization.ImmunizationPerformerComponent;
-import org.hl7.fhir.r4.model.TerminologyCapabilities;
-import org.hl7.fhir.r4.model.UnsignedIntType;
import org.hl7.fhir.r4.terminologies.CodeSystemUtilities;
import org.hl7.fhir.utilities.Utilities;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@@ -55,7 +53,7 @@ import java.util.stream.Collectors;
POSSIBILITY OF SUCH DAMAGE.
*/
-public class VersionConvertor_10_40 {
+public class VersionConvertor_10_40 extends VersionConvertor_Base {
static public List CANONICAL_URLS = new ArrayList();
static {
@@ -2282,23 +2280,53 @@ public class VersionConvertor_10_40 {
}
public static void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException {
+ copyDomainResource(src, tgt, new BaseAdvisor_10_40(), extensionsToIgnore);
+ }
+
+ public static void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt, BaseAdvisor_10_40 advisor, String... extensionsToIgnore) throws FHIRException {
copyResource(src, tgt);
- tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.dstu2.model.Resource t : src.getContained()) tgt.addContained(convertResource(t));
- for (org.hl7.fhir.dstu2.model.Extension t : src.getExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addExtension(convertExtension(t));
- for (org.hl7.fhir.dstu2.model.Extension t : src.getModifierExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addModifierExtension(convertExtension(t));
+ if (src.hasText()) tgt.setText(convertNarrative(src.getText()));
+ src.getContained().stream()
+ .map(resource -> convertResource(resource, advisor))
+ .forEach(tgt::addContained);
+ src.getExtension().forEach(ext -> {
+ if (advisor.useAdvisorForExtension("", ext)) {//TODO add path
+ Extension convertExtension = new Extension();
+ advisor.handleExtension("", ext, convertExtension);//TODO add path
+ tgt.addExtension(convertExtension);
+ } else if (!advisor.ignoreExtension("", ext) && !Arrays.asList(extensionsToIgnore).contains(ext.getUrl())) {//TODO add path
+ tgt.addExtension(convertExtension(ext));
+ }
+ });
+ src.getModifierExtension().stream()
+ .filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
+ .map(VersionConvertor_10_40::convertExtension)
+ .forEach(tgt::addModifierExtension);
}
public static void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.dstu2.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException {
+ copyDomainResource(src, tgt, new BaseAdvisor_10_40(), extensionsToIgnore);
+ }
+
+ public static void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.dstu2.model.DomainResource tgt, BaseAdvisor_10_40 advisor, String... extensionsToIgnore) throws FHIRException {
copyResource(src, tgt);
- tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.r4.model.Resource t : src.getContained()) tgt.addContained(convertResource(t));
- for (org.hl7.fhir.r4.model.Extension t : src.getExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addExtension(convertExtension(t));
- for (org.hl7.fhir.r4.model.Extension t : src.getModifierExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addModifierExtension(convertExtension(t));
+ if (src.hasText()) tgt.setText(convertNarrative(src.getText()));
+ src.getContained().stream()
+ .map(resource -> convertResource(resource, advisor))
+ .forEach(tgt::addContained);
+ src.getExtension().forEach(extension -> {
+ if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
+ org.hl7.fhir.dstu2.model.Extension convertExtension = new org.hl7.fhir.dstu2.model.Extension();
+ advisor.handleExtension("", extension, convertExtension);//TODO add path
+ tgt.addExtension(convertExtension);
+ } else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
+ tgt.addExtension(convertExtension(extension));
+ }
+ });
+ src.getModifierExtension().stream()
+ .filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
+ .map(VersionConvertor_10_40::convertExtension)
+ .forEach(tgt::addModifierExtension);
}
public static void copyResource(org.hl7.fhir.dstu2.model.Resource src, org.hl7.fhir.r4.model.Resource tgt) throws FHIRException {
@@ -2451,19 +2479,6 @@ public class VersionConvertor_10_40 {
return tgt;
}
- static public class SourceElementComponentWrapper {
- public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) {
- super();
- this.source = source;
- this.target = target;
- this.comp = comp;
- }
-
- public String source;
- public String target;
- public org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent comp;
- }
-
public static org.hl7.fhir.r4.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException {
org.hl7.fhir.r4.model.UsageContext result = new org.hl7.fhir.r4.model.UsageContext();
result.setValue(convertCodeableConcept(t));
@@ -2807,7 +2822,7 @@ public class VersionConvertor_10_40 {
return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem()));
}
- public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src, VersionConvertorAdvisor40 advisor) throws FHIRException {
+ public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src, BaseAdvisor_10_40 advisor) throws FHIRException {
if (src == null || src.isEmpty()) return null;
if (src instanceof org.hl7.fhir.dstu2.model.Parameters)
return Parameters10_40.convertParameters((org.hl7.fhir.dstu2.model.Parameters) src);
@@ -2930,7 +2945,11 @@ public class VersionConvertor_10_40 {
throw new FHIRException("Unknown resource " + src.fhirType());
}
- public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src, VersionConvertorAdvisor40 advisor) throws FHIRException {
+ public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src) throws FHIRException {
+ return convertResource(src, new BaseAdvisor_10_40());
+ }
+
+ public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src, BaseAdvisor_10_40 advisor) throws FHIRException {
if (src == null || src.isEmpty()) return null;
if (src instanceof org.hl7.fhir.r4.model.Parameters)
return Parameters10_40.convertParameters((org.hl7.fhir.r4.model.Parameters) src);
@@ -2959,7 +2978,7 @@ public class VersionConvertor_10_40 {
if (src instanceof org.hl7.fhir.r4.model.Condition)
return Condition10_40.convertCondition((org.hl7.fhir.r4.model.Condition) src);
if (src instanceof org.hl7.fhir.r4.model.CapabilityStatement)
- return Conformance10_40.convertConformance((org.hl7.fhir.r4.model.CapabilityStatement) src);
+ return Conformance10_40.convertConformance((org.hl7.fhir.r4.model.CapabilityStatement) src, advisor);
if (src instanceof org.hl7.fhir.r4.model.DetectedIssue)
return DetectedIssue10_40.convertDetectedIssue((org.hl7.fhir.r4.model.DetectedIssue) src);
if (src instanceof org.hl7.fhir.r4.model.DeviceMetric)
@@ -3014,7 +3033,7 @@ public class VersionConvertor_10_40 {
if (src instanceof org.hl7.fhir.r4.model.Practitioner)
return Practitioner10_40.convertPractitioner((org.hl7.fhir.r4.model.Practitioner) src);
if (src instanceof org.hl7.fhir.r4.model.Questionnaire)
- return Questionnaire10_40.convertQuestionnaire((org.hl7.fhir.r4.model.Questionnaire) src);
+ return Questionnaire10_40.convertQuestionnaire((org.hl7.fhir.r4.model.Questionnaire) src, advisor);
if (src instanceof org.hl7.fhir.r4.model.QuestionnaireResponse)
return QuestionnaireResponse10_40.convertQuestionnaireResponse((org.hl7.fhir.r4.model.QuestionnaireResponse) src);
if (src instanceof org.hl7.fhir.r4.model.RiskAssessment)
@@ -3057,10 +3076,6 @@ public class VersionConvertor_10_40 {
return convertResource(src, null);
}
- public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src) throws FHIRException {
- return convertResource(src, null);
- }
-
public static UnsignedIntType convertUnsignedIntToPositive(PositiveIntType src) {
org.hl7.fhir.r4.model.UnsignedIntType tgt = src.hasValue() ? new org.hl7.fhir.r4.model.UnsignedIntType(src.getValue()) : new org.hl7.fhir.r4.model.UnsignedIntType();
copyElement(src, tgt);
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java
index 073707cc9..63c791d2e 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_50.java
@@ -1,7 +1,9 @@
package org.hl7.fhir.convertors;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50;
import org.hl7.fhir.convertors.conv10_50.*;
import org.hl7.fhir.dstu2.model.CodeableConcept;
+import org.hl7.fhir.dstu2.model.Extension;
import org.hl7.fhir.dstu2.model.Parameters;
import org.hl7.fhir.dstu2.model.Parameters.ParametersParameterComponent;
import org.hl7.fhir.dstu2.model.Reference;
@@ -13,7 +15,6 @@ import org.hl7.fhir.r5.model.CodeSystem;
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent;
import org.hl7.fhir.r5.model.CodeableReference;
-import org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent;
import org.hl7.fhir.r5.model.Dosage.DosageDoseAndRateComponent;
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent;
import org.hl7.fhir.r5.model.Immunization.ImmunizationPerformerComponent;
@@ -22,6 +23,7 @@ import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
import org.hl7.fhir.utilities.Utilities;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@@ -54,7 +56,7 @@ import java.util.stream.Collectors;
POSSIBILITY OF SUCH DAMAGE.
*/
-public class VersionConvertor_10_50 {
+public class VersionConvertor_10_50 extends VersionConvertor_Base {
static public List CANONICAL_URLS = new ArrayList();
static {
@@ -2299,23 +2301,53 @@ public class VersionConvertor_10_50 {
}
public static void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException {
+ copyDomainResource(src, tgt, new BaseAdvisor_10_50(), extensionsToIgnore);
+ }
+
+ public static void copyDomainResource(org.hl7.fhir.dstu2.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt, BaseAdvisor_10_50 advisor, String... extensionsToIgnore) throws FHIRException {
copyResource(src, tgt);
- tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.dstu2.model.Resource t : src.getContained()) tgt.addContained(convertResource(t));
- for (org.hl7.fhir.dstu2.model.Extension t : src.getExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addExtension(convertExtension(t));
- for (org.hl7.fhir.dstu2.model.Extension t : src.getModifierExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addModifierExtension(convertExtension(t));
+ if (src.hasText()) tgt.setText(convertNarrative(src.getText()));
+ src.getContained().stream()
+ .map(resource -> convertResource(resource, advisor))
+ .forEach(tgt::addContained);
+ src.getExtension().forEach(extension -> {
+ if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
+ org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension();//TODO add path
+ advisor.handleExtension("", extension, convertExtension);
+ tgt.addExtension(convertExtension);
+ } else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
+ tgt.addExtension(convertExtension(extension));
+ }
+ });
+ src.getModifierExtension().stream()
+ .filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
+ .map(VersionConvertor_10_50::convertExtension)
+ .forEach(tgt::addModifierExtension);
}
public static void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu2.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException {
+ copyDomainResource(src, tgt, new BaseAdvisor_10_50(), extensionsToIgnore);
+ }
+
+ public static void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu2.model.DomainResource tgt, BaseAdvisor_10_50 advisor, String... extensionsToIgnore) throws FHIRException {
copyResource(src, tgt);
- tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.r5.model.Resource t : src.getContained()) tgt.addContained(convertResource(t));
- for (org.hl7.fhir.r5.model.Extension t : src.getExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addExtension(convertExtension(t));
- for (org.hl7.fhir.r5.model.Extension t : src.getModifierExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addModifierExtension(convertExtension(t));
+ if (src.hasText()) tgt.setText(convertNarrative(src.getText()));
+ src.getContained().stream()
+ .map(resource -> convertResource(resource, advisor))
+ .forEach(tgt::addContained);
+ src.getExtension().forEach(extension -> {
+ if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
+ Extension convertExtension = new Extension();
+ advisor.handleExtension("", extension, convertExtension);//TODO add path
+ tgt.addExtension(convertExtension);
+ } else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
+ tgt.addExtension(convertExtension(extension));
+ }
+ });
+ src.getModifierExtension().stream()
+ .filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
+ .map(VersionConvertor_10_50::convertExtension)
+ .forEach(tgt::addModifierExtension);
}
public static void copyResource(org.hl7.fhir.dstu2.model.Resource src, org.hl7.fhir.r5.model.Resource tgt) throws FHIRException {
@@ -2474,19 +2506,6 @@ public class VersionConvertor_10_50 {
return tgt;
}
- static public class SourceElementComponentWrapper {
- public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) {
- super();
- this.source = source;
- this.target = target;
- this.comp = comp;
- }
-
- public String source;
- public String target;
- public org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent comp;
- }
-
public static org.hl7.fhir.r5.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2.model.CodeableConcept t) throws FHIRException {
org.hl7.fhir.r5.model.UsageContext result = new org.hl7.fhir.r5.model.UsageContext();
result.setValue(convertCodeableConcept(t));
@@ -2830,7 +2849,11 @@ public class VersionConvertor_10_50 {
return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem()) || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem()));
}
- public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src, VersionConvertorAdvisor50 advisor) throws FHIRException {
+ public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src) throws FHIRException {
+ return convertResource(src, new BaseAdvisor_10_50());
+ }
+
+ public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src, BaseAdvisor_10_50 advisor) throws FHIRException {
if (src == null || src.isEmpty()) return null;
if (src instanceof org.hl7.fhir.dstu2.model.Parameters)
return Parameters10_50.convertParameters((org.hl7.fhir.dstu2.model.Parameters) src);
@@ -2942,10 +2965,18 @@ public class VersionConvertor_10_50 {
return TestScript10_50.convertTestScript((org.hl7.fhir.dstu2.model.TestScript) src);
if (src instanceof org.hl7.fhir.dstu2.model.ValueSet)
return ValueSet10_50.convertValueSet((org.hl7.fhir.dstu2.model.ValueSet) src, advisor);
- throw new FHIRException("Unknown resource " + src.fhirType());
+ if (advisor.failFastOnNullOrUnknownEntry()) {
+ throw new FHIRException("Unknown resource " + src.fhirType());
+ } else {
+ return null;
+ }
}
- public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src, VersionConvertorAdvisor50 advisor) throws FHIRException {
+ public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src) throws FHIRException {
+ return convertResource(src, new BaseAdvisor_10_50());
+ }
+
+ public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src, BaseAdvisor_10_50 advisor) throws FHIRException {
if (src == null || src.isEmpty()) return null;
if (src instanceof org.hl7.fhir.r5.model.Parameters)
return Parameters10_50.convertParameters((org.hl7.fhir.r5.model.Parameters) src);
@@ -2979,8 +3010,8 @@ public class VersionConvertor_10_50 {
return DetectedIssue10_50.convertDetectedIssue((org.hl7.fhir.r5.model.DetectedIssue) src);
if (src instanceof org.hl7.fhir.r5.model.DeviceMetric)
return DeviceMetric10_50.convertDeviceMetric((org.hl7.fhir.r5.model.DeviceMetric) src);
- if (src instanceof org.hl7.fhir.r5.model.DeviceUseStatement)
- return DeviceUseStatement10_50.convertDeviceUseStatement((org.hl7.fhir.r5.model.DeviceUseStatement) src);
+ if (src instanceof org.hl7.fhir.r5.model.DeviceUsage)
+ return DeviceUseStatement10_50.convertDeviceUseStatement((org.hl7.fhir.r5.model.DeviceUsage) src);
if (src instanceof org.hl7.fhir.r5.model.DiagnosticReport)
return DiagnosticReport10_50.convertDiagnosticReport((org.hl7.fhir.r5.model.DiagnosticReport) src);
if (src instanceof org.hl7.fhir.r5.model.DocumentReference)
@@ -3031,7 +3062,7 @@ public class VersionConvertor_10_50 {
if (src instanceof org.hl7.fhir.r5.model.Provenance)
return Provenance10_50.convertProvenance((org.hl7.fhir.r5.model.Provenance) src);
if (src instanceof org.hl7.fhir.r5.model.Questionnaire)
- return Questionnaire10_50.convertQuestionnaire((org.hl7.fhir.r5.model.Questionnaire) src);
+ return Questionnaire10_50.convertQuestionnaire((org.hl7.fhir.r5.model.Questionnaire) src, advisor);
if (src instanceof org.hl7.fhir.r5.model.QuestionnaireResponse)
return QuestionnaireResponse10_50.convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src);
if (src instanceof org.hl7.fhir.r5.model.RiskAssessment)
@@ -3053,7 +3084,11 @@ public class VersionConvertor_10_50 {
return TestScript10_50.convertTestScript((org.hl7.fhir.r5.model.TestScript) src);
if (src instanceof org.hl7.fhir.r5.model.ValueSet)
return ValueSet10_50.convertValueSet((org.hl7.fhir.r5.model.ValueSet) src, advisor);
- throw new FHIRException("Unknown resource " + src.fhirType());
+ if (advisor.failFastOnNullOrUnknownEntry()) {
+ throw new FHIRException("Unknown resource " + src.fhirType());
+ } else {
+ return null;
+ }
}
public static TerminologyCapabilities convertTerminologyCapabilities(Parameters src) {
@@ -3069,12 +3104,4 @@ public class VersionConvertor_10_50 {
public static boolean convertsResource(String rt) {
return Utilities.existsInList(rt, "Parameters", "Appointment", "AppointmentResponse", "AuditEvent", "Basic", "Binary", "Bundle", "CarePlan", "Communication", "CommunicationRequest", "Composition", "ConceptMap", "Condition", "CapabilityStatement", "DetectedIssue", "DeviceMetric", "DeviceUseStatement", "DiagnosticReport", "DocumentReference", "Encounter", "EnrollmentRequest", "EnrollmentResponse", "EpisodeOfCare", "FamilyMemberHistory", "Flag", "Group", "HealthcareService", "ImplementationGuide", "ListResource", "Location", "MedicationDispense", "MedicationStatement", "MessageHeader", "NamingSystem", "Observation", "OperationDefinition", "OperationOutcome", "Organization", "Patient", "Person", "Practitioner", "Questionnaire", "QuestionnaireResponse", "RiskAssessment", "Schedule", "SearchParameter", "Slot", "StructureDefinition", "Subscription", "Substance", "SupplyDelivery", "SupplyRequest", "TestScript", "ValueSet");
}
-
- public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu2.model.Resource src) throws FHIRException {
- return convertResource(src, null);
- }
-
- public static org.hl7.fhir.dstu2.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src) throws FHIRException {
- return convertResource(src, null);
- }
}
\ No newline at end of file
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_30.java
index fb3a82da9..5d928c7de 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_30.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_30.java
@@ -8,6 +8,7 @@ import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscri
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.utilities.Utilities;
+import java.util.Arrays;
import java.util.Collections;
import java.util.stream.Collectors;
@@ -39,7 +40,7 @@ import java.util.stream.Collectors;
POSSIBILITY OF SUCH DAMAGE.
*/
-public class VersionConvertor_14_30 {
+public class VersionConvertor_14_30 extends VersionConvertor_Base {
static public void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.dstu3.model.Element tgt, String... exemptExtensions) throws FHIRException {
if (src.hasId()) tgt.setId(src.getId());
for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) {
@@ -2398,19 +2399,6 @@ public class VersionConvertor_14_30 {
return result;
}
- static public class SourceElementComponentWrapper {
- public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) {
- super();
- this.source = source;
- this.target = target;
- this.comp = comp;
- }
-
- public String source;
- public String target;
- public org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent comp;
- }
-
static public org.hl7.fhir.dstu3.model.Enumeration convertSearchParamType(org.hl7.fhir.dstu2016may.model.Enumeration src) throws FHIRException {
if (src == null || src.isEmpty()) return null;
org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.SearchParamTypeEnumFactory());
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java
index beb5c3a26..3f8588cb8 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java
@@ -1,8 +1,11 @@
package org.hl7.fhir.convertors;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_14_40;
import org.hl7.fhir.convertors.conv14_40.*;
import org.hl7.fhir.dstu2016may.model.CodeableConcept;
+import org.hl7.fhir.dstu2016may.model.Extension;
import org.hl7.fhir.dstu2016may.model.Reference;
+import org.hl7.fhir.dstu2016may.model.Resource;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.conformance.ProfileUtilities;
import org.hl7.fhir.r4.model.CanonicalType;
@@ -11,6 +14,7 @@ import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingDiscrimin
import org.hl7.fhir.utilities.Utilities;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@@ -43,7 +47,7 @@ import java.util.stream.Collectors;
POSSIBILITY OF SUCH DAMAGE.
*/
-public class VersionConvertor_14_40 {
+public class VersionConvertor_14_40 extends VersionConvertor_Base {
static public List CANONICAL_URLS = new ArrayList();
static {
@@ -2401,24 +2405,64 @@ public class VersionConvertor_14_40 {
return ok;
}
- static public void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException {
- copyResource(src, tgt);
- tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.dstu2016may.model.Resource t : src.getContained()) tgt.addContained(convertResource(t));
- for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addExtension(convertExtension(t));
- for (org.hl7.fhir.dstu2016may.model.Extension t : src.getModifierExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addModifierExtension(convertExtension(t));
+ static public void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src,
+ org.hl7.fhir.r4.model.DomainResource tgt,
+ String... extensionsToIgnore) throws FHIRException {
+ copyDomainResource(src, tgt, new BaseAdvisor_14_40(), extensionsToIgnore);
}
- static public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.dstu2016may.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException {
+ static public void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src,
+ org.hl7.fhir.r4.model.DomainResource tgt,
+ BaseAdvisor_14_40 advisor,
+ String... extensionsToIgnore) throws FHIRException {
copyResource(src, tgt);
if (src.hasText()) tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.r4.model.Resource t : src.getContained()) tgt.addContained(convertResource(t));
- for (org.hl7.fhir.r4.model.Extension t : src.getExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addExtension(convertExtension(t));
- for (org.hl7.fhir.r4.model.Extension t : src.getModifierExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addModifierExtension(convertExtension(t));
+ src.getContained().stream()
+ .map(resource -> convertResource(resource, advisor))
+ .forEach(tgt::addContained);
+ src.getExtension().forEach(extension -> {
+ if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
+ org.hl7.fhir.r4.model.Extension convertExtension = new org.hl7.fhir.r4.model.Extension();
+ advisor.handleExtension("", extension, convertExtension);//TODO add path
+ tgt.addExtension(convertExtension);
+ } else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
+ tgt.addExtension(convertExtension(extension));
+ }
+ });
+ src.getModifierExtension().stream()
+ .filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
+ .map(VersionConvertor_14_40::convertExtension)
+ .forEach(tgt::addModifierExtension);
+ }
+
+ static public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src,
+ org.hl7.fhir.dstu2016may.model.DomainResource tgt,
+ String... extensionsToIgnore) throws FHIRException {
+ copyDomainResource(src, tgt, new BaseAdvisor_14_40(), extensionsToIgnore);
+ }
+
+ static public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src,
+ org.hl7.fhir.dstu2016may.model.DomainResource tgt,
+ BaseAdvisor_14_40 advisor,
+ String... extensionsToIgnore) throws FHIRException {
+ copyResource(src, tgt);
+ if (src.hasText()) tgt.setText(convertNarrative(src.getText()));
+ src.getContained().stream()
+ .map(resource -> convertResource(resource, advisor))
+ .forEach(tgt::addContained);
+ src.getExtension().forEach(extension -> {
+ if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
+ org.hl7.fhir.dstu2016may.model.Extension convertExtension = new org.hl7.fhir.dstu2016may.model.Extension();
+ advisor.handleExtension("", extension, convertExtension);//TODO add path
+ tgt.addExtension(convertExtension);
+ } else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
+ tgt.addExtension(convertExtension(extension));
+ }
+ });
+ src.getModifierExtension().stream()
+ .filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
+ .map(VersionConvertor_14_40::convertExtension)
+ .forEach(tgt::addModifierExtension);
}
static public void copyResource(org.hl7.fhir.dstu2016may.model.Resource src, org.hl7.fhir.r4.model.Resource tgt) throws FHIRException {
@@ -2513,19 +2557,6 @@ public class VersionConvertor_14_40 {
return result;
}
- static public class SourceElementComponentWrapper {
- public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) {
- super();
- this.source = source;
- this.target = target;
- this.comp = comp;
- }
-
- public String source;
- public String target;
- public org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent comp;
- }
-
static public CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException {
CanonicalType dst = new CanonicalType(src.getReference());
copyElement(src, dst);
@@ -2663,6 +2694,10 @@ public class VersionConvertor_14_40 {
}
public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.dstu2016may.model.Resource src) throws FHIRException {
+ return convertResource(src, new BaseAdvisor_14_40());
+ }
+
+ public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.dstu2016may.model.Resource src, BaseAdvisor_14_40 advisor) throws FHIRException {
if (src == null || src.isEmpty()) return null;
if (src instanceof org.hl7.fhir.dstu2016may.model.Parameters)
return Parameters14_40.convertParameters((org.hl7.fhir.dstu2016may.model.Parameters) src);
@@ -2698,10 +2733,18 @@ public class VersionConvertor_14_40 {
return StructureMap14_40.convertStructureMap((org.hl7.fhir.dstu2016may.model.StructureMap) src);
if (src instanceof org.hl7.fhir.dstu2016may.model.ValueSet)
return ValueSet14_40.convertValueSet((org.hl7.fhir.dstu2016may.model.ValueSet) src);
- throw new FHIRException("Unknown resource " + src.fhirType());
+ if (advisor.failFastOnNullOrUnknownEntry()) {
+ throw new FHIRException("Unknown resource " + src.fhirType());
+ } else {
+ return null;
+ }
}
public static org.hl7.fhir.dstu2016may.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src) throws FHIRException {
+ return convertResource(src, new BaseAdvisor_14_40());
+ }
+
+ public static org.hl7.fhir.dstu2016may.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src, BaseAdvisor_14_40 advisor) throws FHIRException {
if (src == null || src.isEmpty()) return null;
if (src instanceof org.hl7.fhir.r4.model.Parameters)
return Parameters14_40.convertParameters((org.hl7.fhir.r4.model.Parameters) src);
@@ -2735,7 +2778,11 @@ public class VersionConvertor_14_40 {
return StructureMap14_40.convertStructureMap((org.hl7.fhir.r4.model.StructureMap) src);
if (src instanceof org.hl7.fhir.r4.model.ValueSet)
return ValueSet14_40.convertValueSet((org.hl7.fhir.r4.model.ValueSet) src);
- throw new FHIRException("Unknown resource " + src.fhirType());
+ if (advisor.failFastOnNullOrUnknownEntry()) {
+ throw new FHIRException("Unknown resource " + src.fhirType());
+ } else {
+ return null;
+ }
}
public static boolean convertsResource(String rt) {
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java
index 19ce5f71a..9f52b7d3c 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_50.java
@@ -1,5 +1,6 @@
package org.hl7.fhir.convertors;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_14_50;
import org.hl7.fhir.convertors.conv14_50.*;
import org.hl7.fhir.dstu2016may.model.CodeableConcept;
import org.hl7.fhir.dstu2016may.model.Reference;
@@ -11,6 +12,7 @@ import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionSlicingDiscrimin
import org.hl7.fhir.utilities.Utilities;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
@@ -43,7 +45,7 @@ import java.util.stream.Collectors;
POSSIBILITY OF SUCH DAMAGE.
*/
-public class VersionConvertor_14_50 {
+public class VersionConvertor_14_50 extends VersionConvertor_Base {
static public List CANONICAL_URLS = new ArrayList();
static {
@@ -145,6 +147,20 @@ public class VersionConvertor_14_50 {
return tgt;
}
+ public static org.hl7.fhir.r5.model.UriType convertCodeToUri(org.hl7.fhir.dstu2016may.model.CodeType src) throws FHIRException {
+ org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType();
+ if (src.hasValue()) tgt.setValue(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public static org.hl7.fhir.dstu2016may.model.CodeType convertCode(org.hl7.fhir.r5.model.UriType src) throws FHIRException {
+ org.hl7.fhir.dstu2016may.model.CodeType tgt = new org.hl7.fhir.dstu2016may.model.CodeType();
+ if (src.hasValue()) tgt.setValue(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
public static org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.dstu2016may.model.DateType src) throws FHIRException {
org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType();
if (src.hasValue()) tgt.setValue(src.getValue());
@@ -285,6 +301,13 @@ public class VersionConvertor_14_50 {
return tgt;
}
+ public static org.hl7.fhir.r5.model.MarkdownType convertStringToMarkdown(org.hl7.fhir.dstu2016may.model.StringType src) throws FHIRException {
+ org.hl7.fhir.r5.model.MarkdownType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.MarkdownType(src.getValue()) : new org.hl7.fhir.r5.model.MarkdownType();
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+
public static org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.dstu2016may.model.TimeType src) throws FHIRException {
org.hl7.fhir.r5.model.TimeType tgt = new org.hl7.fhir.r5.model.TimeType();
if (src.hasValue()) tgt.setValue(src.getValue());
@@ -1493,7 +1516,7 @@ public class VersionConvertor_14_50 {
tgt = new org.hl7.fhir.r5.model.ElementDefinition.TypeRefComponent();
list.add(tgt);
copyElement(src, tgt);
- tgt.setCode(src.getCode());
+ tgt.setCodeElement(convertCodeToUri(src.getCodeElement()));
}
if (tgt.hasTarget()) {
for (org.hl7.fhir.dstu2016may.model.UriType u : src.getProfile()) {
@@ -1518,7 +1541,7 @@ public class VersionConvertor_14_50 {
if (src == null) return;
org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent();
copyElement(src, tgt);
- tgt.setCode(src.getCode());
+ tgt.setCodeElement(convertCode(src.getCodeElement()));
list.add(tgt);
if (src.hasTarget()) {
for (org.hl7.fhir.r5.model.UriType u : src.getProfile()) {
@@ -2404,23 +2427,53 @@ public class VersionConvertor_14_50 {
}
static public void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException {
+ copyDomainResource(src, tgt, new BaseAdvisor_14_50(), extensionsToIgnore);
+ }
+
+ static public void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt, BaseAdvisor_14_50 advisor, String... extensionsToIgnore) throws FHIRException {
copyResource(src, tgt);
- tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.dstu2016may.model.Resource t : src.getContained()) tgt.addContained(convertResource(t));
- for (org.hl7.fhir.dstu2016may.model.Extension t : src.getExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addExtension(convertExtension(t));
- for (org.hl7.fhir.dstu2016may.model.Extension t : src.getModifierExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addModifierExtension(convertExtension(t));
+ if (src.hasText()) tgt.setText(convertNarrative(src.getText()));
+ src.getContained().stream()
+ .map(resource -> convertResource(resource, advisor))
+ .forEach(tgt::addContained);
+ src.getExtension().forEach(extension -> {
+ if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
+ org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension();
+ advisor.handleExtension("", extension, convertExtension);//TODO add path
+ tgt.addExtension(convertExtension);
+ } else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
+ tgt.addExtension(convertExtension(extension));
+ }
+ });
+ src.getModifierExtension().stream()
+ .filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
+ .map(extension -> convertExtension(extension))
+ .forEach(tgt::addModifierExtension);
}
static public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu2016may.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException {
+ copyDomainResource(src, tgt, new BaseAdvisor_14_50(), extensionsToIgnore);
+ }
+
+ static public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu2016may.model.DomainResource tgt, BaseAdvisor_14_50 advisor, String... extensionsToIgnore) throws FHIRException {
copyResource(src, tgt);
if (src.hasText()) tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.r5.model.Resource t : src.getContained()) tgt.addContained(convertResource(t));
- for (org.hl7.fhir.r5.model.Extension t : src.getExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addExtension(convertExtension(t));
- for (org.hl7.fhir.r5.model.Extension t : src.getModifierExtension())
- if (!isExemptExtension(t.getUrl(), extensionsToIgnore)) tgt.addModifierExtension(convertExtension(t));
+ src.getContained().stream()
+ .map(resource -> convertResource(resource, advisor))
+ .forEach(tgt::addContained);
+ src.getExtension().forEach(extension -> {
+ if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
+ org.hl7.fhir.dstu2016may.model.Extension convertExtension = new org.hl7.fhir.dstu2016may.model.Extension();
+ advisor.handleExtension("", extension, convertExtension);//TODO add path
+ tgt.addExtension(convertExtension);
+ } else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
+ tgt.addExtension(convertExtension(extension));
+ }
+ });
+ src.getModifierExtension().stream()
+ .filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
+ .map(VersionConvertor_14_50::convertExtension)
+ .forEach(tgt::addModifierExtension);
}
static public void copyResource(org.hl7.fhir.dstu2016may.model.Resource src, org.hl7.fhir.r5.model.Resource tgt) throws FHIRException {
@@ -2515,19 +2568,6 @@ public class VersionConvertor_14_50 {
return result;
}
- static public class SourceElementComponentWrapper {
- public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) {
- super();
- this.source = source;
- this.target = target;
- this.comp = comp;
- }
-
- public String source;
- public String target;
- public org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent comp;
- }
-
static public CanonicalType convertReferenceToCanonical(Reference src) throws FHIRException {
CanonicalType dst = new CanonicalType(src.getReference());
copyElement(src, dst);
@@ -2665,6 +2705,10 @@ public class VersionConvertor_14_50 {
}
public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu2016may.model.Resource src) throws FHIRException {
+ return convertResource(src, new BaseAdvisor_14_50());
+ }
+
+ public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu2016may.model.Resource src, BaseAdvisor_14_50 advisor) throws FHIRException {
if (src == null || src.isEmpty()) return null;
if (src instanceof org.hl7.fhir.dstu2016may.model.Parameters)
return Parameters14_50.convertParameters((org.hl7.fhir.dstu2016may.model.Parameters) src);
@@ -2700,10 +2744,18 @@ public class VersionConvertor_14_50 {
return StructureMap14_50.convertStructureMap((org.hl7.fhir.dstu2016may.model.StructureMap) src);
if (src instanceof org.hl7.fhir.dstu2016may.model.ValueSet)
return ValueSet14_50.convertValueSet((org.hl7.fhir.dstu2016may.model.ValueSet) src);
- throw new FHIRException("Unknown resource " + src.fhirType());
+ if (advisor.failFastOnNullOrUnknownEntry()) {
+ throw new FHIRException("Unknown resource " + src.fhirType());
+ } else {
+ return null;
+ }
}
public static org.hl7.fhir.dstu2016may.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src) throws FHIRException {
+ return convertResource(src, new BaseAdvisor_14_50());
+ }
+
+ public static org.hl7.fhir.dstu2016may.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src, BaseAdvisor_14_50 advisor) throws FHIRException {
if (src == null || src.isEmpty()) return null;
if (src instanceof org.hl7.fhir.r5.model.Parameters)
return Parameters14_50.convertParameters((org.hl7.fhir.r5.model.Parameters) src);
@@ -2737,7 +2789,11 @@ public class VersionConvertor_14_50 {
return StructureMap14_50.convertStructureMap((org.hl7.fhir.r5.model.StructureMap) src);
if (src instanceof org.hl7.fhir.r5.model.ValueSet)
return ValueSet14_50.convertValueSet((org.hl7.fhir.r5.model.ValueSet) src);
- throw new FHIRException("Unknown resource " + src.fhirType());
+ if (advisor.failFastOnNullOrUnknownEntry()) {
+ throw new FHIRException("Unknown resource " + src.fhirType());
+ } else {
+ return null;
+ }
}
public static boolean convertsResource(String rt) {
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java
index 1e2e01df8..054b6a439 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java
@@ -1,5 +1,6 @@
package org.hl7.fhir.convertors;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_40;
import org.hl7.fhir.convertors.conv30_40.*;
import org.hl7.fhir.dstu3.model.Parameters;
import org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent;
@@ -11,6 +12,7 @@ import org.hl7.fhir.r4.model.UriType;
import org.hl7.fhir.utilities.Utilities;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -42,7 +44,7 @@ import java.util.stream.Collectors;
POSSIBILITY OF SUCH DAMAGE.
*/
-public class VersionConvertor_30_40 {
+public class VersionConvertor_30_40 extends VersionConvertor_Base {
static final public String EXT_SRC_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type";
static public List CANONICAL_URLS = new ArrayList<>();
@@ -3140,23 +3142,54 @@ public class VersionConvertor_30_40 {
}
static public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException {
+ copyDomainResource(src, tgt, new BaseAdvisor_30_40(), extensionsToIgnore);
+ }
+
+ static public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt, BaseAdvisor_30_40 advisor, String... extensionsToIgnore) throws FHIRException {
copyResource(src, tgt);
if (src.hasText()) tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.dstu3.model.Resource t1 : src.getContained()) tgt.addContained(convertResource(t1, false));
- for (org.hl7.fhir.dstu3.model.Extension t2 : src.getExtension())
- if (!isExemptExtension(t2.getUrl(), extensionsToIgnore)) tgt.addExtension(convertExtension(t2));
- for (org.hl7.fhir.dstu3.model.Extension t3 : src.getModifierExtension())
- if (!isExemptExtension(t3.getUrl(), extensionsToIgnore)) tgt.addModifierExtension(convertExtension(t3));
+ src.getContained().stream()
+ .map(resource -> convertResource(resource, advisor))
+ .forEach(tgt::addContained);
+ src.getExtension().forEach(extension -> {
+
+ if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
+ org.hl7.fhir.r4.model.Extension convertExtension = new org.hl7.fhir.r4.model.Extension();
+ advisor.handleExtension("", extension, convertExtension);//TODO add path
+ tgt.addExtension(convertExtension);
+ } else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
+ tgt.addExtension(convertExtension(extension));
+ }
+ });
+ src.getModifierExtension().stream()
+ .filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
+ .map(VersionConvertor_30_40::convertExtension)
+ .forEach(tgt::addModifierExtension);
}
static public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException {
+ copyDomainResource(src, tgt, new BaseAdvisor_30_40(), extensionsToIgnore);
+ }
+
+ static public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt, BaseAdvisor_30_40 advisor, String... extensionsToIgnore) throws FHIRException {
copyResource(src, tgt);
if (src.hasText()) tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.r4.model.Resource t1 : src.getContained()) tgt.addContained(convertResource(t1, false));
- for (org.hl7.fhir.r4.model.Extension t2 : src.getExtension())
- if (!isExemptExtension(t2.getUrl(), extensionsToIgnore)) tgt.addExtension(convertExtension(t2));
- for (org.hl7.fhir.r4.model.Extension t3 : src.getModifierExtension())
- if (!isExemptExtension(t3.getUrl(), extensionsToIgnore)) tgt.addModifierExtension(convertExtension(t3));
+ src.getContained().stream()
+ .map(resource -> convertResource(resource, advisor))
+ .forEach(tgt::addContained);
+ src.getExtension().forEach(extension -> {
+ if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
+ org.hl7.fhir.dstu3.model.Extension convertExtension = new org.hl7.fhir.dstu3.model.Extension();
+ advisor.handleExtension("", extension, convertExtension);//TODO add path
+ tgt.addExtension(convertExtension);
+ } else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
+ tgt.addExtension(convertExtension(extension));
+ }
+ });
+ src.getModifierExtension().stream()
+ .filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
+ .map(VersionConvertor_30_40::convertExtension)
+ .forEach(tgt::addModifierExtension);
}
static public void copyResource(org.hl7.fhir.dstu3.model.Resource src, org.hl7.fhir.r4.model.Resource tgt) throws FHIRException {
@@ -4336,7 +4369,11 @@ public class VersionConvertor_30_40 {
return tgt;
}
- public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src, boolean nullOk) throws FHIRException {
+ public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src) throws FHIRException {
+ return convertResource(src, new BaseAdvisor_30_40());
+ }
+
+ public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src, BaseAdvisor_30_40 advisor) throws FHIRException {
if (src == null) return null;
if (src instanceof org.hl7.fhir.dstu3.model.Parameters)
return Parameters30_40.convertParameters((org.hl7.fhir.dstu3.model.Parameters) src);
@@ -4503,11 +4540,15 @@ public class VersionConvertor_30_40 {
return TestScript30_40.convertTestScript((org.hl7.fhir.dstu3.model.TestScript) src);
if (src instanceof org.hl7.fhir.dstu3.model.ValueSet)
return ValueSet30_40.convertValueSet((org.hl7.fhir.dstu3.model.ValueSet) src);
- if (!nullOk) throw new FHIRException("Unknown resource " + src.fhirType());
+ if (advisor.failFastOnNullOrUnknownEntry()) throw new FHIRException("Unknown resource " + src.fhirType());
else return null;
}
- public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src, boolean nullOk) throws FHIRException {
+ public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src) throws FHIRException {
+ return convertResource(src, new BaseAdvisor_30_40());
+ }
+
+ public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src, BaseAdvisor_30_40 advisor) throws FHIRException {
if (src == null) return null;
if (src instanceof org.hl7.fhir.r4.model.Parameters) {
if (((org.hl7.fhir.r4.model.Parameters) src).hasParameter("profile-url"))
@@ -4672,7 +4713,7 @@ public class VersionConvertor_30_40 {
return TestScript30_40.convertTestScript((org.hl7.fhir.r4.model.TestScript) src);
if (src instanceof org.hl7.fhir.r4.model.ValueSet)
return ValueSet30_40.convertValueSet((org.hl7.fhir.r4.model.ValueSet) src);
- if (!nullOk) throw new FHIRException("Unknown resource " + src.fhirType());
+ if (advisor.failFastOnNullOrUnknownEntry()) throw new FHIRException("Unknown resource " + src.fhirType());
else return null;
}
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java
index c18a7784d..741925409 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java
@@ -1,5 +1,6 @@
package org.hl7.fhir.convertors;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_50;
import org.hl7.fhir.convertors.conv30_50.*;
import org.hl7.fhir.dstu3.model.Parameters;
import org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent;
@@ -8,6 +9,7 @@ import org.hl7.fhir.r5.model.*;
import org.hl7.fhir.utilities.Utilities;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -39,7 +41,7 @@ import java.util.stream.Collectors;
POSSIBILITY OF SUCH DAMAGE.
*/
-public class VersionConvertor_30_50 {
+public class VersionConvertor_30_50 extends VersionConvertor_Base {
static final public String EXT_SRC_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type";
static public List CANONICAL_URLS = new ArrayList<>();
@@ -3212,34 +3214,70 @@ public class VersionConvertor_30_50 {
throw new FHIRException("Unknown type " + src.fhirType());
}
- static public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException {
- copyResource(src, tgt);
- if (src.hasText()) tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.dstu3.model.Resource t1 : src.getContained()) tgt.addContained(convertResource(t1, false));
- for (org.hl7.fhir.dstu3.model.Extension t2 : src.getExtension()) {
- if (!isExemptExtension(t2.getUrl(), extensionsToIgnore)) tgt.addExtension(convertExtension(t2));
- }
- for (org.hl7.fhir.dstu3.model.Extension t3 : src.getModifierExtension()) {
- if (!isExemptExtension(t3.getUrl(), extensionsToIgnore)) tgt.addModifierExtension(convertExtension(t3));
- }
- }
-
static public boolean isExemptExtension(String url, String[] extensionsToIgnore) {
boolean ok = false;
for (String s : extensionsToIgnore) if (s.equals(url)) ok = true;
return ok;
}
- static public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt, String... extensionsToIgnore) throws FHIRException {
+ static public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src,
+ org.hl7.fhir.r5.model.DomainResource tgt,
+ String... extensionsToIgnore) throws FHIRException {
+ copyDomainResource(src, tgt, new BaseAdvisor_30_50(), extensionsToIgnore);
+ }
+
+ static public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src,
+ org.hl7.fhir.r5.model.DomainResource tgt,
+ BaseAdvisor_30_50 advisor,
+ String... extensionsToIgnore) throws FHIRException {
copyResource(src, tgt);
if (src.hasText()) tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.r5.model.Resource t1 : src.getContained()) tgt.addContained(convertResource(t1, false));
- for (org.hl7.fhir.r5.model.Extension t2 : src.getExtension()) {
- if (!isExemptExtension(t2.getUrl(), extensionsToIgnore)) tgt.addExtension(convertExtension(t2));
- }
- for (org.hl7.fhir.r5.model.Extension t3 : src.getModifierExtension()) {
- if (!isExemptExtension(t3.getUrl(), extensionsToIgnore)) tgt.addModifierExtension(convertExtension(t3));
- }
+ src.getContained().stream()
+ .map(resource -> convertResource(resource, advisor))
+ .forEach(tgt::addContained);
+ src.getExtension().forEach(extension -> {
+ if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
+ org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension();
+ advisor.handleExtension("", extension, convertExtension);//TODO add path
+ tgt.addExtension(convertExtension);
+ } else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
+ tgt.addExtension(convertExtension(extension));
+ }
+ });
+ src.getModifierExtension().stream()
+ .filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))//TODO add path
+ .map(VersionConvertor_30_50::convertExtension)
+ .forEach(tgt::addModifierExtension);
+ }
+
+ static public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src,
+ org.hl7.fhir.dstu3.model.DomainResource tgt,
+ String... extensionsToIgnore) throws FHIRException {
+ copyDomainResource(src, tgt, new BaseAdvisor_30_50(), extensionsToIgnore);
+ }
+
+ static public void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src,
+ org.hl7.fhir.dstu3.model.DomainResource tgt,
+ BaseAdvisor_30_50 advisor,
+ String... extensionsToIgnore) throws FHIRException {
+ copyResource(src, tgt);
+ if (src.hasText()) tgt.setText(convertNarrative(src.getText()));
+ src.getContained().stream()
+ .map(resource -> convertResource(resource, advisor))
+ .forEach(tgt::addContained);
+ src.getExtension().forEach(extension -> {
+ if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
+ org.hl7.fhir.dstu3.model.Extension convertExtension = new org.hl7.fhir.dstu3.model.Extension();
+ advisor.handleExtension("", extension, convertExtension);//TODO add path
+ tgt.addExtension(convertExtension);
+ } else if (!advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl())) {//TODO add path
+ tgt.addExtension(convertExtension(extension));
+ }
+ });
+ src.getModifierExtension().stream()
+ .filter(extension -> !advisor.ignoreExtension("", extension) && !Arrays.asList(extensionsToIgnore).contains(extension.getUrl()))
+ .map(VersionConvertor_30_50::convertExtension)
+ .forEach(tgt::addModifierExtension);
}
static public void copyResource(org.hl7.fhir.dstu3.model.Resource src, org.hl7.fhir.r5.model.Resource tgt) throws FHIRException {
@@ -4598,7 +4636,11 @@ public class VersionConvertor_30_50 {
return tgt;
}
- public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src, boolean nullOk) throws FHIRException {
+ public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src) throws FHIRException {
+ return convertResource(src, new BaseAdvisor_30_50());
+ }
+
+ public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src, BaseAdvisor_30_50 advisor) throws FHIRException {
if (src == null) return null;
if (src instanceof org.hl7.fhir.dstu3.model.Parameters)
return Parameters30_50.convertParameters((org.hl7.fhir.dstu3.model.Parameters) src);
@@ -4757,11 +4799,15 @@ public class VersionConvertor_30_50 {
return TestScript30_50.convertTestScript((org.hl7.fhir.dstu3.model.TestScript) src);
if (src instanceof org.hl7.fhir.dstu3.model.ValueSet)
return ValueSet30_50.convertValueSet((org.hl7.fhir.dstu3.model.ValueSet) src);
- if (!nullOk) throw new FHIRException("Unknown resource " + src.fhirType());
+ if (advisor.failFastOnNullOrUnknownEntry()) throw new FHIRException("Unknown resource " + src.fhirType());
else return null;
}
- public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src, boolean nullOk) throws FHIRException {
+ public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src) throws FHIRException {
+ return convertResource(src, new BaseAdvisor_30_50());
+ }
+
+ public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src, BaseAdvisor_30_50 advisor) throws FHIRException {
if (src == null) return null;
if (src instanceof org.hl7.fhir.r5.model.Parameters) {
if (((org.hl7.fhir.r5.model.Parameters) src).hasParameter("profile-url"))
@@ -4809,8 +4855,8 @@ public class VersionConvertor_30_50 {
return Consent30_50.convertConsent((org.hl7.fhir.r5.model.Consent) src);
if (src instanceof org.hl7.fhir.r5.model.DetectedIssue)
return DetectedIssue30_50.convertDetectedIssue((org.hl7.fhir.r5.model.DetectedIssue) src);
- if (src instanceof org.hl7.fhir.r5.model.DeviceUseStatement)
- return DeviceUseStatement30_50.convertDeviceUseStatement((org.hl7.fhir.r5.model.DeviceUseStatement) src);
+ if (src instanceof org.hl7.fhir.r5.model.DeviceUsage)
+ return DeviceUseStatement30_50.convertDeviceUseStatement((org.hl7.fhir.r5.model.DeviceUsage) src);
if (src instanceof org.hl7.fhir.r5.model.DiagnosticReport)
return DiagnosticReport30_50.convertDiagnosticReport((org.hl7.fhir.r5.model.DiagnosticReport) src);
if (src instanceof org.hl7.fhir.r5.model.DocumentReference)
@@ -4917,7 +4963,7 @@ public class VersionConvertor_30_50 {
return TestScript30_50.convertTestScript((org.hl7.fhir.r5.model.TestScript) src);
if (src instanceof org.hl7.fhir.r5.model.ValueSet)
return ValueSet30_50.convertValueSet((org.hl7.fhir.r5.model.ValueSet) src);
- if (!nullOk) throw new FHIRException("Unknown resource " + src.fhirType());
+ if (advisor.failFastOnNullOrUnknownEntry()) throw new FHIRException("Unknown resource " + src.fhirType());
else return null;
}
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java
index b6b7af5dc..64aff69b5 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_40_50.java
@@ -1,9 +1,11 @@
package org.hl7.fhir.convertors;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50;
import org.hl7.fhir.convertors.conv40_50.*;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.CodeableReference;
+import java.util.Arrays;
import java.util.stream.Collectors;
/*
@@ -34,7 +36,7 @@ import java.util.stream.Collectors;
POSSIBILITY OF SUCH DAMAGE.
*/
-public class VersionConvertor_40_50 {
+public class VersionConvertor_40_50 extends VersionConvertor_Base {
static public boolean isExemptExtension(String url, String[] extensionsToIgnore) {
boolean ok = false;
for (String s : extensionsToIgnore) if (s.equals(url)) ok = true;
@@ -967,7 +969,7 @@ public class VersionConvertor_40_50 {
if (src == null) return null;
org.hl7.fhir.r5.model.DataRequirement tgt = new org.hl7.fhir.r5.model.DataRequirement();
copyElement(src, tgt);
- if (src.hasType()) tgt.setType(org.hl7.fhir.r5.model.Enumerations.FHIRAllTypes.fromCode(src.getType()));
+ if (src.hasType()) tgt.setType(org.hl7.fhir.r5.model.Enumerations.FHIRAllTypes.fromCode(convertResourceName4to5(src.getType())));
for (org.hl7.fhir.r4.model.CanonicalType t : src.getProfile()) tgt.getProfile().add(convertCanonical(t));
if (src.hasSubject()) tgt.setSubject(convertType(src.getSubject()));
for (org.hl7.fhir.r4.model.StringType t : src.getMustSupport()) tgt.getMustSupport().add(convertString(t));
@@ -981,11 +983,12 @@ public class VersionConvertor_40_50 {
return tgt;
}
+
public static org.hl7.fhir.r4.model.DataRequirement convertDataRequirement(org.hl7.fhir.r5.model.DataRequirement src) throws FHIRException {
if (src == null) return null;
org.hl7.fhir.r4.model.DataRequirement tgt = new org.hl7.fhir.r4.model.DataRequirement();
copyElement(src, tgt);
- if (src.hasType()) tgt.setType(src.getType().toCode());
+ if (src.hasType()) tgt.setType(convertResourceName5to4(src.getType().toCode()));
for (org.hl7.fhir.r5.model.CanonicalType t : src.getProfile()) tgt.getProfile().add(convertCanonical(t));
if (src.hasSubject()) tgt.setSubject(convertType(src.getSubject()));
for (org.hl7.fhir.r5.model.StringType t : src.getMustSupport()) tgt.getMustSupport().add(convertString(t));
@@ -999,6 +1002,22 @@ public class VersionConvertor_40_50 {
return tgt;
}
+ private static String convertResourceName4to5(String name) {
+ if (name == null) return null;
+ if (name.equals("MedicationStatement")) {
+ return "MedicationUsage";
+ }
+ return name;
+ }
+
+ private static String convertResourceName5to4(String name) {
+ if (name == null) return null;
+ if (name.equals("MedicationUsage")) {
+ return "MedicationStatement";
+ }
+ return name;
+ }
+
public static org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent convertDataRequirementCodeFilterComponent(org.hl7.fhir.r4.model.DataRequirement.DataRequirementCodeFilterComponent src) throws FHIRException {
if (src == null) return null;
org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent tgt = new org.hl7.fhir.r5.model.DataRequirement.DataRequirementCodeFilterComponent();
@@ -3370,19 +3389,53 @@ public class VersionConvertor_40_50 {
}
protected static void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException {
+ copyDomainResource(src, tgt, new BaseAdvisor_40_50());
+ }
+
+ protected static void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.r5.model.DomainResource tgt, BaseAdvisor_40_50 advisor) throws FHIRException {
copyResource(src, tgt);
if (src.hasText()) tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.r4.model.Resource t : src.getContained()) tgt.addContained(convertResource(t));
- for (org.hl7.fhir.r4.model.Extension t : src.getExtension()) tgt.addExtension(convertExtension(t));
- for (org.hl7.fhir.r4.model.Extension t : src.getModifierExtension()) tgt.addModifierExtension(convertExtension(t));
+ src.getContained().stream()
+ .map(resource -> convertResource(resource, advisor))
+ .forEach(tgt::addContained);
+ src.getExtension().forEach(extension -> {
+ if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
+ org.hl7.fhir.r5.model.Extension convertExtension = new org.hl7.fhir.r5.model.Extension();
+ advisor.handleExtension("", extension, convertExtension);//TODO add path
+ tgt.addExtension(convertExtension);
+ } else if (!advisor.ignoreExtension("", extension)) {//TODO add path
+ tgt.addExtension(convertExtension(extension));
+ }
+ });
+ src.getModifierExtension().stream()
+ .filter(extension -> !advisor.ignoreExtension("", extension))//TODO add path
+ .map(VersionConvertor_40_50::convertExtension)
+ .forEach(tgt::addModifierExtension);
}
protected static void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException {
+ copyDomainResource(src, tgt, new BaseAdvisor_40_50());
+ }
+
+ protected static void copyDomainResource(org.hl7.fhir.r5.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt, BaseAdvisor_40_50 advisor) throws FHIRException {
copyResource(src, tgt);
if (src.hasText()) tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.r5.model.Resource t : src.getContained()) tgt.addContained(convertResource(t));
- for (org.hl7.fhir.r5.model.Extension t : src.getExtension()) tgt.addExtension(convertExtension(t));
- for (org.hl7.fhir.r5.model.Extension t : src.getModifierExtension()) tgt.addModifierExtension(convertExtension(t));
+ src.getContained().stream()
+ .map(resource -> convertResource(resource, advisor))
+ .forEach(tgt::addContained);
+ src.getExtension().forEach(extension -> {
+ if (advisor.useAdvisorForExtension("", extension)) {//TODO add path
+ org.hl7.fhir.r4.model.Extension convertExtension = new org.hl7.fhir.r4.model.Extension();
+ advisor.handleExtension("", extension, convertExtension);//TODO add path
+ tgt.addExtension(convertExtension);
+ } else if (!advisor.ignoreExtension("", extension)) {//TODO add path
+ tgt.addExtension(convertExtension(extension));
+ }
+ });
+ src.getModifierExtension().stream()
+ .filter(extension -> !advisor.ignoreExtension("", extension))//TODO add path
+ .map(VersionConvertor_40_50::convertExtension)
+ .forEach(tgt::addModifierExtension);
}
protected static void copyResource(org.hl7.fhir.r4.model.Resource src, org.hl7.fhir.r5.model.Resource tgt) throws FHIRException {
@@ -3400,6 +3453,10 @@ public class VersionConvertor_40_50 {
}
public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src) throws FHIRException {
+ return convertResource(src, new BaseAdvisor_40_50());
+ }
+
+ public static org.hl7.fhir.r5.model.Resource convertResource(org.hl7.fhir.r4.model.Resource src, BaseAdvisor_40_50 advisor) throws FHIRException {
if (src == null) return null;
if (src instanceof org.hl7.fhir.r4.model.Parameters)
return Parameters40_50.convertParameters((org.hl7.fhir.r4.model.Parameters) src);
@@ -3461,8 +3518,8 @@ public class VersionConvertor_40_50 {
return Coverage40_50.convertCoverage((org.hl7.fhir.r4.model.Coverage) src);
if (src instanceof org.hl7.fhir.r4.model.CoverageEligibilityRequest)
return CoverageEligibilityRequest40_50.convertCoverageEligibilityRequest((org.hl7.fhir.r4.model.CoverageEligibilityRequest) src);
- if (src instanceof org.hl7.fhir.r4.model.CoverageEligibilityResponse)
- return CoverageEligibilityResponse40_50.convertCoverageEligibilityResponse((org.hl7.fhir.r4.model.CoverageEligibilityResponse) src);
+// if (src instanceof org.hl7.fhir.r4.model.CoverageEligibilityResponse)
+// return CoverageEligibilityResponse40_50.convertCoverageEligibilityResponse((org.hl7.fhir.r4.model.CoverageEligibilityResponse) src);
if (src instanceof org.hl7.fhir.r4.model.DetectedIssue)
return DetectedIssue40_50.convertDetectedIssue((org.hl7.fhir.r4.model.DetectedIssue) src);
if (src instanceof org.hl7.fhir.r4.model.Device)
@@ -3487,8 +3544,8 @@ public class VersionConvertor_40_50 {
return Endpoint40_50.convertEndpoint((org.hl7.fhir.r4.model.Endpoint) src);
if (src instanceof org.hl7.fhir.r4.model.EnrollmentRequest)
return EnrollmentRequest40_50.convertEnrollmentRequest((org.hl7.fhir.r4.model.EnrollmentRequest) src);
- if (src instanceof org.hl7.fhir.r4.model.EnrollmentResponse)
- return EnrollmentResponse40_50.convertEnrollmentResponse((org.hl7.fhir.r4.model.EnrollmentResponse) src);
+// if (src instanceof org.hl7.fhir.r4.model.EnrollmentResponse)
+// return EnrollmentResponse40_50.convertEnrollmentResponse((org.hl7.fhir.r4.model.EnrollmentResponse) src);
if (src instanceof org.hl7.fhir.r4.model.EpisodeOfCare)
return EpisodeOfCare40_50.convertEpisodeOfCare((org.hl7.fhir.r4.model.EpisodeOfCare) src);
if (src instanceof org.hl7.fhir.r4.model.EventDefinition)
@@ -3547,8 +3604,8 @@ public class VersionConvertor_40_50 {
return MedicationRequest40_50.convertMedicationRequest((org.hl7.fhir.r4.model.MedicationRequest) src);
if (src instanceof org.hl7.fhir.r4.model.MedicationStatement)
return MedicationStatement40_50.convertMedicationStatement((org.hl7.fhir.r4.model.MedicationStatement) src);
- if (src instanceof org.hl7.fhir.r4.model.MedicinalProduct)
- return MedicinalProductDefinition40_50.convertMedicinalProduct((org.hl7.fhir.r4.model.MedicinalProduct) src);
+// if (src instanceof org.hl7.fhir.r4.model.MedicinalProduct)
+// return MedicinalProductDefinition40_50.convertMedicinalProduct((org.hl7.fhir.r4.model.MedicinalProduct) src);
if (src instanceof org.hl7.fhir.r4.model.MessageDefinition)
return MessageDefinition40_50.convertMessageDefinition((org.hl7.fhir.r4.model.MessageDefinition) src);
if (src instanceof org.hl7.fhir.r4.model.MessageHeader)
@@ -3575,8 +3632,8 @@ public class VersionConvertor_40_50 {
return Patient40_50.convertPatient((org.hl7.fhir.r4.model.Patient) src);
if (src instanceof org.hl7.fhir.r4.model.PaymentNotice)
return PaymentNotice40_50.convertPaymentNotice((org.hl7.fhir.r4.model.PaymentNotice) src);
- if (src instanceof org.hl7.fhir.r4.model.PaymentReconciliation)
- return PaymentReconciliation40_50.convertPaymentReconciliation((org.hl7.fhir.r4.model.PaymentReconciliation) src);
+// if (src instanceof org.hl7.fhir.r4.model.PaymentReconciliation)
+// return PaymentReconciliation40_50.convertPaymentReconciliation((org.hl7.fhir.r4.model.PaymentReconciliation) src);
if (src instanceof org.hl7.fhir.r4.model.Person)
return Person40_50.convertPerson((org.hl7.fhir.r4.model.Person) src);
if (src instanceof org.hl7.fhir.r4.model.PlanDefinition)
@@ -3595,12 +3652,12 @@ public class VersionConvertor_40_50 {
return QuestionnaireResponse40_50.convertQuestionnaireResponse((org.hl7.fhir.r4.model.QuestionnaireResponse) src);
if (src instanceof org.hl7.fhir.r4.model.RelatedPerson)
return RelatedPerson40_50.convertRelatedPerson((org.hl7.fhir.r4.model.RelatedPerson) src);
- if (src instanceof org.hl7.fhir.r4.model.RequestGroup)
- return RequestGroup40_50.convertRequestGroup((org.hl7.fhir.r4.model.RequestGroup) src);
- if (src instanceof org.hl7.fhir.r4.model.ResearchStudy)
- return ResearchStudy40_50.convertResearchStudy((org.hl7.fhir.r4.model.ResearchStudy) src);
- if (src instanceof org.hl7.fhir.r4.model.ResearchSubject)
- return ResearchSubject40_50.convertResearchSubject((org.hl7.fhir.r4.model.ResearchSubject) src);
+// if (src instanceof org.hl7.fhir.r4.model.RequestGroup)
+// return RequestGroup40_50.convertRequestGroup((org.hl7.fhir.r4.model.RequestGroup) src);
+// if (src instanceof org.hl7.fhir.r4.model.ResearchStudy)
+// return ResearchStudy40_50.convertResearchStudy((org.hl7.fhir.r4.model.ResearchStudy) src);
+// if (src instanceof org.hl7.fhir.r4.model.ResearchSubject)
+// return ResearchSubject40_50.convertResearchSubject((org.hl7.fhir.r4.model.ResearchSubject) src);
if (src instanceof org.hl7.fhir.r4.model.RiskAssessment)
return RiskAssessment40_50.convertRiskAssessment((org.hl7.fhir.r4.model.RiskAssessment) src);
if (src instanceof org.hl7.fhir.r4.model.Schedule)
@@ -3647,10 +3704,18 @@ public class VersionConvertor_40_50 {
return VerificationResult40_50.convertVerificationResult((org.hl7.fhir.r4.model.VerificationResult) src);
if (src instanceof org.hl7.fhir.r4.model.VisionPrescription)
return VisionPrescription40_50.convertVisionPrescription((org.hl7.fhir.r4.model.VisionPrescription) src);
- throw new FHIRException("Unknown resource " + src.fhirType());
+ if (advisor.failFastOnNullOrUnknownEntry()){
+ throw new FHIRException("Unknown resource " + src.fhirType());
+ } else {
+ return null;
+ }
}
public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src) throws FHIRException {
+ return convertResource(src, new BaseAdvisor_40_50());
+ }
+
+ public static org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.r5.model.Resource src, BaseAdvisor_40_50 advisor) throws FHIRException {
if (src == null) return null;
if (src instanceof org.hl7.fhir.r5.model.Parameters)
return Parameters40_50.convertParameters((org.hl7.fhir.r5.model.Parameters) src);
@@ -3712,8 +3777,8 @@ public class VersionConvertor_40_50 {
return Coverage40_50.convertCoverage((org.hl7.fhir.r5.model.Coverage) src);
if (src instanceof org.hl7.fhir.r5.model.CoverageEligibilityRequest)
return CoverageEligibilityRequest40_50.convertCoverageEligibilityRequest((org.hl7.fhir.r5.model.CoverageEligibilityRequest) src);
- if (src instanceof org.hl7.fhir.r5.model.CoverageEligibilityResponse)
- return CoverageEligibilityResponse40_50.convertCoverageEligibilityResponse((org.hl7.fhir.r5.model.CoverageEligibilityResponse) src);
+// if (src instanceof org.hl7.fhir.r5.model.CoverageEligibilityResponse)
+// return CoverageEligibilityResponse40_50.convertCoverageEligibilityResponse((org.hl7.fhir.r5.model.CoverageEligibilityResponse) src);
if (src instanceof org.hl7.fhir.r5.model.DetectedIssue)
return DetectedIssue40_50.convertDetectedIssue((org.hl7.fhir.r5.model.DetectedIssue) src);
if (src instanceof org.hl7.fhir.r5.model.Device)
@@ -3724,8 +3789,8 @@ public class VersionConvertor_40_50 {
return DeviceMetric40_50.convertDeviceMetric((org.hl7.fhir.r5.model.DeviceMetric) src);
if (src instanceof org.hl7.fhir.r5.model.DeviceRequest)
return DeviceRequest40_50.convertDeviceRequest((org.hl7.fhir.r5.model.DeviceRequest) src);
- if (src instanceof org.hl7.fhir.r5.model.DeviceUseStatement)
- return DeviceUseStatement40_50.convertDeviceUseStatement((org.hl7.fhir.r5.model.DeviceUseStatement) src);
+ if (src instanceof org.hl7.fhir.r5.model.DeviceUsage)
+ return DeviceUseStatement40_50.convertDeviceUseStatement((org.hl7.fhir.r5.model.DeviceUsage) src);
if (src instanceof org.hl7.fhir.r5.model.DiagnosticReport)
return DiagnosticReport40_50.convertDiagnosticReport((org.hl7.fhir.r5.model.DiagnosticReport) src);
if (src instanceof org.hl7.fhir.r5.model.DocumentManifest)
@@ -3738,8 +3803,8 @@ public class VersionConvertor_40_50 {
return Endpoint40_50.convertEndpoint((org.hl7.fhir.r5.model.Endpoint) src);
if (src instanceof org.hl7.fhir.r5.model.EnrollmentRequest)
return EnrollmentRequest40_50.convertEnrollmentRequest((org.hl7.fhir.r5.model.EnrollmentRequest) src);
- if (src instanceof org.hl7.fhir.r5.model.EnrollmentResponse)
- return EnrollmentResponse40_50.convertEnrollmentResponse((org.hl7.fhir.r5.model.EnrollmentResponse) src);
+// if (src instanceof org.hl7.fhir.r5.model.EnrollmentResponse)
+// return EnrollmentResponse40_50.convertEnrollmentResponse((org.hl7.fhir.r5.model.EnrollmentResponse) src);
if (src instanceof org.hl7.fhir.r5.model.EpisodeOfCare)
return EpisodeOfCare40_50.convertEpisodeOfCare((org.hl7.fhir.r5.model.EpisodeOfCare) src);
if (src instanceof org.hl7.fhir.r5.model.EventDefinition)
@@ -3799,8 +3864,8 @@ public class VersionConvertor_40_50 {
return MedicationRequest40_50.convertMedicationRequest((org.hl7.fhir.r5.model.MedicationRequest) src);
if (src instanceof org.hl7.fhir.r5.model.MedicationUsage)
return MedicationStatement40_50.convertMedicationStatement((org.hl7.fhir.r5.model.MedicationUsage) src);
- if (src instanceof org.hl7.fhir.r5.model.MedicinalProductDefinition)
- return MedicinalProductDefinition40_50.convertMedicinalProductDefinition((org.hl7.fhir.r5.model.MedicinalProductDefinition) src);
+// if (src instanceof org.hl7.fhir.r5.model.MedicinalProductDefinition)
+// return MedicinalProductDefinition40_50.convertMedicinalProductDefinition((org.hl7.fhir.r5.model.MedicinalProductDefinition) src);
if (src instanceof org.hl7.fhir.r5.model.MessageDefinition)
return MessageDefinition40_50.convertMessageDefinition((org.hl7.fhir.r5.model.MessageDefinition) src);
if (src instanceof org.hl7.fhir.r5.model.MessageHeader)
@@ -3827,8 +3892,8 @@ public class VersionConvertor_40_50 {
return Patient40_50.convertPatient((org.hl7.fhir.r5.model.Patient) src);
if (src instanceof org.hl7.fhir.r5.model.PaymentNotice)
return PaymentNotice40_50.convertPaymentNotice((org.hl7.fhir.r5.model.PaymentNotice) src);
- if (src instanceof org.hl7.fhir.r5.model.PaymentReconciliation)
- return PaymentReconciliation40_50.convertPaymentReconciliation((org.hl7.fhir.r5.model.PaymentReconciliation) src);
+// if (src instanceof org.hl7.fhir.r5.model.PaymentReconciliation)
+// return PaymentReconciliation40_50.convertPaymentReconciliation((org.hl7.fhir.r5.model.PaymentReconciliation) src);
if (src instanceof org.hl7.fhir.r5.model.Person)
return Person40_50.convertPerson((org.hl7.fhir.r5.model.Person) src);
if (src instanceof org.hl7.fhir.r5.model.PlanDefinition)
@@ -3847,12 +3912,12 @@ public class VersionConvertor_40_50 {
return QuestionnaireResponse40_50.convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src);
if (src instanceof org.hl7.fhir.r5.model.RelatedPerson)
return RelatedPerson40_50.convertRelatedPerson((org.hl7.fhir.r5.model.RelatedPerson) src);
- if (src instanceof org.hl7.fhir.r5.model.RequestGroup)
- return RequestGroup40_50.convertRequestGroup((org.hl7.fhir.r5.model.RequestGroup) src);
- if (src instanceof org.hl7.fhir.r5.model.ResearchStudy)
- return ResearchStudy40_50.convertResearchStudy((org.hl7.fhir.r5.model.ResearchStudy) src);
- if (src instanceof org.hl7.fhir.r5.model.ResearchSubject)
- return ResearchSubject40_50.convertResearchSubject((org.hl7.fhir.r5.model.ResearchSubject) src);
+// if (src instanceof org.hl7.fhir.r5.model.RequestGroup)
+// return RequestGroup40_50.convertRequestGroup((org.hl7.fhir.r5.model.RequestGroup) src);
+// if (src instanceof org.hl7.fhir.r5.model.ResearchStudy)
+// return ResearchStudy40_50.convertResearchStudy((org.hl7.fhir.r5.model.ResearchStudy) src);
+// if (src instanceof org.hl7.fhir.r5.model.ResearchSubject)
+// return ResearchSubject40_50.convertResearchSubject((org.hl7.fhir.r5.model.ResearchSubject) src);
if (src instanceof org.hl7.fhir.r5.model.RiskAssessment)
return RiskAssessment40_50.convertRiskAssessment((org.hl7.fhir.r5.model.RiskAssessment) src);
if (src instanceof org.hl7.fhir.r5.model.Schedule)
@@ -3899,7 +3964,11 @@ public class VersionConvertor_40_50 {
return VerificationResult40_50.convertVerificationResult((org.hl7.fhir.r5.model.VerificationResult) src);
if (src instanceof org.hl7.fhir.r5.model.VisionPrescription)
return VisionPrescription40_50.convertVisionPrescription((org.hl7.fhir.r5.model.VisionPrescription) src);
- throw new FHIRException("Unknown resource " + src.fhirType());
+ if (advisor.failFastOnNullOrUnknownEntry()){
+ throw new FHIRException("Unknown resource " + src.fhirType());
+ } else {
+ return null;
+ }
}
protected static org.hl7.fhir.r5.model.CodeType convertResourceEnum(org.hl7.fhir.r4.model.CodeType src) {
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_Base.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_Base.java
new file mode 100644
index 000000000..34298c5f6
--- /dev/null
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_Base.java
@@ -0,0 +1,13 @@
+package org.hl7.fhir.convertors;
+
+public class VersionConvertor_Base {
+
+ public static org.hl7.fhir.r5.model.CodeableConcept convertAppointmentPriorityToR5(int priority) {
+ return null;
+ }
+
+ public static int convertAppointmentPriorityFromR5(org.hl7.fhir.r5.model.CodeableConcept priority) {
+ return 0;
+ }
+
+}
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Bundle10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Bundle10_30.java
index 6ad1c12a9..7d457ab76 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Bundle10_30.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/Bundle10_30.java
@@ -1,8 +1,9 @@
package org.hl7.fhir.convertors.conv10_30;
-import org.hl7.fhir.convertors.VersionConvertorAdvisor30;
import org.hl7.fhir.convertors.VersionConvertor_10_30;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_30;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.FhirPublication;
public class Bundle10_30 {
@@ -22,7 +23,7 @@ public class Bundle10_30 {
return tgt;
}
- public static org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src, VersionConvertorAdvisor30 advisor) throws FHIRException {
+ public static org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src, BaseAdvisor_10_30 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.Bundle tgt = new org.hl7.fhir.dstu2.model.Bundle();
@@ -42,19 +43,17 @@ public class Bundle10_30 {
return convertBundle(src, null);
}
- public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src, VersionConvertorAdvisor30 advisor) throws FHIRException {
+ public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src, BaseAdvisor_10_30 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- if (advisor.ignoreEntry(src))
+ if (advisor.ignoreEntry(src, FhirPublication.DSTU2))
return null;
org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent();
VersionConvertor_10_30.copyElement(src, tgt);
for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t));
if (src.hasFullUrlElement())
tgt.setFullUrlElement(VersionConvertor_10_30.convertUri(src.getFullUrlElement()));
- org.hl7.fhir.dstu2.model.Resource res = advisor.convert(src.getResource());
- if (res == null)
- res = VersionConvertor_10_30.convertResource(src.getResource());
+ org.hl7.fhir.dstu2.model.Resource res = VersionConvertor_10_30.convertResource(src.getResource());
tgt.setResource(res);
if (src.hasSearch())
tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch()));
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ConceptMap10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ConceptMap10_30.java
index d58591af4..b311ba4c1 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ConceptMap10_30.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ConceptMap10_30.java
@@ -2,6 +2,8 @@ package org.hl7.fhir.convertors.conv10_30;
import java.util.ArrayList;
import java.util.List;
+
+import org.hl7.fhir.convertors.SourceElementComponentWrapper;
import org.hl7.fhir.convertors.VersionConvertor_10_30;
import org.hl7.fhir.dstu3.model.ConceptMap;
import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent;
@@ -85,8 +87,8 @@ public class ConceptMap10_30 {
if (src.hasTarget())
tgt.setTarget(VersionConvertor_10_30.convertType(src.getTarget()));
for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) {
- List ws = convertSourceElementComponent(t);
- for (VersionConvertor_10_30.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp);
+ List> ws = convertSourceElementComponent(t);
+ for (SourceElementComponentWrapper w : ws) getGroup(tgt, w.getSource(), w.getTarget()).addElement(w.getComp());
}
return tgt;
}
@@ -221,8 +223,8 @@ public class ConceptMap10_30 {
return tgt;
}
- public static List convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException {
- List res = new ArrayList();
+ public static List> convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException {
+ List> res = new ArrayList<>();
if (src == null || src.isEmpty())
return res;
for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) {
@@ -230,7 +232,7 @@ public class ConceptMap10_30 {
VersionConvertor_10_30.copyElement(src, tgt);
tgt.setCode(src.getCode());
tgt.addTarget(convertTargetElementComponent(t));
- res.add(new VersionConvertor_10_30.SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem()));
+ res.add(new SourceElementComponentWrapper<>(tgt, src.getCodeSystem(), t.getCodeSystem()));
}
return res;
}
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ValueSet10_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ValueSet10_30.java
index ba503fcc5..5faee1986 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ValueSet10_30.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_30/ValueSet10_30.java
@@ -1,8 +1,9 @@
package org.hl7.fhir.convertors.conv10_30;
import java.util.List;
-import org.hl7.fhir.convertors.VersionConvertorAdvisor30;
+
import org.hl7.fhir.convertors.VersionConvertor_10_30;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_30;
import org.hl7.fhir.dstu2.model.ValueSet;
import org.hl7.fhir.dstu3.model.CodeSystem;
import org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode;
@@ -184,7 +185,7 @@ public class ValueSet10_30 {
return tgt;
}
- public static org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src, VersionConvertorAdvisor30 advisor) throws FHIRException {
+ public static org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src, BaseAdvisor_10_30 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu3.model.ValueSet tgt = new org.hl7.fhir.dstu3.model.ValueSet();
@@ -225,6 +226,7 @@ public class ValueSet10_30 {
tgt.setCompose(convertValueSetComposeComponent(src.getCompose()));
tgt.getCompose().setLockedDate(src.getLockedDate());
}
+ //TODO
if (src.hasCodeSystem() && advisor != null) {
org.hl7.fhir.dstu3.model.CodeSystem tgtcs = new org.hl7.fhir.dstu3.model.CodeSystem();
VersionConvertor_10_30.copyDomainResource(src, tgtcs);
@@ -258,7 +260,7 @@ public class ValueSet10_30 {
return tgt;
}
- public static org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src, VersionConvertorAdvisor30 advisor) throws FHIRException {
+ public static org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src, BaseAdvisor_10_30 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.ValueSet tgt = new org.hl7.fhir.dstu2.model.ValueSet();
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Bundle10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Bundle10_40.java
index 35b7a9d56..f054ec77e 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Bundle10_40.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Bundle10_40.java
@@ -1,8 +1,9 @@
package org.hl7.fhir.convertors.conv10_40;
-import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_40;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.FhirPublication;
public class Bundle10_40 {
@@ -22,7 +23,7 @@ public class Bundle10_40 {
return tgt;
}
- public static org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.r4.model.Bundle src, VersionConvertorAdvisor40 advisor) throws FHIRException {
+ public static org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.r4.model.Bundle src, BaseAdvisor_10_40 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.Bundle tgt = new org.hl7.fhir.dstu2.model.Bundle();
@@ -61,19 +62,17 @@ public class Bundle10_40 {
return tgt;
}
- public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src, VersionConvertorAdvisor40 advisor) throws FHIRException {
+ public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r4.model.Bundle.BundleEntryComponent src, BaseAdvisor_10_40 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- if (advisor.ignoreEntry(src))
+ if (advisor.ignoreEntry(src, FhirPublication.DSTU2))
return null;
org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent();
VersionConvertor_10_40.copyElement(src, tgt);
for (org.hl7.fhir.r4.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t));
if (src.hasFullUrlElement())
tgt.setFullUrlElement(VersionConvertor_10_40.convertUri(src.getFullUrlElement()));
- org.hl7.fhir.dstu2.model.Resource res = advisor.convertR2(src.getResource());
- if (res == null)
- res = VersionConvertor_10_40.convertResource(src.getResource());
+ org.hl7.fhir.dstu2.model.Resource res = VersionConvertor_10_40.convertResource(src.getResource());
tgt.setResource(res);
if (src.hasSearch())
tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch()));
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ConceptMap10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ConceptMap10_40.java
index 625a624c4..1b4634662 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ConceptMap10_40.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ConceptMap10_40.java
@@ -2,6 +2,8 @@ package org.hl7.fhir.convertors.conv10_40;
import java.util.ArrayList;
import java.util.List;
+
+import org.hl7.fhir.convertors.SourceElementComponentWrapper;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.CanonicalType;
@@ -47,8 +49,8 @@ public class ConceptMap10_40 {
r = VersionConvertor_10_40.convertType(src.getTarget());
tgt.setTarget(r instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) r).getReference()) : r);
for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) {
- List ws = convertSourceElementComponent(t);
- for (VersionConvertor_10_40.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp);
+ List> ws = convertSourceElementComponent(t);
+ for (SourceElementComponentWrapper w : ws) getGroup(tgt, w.getSource(), w.getTarget()).addElement(w.getComp());
}
return tgt;
}
@@ -222,8 +224,8 @@ public class ConceptMap10_40 {
return tgt;
}
- public static List convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException {
- List res = new ArrayList();
+ public static List> convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException {
+ List> res = new ArrayList<>();
if (src == null || src.isEmpty())
return res;
for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) {
@@ -231,7 +233,7 @@ public class ConceptMap10_40 {
VersionConvertor_10_40.copyElement(src, tgt);
tgt.setCode(src.getCode());
tgt.addTarget(convertTargetElementComponent(t));
- res.add(new VersionConvertor_10_40.SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem()));
+ res.add(new SourceElementComponentWrapper<>(tgt, src.getCodeSystem(), t.getCodeSystem()));
}
return res;
}
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Conformance10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Conformance10_40.java
index 0b4168acf..cebae00a2 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Conformance10_40.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Conformance10_40.java
@@ -2,6 +2,7 @@ package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.VersionConvertorConstants;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_40;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent;
import org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent;
@@ -53,11 +54,11 @@ public class Conformance10_40 {
return tgt;
}
- public static org.hl7.fhir.dstu2.model.Conformance convertConformance(org.hl7.fhir.r4.model.CapabilityStatement src) throws FHIRException {
+ public static org.hl7.fhir.dstu2.model.Conformance convertConformance(org.hl7.fhir.r4.model.CapabilityStatement src, BaseAdvisor_10_40 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance();
- VersionConvertor_10_40.copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown");
+ VersionConvertor_10_40.copyDomainResource(src, tgt, "http://hl7.org/fhir/3.0/StructureDefinition/extension-CapabilityStatement.acceptUnknown");
if (src.hasUrlElement())
tgt.setUrlElement(VersionConvertor_10_40.convertUri(src.getUrlElement()));
if (src.hasVersionElement())
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MedicationRequest10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MedicationRequest10_40.java
index e0e3bbed0..fd44431f6 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MedicationRequest10_40.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/MedicationRequest10_40.java
@@ -18,6 +18,8 @@ public class MedicationRequest10_40 {
tgt.setAuthoredOnElement(VersionConvertor_10_40.convertDateTime(src.getDateWrittenElement()));
if (src.hasStatus())
tgt.setStatus(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.fromCode(src.getStatus().toCode()));
+ else
+ tgt.setStatus(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.UNKNOWN);
if (src.hasPatient())
tgt.setSubject(VersionConvertor_10_40.convertReference(src.getPatient()));
if (src.hasPrescriber())
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Questionnaire10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Questionnaire10_40.java
index d8492ab63..695c87ee8 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Questionnaire10_40.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/Questionnaire10_40.java
@@ -1,318 +1,336 @@
package org.hl7.fhir.convertors.conv10_40;
import org.hl7.fhir.convertors.VersionConvertor_10_40;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_40;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.ContactDetail;
import org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemAnswerOptionComponent;
public class Questionnaire10_40 {
- public static org.hl7.fhir.dstu2.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r4.model.Questionnaire src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.dstu2.model.Questionnaire tgt = new org.hl7.fhir.dstu2.model.Questionnaire();
- VersionConvertor_10_40.copyDomainResource(src, tgt);
- for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t));
- if (src.hasVersionElement())
- tgt.setVersionElement(VersionConvertor_10_40.convertString(src.getVersionElement()));
- if (src.hasStatus())
- tgt.setStatusElement(convertQuestionnaireStatus(src.getStatusElement()));
- if (src.hasDate())
- tgt.setDateElement(VersionConvertor_10_40.convertDateTime(src.getDateElement()));
- if (src.hasPublisherElement())
- tgt.setPublisherElement(VersionConvertor_10_40.convertString(src.getPublisherElement()));
- for (ContactDetail t : src.getContact()) for (org.hl7.fhir.r4.model.ContactPoint t1 : t.getTelecom()) tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t1));
- org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = tgt.getGroup();
- root.setTitle(src.getTitle());
- for (org.hl7.fhir.r4.model.Coding t : src.getCode()) {
- root.addConcept(VersionConvertor_10_40.convertCoding(t));
+ public static org.hl7.fhir.dstu2.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r4.model.Questionnaire src, BaseAdvisor_10_40 advisor) {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.dstu2.model.Questionnaire tgt = new org.hl7.fhir.dstu2.model.Questionnaire();
+ VersionConvertor_10_40.copyDomainResource(src, tgt, advisor);
+ for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t));
+ if (src.hasVersionElement())
+ tgt.setVersionElement(VersionConvertor_10_40.convertString(src.getVersionElement()));
+ if (src.hasStatus())
+ tgt.setStatusElement(convertQuestionnaireStatus(src.getStatusElement()));
+ if (src.hasDate())
+ tgt.setDateElement(VersionConvertor_10_40.convertDateTime(src.getDateElement()));
+ if (src.hasPublisherElement())
+ tgt.setPublisherElement(VersionConvertor_10_40.convertString(src.getPublisherElement()));
+ for (ContactDetail t : src.getContact())
+ for (org.hl7.fhir.r4.model.ContactPoint t1 : t.getTelecom())
+ tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(t1));
+ org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = tgt.getGroup();
+ root.setTitle(src.getTitle());
+ for (org.hl7.fhir.r4.model.Coding t : src.getCode()) {
+ root.addConcept(VersionConvertor_10_40.convertCoding(t));
+ }
+ for (org.hl7.fhir.r4.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue());
+ for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem())
+ if (t.getType() == org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP)
+ root.addGroup(convertQuestionnaireGroupComponent(t));
+ else
+ root.addQuestion(convertQuestionnaireQuestionComponent(t));
+ return tgt;
+ }
+
+ public static org.hl7.fhir.r4.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2.model.Questionnaire src) throws FHIRException {
+ return convertQuestionnaire(src, null);
+ }
+
+ public static org.hl7.fhir.r4.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2.model.Questionnaire src, BaseAdvisor_10_40 advisor) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Questionnaire tgt = new org.hl7.fhir.r4.model.Questionnaire();
+ VersionConvertor_10_40.copyDomainResource(src, tgt);
+ for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t));
+ if (src.hasVersionElement())
+ tgt.setVersionElement(VersionConvertor_10_40.convertString(src.getVersionElement()));
+ if (src.hasStatus())
+ tgt.setStatusElement(convertQuestionnaireStatus(src.getStatusElement()));
+ if (src.hasDate())
+ tgt.setDateElement(VersionConvertor_10_40.convertDateTime(src.getDateElement()));
+ if (src.hasPublisherElement())
+ tgt.setPublisherElement(VersionConvertor_10_40.convertString(src.getPublisherElement()));
+ for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom())
+ tgt.addContact(convertQuestionnaireContactComponent(t));
+ org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = src.getGroup();
+ tgt.setTitle(root.getTitle());
+ for (org.hl7.fhir.dstu2.model.Coding t : root.getConcept()) tgt.addCode(VersionConvertor_10_40.convertCoding(t));
+ for (org.hl7.fhir.dstu2.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue());
+ tgt.addItem(convertQuestionnaireGroupComponent(root));
+ return tgt;
+ }
+
+ public static org.hl7.fhir.r4.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
+ VersionConvertor_10_40.copyElement(src, tgt);
+ tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(src));
+ return tgt;
+ }
+
+ public static org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent convertQuestionnaireGroupComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent();
+ VersionConvertor_10_40.copyElement(src, tgt);
+ if (src.hasLinkIdElement())
+ tgt.setLinkIdElement(VersionConvertor_10_40.convertString(src.getLinkIdElement()));
+ for (org.hl7.fhir.r4.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_10_40.convertCoding(t));
+ if (src.hasTextElement())
+ tgt.setTextElement(VersionConvertor_10_40.convertString(src.getTextElement()));
+ if (src.hasRequiredElement())
+ tgt.setRequiredElement(VersionConvertor_10_40.convertBoolean(src.getRequiredElement()));
+ if (src.hasRepeatsElement())
+ tgt.setRepeatsElement(VersionConvertor_10_40.convertBoolean(src.getRepeatsElement()));
+ for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem())
+ if (t.getType() == org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP)
+ tgt.addGroup(convertQuestionnaireGroupComponent(t));
+ else
+ tgt.addQuestion(convertQuestionnaireQuestionComponent(t));
+ return tgt;
+ }
+
+ public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireGroupComponent(org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent();
+ VersionConvertor_10_40.copyElement(src, tgt);
+ if (src.hasLinkIdElement())
+ tgt.setLinkIdElement(VersionConvertor_10_40.convertString(src.getLinkIdElement()));
+ for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_10_40.convertCoding(t));
+ if (src.hasTextElement())
+ tgt.setTextElement(VersionConvertor_10_40.convertString(src.getTextElement()));
+ tgt.setType(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP);
+ if (src.hasRequiredElement())
+ tgt.setRequiredElement(VersionConvertor_10_40.convertBoolean(src.getRequiredElement()));
+ if (src.hasRepeatsElement())
+ tgt.setRepeatsElement(VersionConvertor_10_40.convertBoolean(src.getRepeatsElement()));
+ for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup())
+ tgt.addItem(convertQuestionnaireGroupComponent(t));
+ for (org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent t : src.getQuestion())
+ tgt.addItem(convertQuestionnaireQuestionComponent(t));
+ return tgt;
+ }
+
+ static public org.hl7.fhir.dstu2.model.Enumeration convertQuestionnaireItemType(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormatEnumFactory());
+ VersionConvertor_10_40.copyElement(src, tgt);
+ switch (src.getValue()) {
+ case BOOLEAN:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.BOOLEAN);
+ break;
+ case DECIMAL:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DECIMAL);
+ break;
+ case INTEGER:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.INTEGER);
+ break;
+ case DATE:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATE);
+ break;
+ case DATETIME:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATETIME);
+ break;
+ case TIME:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TIME);
+ break;
+ case STRING:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.STRING);
+ break;
+ case TEXT:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TEXT);
+ break;
+ case URL:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.URL);
+ break;
+ case CHOICE:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.CHOICE);
+ break;
+ case OPENCHOICE:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.OPENCHOICE);
+ break;
+ case ATTACHMENT:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.ATTACHMENT);
+ break;
+ case REFERENCE:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.REFERENCE);
+ break;
+ case QUANTITY:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.QUANTITY);
+ break;
+ default:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.NULL);
+ break;
+ }
+ return tgt;
+ }
+
+ public static org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent();
+ VersionConvertor_10_40.copyElement(src, tgt);
+ if (src.hasLinkIdElement())
+ tgt.setLinkIdElement(VersionConvertor_10_40.convertString(src.getLinkIdElement()));
+ for (org.hl7.fhir.r4.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_10_40.convertCoding(t));
+ if (src.hasTextElement())
+ tgt.setTextElement(VersionConvertor_10_40.convertString(src.getTextElement()));
+ if (src.hasType())
+ tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement()));
+ if (src.hasRequiredElement())
+ tgt.setRequiredElement(VersionConvertor_10_40.convertBoolean(src.getRequiredElement()));
+ if (src.hasRepeatsElement())
+ tgt.setRepeatsElement(VersionConvertor_10_40.convertBoolean(src.getRepeatsElement()));
+ if (src.hasAnswerValueSetElement())
+ tgt.setOptions(VersionConvertor_10_40.convertCanonicalToReference(src.getAnswerValueSetElement()));
+ for (QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption())
+ if (t.hasValueCoding())
+ try {
+ tgt.addOption(VersionConvertor_10_40.convertCoding(t.getValueCoding()));
+ } catch (org.hl7.fhir.exceptions.FHIRException e) {
+ throw new FHIRException(e);
}
- for (org.hl7.fhir.r4.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue());
- for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) if (t.getType() == org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP)
- root.addGroup(convertQuestionnaireGroupComponent(t));
- else
- root.addQuestion(convertQuestionnaireQuestionComponent(t));
- return tgt;
- }
+ for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem())
+ tgt.addGroup(convertQuestionnaireGroupComponent(t));
+ return tgt;
+ }
- public static org.hl7.fhir.r4.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2.model.Questionnaire src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Questionnaire tgt = new org.hl7.fhir.r4.model.Questionnaire();
- VersionConvertor_10_40.copyDomainResource(src, tgt);
- for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t));
- if (src.hasVersionElement())
- tgt.setVersionElement(VersionConvertor_10_40.convertString(src.getVersionElement()));
- if (src.hasStatus())
- tgt.setStatusElement(convertQuestionnaireStatus(src.getStatusElement()));
- if (src.hasDate())
- tgt.setDateElement(VersionConvertor_10_40.convertDateTime(src.getDateElement()));
- if (src.hasPublisherElement())
- tgt.setPublisherElement(VersionConvertor_10_40.convertString(src.getPublisherElement()));
- for (org.hl7.fhir.dstu2.model.ContactPoint t : src.getTelecom()) tgt.addContact(convertQuestionnaireContactComponent(t));
- org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent root = src.getGroup();
- tgt.setTitle(root.getTitle());
- for (org.hl7.fhir.dstu2.model.Coding t : root.getConcept()) tgt.addCode(VersionConvertor_10_40.convertCoding(t));
- for (org.hl7.fhir.dstu2.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue());
- tgt.addItem(convertQuestionnaireGroupComponent(root));
- return tgt;
- }
+ public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent();
+ VersionConvertor_10_40.copyElement(src, tgt);
+ if (src.hasLinkIdElement())
+ tgt.setLinkIdElement(VersionConvertor_10_40.convertString(src.getLinkIdElement()));
+ for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_10_40.convertCoding(t));
+ if (src.hasTextElement())
+ tgt.setTextElement(VersionConvertor_10_40.convertString(src.getTextElement()));
+ if (src.hasType())
+ tgt.setTypeElement(convertQuestionnaireQuestionType(src.getTypeElement()));
+ if (src.hasRequiredElement())
+ tgt.setRequiredElement(VersionConvertor_10_40.convertBoolean(src.getRequiredElement()));
+ if (src.hasRepeatsElement())
+ tgt.setRepeatsElement(VersionConvertor_10_40.convertBoolean(src.getRepeatsElement()));
+ if (src.hasOptions())
+ tgt.setAnswerValueSetElement(VersionConvertor_10_40.convertReferenceToCanonical(src.getOptions()));
+ for (org.hl7.fhir.dstu2.model.Coding t : src.getOption())
+ tgt.addAnswerOption().setValue(VersionConvertor_10_40.convertCoding(t));
+ for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup())
+ tgt.addItem(convertQuestionnaireGroupComponent(t));
+ return tgt;
+ }
- public static org.hl7.fhir.r4.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2.model.ContactPoint src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
- VersionConvertor_10_40.copyElement(src, tgt);
- tgt.addTelecom(VersionConvertor_10_40.convertContactPoint(src));
- return tgt;
+ static public org.hl7.fhir.r4.model.Enumeration convertQuestionnaireQuestionType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
+ VersionConvertor_10_40.copyElement(src, tgt);
+ switch (src.getValue()) {
+ case BOOLEAN:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.BOOLEAN);
+ break;
+ case DECIMAL:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DECIMAL);
+ break;
+ case INTEGER:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.INTEGER);
+ break;
+ case DATE:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATE);
+ break;
+ case DATETIME:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME);
+ break;
+ case INSTANT:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME);
+ break;
+ case TIME:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TIME);
+ break;
+ case STRING:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.STRING);
+ break;
+ case TEXT:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TEXT);
+ break;
+ case URL:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL);
+ break;
+ case CHOICE:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE);
+ break;
+ case OPENCHOICE:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE);
+ break;
+ case ATTACHMENT:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT);
+ break;
+ case REFERENCE:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.REFERENCE);
+ break;
+ case QUANTITY:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUANTITY);
+ break;
+ default:
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.NULL);
+ break;
}
+ return tgt;
+ }
- public static org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent convertQuestionnaireGroupComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent();
- VersionConvertor_10_40.copyElement(src, tgt);
- if (src.hasLinkIdElement())
- tgt.setLinkIdElement(VersionConvertor_10_40.convertString(src.getLinkIdElement()));
- for (org.hl7.fhir.r4.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_10_40.convertCoding(t));
- if (src.hasTextElement())
- tgt.setTextElement(VersionConvertor_10_40.convertString(src.getTextElement()));
- if (src.hasRequiredElement())
- tgt.setRequiredElement(VersionConvertor_10_40.convertBoolean(src.getRequiredElement()));
- if (src.hasRepeatsElement())
- tgt.setRepeatsElement(VersionConvertor_10_40.convertBoolean(src.getRepeatsElement()));
- for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) if (t.getType() == org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP)
- tgt.addGroup(convertQuestionnaireGroupComponent(t));
- else
- tgt.addQuestion(convertQuestionnaireQuestionComponent(t));
- return tgt;
+ static public org.hl7.fhir.dstu2.model.Enumeration convertQuestionnaireStatus(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatusEnumFactory());
+ VersionConvertor_10_40.copyElement(src, tgt);
+ switch (src.getValue()) {
+ case DRAFT:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.DRAFT);
+ break;
+ case ACTIVE:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.PUBLISHED);
+ break;
+ case RETIRED:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.RETIRED);
+ break;
+ default:
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.NULL);
+ break;
}
+ return tgt;
+ }
- public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireGroupComponent(org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent();
- VersionConvertor_10_40.copyElement(src, tgt);
- if (src.hasLinkIdElement())
- tgt.setLinkIdElement(VersionConvertor_10_40.convertString(src.getLinkIdElement()));
- for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_10_40.convertCoding(t));
- if (src.hasTextElement())
- tgt.setTextElement(VersionConvertor_10_40.convertString(src.getTextElement()));
- tgt.setType(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.GROUP);
- if (src.hasRequiredElement())
- tgt.setRequiredElement(VersionConvertor_10_40.convertBoolean(src.getRequiredElement()));
- if (src.hasRepeatsElement())
- tgt.setRepeatsElement(VersionConvertor_10_40.convertBoolean(src.getRepeatsElement()));
- for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) tgt.addItem(convertQuestionnaireGroupComponent(t));
- for (org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent t : src.getQuestion()) tgt.addItem(convertQuestionnaireQuestionComponent(t));
- return tgt;
- }
-
- static public org.hl7.fhir.dstu2.model.Enumeration convertQuestionnaireItemType(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormatEnumFactory());
- VersionConvertor_10_40.copyElement(src, tgt);
- switch(src.getValue()) {
- case BOOLEAN:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.BOOLEAN);
- break;
- case DECIMAL:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DECIMAL);
- break;
- case INTEGER:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.INTEGER);
- break;
- case DATE:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATE);
- break;
- case DATETIME:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.DATETIME);
- break;
- case TIME:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TIME);
- break;
- case STRING:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.STRING);
- break;
- case TEXT:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.TEXT);
- break;
- case URL:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.URL);
- break;
- case CHOICE:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.CHOICE);
- break;
- case OPENCHOICE:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.OPENCHOICE);
- break;
- case ATTACHMENT:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.ATTACHMENT);
- break;
- case REFERENCE:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.REFERENCE);
- break;
- case QUANTITY:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.QUANTITY);
- break;
- default:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.NULL);
- break;
- }
- return tgt;
- }
-
- public static org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent tgt = new org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent();
- VersionConvertor_10_40.copyElement(src, tgt);
- if (src.hasLinkIdElement())
- tgt.setLinkIdElement(VersionConvertor_10_40.convertString(src.getLinkIdElement()));
- for (org.hl7.fhir.r4.model.Coding t : src.getCode()) tgt.addConcept(VersionConvertor_10_40.convertCoding(t));
- if (src.hasTextElement())
- tgt.setTextElement(VersionConvertor_10_40.convertString(src.getTextElement()));
- if (src.hasType())
- tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement()));
- if (src.hasRequiredElement())
- tgt.setRequiredElement(VersionConvertor_10_40.convertBoolean(src.getRequiredElement()));
- if (src.hasRepeatsElement())
- tgt.setRepeatsElement(VersionConvertor_10_40.convertBoolean(src.getRepeatsElement()));
- if (src.hasAnswerValueSetElement())
- tgt.setOptions(VersionConvertor_10_40.convertCanonicalToReference(src.getAnswerValueSetElement()));
- for (QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) if (t.hasValueCoding())
- try {
- tgt.addOption(VersionConvertor_10_40.convertCoding(t.getValueCoding()));
- } catch (org.hl7.fhir.exceptions.FHIRException e) {
- throw new FHIRException(e);
- }
- for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) tgt.addGroup(convertQuestionnaireGroupComponent(t));
- return tgt;
- }
-
- public static org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.dstu2.model.Questionnaire.QuestionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent();
- VersionConvertor_10_40.copyElement(src, tgt);
- if (src.hasLinkIdElement())
- tgt.setLinkIdElement(VersionConvertor_10_40.convertString(src.getLinkIdElement()));
- for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_10_40.convertCoding(t));
- if (src.hasTextElement())
- tgt.setTextElement(VersionConvertor_10_40.convertString(src.getTextElement()));
- if (src.hasType())
- tgt.setTypeElement(convertQuestionnaireQuestionType(src.getTypeElement()));
- if (src.hasRequiredElement())
- tgt.setRequiredElement(VersionConvertor_10_40.convertBoolean(src.getRequiredElement()));
- if (src.hasRepeatsElement())
- tgt.setRepeatsElement(VersionConvertor_10_40.convertBoolean(src.getRepeatsElement()));
- if (src.hasOptions())
- tgt.setAnswerValueSetElement(VersionConvertor_10_40.convertReferenceToCanonical(src.getOptions()));
- for (org.hl7.fhir.dstu2.model.Coding t : src.getOption()) tgt.addAnswerOption().setValue(VersionConvertor_10_40.convertCoding(t));
- for (org.hl7.fhir.dstu2.model.Questionnaire.GroupComponent t : src.getGroup()) tgt.addItem(convertQuestionnaireGroupComponent(t));
- return tgt;
- }
-
- static public org.hl7.fhir.r4.model.Enumeration convertQuestionnaireQuestionType(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
- VersionConvertor_10_40.copyElement(src, tgt);
- switch(src.getValue()) {
- case BOOLEAN:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.BOOLEAN);
- break;
- case DECIMAL:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DECIMAL);
- break;
- case INTEGER:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.INTEGER);
- break;
- case DATE:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATE);
- break;
- case DATETIME:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME);
- break;
- case INSTANT:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.DATETIME);
- break;
- case TIME:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TIME);
- break;
- case STRING:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.STRING);
- break;
- case TEXT:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.TEXT);
- break;
- case URL:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL);
- break;
- case CHOICE:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE);
- break;
- case OPENCHOICE:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE);
- break;
- case ATTACHMENT:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT);
- break;
- case REFERENCE:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.REFERENCE);
- break;
- case QUANTITY:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.QUANTITY);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.dstu2.model.Enumeration convertQuestionnaireStatus(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatusEnumFactory());
- VersionConvertor_10_40.copyElement(src, tgt);
- switch(src.getValue()) {
- case DRAFT:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.DRAFT);
- break;
- case ACTIVE:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.PUBLISHED);
- break;
- case RETIRED:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.RETIRED);
- break;
- default:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.QuestionnaireStatus.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r4.model.Enumeration convertQuestionnaireStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Enumerations.PublicationStatusEnumFactory());
- VersionConvertor_10_40.copyElement(src, tgt);
- switch(src.getValue()) {
- case DRAFT:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT);
- break;
- case PUBLISHED:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE);
- break;
- case RETIRED:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL);
- break;
- }
- return tgt;
+ static public org.hl7.fhir.r4.model.Enumeration convertQuestionnaireStatus(org.hl7.fhir.dstu2.model.Enumeration src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Enumerations.PublicationStatusEnumFactory());
+ VersionConvertor_10_40.copyElement(src, tgt);
+ switch (src.getValue()) {
+ case DRAFT:
+ tgt.setValue(org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT);
+ break;
+ case PUBLISHED:
+ tgt.setValue(org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE);
+ break;
+ case RETIRED:
+ tgt.setValue(org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED);
+ break;
+ default:
+ tgt.setValue(org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL);
+ break;
}
+ return tgt;
+ }
}
\ No newline at end of file
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ValueSet10_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ValueSet10_40.java
index a29833cc0..57f5b7e5f 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ValueSet10_40.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_40/ValueSet10_40.java
@@ -1,8 +1,9 @@
package org.hl7.fhir.convertors.conv10_40;
import java.util.List;
-import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
+
import org.hl7.fhir.convertors.VersionConvertor_10_40;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_40;
import org.hl7.fhir.dstu2.model.ValueSet;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.BooleanType;
@@ -189,7 +190,7 @@ public class ValueSet10_40 {
return convertValueSet(src, null);
}
- public static org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src, VersionConvertorAdvisor40 advisor) throws FHIRException {
+ public static org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src, BaseAdvisor_10_40 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.r4.model.ValueSet tgt = new org.hl7.fhir.r4.model.ValueSet();
@@ -263,11 +264,11 @@ public class ValueSet10_40 {
return tgt;
}
- public static org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src, VersionConvertorAdvisor40 advisor) throws FHIRException {
+ public static org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src, BaseAdvisor_10_40 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.ValueSet tgt = new org.hl7.fhir.dstu2.model.ValueSet();
- VersionConvertor_10_40.copyDomainResource(src, tgt);
+ VersionConvertor_10_40.copyDomainResource(src, tgt, advisor);
if (src.hasUrlElement())
tgt.setUrlElement(VersionConvertor_10_40.convertUri(src.getUrlElement()));
for (org.hl7.fhir.r4.model.Identifier i : src.getIdentifier()) tgt.setIdentifier(VersionConvertor_10_40.convertIdentifier(i));
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Appointment10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Appointment10_50.java
index d36e842a5..96266716a 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Appointment10_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Appointment10_50.java
@@ -1,9 +1,12 @@
package org.hl7.fhir.convertors.conv10_50;
import org.hl7.fhir.convertors.VersionConvertor_10_50;
+import org.hl7.fhir.convertors.VersionConvertor_Base;
+import org.hl7.fhir.dstu2.model.UnsignedIntType;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.CodeableConcept;
-public class Appointment10_50 {
+public class Appointment10_50 extends VersionConvertor_Base {
public static org.hl7.fhir.dstu2.model.Appointment convertAppointment(org.hl7.fhir.r5.model.Appointment src) throws FHIRException {
if (src == null || src.isEmpty())
@@ -14,8 +17,8 @@ public class Appointment10_50 {
if (src.hasStatus())
tgt.setStatusElement(convertAppointmentStatus(src.getStatusElement()));
for (org.hl7.fhir.r5.model.CodeableConcept t : src.getServiceType()) tgt.setType(VersionConvertor_10_50.convertCodeableConcept(t));
- if (src.hasPriorityElement())
- tgt.setPriorityElement(VersionConvertor_10_50.convertUnsignedInt(src.getPriorityElement()));
+ if (src.hasPriority())
+ tgt.setPriorityElement(convertAppointmentPriority(src.getPriority()));
if (src.hasDescriptionElement())
tgt.setDescriptionElement(VersionConvertor_10_50.convertString(src.getDescriptionElement()));
if (src.hasStartElement())
@@ -31,6 +34,18 @@ public class Appointment10_50 {
return tgt;
}
+ private static UnsignedIntType convertAppointmentPriority(CodeableConcept src) {
+ UnsignedIntType tgt = new UnsignedIntType(convertAppointmentPriorityFromR5(src));
+ VersionConvertor_10_50.copyElement(src, tgt);
+ return tgt;
+ }
+
+ private static CodeableConcept convertAppointmentPriority(UnsignedIntType src) {
+ CodeableConcept tgt = src.hasValue() ? convertAppointmentPriorityToR5(src.getValue()) : new CodeableConcept();
+ VersionConvertor_10_50.copyElement(src, tgt);
+ return tgt;
+ }
+
public static org.hl7.fhir.r5.model.Appointment convertAppointment(org.hl7.fhir.dstu2.model.Appointment src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -42,7 +57,7 @@ public class Appointment10_50 {
if (src.hasType())
tgt.addServiceType(VersionConvertor_10_50.convertCodeableConcept(src.getType()));
if (src.hasPriorityElement())
- tgt.setPriorityElement(VersionConvertor_10_50.convertUnsignedInt(src.getPriorityElement()));
+ tgt.setPriority(convertAppointmentPriority(src.getPriorityElement()));
if (src.hasDescriptionElement())
tgt.setDescriptionElement(VersionConvertor_10_50.convertString(src.getDescriptionElement()));
if (src.hasStartElement())
@@ -58,6 +73,7 @@ public class Appointment10_50 {
return tgt;
}
+
public static org.hl7.fhir.dstu2.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r5.model.Appointment.AppointmentParticipantComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Bundle10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Bundle10_50.java
index 13a80b9d2..280a19439 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Bundle10_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Bundle10_50.java
@@ -1,8 +1,9 @@
package org.hl7.fhir.convertors.conv10_50;
-import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
import org.hl7.fhir.convertors.VersionConvertor_10_50;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.FhirPublication;
public class Bundle10_50 {
@@ -26,7 +27,7 @@ public class Bundle10_50 {
return convertBundle(src, null);
}
- public static org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.r5.model.Bundle src, VersionConvertorAdvisor50 advisor) throws FHIRException {
+ public static org.hl7.fhir.dstu2.model.Bundle convertBundle(org.hl7.fhir.r5.model.Bundle src, BaseAdvisor_10_50 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.Bundle tgt = new org.hl7.fhir.dstu2.model.Bundle();
@@ -61,19 +62,17 @@ public class Bundle10_50 {
return tgt;
}
- public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src, VersionConvertorAdvisor50 advisor) throws FHIRException {
+ public static org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.r5.model.Bundle.BundleEntryComponent src, BaseAdvisor_10_50 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- if (advisor.ignoreEntry(src))
+ if (advisor.ignoreEntry(src, FhirPublication.DSTU2))
return null;
org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent();
VersionConvertor_10_50.copyElement(src, tgt);
for (org.hl7.fhir.r5.model.Bundle.BundleLinkComponent t : src.getLink()) tgt.addLink(convertBundleLinkComponent(t));
if (src.hasFullUrlElement())
tgt.setFullUrlElement(VersionConvertor_10_50.convertUri(src.getFullUrlElement()));
- org.hl7.fhir.dstu2.model.Resource res = advisor.convertR2(src.getResource());
- if (res == null)
- res = VersionConvertor_10_50.convertResource(src.getResource());
+ org.hl7.fhir.dstu2.model.Resource res = VersionConvertor_10_50.convertResource(src.getResource());
tgt.setResource(res);
if (src.hasSearch())
tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch()));
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/CarePlan10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/CarePlan10_50.java
index 149cae38f..14989fd16 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/CarePlan10_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/CarePlan10_50.java
@@ -70,10 +70,10 @@ public class CarePlan10_50 {
org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityComponent();
VersionConvertor_10_50.copyElement(src, tgt);
for (org.hl7.fhir.r5.model.Annotation t : src.getProgress()) tgt.addProgress(VersionConvertor_10_50.convertAnnotation(t));
- if (src.hasReference())
- tgt.setReference(VersionConvertor_10_50.convertReference(src.getReference()));
- if (src.hasDetail())
- tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail()));
+ if (src.hasPlannedActivityReference())
+ tgt.setReference(VersionConvertor_10_50.convertReference(src.getPlannedActivityReference()));
+ if (src.hasPlannedActivityDetail())
+ tgt.setDetail(convertCarePlanActivityDetailComponent(src.getPlannedActivityDetail()));
return tgt;
}
@@ -84,16 +84,16 @@ public class CarePlan10_50 {
VersionConvertor_10_50.copyElement(src, tgt);
for (org.hl7.fhir.dstu2.model.Annotation t : src.getProgress()) tgt.addProgress(VersionConvertor_10_50.convertAnnotation(t));
if (src.hasReference())
- tgt.setReference(VersionConvertor_10_50.convertReference(src.getReference()));
+ tgt.setPlannedActivityReference(VersionConvertor_10_50.convertReference(src.getReference()));
if (src.hasDetail())
- tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail()));
+ tgt.setPlannedActivityDetail(convertCarePlanActivityDetailComponent(src.getDetail()));
return tgt;
}
- public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException {
+ public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityPlannedActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent();
+ org.hl7.fhir.r5.model.CarePlan.CarePlanActivityPlannedActivityDetailComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityPlannedActivityDetailComponent();
VersionConvertor_10_50.copyElement(src, tgt);
if (src.hasCode())
tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode()));
@@ -120,7 +120,7 @@ public class CarePlan10_50 {
return tgt;
}
- public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException {
+ public static org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityPlannedActivityDetailComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu2.model.CarePlan.CarePlanActivityDetailComponent();
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ConceptMap10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ConceptMap10_50.java
index c21d943ab..86e2caf75 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ConceptMap10_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ConceptMap10_50.java
@@ -2,6 +2,8 @@ package org.hl7.fhir.convertors.conv10_50;
import java.util.ArrayList;
import java.util.List;
+
+import org.hl7.fhir.convertors.SourceElementComponentWrapper;
import org.hl7.fhir.convertors.VersionConvertorConstants;
import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.dstu2.model.Enumerations.ConceptMapEquivalence;
@@ -53,8 +55,8 @@ public class ConceptMap10_50 {
r = VersionConvertor_10_50.convertType(src.getTarget());
tgt.setTarget(r instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) r).getReference()) : r);
for (org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent t : src.getElement()) {
- List ws = convertSourceElementComponent(t);
- for (VersionConvertor_10_50.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp);
+ List> ws = convertSourceElementComponent(t);
+ for (SourceElementComponentWrapper w : ws) getGroup(tgt, w.getSource(), w.getTarget()).addElement(w.getComp());
}
return tgt;
}
@@ -236,8 +238,8 @@ public class ConceptMap10_50 {
return tgt;
}
- public static List convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException {
- List res = new ArrayList();
+ public static List> convertSourceElementComponent(org.hl7.fhir.dstu2.model.ConceptMap.SourceElementComponent src) throws FHIRException {
+ List> res = new ArrayList<>();
if (src == null || src.isEmpty())
return res;
for (org.hl7.fhir.dstu2.model.ConceptMap.TargetElementComponent t : src.getTarget()) {
@@ -249,7 +251,7 @@ public class ConceptMap10_50 {
} else {
tgt.addTarget(convertTargetElementComponent(t));
}
- res.add(new VersionConvertor_10_50.SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem()));
+ res.add(new SourceElementComponentWrapper<>(tgt, src.getCodeSystem(), t.getCodeSystem()));
}
return res;
}
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Conformance10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Conformance10_50.java
index 46a72c07d..677adb9e6 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Conformance10_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Conformance10_50.java
@@ -2,6 +2,7 @@ package org.hl7.fhir.convertors.conv10_50;
import org.hl7.fhir.convertors.VersionConvertorConstants;
import org.hl7.fhir.convertors.VersionConvertor_10_50;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestComponent;
import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResourceComponent;
@@ -54,6 +55,10 @@ public class Conformance10_50 {
}
public static org.hl7.fhir.dstu2.model.Conformance convertConformance(org.hl7.fhir.r5.model.CapabilityStatement src) throws FHIRException {
+ return convertConformance(src, new BaseAdvisor_10_50());
+ }
+
+ public static org.hl7.fhir.dstu2.model.Conformance convertConformance(org.hl7.fhir.r5.model.CapabilityStatement src, BaseAdvisor_10_50 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.Conformance tgt = new org.hl7.fhir.dstu2.model.Conformance();
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DeviceUseStatement10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DeviceUseStatement10_50.java
index f144a1924..c0a95be9c 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DeviceUseStatement10_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/DeviceUseStatement10_50.java
@@ -7,10 +7,10 @@ import org.hl7.fhir.r5.model.CodeableReference;
public class DeviceUseStatement10_50 {
- public static org.hl7.fhir.r5.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu2.model.DeviceUseStatement src) throws FHIRException {
+ public static org.hl7.fhir.r5.model.DeviceUsage convertDeviceUseStatement(org.hl7.fhir.dstu2.model.DeviceUseStatement src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.r5.model.DeviceUseStatement tgt = new org.hl7.fhir.r5.model.DeviceUseStatement();
+ org.hl7.fhir.r5.model.DeviceUsage tgt = new org.hl7.fhir.r5.model.DeviceUsage();
VersionConvertor_10_50.copyDomainResource(src, tgt);
if (src.hasBodySiteCodeableConcept())
tgt.getBodySite().setConcept(VersionConvertor_10_50.convertCodeableConcept(src.getBodySiteCodeableConcept()));
@@ -28,7 +28,7 @@ public class DeviceUseStatement10_50 {
return tgt;
}
- public static org.hl7.fhir.dstu2.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r5.model.DeviceUseStatement src) throws FHIRException {
+ public static org.hl7.fhir.dstu2.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r5.model.DeviceUsage src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu2.model.DeviceUseStatement();
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/MedicationStatement10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/MedicationStatement10_50.java
index 6ef18e55c..eeda7650c 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/MedicationStatement10_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/MedicationStatement10_50.java
@@ -122,7 +122,7 @@ public class MedicationStatement10_50 {
VersionConvertor_10_50.copyElement(src, tgt);
switch(src.getValue()) {
case ACTIVE:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ACTIVE);
+ tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.COMPLETED);
break;
case COMPLETED:
tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.COMPLETED);
@@ -131,7 +131,7 @@ public class MedicationStatement10_50 {
tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ENTEREDINERROR);
break;
case INTENDED:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.INTENDED);
+ tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.UNKNOWN);
break;
default:
tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.NULL);
@@ -146,16 +146,16 @@ public class MedicationStatement10_50 {
org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatusEnumFactory());
VersionConvertor_10_50.copyElement(src, tgt);
switch(src.getValue()) {
- case ACTIVE:
- tgt.setValue(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ACTIVE);
- break;
+// case ACTIVE:
+// tgt.setValue(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ACTIVE);
+// break;
case COMPLETED:
tgt.setValue(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.COMPLETED);
break;
case ENTEREDINERROR:
tgt.setValue(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR);
break;
- case INTENDED:
+ case UNKNOWN:
tgt.setValue(org.hl7.fhir.dstu2.model.MedicationStatement.MedicationStatementStatus.INTENDED);
break;
default:
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Questionnaire10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Questionnaire10_50.java
index f5f4b51be..ede458bb0 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Questionnaire10_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Questionnaire10_50.java
@@ -1,18 +1,27 @@
package org.hl7.fhir.convertors.conv10_50;
import org.hl7.fhir.convertors.VersionConvertor_10_50;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50;
+import org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat;
+import org.hl7.fhir.dstu2.model.Resource;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.CodeType;
import org.hl7.fhir.r5.model.ContactDetail;
+import org.hl7.fhir.r5.model.Questionnaire;
+import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent;
public class Questionnaire10_50 {
public static org.hl7.fhir.r5.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2.model.Questionnaire src) throws FHIRException {
+ return convertQuestionnaire(src, new BaseAdvisor_10_50());
+ }
+
+ public static org.hl7.fhir.r5.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2.model.Questionnaire src, BaseAdvisor_10_50 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.r5.model.Questionnaire tgt = new org.hl7.fhir.r5.model.Questionnaire();
- VersionConvertor_10_50.copyDomainResource(src, tgt);
+ VersionConvertor_10_50.copyDomainResource(src, tgt, advisor);
for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t));
if (src.hasVersionElement())
tgt.setVersionElement(VersionConvertor_10_50.convertString(src.getVersionElement()));
@@ -32,10 +41,14 @@ public class Questionnaire10_50 {
}
public static org.hl7.fhir.dstu2.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r5.model.Questionnaire src) throws FHIRException {
+ return convertQuestionnaire(src, new BaseAdvisor_10_50());
+ }
+
+ public static org.hl7.fhir.dstu2.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r5.model.Questionnaire src, BaseAdvisor_10_50 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.Questionnaire tgt = new org.hl7.fhir.dstu2.model.Questionnaire();
- VersionConvertor_10_50.copyDomainResource(src, tgt);
+ VersionConvertor_10_50.copyDomainResource(src, tgt, advisor);
for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t));
if (src.hasVersionElement())
tgt.setVersionElement(VersionConvertor_10_50.convertString(src.getVersionElement()));
@@ -98,7 +111,7 @@ public class Questionnaire10_50 {
tgt.setLinkIdElement(VersionConvertor_10_50.convertString(src.getLinkIdElement()));
for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_10_50.convertCoding(t));
if (src.hasTextElement())
- tgt.setTextElement(VersionConvertor_10_50.convertString(src.getTextElement()));
+ tgt.setTextElement(VersionConvertor_10_50.convertStringToMarkdown(src.getTextElement()));
tgt.setType(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP);
if (src.hasRequiredElement())
tgt.setRequiredElement(VersionConvertor_10_50.convertBoolean(src.getRequiredElement()));
@@ -109,7 +122,7 @@ public class Questionnaire10_50 {
return tgt;
}
- static public org.hl7.fhir.dstu2.model.Enumeration convertQuestionnaireItemType(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
+ static public org.hl7.fhir.dstu2.model.Enumeration convertQuestionnaireItemType(org.hl7.fhir.r5.model.Enumeration src, QuestionnaireAnswerConstraint constraint) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.Enumeration tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormatEnumFactory());
@@ -142,11 +155,11 @@ public class Questionnaire10_50 {
case URL:
tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.URL);
break;
- case CHOICE:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.CHOICE);
- break;
- case OPENCHOICE:
- tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.OPENCHOICE);
+ case CODING:
+ if (constraint == QuestionnaireAnswerConstraint.OPTIONSORSTRING)
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.OPENCHOICE);
+ else
+ tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.CHOICE);
break;
case ATTACHMENT:
tgt.setValue(org.hl7.fhir.dstu2.model.Questionnaire.AnswerFormat.ATTACHMENT);
@@ -175,7 +188,7 @@ public class Questionnaire10_50 {
if (src.hasTextElement())
tgt.setTextElement(VersionConvertor_10_50.convertString(src.getTextElement()));
if (src.hasType())
- tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement()));
+ tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement(), src.getAnswerConstraint()));
if (src.hasRequiredElement())
tgt.setRequiredElement(VersionConvertor_10_50.convertBoolean(src.getRequiredElement()));
if (src.hasRepeatsElement())
@@ -201,9 +214,15 @@ public class Questionnaire10_50 {
tgt.setLinkIdElement(VersionConvertor_10_50.convertString(src.getLinkIdElement()));
for (org.hl7.fhir.dstu2.model.Coding t : src.getConcept()) tgt.addCode(VersionConvertor_10_50.convertCoding(t));
if (src.hasTextElement())
- tgt.setTextElement(VersionConvertor_10_50.convertString(src.getTextElement()));
- if (src.hasType())
+ tgt.setTextElement(VersionConvertor_10_50.convertStringToMarkdown(src.getTextElement()));
+ if (src.hasType()) {
tgt.setTypeElement(convertQuestionnaireQuestionType(src.getTypeElement()));
+ if (src.getType() == AnswerFormat.CHOICE) {
+ tgt.setAnswerConstraint(QuestionnaireAnswerConstraint.OPTIONSONLY);
+ } else if (src.getType() == AnswerFormat.OPENCHOICE) {
+ tgt.setAnswerConstraint(QuestionnaireAnswerConstraint.OPTIONSORSTRING);
+ }
+ }
if (src.hasRequiredElement())
tgt.setRequiredElement(VersionConvertor_10_50.convertBoolean(src.getRequiredElement()));
if (src.hasRepeatsElement())
@@ -252,10 +271,10 @@ public class Questionnaire10_50 {
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.URL);
break;
case CHOICE:
- tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CHOICE);
+ tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CODING);
break;
case OPENCHOICE:
- tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.OPENCHOICE);
+ tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CODING);
break;
case ATTACHMENT:
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.ATTACHMENT);
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Substance10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Substance10_50.java
index f5c708de7..466e4dc13 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Substance10_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/Substance10_50.java
@@ -2,6 +2,7 @@ package org.hl7.fhir.convertors.conv10_50;
import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.Identifier;
public class Substance10_50 {
@@ -13,10 +14,10 @@ public class Substance10_50 {
for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t));
for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_10_50.convertCodeableConcept(t));
if (src.hasCode())
- tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode()));
+ tgt.getCode().setConcept(VersionConvertor_10_50.convertCodeableConcept(src.getCode()));
if (src.hasDescriptionElement())
tgt.setDescriptionElement(VersionConvertor_10_50.convertString(src.getDescriptionElement()));
- for (org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent t : src.getInstance()) tgt.addInstance(convertSubstanceInstanceComponent(t));
+ for (org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent t : src.getInstance()) convertSubstanceInstanceComponent(t, tgt);
for (org.hl7.fhir.dstu2.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertSubstanceIngredientComponent(t));
return tgt;
}
@@ -29,10 +30,12 @@ public class Substance10_50 {
for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(t));
for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_10_50.convertCodeableConcept(t));
if (src.hasCode())
- tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode()));
+ tgt.setCode(VersionConvertor_10_50.convertCodeableConcept(src.getCode().getConcept()));
if (src.hasDescriptionElement())
tgt.setDescriptionElement(VersionConvertor_10_50.convertString(src.getDescriptionElement()));
- for (org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent t : src.getInstance()) tgt.addInstance(convertSubstanceInstanceComponent(t));
+ if (src.getInstance()) {
+ tgt.addInstance(convertSubstanceInstanceComponent(src));
+ }
for (org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertSubstanceIngredientComponent(t));
return tgt;
}
@@ -59,31 +62,26 @@ public class Substance10_50 {
return tgt;
}
- public static org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
+ public static org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r5.model.Substance src) throws FHIRException {
org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent();
- VersionConvertor_10_50.copyElement(src, tgt);
- if (src.hasIdentifier())
- tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier()));
- if (src.hasExpiryElement())
- tgt.setExpiryElement(VersionConvertor_10_50.convertDateTime(src.getExpiryElement()));
- if (src.hasQuantity())
- tgt.setQuantity(VersionConvertor_10_50.convertSimpleQuantity(src.getQuantity()));
- return tgt;
- }
+ for (Identifier t : src.getIdentifier()) {
+ tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(t));
+ }
+ if (src.hasExpiry())
+ tgt.setExpiryElement(VersionConvertor_10_50.convertDateTime(src.getExpiryElement()));
+ if (src.hasQuantity())
+ tgt.setQuantity(VersionConvertor_10_50.convertSimpleQuantity(src.getQuantity()));
+ return tgt;
+ }
- public static org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent();
- VersionConvertor_10_50.copyElement(src, tgt);
+
+ public static void convertSubstanceInstanceComponent(org.hl7.fhir.dstu2.model.Substance.SubstanceInstanceComponent src, org.hl7.fhir.r5.model.Substance tgt) throws FHIRException {
+ tgt.setInstance(true);
if (src.hasIdentifier())
- tgt.setIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier()));
+ tgt.addIdentifier(VersionConvertor_10_50.convertIdentifier(src.getIdentifier()));
if (src.hasExpiryElement())
tgt.setExpiryElement(VersionConvertor_10_50.convertDateTime(src.getExpiryElement()));
if (src.hasQuantity())
tgt.setQuantity(VersionConvertor_10_50.convertSimpleQuantity(src.getQuantity()));
- return tgt;
}
}
\ No newline at end of file
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ValueSet10_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ValueSet10_50.java
index f4ceb8379..251538d6a 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ValueSet10_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv10_50/ValueSet10_50.java
@@ -1,8 +1,9 @@
package org.hl7.fhir.convertors.conv10_50;
import java.util.List;
-import org.hl7.fhir.convertors.VersionConvertorAdvisor50;
+
import org.hl7.fhir.convertors.VersionConvertor_10_50;
+import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50;
import org.hl7.fhir.dstu2.model.ValueSet;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.BooleanType;
@@ -185,7 +186,7 @@ public class ValueSet10_50 {
return tgt;
}
- public static org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.r5.model.ValueSet src, VersionConvertorAdvisor50 advisor) throws FHIRException {
+ public static org.hl7.fhir.dstu2.model.ValueSet convertValueSet(org.hl7.fhir.r5.model.ValueSet src, BaseAdvisor_10_50 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2.model.ValueSet tgt = new org.hl7.fhir.dstu2.model.ValueSet();
@@ -240,7 +241,7 @@ public class ValueSet10_50 {
return convertValueSet(src, null);
}
- public static org.hl7.fhir.r5.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src, VersionConvertorAdvisor50 advisor) throws FHIRException {
+ public static org.hl7.fhir.r5.model.ValueSet convertValueSet(org.hl7.fhir.dstu2.model.ValueSet src, BaseAdvisor_10_50 advisor) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.r5.model.ValueSet tgt = new org.hl7.fhir.r5.model.ValueSet();
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/ConceptMap14_30.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/ConceptMap14_30.java
index 8425cc0a6..e10ba629e 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/ConceptMap14_30.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_30/ConceptMap14_30.java
@@ -2,6 +2,8 @@ package org.hl7.fhir.convertors.conv14_30;
import java.util.ArrayList;
import java.util.List;
+
+import org.hl7.fhir.convertors.SourceElementComponentWrapper;
import org.hl7.fhir.convertors.VersionConvertor_14_30;
import org.hl7.fhir.dstu3.model.ConceptMap;
import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent;
@@ -85,8 +87,8 @@ public class ConceptMap14_30 {
if (src.hasTarget())
tgt.setTarget(VersionConvertor_14_30.convertType(src.getTarget()));
for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) {
- List ws = convertSourceElementComponent(t);
- for (VersionConvertor_14_30.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp);
+ List> ws = convertSourceElementComponent(t);
+ for (SourceElementComponentWrapper w : ws) getGroup(tgt, w.getSource(), w.getTarget()).addElement(w.getComp());
}
return tgt;
}
@@ -234,8 +236,8 @@ public class ConceptMap14_30 {
return tgt;
}
- public static List convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException {
- List res = new ArrayList();
+ public static List> convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException {
+ List> res = new ArrayList<>();
if (src == null || src.isEmpty())
return res;
for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) {
@@ -244,7 +246,7 @@ public class ConceptMap14_30 {
if (src.hasCode())
tgt.setCode(src.getCode());
tgt.addTarget(convertTargetElementComponent(t));
- res.add(new VersionConvertor_14_30.SourceElementComponentWrapper(tgt, src.getSystem(), t.getSystem()));
+ res.add(new SourceElementComponentWrapper<>(tgt, src.getSystem(), t.getSystem()));
}
return res;
}
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/ConceptMap14_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/ConceptMap14_40.java
index a5d7a3ef7..d784a5b5c 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/ConceptMap14_40.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_40/ConceptMap14_40.java
@@ -2,6 +2,8 @@ package org.hl7.fhir.convertors.conv14_40;
import java.util.ArrayList;
import java.util.List;
+
+import org.hl7.fhir.convertors.SourceElementComponentWrapper;
import org.hl7.fhir.convertors.VersionConvertor_14_40;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.CanonicalType;
@@ -47,8 +49,8 @@ public class ConceptMap14_40 {
tt = VersionConvertor_14_40.convertType(src.getTarget());
tgt.setTarget(tt instanceof org.hl7.fhir.r4.model.Reference ? new CanonicalType(((org.hl7.fhir.r4.model.Reference) tt).getReference()) : tt);
for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) {
- List ws = convertSourceElementComponent(t);
- for (VersionConvertor_14_40.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp);
+ List> ws = convertSourceElementComponent(t);
+ for (SourceElementComponentWrapper w : ws) getGroup(tgt, w.getSource(), w.getTarget()).addElement(w.getComp());
}
return tgt;
}
@@ -230,8 +232,8 @@ public class ConceptMap14_40 {
return tgt;
}
- public static List convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException {
- List res = new ArrayList();
+ public static List> convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException {
+ List> res = new ArrayList<>();
if (src == null || src.isEmpty())
return res;
for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) {
@@ -240,7 +242,7 @@ public class ConceptMap14_40 {
if (src.hasCode())
tgt.setCode(src.getCode());
tgt.addTarget(convertTargetElementComponent(t));
- res.add(new VersionConvertor_14_40.SourceElementComponentWrapper(tgt, src.getSystem(), t.getSystem()));
+ res.add(new SourceElementComponentWrapper<>(tgt, src.getSystem(), t.getSystem()));
}
return res;
}
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/ConceptMap14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/ConceptMap14_50.java
index ec066531f..1f1a133b3 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/ConceptMap14_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/ConceptMap14_50.java
@@ -2,6 +2,8 @@ package org.hl7.fhir.convertors.conv14_50;
import java.util.ArrayList;
import java.util.List;
+
+import org.hl7.fhir.convertors.SourceElementComponentWrapper;
import org.hl7.fhir.convertors.VersionConvertorConstants;
import org.hl7.fhir.convertors.VersionConvertor_14_50;
import org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence;
@@ -53,8 +55,8 @@ public class ConceptMap14_50 {
tt = VersionConvertor_14_50.convertType(src.getTarget());
tgt.setTarget(tt instanceof org.hl7.fhir.r5.model.Reference ? new CanonicalType(((org.hl7.fhir.r5.model.Reference) tt).getReference()) : tt);
for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) {
- List ws = convertSourceElementComponent(t);
- for (VersionConvertor_14_50.SourceElementComponentWrapper w : ws) getGroup(tgt, w.source, w.target).addElement(w.comp);
+ List> ws = convertSourceElementComponent(t);
+ for (SourceElementComponentWrapper w : ws) getGroup(tgt, w.getSource(), w.getTarget()).addElement(w.getComp());
}
return tgt;
}
@@ -228,8 +230,8 @@ public class ConceptMap14_50 {
return tgt;
}
- public static List convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException {
- List res = new ArrayList();
+ public static List> convertSourceElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent src) throws FHIRException {
+ List> res = new ArrayList<>();
if (src == null || src.isEmpty())
return res;
for (org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent t : src.getTarget()) {
@@ -242,7 +244,7 @@ public class ConceptMap14_50 {
} else {
tgt.addTarget(convertTargetElementComponent(t));
}
- res.add(new VersionConvertor_14_50.SourceElementComponentWrapper(tgt, src.getSystem(), t.getSystem()));
+ res.add(new SourceElementComponentWrapper<>(tgt, src.getSystem(), t.getSystem()));
}
return res;
}
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Questionnaire14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Questionnaire14_50.java
index 4238da85a..5960af264 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Questionnaire14_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/Questionnaire14_50.java
@@ -1,9 +1,11 @@
package org.hl7.fhir.convertors.conv14_50;
import org.hl7.fhir.convertors.VersionConvertor_14_50;
+import org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.CodeType;
import org.hl7.fhir.r5.model.ContactDetail;
+import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint;
import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator;
import org.hl7.fhir.r5.model.UsageContext;
@@ -87,7 +89,7 @@ public class Questionnaire14_50 {
if (src.hasText())
tgt.setTextElement(VersionConvertor_14_50.convertString(src.getTextElement()));
if (src.hasType())
- tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement()));
+ tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement(), src.getAnswerConstraint()));
for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t));
if (src.hasRequired())
tgt.setRequiredElement(VersionConvertor_14_50.convertBoolean(src.getRequiredElement()));
@@ -117,9 +119,15 @@ public class Questionnaire14_50 {
if (src.hasPrefix())
tgt.setPrefixElement(VersionConvertor_14_50.convertString(src.getPrefixElement()));
if (src.hasText())
- tgt.setTextElement(VersionConvertor_14_50.convertString(src.getTextElement()));
- if (src.hasType())
+ tgt.setTextElement(VersionConvertor_14_50.convertStringToMarkdown(src.getTextElement()));
+ if (src.hasType()) {
tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement()));
+ if (src.getType() == QuestionnaireItemType.CHOICE) {
+ tgt.setAnswerConstraint(QuestionnaireAnswerConstraint.OPTIONSONLY);
+ } else if (src.getType() == QuestionnaireItemType.OPENCHOICE) {
+ tgt.setAnswerConstraint(QuestionnaireAnswerConstraint.OPTIONSORSTRING);
+ }
+ }
for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t));
if (src.hasRequired())
tgt.setRequiredElement(VersionConvertor_14_50.convertBoolean(src.getRequiredElement()));
@@ -235,10 +243,10 @@ public class Questionnaire14_50 {
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.URL);
break;
case CHOICE:
- tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CHOICE);
+ tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CODING);
break;
case OPENCHOICE:
- tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.OPENCHOICE);
+ tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CODING);
break;
case ATTACHMENT:
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.ATTACHMENT);
@@ -256,7 +264,7 @@ public class Questionnaire14_50 {
return tgt;
}
- static public org.hl7.fhir.dstu2016may.model.Enumeration convertQuestionnaireItemType(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
+ static public org.hl7.fhir.dstu2016may.model.Enumeration convertQuestionnaireItemType(org.hl7.fhir.r5.model.Enumeration src, QuestionnaireAnswerConstraint constraint) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu2016may.model.Enumeration tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
@@ -295,12 +303,12 @@ public class Questionnaire14_50 {
case URL:
tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.URL);
break;
- case CHOICE:
- tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.CHOICE);
- break;
- case OPENCHOICE:
+ case CODING:
+ if (constraint == QuestionnaireAnswerConstraint.OPTIONSORSTRING)
tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.OPENCHOICE);
- break;
+ else
+ tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.CHOICE);
+ break;
case ATTACHMENT:
tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.ATTACHMENT);
break;
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/StructureDefinition14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/StructureDefinition14_50.java
index c714327c1..a789c1190 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/StructureDefinition14_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/StructureDefinition14_50.java
@@ -177,7 +177,9 @@ public class StructureDefinition14_50 {
if (src.hasDifferential()) {
if (src.hasDifferential())
tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
- tgt.getDifferential().getElementFirstRep().getType().clear();
+ if (!tgt.getDifferential().getElementFirstRep().getPath().contains(".")) {
+ tgt.getDifferential().getElementFirstRep().getType().clear();
+ }
}
if (tgt.getDerivation() == TypeDerivationRule.SPECIALIZATION) {
for (ElementDefinition ed : tgt.getSnapshot().getElement()) {
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/StructureMap14_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/StructureMap14_50.java
index f2dee9f21..9360e154d 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/StructureMap14_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv14_50/StructureMap14_50.java
@@ -106,44 +106,6 @@ public class StructureMap14_50 {
return tgt;
}
- public static org.hl7.fhir.r5.model.Enumeration convertStructureMapContextType(org.hl7.fhir.dstu2016may.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.StructureMap.StructureMapContextTypeEnumFactory());
- VersionConvertor_14_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case TYPE:
- tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.TYPE);
- break;
- case VARIABLE:
- tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.VARIABLE);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.dstu2016may.model.Enumeration convertStructureMapContextType(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.dstu2016may.model.Enumeration tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextTypeEnumFactory());
- VersionConvertor_14_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case TYPE:
- tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.TYPE);
- break;
- case VARIABLE:
- tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.VARIABLE);
- break;
- default:
- tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.NULL);
- break;
- }
- return tgt;
- }
-
public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -313,8 +275,7 @@ public class StructureMap14_50 {
VersionConvertor_14_50.copyElement(src, tgt);
if (src.hasContext())
tgt.setContextElement(VersionConvertor_14_50.convertId(src.getContextElement()));
- if (src.hasContextType())
- tgt.setContextTypeElement(convertStructureMapContextType(src.getContextTypeElement()));
+ tgt.setContextType(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.VARIABLE);
if (src.hasElement())
tgt.setElementElement(VersionConvertor_14_50.convertString(src.getElementElement()));
if (src.hasVariable())
@@ -337,8 +298,8 @@ public class StructureMap14_50 {
VersionConvertor_14_50.copyElement(src, tgt);
if (src.hasContext())
tgt.setContextElement(VersionConvertor_14_50.convertId(src.getContextElement()));
- if (src.hasContextType())
- tgt.setContextTypeElement(convertStructureMapContextType(src.getContextTypeElement()));
+ if (src.hasContextType() && src.getContextType() == org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.VARIABLE)
+ throw new Error("This conversion is not supported. Consult code maintainers"); // this should never happens - no one knows what the intent was here.
if (src.hasElement())
tgt.setElementElement(VersionConvertor_14_50.convertString(src.getElementElement()));
if (src.hasVariable())
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Bundle30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Bundle30_40.java
index da745267a..8cb793eb0 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Bundle30_40.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Bundle30_40.java
@@ -50,7 +50,7 @@ public class Bundle30_40 {
if (src.hasFullUrl())
tgt.setFullUrlElement(VersionConvertor_30_40.convertUri(src.getFullUrlElement()));
if (src.hasResource())
- tgt.setResource(VersionConvertor_30_40.convertResource(src.getResource(), false));
+ tgt.setResource(VersionConvertor_30_40.convertResource(src.getResource()));
if (src.hasSearch())
tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch()));
if (src.hasRequest())
@@ -69,7 +69,7 @@ public class Bundle30_40 {
if (src.hasFullUrl())
tgt.setFullUrlElement(VersionConvertor_30_40.convertUri(src.getFullUrlElement()));
if (src.hasResource())
- tgt.setResource(VersionConvertor_30_40.convertResource(src.getResource(), false));
+ tgt.setResource(VersionConvertor_30_40.convertResource(src.getResource()));
if (src.hasSearch())
tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch()));
if (src.hasRequest())
@@ -133,7 +133,7 @@ public class Bundle30_40 {
if (src.hasLastModified())
tgt.setLastModifiedElement(VersionConvertor_30_40.convertInstant(src.getLastModifiedElement()));
if (src.hasOutcome())
- tgt.setOutcome(VersionConvertor_30_40.convertResource(src.getOutcome(), false));
+ tgt.setOutcome(VersionConvertor_30_40.convertResource(src.getOutcome()));
return tgt;
}
@@ -151,7 +151,7 @@ public class Bundle30_40 {
if (src.hasLastModified())
tgt.setLastModifiedElement(VersionConvertor_30_40.convertInstant(src.getLastModifiedElement()));
if (src.hasOutcome())
- tgt.setOutcome(VersionConvertor_30_40.convertResource(src.getOutcome(), false));
+ tgt.setOutcome(VersionConvertor_30_40.convertResource(src.getOutcome()));
return tgt;
}
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Parameters30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Parameters30_40.java
index 1869aeb6b..d0c5a87ad 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Parameters30_40.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_40/Parameters30_40.java
@@ -33,7 +33,7 @@ public class Parameters30_40 {
if (src.hasValue())
tgt.setValue(VersionConvertor_30_40.convertType(src.getValue()));
if (src.hasResource())
- tgt.setResource(VersionConvertor_30_40.convertResource(src.getResource(), false));
+ tgt.setResource(VersionConvertor_30_40.convertResource(src.getResource()));
for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t));
return tgt;
}
@@ -48,7 +48,7 @@ public class Parameters30_40 {
if (src.hasValue())
tgt.setValue(VersionConvertor_30_40.convertType(src.getValue()));
if (src.hasResource())
- tgt.setResource(VersionConvertor_30_40.convertResource(src.getResource(), false));
+ tgt.setResource(VersionConvertor_30_40.convertResource(src.getResource()));
for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t));
return tgt;
}
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ActivityDefinition30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ActivityDefinition30_50.java
index 5d05a633a..8f953620c 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ActivityDefinition30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ActivityDefinition30_50.java
@@ -4,6 +4,7 @@ import org.hl7.fhir.convertors.VersionConvertor_30_50;
import org.hl7.fhir.dstu3.model.ContactDetail;
import org.hl7.fhir.dstu3.model.Contributor.ContributorType;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.CodeableReference;
public class ActivityDefinition30_50 {
@@ -66,7 +67,7 @@ public class ActivityDefinition30_50 {
if (src.hasTiming())
tgt.setTiming(VersionConvertor_30_50.convertType(src.getTiming()));
if (src.hasLocation())
- tgt.setLocation(VersionConvertor_30_50.convertReference(src.getLocation()));
+ tgt.setLocation(new CodeableReference(VersionConvertor_30_50.convertReference(src.getLocation())));
for (org.hl7.fhir.dstu3.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertActivityDefinitionParticipantComponent(t));
if (src.hasProduct())
tgt.setProduct(VersionConvertor_30_50.convertType(src.getProduct()));
@@ -152,8 +153,8 @@ public class ActivityDefinition30_50 {
tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode()));
if (src.hasTiming())
tgt.setTiming(VersionConvertor_30_50.convertType(src.getTiming()));
- if (src.hasLocation())
- tgt.setLocation(VersionConvertor_30_50.convertReference(src.getLocation()));
+ if (src.getLocation().hasReference())
+ tgt.setLocation(VersionConvertor_30_50.convertReference(src.getLocation().getReference()));
for (org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertActivityDefinitionParticipantComponent(t));
if (src.hasProduct())
tgt.setProduct(VersionConvertor_30_50.convertType(src.getProduct()));
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/AllergyIntolerance30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/AllergyIntolerance30_50.java
index 412dcf124..2ff8491a2 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/AllergyIntolerance30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/AllergyIntolerance30_50.java
@@ -2,6 +2,7 @@ package org.hl7.fhir.convertors.conv30_50;
import org.hl7.fhir.convertors.VersionConvertor_30_50;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.CodeableReference;
import java.util.stream.Collectors;
@@ -207,7 +208,7 @@ public class AllergyIntolerance30_50 {
VersionConvertor_30_50.copyElement(src, tgt);
if (src.hasSubstance())
tgt.setSubstance(VersionConvertor_30_50.convertCodeableConcept(src.getSubstance()));
- for (org.hl7.fhir.r5.model.CodeableConcept t : src.getManifestation()) tgt.addManifestation(VersionConvertor_30_50.convertCodeableConcept(t));
+ for (CodeableReference t : src.getManifestation()) if (t.hasConcept()) tgt.addManifestation(VersionConvertor_30_50.convertCodeableConcept(t.getConcept()));
if (src.hasDescription())
tgt.setDescriptionElement(VersionConvertor_30_50.convertString(src.getDescriptionElement()));
if (src.hasOnset())
@@ -227,7 +228,7 @@ public class AllergyIntolerance30_50 {
VersionConvertor_30_50.copyElement(src, tgt);
if (src.hasSubstance())
tgt.setSubstance(VersionConvertor_30_50.convertCodeableConcept(src.getSubstance()));
- for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getManifestation()) tgt.addManifestation(VersionConvertor_30_50.convertCodeableConcept(t));
+ for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getManifestation()) tgt.addManifestation(new CodeableReference(VersionConvertor_30_50.convertCodeableConcept(t)));
if (src.hasDescription())
tgt.setDescriptionElement(VersionConvertor_30_50.convertString(src.getDescriptionElement()));
if (src.hasOnset())
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Appointment30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Appointment30_50.java
index 28d708cc8..43dd6f869 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Appointment30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Appointment30_50.java
@@ -1,10 +1,14 @@
package org.hl7.fhir.convertors.conv30_50;
+import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.convertors.VersionConvertor_30_50;
+import org.hl7.fhir.convertors.VersionConvertor_Base;
+import org.hl7.fhir.dstu3.model.UnsignedIntType;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.CodeableConcept;
import org.hl7.fhir.r5.model.CodeableReference;
-public class Appointment30_50 {
+public class Appointment30_50 extends VersionConvertor_Base {
public static org.hl7.fhir.dstu3.model.Appointment convertAppointment(org.hl7.fhir.r5.model.Appointment src) throws FHIRException {
if (src == null)
@@ -25,7 +29,7 @@ public class Appointment30_50 {
for (CodeableReference t : src.getReason()) if (t.hasReference())
tgt.addIndication(VersionConvertor_30_50.convertReference(t.getReference()));
if (src.hasPriority())
- tgt.setPriorityElement(VersionConvertor_30_50.convertUnsignedInt(src.getPriorityElement()));
+ tgt.setPriorityElement(convertAppointmentPriority(src.getPriority()));
if (src.hasDescription())
tgt.setDescriptionElement(VersionConvertor_30_50.convertString(src.getDescriptionElement()));
for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_50.convertReference(t));
@@ -46,6 +50,19 @@ public class Appointment30_50 {
return tgt;
}
+
+ private static UnsignedIntType convertAppointmentPriority(CodeableConcept src) {
+ UnsignedIntType tgt = new UnsignedIntType(convertAppointmentPriorityFromR5(src));
+ VersionConvertor_30_50.copyElement(src, tgt);
+ return tgt;
+ }
+
+ private static CodeableConcept convertAppointmentPriority(UnsignedIntType src) {
+ CodeableConcept tgt = src.hasValue() ? convertAppointmentPriorityToR5(src.getValue()) : new CodeableConcept();
+ VersionConvertor_30_50.copyElement(src, tgt);
+ return tgt;
+ }
+
public static org.hl7.fhir.r5.model.Appointment convertAppointment(org.hl7.fhir.dstu3.model.Appointment src) throws FHIRException {
if (src == null)
return null;
@@ -63,7 +80,7 @@ public class Appointment30_50 {
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t));
for (org.hl7.fhir.dstu3.model.Reference t : src.getIndication()) tgt.addReason(VersionConvertor_30_50.convertReferenceToCodableReference(t));
if (src.hasPriority())
- tgt.setPriorityElement(VersionConvertor_30_50.convertUnsignedInt(src.getPriorityElement()));
+ tgt.setPriority(convertAppointmentPriority(src.getPriorityElement()));
if (src.hasDescription())
tgt.setDescriptionElement(VersionConvertor_30_50.convertString(src.getDescriptionElement()));
for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(VersionConvertor_30_50.convertReference(t));
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Bundle30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Bundle30_50.java
index 5a15d2726..4570e0413 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Bundle30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Bundle30_50.java
@@ -50,7 +50,7 @@ public class Bundle30_50 {
if (src.hasFullUrl())
tgt.setFullUrlElement(VersionConvertor_30_50.convertUri(src.getFullUrlElement()));
if (src.hasResource())
- tgt.setResource(VersionConvertor_30_50.convertResource(src.getResource(), false));
+ tgt.setResource(VersionConvertor_30_50.convertResource(src.getResource()));
if (src.hasSearch())
tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch()));
if (src.hasRequest())
@@ -69,7 +69,7 @@ public class Bundle30_50 {
if (src.hasFullUrl())
tgt.setFullUrlElement(VersionConvertor_30_50.convertUri(src.getFullUrlElement()));
if (src.hasResource())
- tgt.setResource(VersionConvertor_30_50.convertResource(src.getResource(), false));
+ tgt.setResource(VersionConvertor_30_50.convertResource(src.getResource()));
if (src.hasSearch())
tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch()));
if (src.hasRequest())
@@ -133,7 +133,7 @@ public class Bundle30_50 {
if (src.hasLastModified())
tgt.setLastModifiedElement(VersionConvertor_30_50.convertInstant(src.getLastModifiedElement()));
if (src.hasOutcome())
- tgt.setOutcome(VersionConvertor_30_50.convertResource(src.getOutcome(), false));
+ tgt.setOutcome(VersionConvertor_30_50.convertResource(src.getOutcome()));
return tgt;
}
@@ -151,7 +151,7 @@ public class Bundle30_50 {
if (src.hasLastModified())
tgt.setLastModifiedElement(VersionConvertor_30_50.convertInstant(src.getLastModifiedElement()));
if (src.hasOutcome())
- tgt.setOutcome(VersionConvertor_30_50.convertResource(src.getOutcome(), false));
+ tgt.setOutcome(VersionConvertor_30_50.convertResource(src.getOutcome()));
return tgt;
}
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CarePlan30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CarePlan30_50.java
index 8300d84a1..6a4011902 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CarePlan30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/CarePlan30_50.java
@@ -161,24 +161,24 @@ public class CarePlan30_50 {
return null;
org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent();
VersionConvertor_30_50.copyElement(src, tgt);
- for (CodeableReference t : src.getOutcome()) {
+ for (CodeableReference t : src.getPerformedActivity()) {
if (t.hasConcept())
tgt.addOutcomeCodeableConcept(VersionConvertor_30_50.convertCodeableConcept(t.getConcept()));
}
- for (CodeableReference t : src.getOutcome()) {
+ for (CodeableReference t : src.getPerformedActivity()) {
if (t.hasReference())
tgt.addOutcomeReference(VersionConvertor_30_50.convertReference(t.getReference()));
}
for (org.hl7.fhir.r5.model.Annotation t : src.getProgress()) {
tgt.addProgress(VersionConvertor_30_50.convertAnnotation(t));
}
- if (src.hasReference()) {
- if (src.hasReference())
- tgt.setReference(VersionConvertor_30_50.convertReference(src.getReference()));
+ if (src.hasPlannedActivityReference()) {
+ if (src.hasPlannedActivityReference())
+ tgt.setReference(VersionConvertor_30_50.convertReference(src.getPlannedActivityReference()));
}
- if (src.hasDetail()) {
- if (src.hasDetail())
- tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail()));
+ if (src.hasPlannedActivityDetail()) {
+ if (src.hasPlannedActivityDetail())
+ tgt.setDetail(convertCarePlanActivityDetailComponent(src.getPlannedActivityDetail()));
}
return tgt;
}
@@ -189,26 +189,26 @@ public class CarePlan30_50 {
org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent();
VersionConvertor_30_50.copyElement(src, tgt);
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOutcomeCodeableConcept()) {
- tgt.addOutcome(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t));
+ tgt.addPerformedActivity(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t));
}
for (org.hl7.fhir.dstu3.model.Reference t : src.getOutcomeReference()) {
- tgt.addOutcome(VersionConvertor_30_50.convertReferenceToCodableReference(t));
+ tgt.addPerformedActivity(VersionConvertor_30_50.convertReferenceToCodableReference(t));
}
for (org.hl7.fhir.dstu3.model.Annotation t : src.getProgress()) {
tgt.addProgress(VersionConvertor_30_50.convertAnnotation(t));
}
if (src.hasReference()) {
if (src.hasReference())
- tgt.setReference(VersionConvertor_30_50.convertReference(src.getReference()));
+ tgt.setPlannedActivityReference(VersionConvertor_30_50.convertReference(src.getReference()));
}
if (src.hasDetail()) {
if (src.hasDetail())
- tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail()));
+ tgt.setPlannedActivityDetail(convertCarePlanActivityDetailComponent(src.getDetail()));
}
return tgt;
}
- public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException {
+ public static org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityPlannedActivityDetailComponent src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent();
@@ -281,10 +281,10 @@ public class CarePlan30_50 {
return tgt;
}
- public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException {
+ public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityPlannedActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException {
if (src == null)
return null;
- org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent();
+ org.hl7.fhir.r5.model.CarePlan.CarePlanActivityPlannedActivityDetailComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityPlannedActivityDetailComponent();
VersionConvertor_30_50.copyElement(src, tgt);
if (src.hasCategory()) {
org.hl7.fhir.r5.model.Extension t = new org.hl7.fhir.r5.model.Extension();
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ConceptMap30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ConceptMap30_50.java
index 1da574ca9..9dd6f2771 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ConceptMap30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ConceptMap30_50.java
@@ -4,10 +4,12 @@ import org.hl7.fhir.convertors.VersionConvertorConstants;
import org.hl7.fhir.convertors.VersionConvertor_30_50;
import org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.CanonicalType;
import org.hl7.fhir.r5.model.Enumeration;
import org.hl7.fhir.r5.model.Enumerations;
import org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship;
import org.hl7.fhir.r5.utils.ToolingExtensions;
+import org.hl7.fhir.utilities.CanonicalPair;
public class ConceptMap30_50 {
@@ -100,14 +102,11 @@ public class ConceptMap30_50 {
return null;
org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent();
VersionConvertor_30_50.copyElement(src, tgt);
- if (src.hasSource())
- tgt.setSourceElement(VersionConvertor_30_50.convertUri(src.getSourceElement()));
- if (src.hasSourceVersion())
- tgt.setSourceVersionElement(VersionConvertor_30_50.convertString(src.getSourceVersionElement()));
- if (src.hasTarget())
- tgt.setTarget(src.getTarget());
- if (src.hasTargetVersion())
- tgt.setTargetVersion(src.getTargetVersion());
+ if (src.hasSource() || src.hasSourceVersion())
+ tgt.setSourceElement(convertUriAndVersionToCanonical(src.getSourceElement(), src.getSourceVersionElement()));
+ if (src.hasTarget() || src.hasTargetVersion())
+ tgt.setSourceElement(convertUriAndVersionToCanonical(src.getTargetElement(), src.getTargetVersionElement()));
+
for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : src.getElement()) tgt.addElement(convertSourceElementComponent(t));
if (src.hasUnmapped())
tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped()));
@@ -119,20 +118,38 @@ public class ConceptMap30_50 {
return null;
org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent();
VersionConvertor_30_50.copyElement(src, tgt);
- if (src.hasSource())
- tgt.setSourceElement(VersionConvertor_30_50.convertUri(src.getSourceElement()));
- if (src.hasSourceVersion())
- tgt.setSourceVersionElement(VersionConvertor_30_50.convertString(src.getSourceVersionElement()));
- if (src.hasTarget())
- tgt.setTarget(src.getTarget());
- if (src.hasTargetVersion())
- tgt.setTargetVersion(src.getTargetVersion());
+ if (src.hasSource()) {
+ CanonicalPair cp = new CanonicalPair(src.getSource());
+ tgt.setSource(cp.getUrl());
+ tgt.setSourceVersion(cp.getVersion());
+ }
+ if (src.hasTarget()) {
+ CanonicalPair cp = new CanonicalPair(src.getTarget());
+ tgt.setTarget(cp.getUrl());
+ tgt.setTargetVersion(cp.getVersion());
+ }
for (org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent t : src.getElement()) tgt.addElement(convertSourceElementComponent(t));
if (src.hasUnmapped())
tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped()));
return tgt;
}
+ private static CanonicalType convertUriAndVersionToCanonical(org.hl7.fhir.dstu3.model.UriType srcUri, org.hl7.fhir.dstu3.model.StringType srcVersion) {
+ if (srcUri == null && srcVersion == null)
+ return null;
+ org.hl7.fhir.r5.model.CanonicalType tgt = new org.hl7.fhir.r5.model.CanonicalType();
+ VersionConvertor_30_50.copyElement(srcUri == null ? srcVersion : srcUri, tgt);
+ if (srcUri.hasValue()) {
+ if (srcVersion.hasValue()) {
+ tgt.setValue(srcUri.getValue()+"|"+srcVersion.getValue());
+ } else {
+ tgt.setValue(srcUri.getValue());
+ }
+ }
+ return tgt;
+ }
+
+
public static org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupUnmappedComponent convertConceptMapGroupUnmappedComponent(org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupUnmappedComponent src) throws FHIRException {
if (src == null)
return null;
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DeviceUseStatement30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DeviceUseStatement30_50.java
index 9b6444401..0f74d359e 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DeviceUseStatement30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/DeviceUseStatement30_50.java
@@ -6,7 +6,7 @@ import org.hl7.fhir.r5.model.CodeableReference;
public class DeviceUseStatement30_50 {
- public static org.hl7.fhir.dstu3.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r5.model.DeviceUseStatement src) throws FHIRException {
+ public static org.hl7.fhir.dstu3.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r5.model.DeviceUsage src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.dstu3.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu3.model.DeviceUseStatement();
@@ -32,10 +32,10 @@ public class DeviceUseStatement30_50 {
return tgt;
}
- public static org.hl7.fhir.r5.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu3.model.DeviceUseStatement src) throws FHIRException {
+ public static org.hl7.fhir.r5.model.DeviceUsage convertDeviceUseStatement(org.hl7.fhir.dstu3.model.DeviceUseStatement src) throws FHIRException {
if (src == null)
return null;
- org.hl7.fhir.r5.model.DeviceUseStatement tgt = new org.hl7.fhir.r5.model.DeviceUseStatement();
+ org.hl7.fhir.r5.model.DeviceUsage tgt = new org.hl7.fhir.r5.model.DeviceUsage();
VersionConvertor_30_50.copyDomainResource(src, tgt);
for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(t));
if (src.hasStatus())
@@ -57,7 +57,7 @@ public class DeviceUseStatement30_50 {
return tgt;
}
- static public org.hl7.fhir.dstu3.model.Enumeration convertDeviceUseStatementStatus(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
+ static public org.hl7.fhir.dstu3.model.Enumeration convertDeviceUseStatementStatus(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DeviceUseStatement.DeviceUseStatementStatusEnumFactory());
@@ -88,32 +88,32 @@ public class DeviceUseStatement30_50 {
return tgt;
}
- static public org.hl7.fhir.r5.model.Enumeration convertDeviceUseStatementStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException {
+ static public org.hl7.fhir.r5.model.Enumeration convertDeviceUseStatementStatus(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatusEnumFactory());
+ org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatusEnumFactory());
VersionConvertor_30_50.copyElement(src, tgt);
switch(src.getValue()) {
case ACTIVE:
- tgt.setValue(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ACTIVE);
+ tgt.setValue(org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatus.ACTIVE);
break;
case COMPLETED:
- tgt.setValue(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.COMPLETED);
+ tgt.setValue(org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatus.COMPLETED);
break;
case ENTEREDINERROR:
- tgt.setValue(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ENTEREDINERROR);
+ tgt.setValue(org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatus.ENTEREDINERROR);
break;
case INTENDED:
- tgt.setValue(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.INTENDED);
+ tgt.setValue(org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatus.INTENDED);
break;
case STOPPED:
- tgt.setValue(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.STOPPED);
+ tgt.setValue(org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatus.STOPPED);
break;
case ONHOLD:
- tgt.setValue(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ONHOLD);
+ tgt.setValue(org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatus.ONHOLD);
break;
default:
- tgt.setValue(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.NULL);
+ tgt.setValue(org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatus.NULL);
break;
}
return tgt;
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Goal30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Goal30_50.java
index 3926aee3a..07d9de0c8 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Goal30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Goal30_50.java
@@ -29,8 +29,6 @@ public class Goal30_50 {
tgt.setStatusDateElement(VersionConvertor_30_50.convertDate(src.getStatusDateElement()));
if (src.hasStatusReason())
tgt.setStatusReasonElement(VersionConvertor_30_50.convertString(src.getStatusReasonElement()));
- if (src.hasExpressedBy())
- tgt.setExpressedBy(VersionConvertor_30_50.convertReference(src.getExpressedBy()));
for (org.hl7.fhir.r5.model.Reference t : src.getAddresses()) tgt.addAddresses(VersionConvertor_30_50.convertReference(t));
for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t));
for (CodeableReference t : src.getOutcome()) if (t.hasConcept())
@@ -63,8 +61,6 @@ public class Goal30_50 {
tgt.setStatusDateElement(VersionConvertor_30_50.convertDate(src.getStatusDateElement()));
if (src.hasStatusReason())
tgt.setStatusReasonElement(VersionConvertor_30_50.convertString(src.getStatusReasonElement()));
- if (src.hasExpressedBy())
- tgt.setExpressedBy(VersionConvertor_30_50.convertReference(src.getExpressedBy()));
for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) tgt.addAddresses(VersionConvertor_30_50.convertReference(t));
for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) tgt.addNote(VersionConvertor_30_50.convertAnnotation(t));
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOutcomeCode()) tgt.addOutcome(VersionConvertor_30_50.convertCodeableConceptToCodableReference(t));
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Medication30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Medication30_50.java
index 9f8c07d10..4cc577bea 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Medication30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Medication30_50.java
@@ -15,7 +15,7 @@ public class Medication30_50 {
if (src.hasStatus())
tgt.setStatusElement(convertMedicationStatus(src.getStatusElement()));
if (src.hasManufacturer())
- tgt.setManufacturer(VersionConvertor_30_50.convertReference(src.getManufacturer()));
+ tgt.setSponsor(VersionConvertor_30_50.convertReference(src.getManufacturer()));
if (src.hasForm())
tgt.setDoseForm(VersionConvertor_30_50.convertCodeableConcept(src.getForm()));
for (org.hl7.fhir.dstu3.model.Medication.MedicationIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertMedicationIngredientComponent(t));
@@ -33,8 +33,8 @@ public class Medication30_50 {
tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode()));
if (src.hasStatus())
tgt.setStatusElement(convertMedicationStatus(src.getStatusElement()));
- if (src.hasManufacturer())
- tgt.setManufacturer(VersionConvertor_30_50.convertReference(src.getManufacturer()));
+ if (src.hasSponsor())
+ tgt.setManufacturer(VersionConvertor_30_50.convertReference(src.getSponsor()));
if (src.hasDoseForm())
tgt.setForm(VersionConvertor_30_50.convertCodeableConcept(src.getDoseForm()));
for (org.hl7.fhir.r5.model.Medication.MedicationIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertMedicationIngredientComponent(t));
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationStatement30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationStatement30_50.java
index d9d865f40..7814583c7 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationStatement30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/MedicationStatement30_50.java
@@ -86,24 +86,24 @@ public class MedicationStatement30_50 {
org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatusEnumFactory());
VersionConvertor_30_50.copyElement(src, tgt);
switch(src.getValue()) {
- case ACTIVE:
- tgt.setValue(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ACTIVE);
- break;
+// case ACTIVE:
+// tgt.setValue(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ACTIVE);
+// break;
case COMPLETED:
tgt.setValue(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.COMPLETED);
break;
case ENTEREDINERROR:
tgt.setValue(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR);
break;
- case INTENDED:
+ case UNKNOWN:
tgt.setValue(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.INTENDED);
break;
- case STOPPED:
- tgt.setValue(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.STOPPED);
- break;
- case ONHOLD:
- tgt.setValue(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ONHOLD);
- break;
+// case STOPPED:
+// tgt.setValue(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.STOPPED);
+// break;
+// case ONHOLD:
+// tgt.setValue(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ONHOLD);
+// break;
default:
tgt.setValue(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.NULL);
break;
@@ -118,7 +118,7 @@ public class MedicationStatement30_50 {
VersionConvertor_30_50.copyElement(src, tgt);
switch(src.getValue()) {
case ACTIVE:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ACTIVE);
+ tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.COMPLETED);
break;
case COMPLETED:
tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.COMPLETED);
@@ -127,13 +127,13 @@ public class MedicationStatement30_50 {
tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ENTEREDINERROR);
break;
case INTENDED:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.INTENDED);
+ tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.UNKNOWN);
break;
case STOPPED:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.STOPPED);
+ tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.UNKNOWN);
break;
case ONHOLD:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ONHOLD);
+ tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.UNKNOWN);
break;
default:
tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.NULL);
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Parameters30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Parameters30_50.java
index 935eaeafe..c2bc0da71 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Parameters30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Parameters30_50.java
@@ -33,7 +33,7 @@ public class Parameters30_50 {
if (src.hasValue())
tgt.setValue(VersionConvertor_30_50.convertType(src.getValue()));
if (src.hasResource())
- tgt.setResource(VersionConvertor_30_50.convertResource(src.getResource(), false));
+ tgt.setResource(VersionConvertor_30_50.convertResource(src.getResource()));
for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t));
return tgt;
}
@@ -48,7 +48,7 @@ public class Parameters30_50 {
if (src.hasValue())
tgt.setValue(VersionConvertor_30_50.convertType(src.getValue()));
if (src.hasResource())
- tgt.setResource(VersionConvertor_30_50.convertResource(src.getResource(), false));
+ tgt.setResource(VersionConvertor_30_50.convertResource(src.getResource()));
for (org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent t : src.getPart()) tgt.addPart(convertParametersParameterComponent(t));
return tgt;
}
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/PlanDefinition30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/PlanDefinition30_50.java
index 63c6c204e..7301a32a1 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/PlanDefinition30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/PlanDefinition30_50.java
@@ -1,9 +1,17 @@
package org.hl7.fhir.convertors.conv30_50;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
import org.hl7.fhir.convertors.VersionConvertor_30_50;
import org.hl7.fhir.dstu3.model.ContactDetail;
import org.hl7.fhir.dstu3.model.Contributor.ContributorType;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.DataRequirement;
+import org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionInputComponent;
+import org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionOutputComponent;
public class PlanDefinition30_50 {
@@ -546,14 +554,14 @@ public class PlanDefinition30_50 {
tgt.setDescriptionElement(VersionConvertor_30_50.convertString(src.getDescriptionElement()));
if (src.hasTextEquivalent())
tgt.setTextEquivalentElement(VersionConvertor_30_50.convertString(src.getTextEquivalentElement()));
- for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_50.convertCodeableConcept(t));
+ for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(t));
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_30_50.convertCodeableConcept(t));
for (org.hl7.fhir.dstu3.model.RelatedArtifact t : src.getDocumentation()) tgt.addDocumentation(VersionConvertor_30_50.convertRelatedArtifact(t));
for (org.hl7.fhir.dstu3.model.IdType t : src.getGoalId()) tgt.addGoalId(t.getValue());
for (org.hl7.fhir.dstu3.model.TriggerDefinition t : src.getTriggerDefinition()) tgt.addTrigger(VersionConvertor_30_50.convertTriggerDefinition(t));
for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) tgt.addCondition(convertPlanDefinitionActionConditionComponent(t));
- for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getInput()) tgt.addInput(VersionConvertor_30_50.convertDataRequirement(t));
- for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getOutput()) tgt.addOutput(VersionConvertor_30_50.convertDataRequirement(t));
+ for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getInput()) tgt.addInput(wrapInput(VersionConvertor_30_50.convertDataRequirement(t)));
+ for (org.hl7.fhir.dstu3.model.DataRequirement t : src.getOutput()) tgt.addOutput(wrapOutput(VersionConvertor_30_50.convertDataRequirement(t)));
for (org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t));
if (src.hasTiming())
tgt.setTiming(VersionConvertor_30_50.convertType(src.getTiming()));
@@ -579,6 +587,14 @@ public class PlanDefinition30_50 {
return tgt;
}
+ private static PlanDefinitionActionOutputComponent wrapOutput(DataRequirement dr) {
+ return new PlanDefinitionActionOutputComponent().setRequirement(dr);
+ }
+
+ private static PlanDefinitionActionInputComponent wrapInput(DataRequirement dr) {
+ return new PlanDefinitionActionInputComponent().setRequirement(dr);
+ }
+
public static org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException {
if (src == null)
return null;
@@ -592,14 +608,14 @@ public class PlanDefinition30_50 {
tgt.setDescriptionElement(VersionConvertor_30_50.convertString(src.getDescriptionElement()));
if (src.hasTextEquivalent())
tgt.setTextEquivalentElement(VersionConvertor_30_50.convertString(src.getTextEquivalentElement()));
- for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) tgt.addCode(VersionConvertor_30_50.convertCodeableConcept(t));
+ if (src.hasCode()) tgt.addCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode()));
for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) tgt.addReason(VersionConvertor_30_50.convertCodeableConcept(t));
for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getDocumentation()) tgt.addDocumentation(VersionConvertor_30_50.convertRelatedArtifact(t));
for (org.hl7.fhir.r5.model.IdType t : src.getGoalId()) tgt.addGoalId(t.getValue());
for (org.hl7.fhir.r5.model.TriggerDefinition t : src.getTrigger()) tgt.addTriggerDefinition(VersionConvertor_30_50.convertTriggerDefinition(t));
for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) tgt.addCondition(convertPlanDefinitionActionConditionComponent(t));
- for (org.hl7.fhir.r5.model.DataRequirement t : src.getInput()) tgt.addInput(VersionConvertor_30_50.convertDataRequirement(t));
- for (org.hl7.fhir.r5.model.DataRequirement t : src.getOutput()) tgt.addOutput(VersionConvertor_30_50.convertDataRequirement(t));
+ for (PlanDefinitionActionInputComponent t : src.getInput()) tgt.addInput(VersionConvertor_30_50.convertDataRequirement(t.getRequirement()));
+ for (PlanDefinitionActionOutputComponent t : src.getOutput()) tgt.addOutput(VersionConvertor_30_50.convertDataRequirement(t.getRequirement()));
for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t));
if (src.hasTiming())
tgt.setTiming(VersionConvertor_30_50.convertType(src.getTiming()));
@@ -718,8 +734,8 @@ public class PlanDefinition30_50 {
return null;
org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.dstu3.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent();
VersionConvertor_30_50.copyElement(src, tgt);
- if (src.hasActionId())
- tgt.setActionIdElement(VersionConvertor_30_50.convertId(src.getActionIdElement()));
+ if (src.hasTargetId())
+ tgt.setActionIdElement(VersionConvertor_30_50.convertId(src.getTargetIdElement()));
if (src.hasRelationship())
tgt.setRelationshipElement(convertActionRelationshipType(src.getRelationshipElement()));
if (src.hasOffset())
@@ -733,7 +749,7 @@ public class PlanDefinition30_50 {
org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent();
VersionConvertor_30_50.copyElement(src, tgt);
if (src.hasActionId())
- tgt.setActionIdElement(VersionConvertor_30_50.convertId(src.getActionIdElement()));
+ tgt.setTargetIdElement(VersionConvertor_30_50.convertId(src.getActionIdElement()));
if (src.hasRelationship())
tgt.setRelationshipElement(convertActionRelationshipType(src.getRelationshipElement()));
if (src.hasOffset())
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Questionnaire30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Questionnaire30_50.java
index 21536a757..d3ede0336 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Questionnaire30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Questionnaire30_50.java
@@ -1,8 +1,10 @@
package org.hl7.fhir.convertors.conv30_50;
import org.hl7.fhir.convertors.VersionConvertor_30_50;
+import org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r5.model.Questionnaire;
+import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint;
public class Questionnaire30_50 {
@@ -106,8 +108,8 @@ public class Questionnaire30_50 {
tgt.setPrefixElement(VersionConvertor_30_50.convertString(src.getPrefixElement()));
if (src.hasText())
tgt.setTextElement(VersionConvertor_30_50.convertString(src.getTextElement()));
- if (src.hasType())
- tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement()));
+ if (src.hasType())
+ tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement(), src.getAnswerConstraint()));
for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t));
if (src.hasRequired())
tgt.setRequiredElement(VersionConvertor_30_50.convertBoolean(src.getRequiredElement()));
@@ -139,9 +141,15 @@ public class Questionnaire30_50 {
if (src.hasPrefix())
tgt.setPrefixElement(VersionConvertor_30_50.convertString(src.getPrefixElement()));
if (src.hasText())
- tgt.setTextElement(VersionConvertor_30_50.convertString(src.getTextElement()));
- if (src.hasType())
+ tgt.setTextElement(VersionConvertor_30_50.convertStringToMarkdown(src.getTextElement()));
+ if (src.hasType()) {
tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement()));
+ if (src.getType() == QuestionnaireItemType.CHOICE) {
+ tgt.setAnswerConstraint(QuestionnaireAnswerConstraint.OPTIONSONLY);
+ } else if (src.getType() == QuestionnaireItemType.OPENCHOICE) {
+ tgt.setAnswerConstraint(QuestionnaireAnswerConstraint.OPTIONSORSTRING);
+ }
+ }
for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t));
tgt.setEnableBehavior(Questionnaire.EnableWhenBehavior.ANY);
if (src.hasRequired())
@@ -217,7 +225,7 @@ public class Questionnaire30_50 {
return tgt;
}
- static public org.hl7.fhir.dstu3.model.Enumeration convertQuestionnaireItemType(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
+ static public org.hl7.fhir.dstu3.model.Enumeration convertQuestionnaireItemType(org.hl7.fhir.r5.model.Enumeration src, QuestionnaireAnswerConstraint constraint) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
@@ -256,12 +264,12 @@ public class Questionnaire30_50 {
case URL:
tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL);
break;
- case CHOICE:
- tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE);
- break;
- case OPENCHOICE:
+ case CODING:
+ if (constraint == QuestionnaireAnswerConstraint.OPTIONSORSTRING)
tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE);
- break;
+ else
+ tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE);
+ break;
case ATTACHMENT:
tgt.setValue(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT);
break;
@@ -318,10 +326,10 @@ public class Questionnaire30_50 {
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.URL);
break;
case CHOICE:
- tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CHOICE);
+ tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CODING);
break;
case OPENCHOICE:
- tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.OPENCHOICE);
+ tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CODING);
break;
case ATTACHMENT:
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.ATTACHMENT);
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/StructureMap30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/StructureMap30_50.java
index f8f49b95d..624c845e6 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/StructureMap30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/StructureMap30_50.java
@@ -81,43 +81,6 @@ public class StructureMap30_50 {
return tgt;
}
- static public org.hl7.fhir.r5.model.Enumeration convertStructureMapContextType(org.hl7.fhir.dstu3.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.StructureMap.StructureMapContextTypeEnumFactory());
- VersionConvertor_30_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case TYPE:
- tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.TYPE);
- break;
- case VARIABLE:
- tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.VARIABLE);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapContextType.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.dstu3.model.Enumeration convertStructureMapContextType(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.dstu3.model.Enumeration tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextTypeEnumFactory());
- VersionConvertor_30_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case TYPE:
- tgt.setValue(org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.TYPE);
- break;
- case VARIABLE:
- tgt.setValue(org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.VARIABLE);
- break;
- default:
- tgt.setValue(org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.NULL);
- break;
- }
- return tgt;
- }
public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.dstu3.model.StructureMap.StructureMapGroupComponent src) throws FHIRException {
if (src == null)
@@ -304,8 +267,8 @@ public class StructureMap30_50 {
VersionConvertor_30_50.copyElement(src, tgt);
if (src.hasContext())
tgt.setContextElement(VersionConvertor_30_50.convertId(src.getContextElement()));
- if (src.hasContextType())
- tgt.setContextTypeElement(convertStructureMapContextType(src.getContextTypeElement()));
+ if (src.hasContextType() && src.getContextType() != org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.VARIABLE)
+ throw new Error("This conversion is not supported. Consult code maintainers"); // this should never happens - no one knows what the intent was here.
if (src.hasElement())
tgt.setElementElement(VersionConvertor_30_50.convertString(src.getElementElement()));
if (src.hasVariable())
@@ -328,8 +291,7 @@ public class StructureMap30_50 {
VersionConvertor_30_50.copyElement(src, tgt);
if (src.hasContext())
tgt.setContextElement(VersionConvertor_30_50.convertId(src.getContextElement()));
- if (src.hasContextType())
- tgt.setContextTypeElement(convertStructureMapContextType(src.getContextTypeElement()));
+ tgt.setContextType(org.hl7.fhir.dstu3.model.StructureMap.StructureMapContextType.VARIABLE);
if (src.hasElement())
tgt.setElementElement(VersionConvertor_30_50.convertString(src.getElementElement()));
if (src.hasVariable())
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Substance30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Substance30_50.java
index df8313582..922ba3751 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Substance30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/Substance30_50.java
@@ -2,6 +2,7 @@ package org.hl7.fhir.convertors.conv30_50;
import org.hl7.fhir.convertors.VersionConvertor_30_50;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.Identifier;
public class Substance30_50 {
@@ -59,10 +60,10 @@ public class Substance30_50 {
tgt.setStatusElement(convertFHIRSubstanceStatus(src.getStatusElement()));
for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t));
if (src.hasCode())
- tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode()));
+ tgt.getCode().setConcept(VersionConvertor_30_50.convertCodeableConcept(src.getCode()));
if (src.hasDescription())
tgt.setDescriptionElement(VersionConvertor_30_50.convertString(src.getDescriptionElement()));
- for (org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent t : src.getInstance()) tgt.addInstance(convertSubstanceInstanceComponent(t));
+ for (org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent t : src.getInstance()) convertSubstanceInstanceComponent(t, tgt);
for (org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertSubstanceIngredientComponent(t));
return tgt;
}
@@ -76,11 +77,13 @@ public class Substance30_50 {
if (src.hasStatus())
tgt.setStatusElement(convertFHIRSubstanceStatus(src.getStatusElement()));
for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCategory()) tgt.addCategory(VersionConvertor_30_50.convertCodeableConcept(t));
- if (src.hasCode())
- tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode()));
+ if (src.getCode().hasConcept())
+ tgt.setCode(VersionConvertor_30_50.convertCodeableConcept(src.getCode().getConcept()));
if (src.hasDescription())
tgt.setDescriptionElement(VersionConvertor_30_50.convertString(src.getDescriptionElement()));
- for (org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent t : src.getInstance()) tgt.addInstance(convertSubstanceInstanceComponent(t));
+ if (src.getInstance()) {
+ tgt.addInstance(convertSubstanceInstanceComponent(src));
+ }
for (org.hl7.fhir.r5.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) tgt.addIngredient(convertSubstanceIngredientComponent(t));
return tgt;
}
@@ -109,31 +112,26 @@ public class Substance30_50 {
return tgt;
}
- public static org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent();
- VersionConvertor_30_50.copyElement(src, tgt);
+ public static void convertSubstanceInstanceComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent src, org.hl7.fhir.r5.model.Substance tgt) throws FHIRException {
+ tgt.setInstance(true);
if (src.hasIdentifier())
- tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier()));
+ tgt.addIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier()));
if (src.hasExpiry())
tgt.setExpiryElement(VersionConvertor_30_50.convertDateTime(src.getExpiryElement()));
if (src.hasQuantity())
tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity()));
- return tgt;
}
- public static org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r5.model.Substance.SubstanceInstanceComponent src) throws FHIRException {
- if (src == null)
- return null;
+ public static org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r5.model.Substance src) throws FHIRException {
org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent();
- VersionConvertor_30_50.copyElement(src, tgt);
- if (src.hasIdentifier())
- tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(src.getIdentifier()));
- if (src.hasExpiry())
- tgt.setExpiryElement(VersionConvertor_30_50.convertDateTime(src.getExpiryElement()));
- if (src.hasQuantity())
- tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity()));
- return tgt;
+ for (Identifier t : src.getIdentifier()) {
+ tgt.setIdentifier(VersionConvertor_30_50.convertIdentifier(t));
+ }
+ if (src.hasExpiry())
+ tgt.setExpiryElement(VersionConvertor_30_50.convertDateTime(src.getExpiryElement()));
+ if (src.hasQuantity())
+ tgt.setQuantity(VersionConvertor_30_50.convertSimpleQuantity(src.getQuantity()));
+ return tgt;
+
}
}
\ No newline at end of file
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ActivityDefinition40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ActivityDefinition40_50.java
index 2b8b0b4bb..d675c6fb2 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ActivityDefinition40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ActivityDefinition40_50.java
@@ -3,6 +3,7 @@ package org.hl7.fhir.convertors.conv40_50;
import org.hl7.fhir.convertors.VersionConvertor_40_50;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.CodeableReference;
/*
Copyright (c) 2011+, HL7, Inc.
@@ -100,7 +101,7 @@ public class ActivityDefinition40_50 extends VersionConvertor_40_50 {
if (src.hasTiming())
tgt.setTiming(convertType(src.getTiming()));
if (src.hasLocation())
- tgt.setLocation(convertReference(src.getLocation()));
+ tgt.setLocation(new CodeableReference(convertReference(src.getLocation())));
for (org.hl7.fhir.r4.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertActivityDefinitionParticipantComponent(t));
if (src.hasProduct())
tgt.setProduct(convertType(src.getProduct()));
@@ -181,8 +182,8 @@ public class ActivityDefinition40_50 extends VersionConvertor_40_50 {
tgt.setDoNotPerformElement(convertBoolean(src.getDoNotPerformElement()));
if (src.hasTiming())
tgt.setTiming(convertType(src.getTiming()));
- if (src.hasLocation())
- tgt.setLocation(convertReference(src.getLocation()));
+ if (src.getLocation().hasReference())
+ tgt.setLocation(convertReference(src.getLocation().getReference()));
for (org.hl7.fhir.r5.model.ActivityDefinition.ActivityDefinitionParticipantComponent t : src.getParticipant()) tgt.addParticipant(convertActivityDefinitionParticipantComponent(t));
if (src.hasProduct())
tgt.setProduct(convertType(src.getProduct()));
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AllergyIntolerance40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AllergyIntolerance40_50.java
index abc2fa53b..b8ae4fed3 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AllergyIntolerance40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/AllergyIntolerance40_50.java
@@ -3,6 +3,7 @@ package org.hl7.fhir.convertors.conv40_50;
import org.hl7.fhir.convertors.VersionConvertor_40_50;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.CodeableReference;
import java.util.stream.Collectors;
@@ -252,7 +253,7 @@ public class AllergyIntolerance40_50 extends VersionConvertor_40_50 {
copyElement(src, tgt);
if (src.hasSubstance())
tgt.setSubstance(convertCodeableConcept(src.getSubstance()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getManifestation()) tgt.addManifestation(convertCodeableConcept(t));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getManifestation()) tgt.addManifestation(new CodeableReference(convertCodeableConcept(t)));
if (src.hasDescription())
tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
if (src.hasOnset())
@@ -272,7 +273,7 @@ public class AllergyIntolerance40_50 extends VersionConvertor_40_50 {
copyElement(src, tgt);
if (src.hasSubstance())
tgt.setSubstance(convertCodeableConcept(src.getSubstance()));
- for (org.hl7.fhir.r5.model.CodeableConcept t : src.getManifestation()) tgt.addManifestation(convertCodeableConcept(t));
+ for (CodeableReference t : src.getManifestation()) if (t.hasConcept()) tgt.addManifestation(convertCodeableConcept(t.getConcept()));
if (src.hasDescription())
tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
if (src.hasOnset())
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Appointment40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Appointment40_50.java
index de3e2c338..daa0499ef 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Appointment40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Appointment40_50.java
@@ -1,8 +1,11 @@
package org.hl7.fhir.convertors.conv40_50;
+import org.hl7.fhir.convertors.VersionConvertor_10_50;
import org.hl7.fhir.convertors.VersionConvertor_40_50;
+import org.hl7.fhir.r4.model.UnsignedIntType;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.CodeableConcept;
import org.hl7.fhir.r5.model.CodeableReference;
/*
@@ -54,7 +57,7 @@ public class Appointment40_50 extends VersionConvertor_40_50 {
for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(convertCodeableConceptToCodeableReference(t));
for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) tgt.addReason(convertReferenceToCodeableReference(t));
if (src.hasPriority())
- tgt.setPriorityElement(convertUnsignedInt(src.getPriorityElement()));
+ tgt.setPriority(convertAppointmentPriority(src.getPriorityElement()));
if (src.hasDescription())
tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
for (org.hl7.fhir.r4.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(convertReference(t));
@@ -97,7 +100,7 @@ public class Appointment40_50 extends VersionConvertor_40_50 {
for (CodeableReference t : src.getReason()) if (t.hasReference())
tgt.addReasonReference(convertReference(t.getReference()));
if (src.hasPriority())
- tgt.setPriorityElement(convertUnsignedInt(src.getPriorityElement()));
+ tgt.setPriorityElement(convertAppointmentPriority(src.getPriority()));
if (src.hasDescription())
tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
for (org.hl7.fhir.r5.model.Reference t : src.getSupportingInformation()) tgt.addSupportingInformation(convertReference(t));
@@ -120,6 +123,19 @@ public class Appointment40_50 extends VersionConvertor_40_50 {
return tgt;
}
+
+ private static UnsignedIntType convertAppointmentPriority(CodeableConcept src) {
+ UnsignedIntType tgt = new UnsignedIntType(convertAppointmentPriorityFromR5(src));
+ VersionConvertor_40_50.copyElement(src, tgt);
+ return tgt;
+ }
+
+ private static CodeableConcept convertAppointmentPriority(UnsignedIntType src) {
+ CodeableConcept tgt = src.hasValue() ? convertAppointmentPriorityToR5(src.getValue()) : new CodeableConcept();
+ VersionConvertor_40_50.copyElement(src, tgt);
+ return tgt;
+ }
+
static public org.hl7.fhir.r5.model.Enumeration convertAppointmentStatus(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CarePlan40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CarePlan40_50.java
index 4a0748ecd..773de7806 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CarePlan40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CarePlan40_50.java
@@ -240,13 +240,13 @@ public class CarePlan40_50 extends VersionConvertor_40_50 {
return null;
org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityComponent();
copyElement(src, tgt);
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOutcomeCodeableConcept()) tgt.addOutcome(convertCodeableConceptToCodeableReference(t));
- for (org.hl7.fhir.r4.model.Reference t : src.getOutcomeReference()) tgt.addOutcome(convertReferenceToCodeableReference(t));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOutcomeCodeableConcept()) tgt.addPerformedActivity(convertCodeableConceptToCodeableReference(t));
+ for (org.hl7.fhir.r4.model.Reference t : src.getOutcomeReference()) tgt.addPerformedActivity(convertReferenceToCodeableReference(t));
for (org.hl7.fhir.r4.model.Annotation t : src.getProgress()) tgt.addProgress(convertAnnotation(t));
if (src.hasReference())
- tgt.setReference(convertReference(src.getReference()));
+ tgt.setPlannedActivityReference(convertReference(src.getReference()));
if (src.hasDetail())
- tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail()));
+ tgt.setPlannedActivityDetail(convertCarePlanActivityDetailComponent(src.getDetail()));
return tgt;
}
@@ -255,22 +255,22 @@ public class CarePlan40_50 extends VersionConvertor_40_50 {
return null;
org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityComponent();
copyElement(src, tgt);
- for (CodeableReference t : src.getOutcome()) if (t.hasConcept())
+ for (CodeableReference t : src.getPerformedActivity()) if (t.hasConcept())
tgt.addOutcomeCodeableConcept(convertCodeableConcept(t.getConcept()));
- for (CodeableReference t : src.getOutcome()) if (t.hasReference())
+ for (CodeableReference t : src.getPerformedActivity()) if (t.hasReference())
tgt.addOutcomeReference(convertReference(t.getReference()));
for (org.hl7.fhir.r5.model.Annotation t : src.getProgress()) tgt.addProgress(convertAnnotation(t));
- if (src.hasReference())
- tgt.setReference(convertReference(src.getReference()));
- if (src.hasDetail())
- tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail()));
+ if (src.hasPlannedActivityReference())
+ tgt.setReference(convertReference(src.getPlannedActivityReference()));
+ if (src.hasPlannedActivityDetail())
+ tgt.setDetail(convertCarePlanActivityDetailComponent(src.getPlannedActivityDetail()));
return tgt;
}
- public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException {
+ public static org.hl7.fhir.r5.model.CarePlan.CarePlanActivityPlannedActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException {
if (src == null)
return null;
- org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent();
+ org.hl7.fhir.r5.model.CarePlan.CarePlanActivityPlannedActivityDetailComponent tgt = new org.hl7.fhir.r5.model.CarePlan.CarePlanActivityPlannedActivityDetailComponent();
copyElement(src, tgt);
if (src.hasKind())
tgt.setKindElement(convertCarePlanActivityKind(src.getKindElement()));
@@ -303,7 +303,7 @@ public class CarePlan40_50 extends VersionConvertor_40_50 {
return tgt;
}
- public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException {
+ public static org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.r5.model.CarePlan.CarePlanActivityPlannedActivityDetailComponent src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanActivityDetailComponent();
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ConceptMap40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ConceptMap40_50.java
index 1c131f8da..97cc0f87c 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ConceptMap40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ConceptMap40_50.java
@@ -5,10 +5,14 @@ import org.hl7.fhir.convertors.VersionConvertorConstants;
import org.hl7.fhir.convertors.VersionConvertor_40_50;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence;
+import org.hl7.fhir.r4.model.StringType;
+import org.hl7.fhir.r4.model.UriType;
+import org.hl7.fhir.r5.model.CanonicalType;
import org.hl7.fhir.r5.model.Enumeration;
import org.hl7.fhir.r5.model.Enumerations;
import org.hl7.fhir.r5.model.Enumerations.ConceptMapRelationship;
import org.hl7.fhir.r5.utils.ToolingExtensions;
+import org.hl7.fhir.utilities.CanonicalPair;
/*
Copyright (c) 2011+, HL7, Inc.
@@ -126,33 +130,46 @@ public class ConceptMap40_50 extends VersionConvertor_40_50 {
return null;
org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent();
copyElement(src, tgt);
- if (src.hasSource())
- tgt.setSourceElement(convertUri(src.getSourceElement()));
- if (src.hasSourceVersion())
- tgt.setSourceVersionElement(convertString(src.getSourceVersionElement()));
- if (src.hasTarget())
- tgt.setTargetElement(convertUri(src.getTargetElement()));
- if (src.hasTargetVersion())
- tgt.setTargetVersionElement(convertString(src.getTargetVersionElement()));
+ if (src.hasSource() || src.hasSourceVersion())
+ tgt.setSourceElement(convertUriAndVersionToCanonical(src.getSourceElement(), src.getSourceVersionElement()));
+ if (src.hasTarget() || src.hasTargetVersion())
+ tgt.setTargetElement(convertUriAndVersionToCanonical(src.getTargetElement(), src.getTargetVersionElement()));
for (org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent t : src.getElement()) tgt.addElement(convertSourceElementComponent(t));
if (src.hasUnmapped())
tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped()));
return tgt;
}
+ private static CanonicalType convertUriAndVersionToCanonical(org.hl7.fhir.r4.model.UriType srcUri, org.hl7.fhir.r4.model.StringType srcVersion) {
+ if (srcUri == null && srcVersion == null)
+ return null;
+ org.hl7.fhir.r5.model.CanonicalType tgt = new org.hl7.fhir.r5.model.CanonicalType();
+ copyElement(srcUri == null ? srcVersion : srcUri, tgt);
+ if (srcUri.hasValue()) {
+ if (srcVersion.hasValue()) {
+ tgt.setValue(srcUri.getValue()+"|"+srcVersion.getValue());
+ } else {
+ tgt.setValue(srcUri.getValue());
+ }
+ }
+ return tgt;
+ }
+
public static org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent convertConceptMapGroupComponent(org.hl7.fhir.r5.model.ConceptMap.ConceptMapGroupComponent src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent();
copyElement(src, tgt);
- if (src.hasSource())
- tgt.setSourceElement(convertUri(src.getSourceElement()));
- if (src.hasSourceVersion())
- tgt.setSourceVersionElement(convertString(src.getSourceVersionElement()));
- if (src.hasTarget())
- tgt.setTargetElement(convertUri(src.getTargetElement()));
- if (src.hasTargetVersion())
- tgt.setTargetVersionElement(convertString(src.getTargetVersionElement()));
+ if (src.hasSource()) {
+ CanonicalPair cp = new CanonicalPair(src.getSource());
+ tgt.setSource(cp.getUrl());
+ tgt.setSourceVersion(cp.getVersion());
+ }
+ if (src.hasTarget()) {
+ CanonicalPair cp = new CanonicalPair(src.getTarget());
+ tgt.setTarget(cp.getUrl());
+ tgt.setTargetVersion(cp.getVersion());
+ }
for (org.hl7.fhir.r5.model.ConceptMap.SourceElementComponent t : src.getElement()) tgt.addElement(convertSourceElementComponent(t));
if (src.hasUnmapped())
tgt.setUnmapped(convertConceptMapGroupUnmappedComponent(src.getUnmapped()));
@@ -167,11 +184,14 @@ public class ConceptMap40_50 extends VersionConvertor_40_50 {
if (src.hasCode())
tgt.setCodeElement(convertCode(src.getCodeElement()));
if (src.hasDisplay())
- tgt.setDisplayElement(convertString(src.getDisplayElement()));
- for (org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent t : src.getTarget()) if (t.getEquivalence() == org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.UNMATCHED) {
+ tgt.setDisplayElement(convertString(src.getDisplayElement()));
+ for (org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent t : src.getTarget()) {
+ if (t.getEquivalence() == org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence.UNMATCHED) {
tgt.setNoMap(true);
- } else {
+ }
+ else {
tgt.addTarget(convertTargetElementComponent(t));
+ }
}
return tgt;
}
@@ -222,6 +242,8 @@ public class ConceptMap40_50 extends VersionConvertor_40_50 {
tgt.setDisplayElement(convertString(src.getDisplayElement()));
if (src.hasRelationship())
tgt.setEquivalenceElement(convertConceptMapEquivalence(src.getRelationshipElement()));
+ else
+ tgt.setEquivalence(ConceptMapEquivalence.RELATEDTO);
if (src.hasComment())
tgt.setCommentElement(convertString(src.getCommentElement()));
for (org.hl7.fhir.r5.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) tgt.addDependsOn(convertOtherElementComponent(t));
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CoverageEligibilityResponse40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CoverageEligibilityResponse40_50.java
deleted file mode 100644
index f2cc38e30..000000000
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/CoverageEligibilityResponse40_50.java
+++ /dev/null
@@ -1,405 +0,0 @@
-package org.hl7.fhir.convertors.conv40_50;
-
-
-import org.hl7.fhir.convertors.VersionConvertor_40_50;
-import org.hl7.fhir.exceptions.FHIRException;
-
-import java.util.stream.Collectors;
-
-/*
- Copyright (c) 2011+, HL7, Inc.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of HL7 nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
-*/
-// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
-public class CoverageEligibilityResponse40_50 extends VersionConvertor_40_50 {
-
- public static org.hl7.fhir.r5.model.CoverageEligibilityResponse convertCoverageEligibilityResponse(org.hl7.fhir.r4.model.CoverageEligibilityResponse src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r5.model.CoverageEligibilityResponse tgt = new org.hl7.fhir.r5.model.CoverageEligibilityResponse();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
- if (src.hasStatus())
- tgt.setStatusElement(convertEligibilityResponseStatus(src.getStatusElement()));
- tgt.setPurpose(src.getPurpose().stream()
- .map(CoverageEligibilityResponse40_50::convertEligibilityResponsePurpose)
- .collect(Collectors.toList()));
- if (src.hasPatient())
- tgt.setPatient(convertReference(src.getPatient()));
- if (src.hasServiced())
- tgt.setServiced(convertType(src.getServiced()));
- if (src.hasCreated())
- tgt.setCreatedElement(convertDateTime(src.getCreatedElement()));
- if (src.hasRequestor())
- tgt.setRequestor(convertReference(src.getRequestor()));
- if (src.hasRequest())
- tgt.setRequest(convertReference(src.getRequest()));
- if (src.hasOutcome())
- tgt.setOutcomeElement(convertRemittanceOutcome(src.getOutcomeElement()));
- if (src.hasDisposition())
- tgt.setDispositionElement(convertString(src.getDispositionElement()));
- if (src.hasInsurer())
- tgt.setInsurer(convertReference(src.getInsurer()));
- for (org.hl7.fhir.r4.model.CoverageEligibilityResponse.InsuranceComponent t : src.getInsurance()) tgt.addInsurance(convertInsuranceComponent(t));
- if (src.hasPreAuthRef())
- tgt.setPreAuthRefElement(convertString(src.getPreAuthRefElement()));
- if (src.hasForm())
- tgt.setForm(convertCodeableConcept(src.getForm()));
- for (org.hl7.fhir.r4.model.CoverageEligibilityResponse.ErrorsComponent t : src.getError()) tgt.addError(convertErrorsComponent(t));
- return tgt;
- }
-
- public static org.hl7.fhir.r4.model.CoverageEligibilityResponse convertCoverageEligibilityResponse(org.hl7.fhir.r5.model.CoverageEligibilityResponse src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r4.model.CoverageEligibilityResponse tgt = new org.hl7.fhir.r4.model.CoverageEligibilityResponse();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
- if (src.hasStatus())
- tgt.setStatusElement(convertEligibilityResponseStatus(src.getStatusElement()));
- tgt.setPurpose(src.getPurpose().stream()
- .map(CoverageEligibilityResponse40_50::convertEligibilityResponsePurpose)
- .collect(Collectors.toList()));
- if (src.hasPatient())
- tgt.setPatient(convertReference(src.getPatient()));
- if (src.hasServiced())
- tgt.setServiced(convertType(src.getServiced()));
- if (src.hasCreated())
- tgt.setCreatedElement(convertDateTime(src.getCreatedElement()));
- if (src.hasRequestor())
- tgt.setRequestor(convertReference(src.getRequestor()));
- if (src.hasRequest())
- tgt.setRequest(convertReference(src.getRequest()));
- if (src.hasOutcome())
- tgt.setOutcomeElement(convertRemittanceOutcome(src.getOutcomeElement()));
- if (src.hasDisposition())
- tgt.setDispositionElement(convertString(src.getDispositionElement()));
- if (src.hasInsurer())
- tgt.setInsurer(convertReference(src.getInsurer()));
- for (org.hl7.fhir.r5.model.CoverageEligibilityResponse.InsuranceComponent t : src.getInsurance()) tgt.addInsurance(convertInsuranceComponent(t));
- if (src.hasPreAuthRef())
- tgt.setPreAuthRefElement(convertString(src.getPreAuthRefElement()));
- if (src.hasForm())
- tgt.setForm(convertCodeableConcept(src.getForm()));
- for (org.hl7.fhir.r5.model.CoverageEligibilityResponse.ErrorsComponent t : src.getError()) tgt.addError(convertErrorsComponent(t));
- return tgt;
- }
-
- static public org.hl7.fhir.r5.model.Enumeration convertEligibilityResponseStatus(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodesEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case ACTIVE:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.ACTIVE);
- break;
- case CANCELLED:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.CANCELLED);
- break;
- case DRAFT:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.DRAFT);
- break;
- case ENTEREDINERROR:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.ENTEREDINERROR);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r4.model.Enumeration convertEligibilityResponseStatus(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case ACTIVE:
- tgt.setValue(org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponseStatus.ACTIVE);
- break;
- case CANCELLED:
- tgt.setValue(org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponseStatus.CANCELLED);
- break;
- case DRAFT:
- tgt.setValue(org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponseStatus.DRAFT);
- break;
- case ENTEREDINERROR:
- tgt.setValue(org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponseStatus.ENTEREDINERROR);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponseStatus.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r5.model.Enumeration convertEligibilityResponsePurpose(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case AUTHREQUIREMENTS:
- tgt.setValue(org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponsePurpose.AUTHREQUIREMENTS);
- break;
- case BENEFITS:
- tgt.setValue(org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponsePurpose.BENEFITS);
- break;
- case DISCOVERY:
- tgt.setValue(org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponsePurpose.DISCOVERY);
- break;
- case VALIDATION:
- tgt.setValue(org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponsePurpose.VALIDATION);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r5.model.CoverageEligibilityResponse.EligibilityResponsePurpose.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r4.model.Enumeration convertEligibilityResponsePurpose(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case AUTHREQUIREMENTS:
- tgt.setValue(org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponsePurpose.AUTHREQUIREMENTS);
- break;
- case BENEFITS:
- tgt.setValue(org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponsePurpose.BENEFITS);
- break;
- case DISCOVERY:
- tgt.setValue(org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponsePurpose.DISCOVERY);
- break;
- case VALIDATION:
- tgt.setValue(org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponsePurpose.VALIDATION);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r4.model.CoverageEligibilityResponse.EligibilityResponsePurpose.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r5.model.Enumeration convertRemittanceOutcome(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodesEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case QUEUED:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.QUEUED);
- break;
- case COMPLETE:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.COMPLETE);
- break;
- case ERROR:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.ERROR);
- break;
- case PARTIAL:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.PARTIAL);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r4.model.Enumeration convertRemittanceOutcome(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Enumerations.RemittanceOutcomeEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case QUEUED:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.QUEUED);
- break;
- case COMPLETE:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.COMPLETE);
- break;
- case ERROR:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.ERROR);
- break;
- case PARTIAL:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.PARTIAL);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.NULL);
- break;
- }
- return tgt;
- }
-
- public static org.hl7.fhir.r5.model.CoverageEligibilityResponse.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r4.model.CoverageEligibilityResponse.InsuranceComponent src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r5.model.CoverageEligibilityResponse.InsuranceComponent tgt = new org.hl7.fhir.r5.model.CoverageEligibilityResponse.InsuranceComponent();
- copyElement(src, tgt);
- if (src.hasCoverage())
- tgt.setCoverage(convertReference(src.getCoverage()));
- if (src.hasInforce())
- tgt.setInforceElement(convertBoolean(src.getInforceElement()));
- if (src.hasBenefitPeriod())
- tgt.setBenefitPeriod(convertPeriod(src.getBenefitPeriod()));
- for (org.hl7.fhir.r4.model.CoverageEligibilityResponse.ItemsComponent t : src.getItem()) tgt.addItem(convertItemsComponent(t));
- return tgt;
- }
-
- public static org.hl7.fhir.r4.model.CoverageEligibilityResponse.InsuranceComponent convertInsuranceComponent(org.hl7.fhir.r5.model.CoverageEligibilityResponse.InsuranceComponent src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r4.model.CoverageEligibilityResponse.InsuranceComponent tgt = new org.hl7.fhir.r4.model.CoverageEligibilityResponse.InsuranceComponent();
- copyElement(src, tgt);
- if (src.hasCoverage())
- tgt.setCoverage(convertReference(src.getCoverage()));
- if (src.hasInforce())
- tgt.setInforceElement(convertBoolean(src.getInforceElement()));
- if (src.hasBenefitPeriod())
- tgt.setBenefitPeriod(convertPeriod(src.getBenefitPeriod()));
- for (org.hl7.fhir.r5.model.CoverageEligibilityResponse.ItemsComponent t : src.getItem()) tgt.addItem(convertItemsComponent(t));
- return tgt;
- }
-
- public static org.hl7.fhir.r5.model.CoverageEligibilityResponse.ItemsComponent convertItemsComponent(org.hl7.fhir.r4.model.CoverageEligibilityResponse.ItemsComponent src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r5.model.CoverageEligibilityResponse.ItemsComponent tgt = new org.hl7.fhir.r5.model.CoverageEligibilityResponse.ItemsComponent();
- copyElement(src, tgt);
- if (src.hasCategory())
- tgt.setCategory(convertCodeableConcept(src.getCategory()));
- if (src.hasProductOrService())
- tgt.setProductOrService(convertCodeableConcept(src.getProductOrService()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getModifier()) tgt.addModifier(convertCodeableConcept(t));
- if (src.hasProvider())
- tgt.setProvider(convertReference(src.getProvider()));
- if (src.hasExcluded())
- tgt.setExcludedElement(convertBoolean(src.getExcludedElement()));
- if (src.hasName())
- tgt.setNameElement(convertString(src.getNameElement()));
- if (src.hasDescription())
- tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
- if (src.hasNetwork())
- tgt.setNetwork(convertCodeableConcept(src.getNetwork()));
- if (src.hasUnit())
- tgt.setUnit(convertCodeableConcept(src.getUnit()));
- if (src.hasTerm())
- tgt.setTerm(convertCodeableConcept(src.getTerm()));
- for (org.hl7.fhir.r4.model.CoverageEligibilityResponse.BenefitComponent t : src.getBenefit()) tgt.addBenefit(convertBenefitComponent(t));
- if (src.hasAuthorizationRequired())
- tgt.setAuthorizationRequiredElement(convertBoolean(src.getAuthorizationRequiredElement()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAuthorizationSupporting()) tgt.addAuthorizationSupporting(convertCodeableConcept(t));
- if (src.hasAuthorizationUrl())
- tgt.setAuthorizationUrlElement(convertUri(src.getAuthorizationUrlElement()));
- return tgt;
- }
-
- public static org.hl7.fhir.r4.model.CoverageEligibilityResponse.ItemsComponent convertItemsComponent(org.hl7.fhir.r5.model.CoverageEligibilityResponse.ItemsComponent src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r4.model.CoverageEligibilityResponse.ItemsComponent tgt = new org.hl7.fhir.r4.model.CoverageEligibilityResponse.ItemsComponent();
- copyElement(src, tgt);
- if (src.hasCategory())
- tgt.setCategory(convertCodeableConcept(src.getCategory()));
- if (src.hasProductOrService())
- tgt.setProductOrService(convertCodeableConcept(src.getProductOrService()));
- for (org.hl7.fhir.r5.model.CodeableConcept t : src.getModifier()) tgt.addModifier(convertCodeableConcept(t));
- if (src.hasProvider())
- tgt.setProvider(convertReference(src.getProvider()));
- if (src.hasExcluded())
- tgt.setExcludedElement(convertBoolean(src.getExcludedElement()));
- if (src.hasName())
- tgt.setNameElement(convertString(src.getNameElement()));
- if (src.hasDescription())
- tgt.setDescriptionElement(convertString(src.getDescriptionElement()));
- if (src.hasNetwork())
- tgt.setNetwork(convertCodeableConcept(src.getNetwork()));
- if (src.hasUnit())
- tgt.setUnit(convertCodeableConcept(src.getUnit()));
- if (src.hasTerm())
- tgt.setTerm(convertCodeableConcept(src.getTerm()));
- for (org.hl7.fhir.r5.model.CoverageEligibilityResponse.BenefitComponent t : src.getBenefit()) tgt.addBenefit(convertBenefitComponent(t));
- if (src.hasAuthorizationRequired())
- tgt.setAuthorizationRequiredElement(convertBoolean(src.getAuthorizationRequiredElement()));
- for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAuthorizationSupporting()) tgt.addAuthorizationSupporting(convertCodeableConcept(t));
- if (src.hasAuthorizationUrl())
- tgt.setAuthorizationUrlElement(convertUri(src.getAuthorizationUrlElement()));
- return tgt;
- }
-
- public static org.hl7.fhir.r5.model.CoverageEligibilityResponse.BenefitComponent convertBenefitComponent(org.hl7.fhir.r4.model.CoverageEligibilityResponse.BenefitComponent src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r5.model.CoverageEligibilityResponse.BenefitComponent tgt = new org.hl7.fhir.r5.model.CoverageEligibilityResponse.BenefitComponent();
- copyElement(src, tgt);
- if (src.hasType())
- tgt.setType(convertCodeableConcept(src.getType()));
- if (src.hasAllowed())
- tgt.setAllowed(convertType(src.getAllowed()));
- if (src.hasUsed())
- tgt.setUsed(convertType(src.getUsed()));
- return tgt;
- }
-
- public static org.hl7.fhir.r4.model.CoverageEligibilityResponse.BenefitComponent convertBenefitComponent(org.hl7.fhir.r5.model.CoverageEligibilityResponse.BenefitComponent src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r4.model.CoverageEligibilityResponse.BenefitComponent tgt = new org.hl7.fhir.r4.model.CoverageEligibilityResponse.BenefitComponent();
- copyElement(src, tgt);
- if (src.hasType())
- tgt.setType(convertCodeableConcept(src.getType()));
- if (src.hasAllowed())
- tgt.setAllowed(convertType(src.getAllowed()));
- if (src.hasUsed())
- tgt.setUsed(convertType(src.getUsed()));
- return tgt;
- }
-
- public static org.hl7.fhir.r5.model.CoverageEligibilityResponse.ErrorsComponent convertErrorsComponent(org.hl7.fhir.r4.model.CoverageEligibilityResponse.ErrorsComponent src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r5.model.CoverageEligibilityResponse.ErrorsComponent tgt = new org.hl7.fhir.r5.model.CoverageEligibilityResponse.ErrorsComponent();
- copyElement(src, tgt);
- if (src.hasCode())
- tgt.setCode(convertCodeableConcept(src.getCode()));
- return tgt;
- }
-
- public static org.hl7.fhir.r4.model.CoverageEligibilityResponse.ErrorsComponent convertErrorsComponent(org.hl7.fhir.r5.model.CoverageEligibilityResponse.ErrorsComponent src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r4.model.CoverageEligibilityResponse.ErrorsComponent tgt = new org.hl7.fhir.r4.model.CoverageEligibilityResponse.ErrorsComponent();
- copyElement(src, tgt);
- if (src.hasCode())
- tgt.setCode(convertCodeableConcept(src.getCode()));
- return tgt;
- }
-}
\ No newline at end of file
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Device40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Device40_50.java
index aaae94802..15f41672c 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Device40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Device40_50.java
@@ -432,8 +432,8 @@ public class Device40_50 extends VersionConvertor_40_50 {
copyElement(src, tgt);
if (src.hasType())
tgt.setType(convertCodeableConcept(src.getType()));
- for (org.hl7.fhir.r4.model.Quantity t : src.getValueQuantity()) tgt.addValueQuantity(convertQuantity(t));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getValueCode()) tgt.addValueCode(convertCodeableConcept(t));
+ for (org.hl7.fhir.r4.model.Quantity t : src.getValueQuantity()) tgt.setValue(convertQuantity(t));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getValueCode()) tgt.setValue(convertCodeableConcept(t));
return tgt;
}
@@ -444,8 +444,8 @@ public class Device40_50 extends VersionConvertor_40_50 {
copyElement(src, tgt);
if (src.hasType())
tgt.setType(convertCodeableConcept(src.getType()));
- for (org.hl7.fhir.r5.model.Quantity t : src.getValueQuantity()) tgt.addValueQuantity(convertQuantity(t));
- for (org.hl7.fhir.r5.model.CodeableConcept t : src.getValueCode()) tgt.addValueCode(convertCodeableConcept(t));
+ if (src.hasValueQuantity()) tgt.addValueQuantity(convertQuantity(src.getValueQuantity()));
+ if (src.hasValueCodeableConcept()) tgt.addValueCode(convertCodeableConcept(src.getValueCodeableConcept()));
return tgt;
}
}
\ No newline at end of file
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceDefinition40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceDefinition40_50.java
index 4b2e7a9f7..3d1e35c3f 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceDefinition40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceDefinition40_50.java
@@ -3,6 +3,7 @@ package org.hl7.fhir.convertors.conv40_50;
import org.hl7.fhir.convertors.VersionConvertor_40_50;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionVersionComponent;
/*
Copyright (c) 2011+, HL7, Inc.
@@ -48,9 +49,9 @@ public class DeviceDefinition40_50 extends VersionConvertor_40_50 {
if (src.hasModelNumber())
tgt.setModelNumberElement(convertString(src.getModelNumberElement()));
if (src.hasType())
- tgt.setType(convertCodeableConcept(src.getType()));
+ tgt.addType(convertCodeableConcept(src.getType()));
for (org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionSpecializationComponent t : src.getSpecialization()) tgt.addSpecialization(convertDeviceDefinitionSpecializationComponent(t));
- for (org.hl7.fhir.r4.model.StringType t : src.getVersion()) tgt.getVersion().add(convertString(t));
+ for (org.hl7.fhir.r4.model.StringType t : src.getVersion()) tgt.getVersion().add(new DeviceDefinitionVersionComponent().setValueElement(convertString(t)));
for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSafety()) tgt.addSafety(convertCodeableConcept(t));
for (org.hl7.fhir.r4.model.ProductShelfLife t : src.getShelfLifeStorage()) tgt.addShelfLifeStorage(convertProductShelfLife(t));
if (src.hasPhysicalCharacteristics())
@@ -64,8 +65,6 @@ public class DeviceDefinition40_50 extends VersionConvertor_40_50 {
if (src.hasOnlineInformation())
tgt.setOnlineInformationElement(convertUri(src.getOnlineInformationElement()));
for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(convertAnnotation(t));
- if (src.hasQuantity())
- tgt.setQuantity(convertQuantity(src.getQuantity()));
if (src.hasParentDevice())
tgt.setParentDevice(convertReference(src.getParentDevice()));
for (org.hl7.fhir.r4.model.DeviceDefinition.DeviceDefinitionMaterialComponent t : src.getMaterial()) tgt.addMaterial(convertDeviceDefinitionMaterialComponent(t));
@@ -84,10 +83,9 @@ public class DeviceDefinition40_50 extends VersionConvertor_40_50 {
for (org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionDeviceNameComponent t : src.getDeviceName()) tgt.addDeviceName(convertDeviceDefinitionDeviceNameComponent(t));
if (src.hasModelNumber())
tgt.setModelNumberElement(convertString(src.getModelNumberElement()));
- if (src.hasType())
- tgt.setType(convertCodeableConcept(src.getType()));
+ for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType()) tgt.setType(convertCodeableConcept(t));
for (org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionSpecializationComponent t : src.getSpecialization()) tgt.addSpecialization(convertDeviceDefinitionSpecializationComponent(t));
- for (org.hl7.fhir.r5.model.StringType t : src.getVersion()) tgt.getVersion().add(convertString(t));
+ for (DeviceDefinitionVersionComponent t : src.getVersion()) tgt.getVersion().add(convertString(t.getValueElement()));
for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSafety()) tgt.addSafety(convertCodeableConcept(t));
for (org.hl7.fhir.r5.model.ProductShelfLife t : src.getShelfLifeStorage()) tgt.addShelfLifeStorage(convertProductShelfLife(t));
if (src.hasPhysicalCharacteristics())
@@ -101,8 +99,6 @@ public class DeviceDefinition40_50 extends VersionConvertor_40_50 {
if (src.hasOnlineInformation())
tgt.setOnlineInformationElement(convertUri(src.getOnlineInformationElement()));
for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(convertAnnotation(t));
- if (src.hasQuantity())
- tgt.setQuantity(convertQuantity(src.getQuantity()));
if (src.hasParentDevice())
tgt.setParentDevice(convertReference(src.getParentDevice()));
for (org.hl7.fhir.r5.model.DeviceDefinition.DeviceDefinitionMaterialComponent t : src.getMaterial()) tgt.addMaterial(convertDeviceDefinitionMaterialComponent(t));
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceUseStatement40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceUseStatement40_50.java
index b0febbf32..aad53c269 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceUseStatement40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/DeviceUseStatement40_50.java
@@ -36,10 +36,10 @@ import org.hl7.fhir.r5.model.CodeableReference;
// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
public class DeviceUseStatement40_50 extends VersionConvertor_40_50 {
- public static org.hl7.fhir.r5.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r4.model.DeviceUseStatement src) throws FHIRException {
+ public static org.hl7.fhir.r5.model.DeviceUsage convertDeviceUseStatement(org.hl7.fhir.r4.model.DeviceUseStatement src) throws FHIRException {
if (src == null)
return null;
- org.hl7.fhir.r5.model.DeviceUseStatement tgt = new org.hl7.fhir.r5.model.DeviceUseStatement();
+ org.hl7.fhir.r5.model.DeviceUsage tgt = new org.hl7.fhir.r5.model.DeviceUsage();
copyDomainResource(src, tgt);
for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) tgt.addBasedOn(convertReference(t));
@@ -64,7 +64,7 @@ public class DeviceUseStatement40_50 extends VersionConvertor_40_50 {
return tgt;
}
- public static org.hl7.fhir.r4.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r5.model.DeviceUseStatement src) throws FHIRException {
+ public static org.hl7.fhir.r4.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.r5.model.DeviceUsage src) throws FHIRException {
if (src == null)
return null;
org.hl7.fhir.r4.model.DeviceUseStatement tgt = new org.hl7.fhir.r4.model.DeviceUseStatement();
@@ -94,38 +94,38 @@ public class DeviceUseStatement40_50 extends VersionConvertor_40_50 {
return tgt;
}
- static public org.hl7.fhir.r5.model.Enumeration convertDeviceUseStatementStatus(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
+ static public org.hl7.fhir.r5.model.Enumeration convertDeviceUseStatementStatus(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatusEnumFactory());
+ org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatusEnumFactory());
VersionConvertor_40_50.copyElement(src, tgt);
switch(src.getValue()) {
case ACTIVE:
- tgt.setValue(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ACTIVE);
+ tgt.setValue(org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatus.ACTIVE);
break;
case COMPLETED:
- tgt.setValue(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.COMPLETED);
+ tgt.setValue(org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatus.COMPLETED);
break;
case ENTEREDINERROR:
- tgt.setValue(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ENTEREDINERROR);
+ tgt.setValue(org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatus.ENTEREDINERROR);
break;
case INTENDED:
- tgt.setValue(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.INTENDED);
+ tgt.setValue(org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatus.INTENDED);
break;
case STOPPED:
- tgt.setValue(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.STOPPED);
+ tgt.setValue(org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatus.STOPPED);
break;
case ONHOLD:
- tgt.setValue(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.ONHOLD);
+ tgt.setValue(org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatus.ONHOLD);
break;
default:
- tgt.setValue(org.hl7.fhir.r5.model.DeviceUseStatement.DeviceUseStatementStatus.NULL);
+ tgt.setValue(org.hl7.fhir.r5.model.DeviceUsage.DeviceUsageStatus.NULL);
break;
}
return tgt;
}
- static public org.hl7.fhir.r4.model.Enumeration convertDeviceUseStatementStatus(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
+ static public org.hl7.fhir.r4.model.Enumeration convertDeviceUseStatementStatus(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.DeviceUseStatement.DeviceUseStatementStatusEnumFactory());
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EnrollmentResponse40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EnrollmentResponse40_50.java
deleted file mode 100644
index 1b86f55c3..000000000
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/EnrollmentResponse40_50.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.hl7.fhir.convertors.conv40_50;
-
-
-import org.hl7.fhir.convertors.VersionConvertor_40_50;
-import org.hl7.fhir.exceptions.FHIRException;
-
-/*
- Copyright (c) 2011+, HL7, Inc.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of HL7 nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
-*/
-// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
-public class EnrollmentResponse40_50 extends VersionConvertor_40_50 {
-
- public static org.hl7.fhir.r5.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.r4.model.EnrollmentResponse src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r5.model.EnrollmentResponse tgt = new org.hl7.fhir.r5.model.EnrollmentResponse();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
- if (src.hasStatus())
- tgt.setStatusElement(convertEnrollmentResponseStatus(src.getStatusElement()));
- if (src.hasRequest())
- tgt.setRequest(convertReference(src.getRequest()));
- if (src.hasOutcome())
- tgt.setOutcomeElement(convertRemittanceOutcome(src.getOutcomeElement()));
- if (src.hasDisposition())
- tgt.setDispositionElement(convertString(src.getDispositionElement()));
- if (src.hasCreated())
- tgt.setCreatedElement(convertDateTime(src.getCreatedElement()));
- if (src.hasOrganization())
- tgt.setOrganization(convertReference(src.getOrganization()));
- if (src.hasRequestProvider())
- tgt.setRequestProvider(convertReference(src.getRequestProvider()));
- return tgt;
- }
-
- public static org.hl7.fhir.r4.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.r5.model.EnrollmentResponse src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r4.model.EnrollmentResponse tgt = new org.hl7.fhir.r4.model.EnrollmentResponse();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
- if (src.hasStatus())
- tgt.setStatusElement(convertEnrollmentResponseStatus(src.getStatusElement()));
- if (src.hasRequest())
- tgt.setRequest(convertReference(src.getRequest()));
- if (src.hasOutcome())
- tgt.setOutcomeElement(convertRemittanceOutcome(src.getOutcomeElement()));
- if (src.hasDisposition())
- tgt.setDispositionElement(convertString(src.getDispositionElement()));
- if (src.hasCreated())
- tgt.setCreatedElement(convertDateTime(src.getCreatedElement()));
- if (src.hasOrganization())
- tgt.setOrganization(convertReference(src.getOrganization()));
- if (src.hasRequestProvider())
- tgt.setRequestProvider(convertReference(src.getRequestProvider()));
- return tgt;
- }
-
- static public org.hl7.fhir.r5.model.Enumeration convertEnrollmentResponseStatus(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodesEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case ACTIVE:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.ACTIVE);
- break;
- case CANCELLED:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.CANCELLED);
- break;
- case DRAFT:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.DRAFT);
- break;
- case ENTEREDINERROR:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.ENTEREDINERROR);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r4.model.Enumeration convertEnrollmentResponseStatus(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.EnrollmentResponse.EnrollmentResponseStatusEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case ACTIVE:
- tgt.setValue(org.hl7.fhir.r4.model.EnrollmentResponse.EnrollmentResponseStatus.ACTIVE);
- break;
- case CANCELLED:
- tgt.setValue(org.hl7.fhir.r4.model.EnrollmentResponse.EnrollmentResponseStatus.CANCELLED);
- break;
- case DRAFT:
- tgt.setValue(org.hl7.fhir.r4.model.EnrollmentResponse.EnrollmentResponseStatus.DRAFT);
- break;
- case ENTEREDINERROR:
- tgt.setValue(org.hl7.fhir.r4.model.EnrollmentResponse.EnrollmentResponseStatus.ENTEREDINERROR);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r4.model.EnrollmentResponse.EnrollmentResponseStatus.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r5.model.Enumeration convertRemittanceOutcome(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodesEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case QUEUED:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.QUEUED);
- break;
- case COMPLETE:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.COMPLETE);
- break;
- case ERROR:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.ERROR);
- break;
- case PARTIAL:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.PARTIAL);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r4.model.Enumeration convertRemittanceOutcome(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Enumerations.RemittanceOutcomeEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case QUEUED:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.QUEUED);
- break;
- case COMPLETE:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.COMPLETE);
- break;
- case ERROR:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.ERROR);
- break;
- case PARTIAL:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.PARTIAL);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.NULL);
- break;
- }
- return tgt;
- }
-}
\ No newline at end of file
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Enumerations40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Enumerations40_50.java
index 64a7d25f5..36a628011 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Enumerations40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Enumerations40_50.java
@@ -210,6 +210,9 @@ public class Enumerations40_50 extends VersionConvertor_40_50 {
case _4_0_1:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FHIRVersion._4_0_1);
break;
+ case _4_1_0:
+ tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FHIRVersion._4_1_0);
+ break;
default:
tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FHIRVersion.NULL);
break;
@@ -292,6 +295,9 @@ public class Enumerations40_50 extends VersionConvertor_40_50 {
case _4_0_1:
tgt.setValue(org.hl7.fhir.r4.model.Enumerations.FHIRVersion._4_0_1);
break;
+ case _4_1_0:
+ tgt.setValue(org.hl7.fhir.r4.model.Enumerations.FHIRVersion._4_1_0);
+ break;
default:
tgt.setValue(org.hl7.fhir.r4.model.Enumerations.FHIRVersion.NULL);
break;
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Goal40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Goal40_50.java
index 7ef1ec78a..28b139197 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Goal40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Goal40_50.java
@@ -60,8 +60,6 @@ public class Goal40_50 extends VersionConvertor_40_50 {
tgt.setStatusDateElement(convertDate(src.getStatusDateElement()));
if (src.hasStatusReason())
tgt.setStatusReasonElement(convertString(src.getStatusReasonElement()));
- if (src.hasExpressedBy())
- tgt.setExpressedBy(convertReference(src.getExpressedBy()));
for (org.hl7.fhir.r4.model.Reference t : src.getAddresses()) tgt.addAddresses(convertReference(t));
for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(convertAnnotation(t));
for (org.hl7.fhir.r4.model.CodeableConcept t : src.getOutcomeCode()) tgt.addOutcome(convertCodeableConceptToCodeableReference(t));
@@ -93,8 +91,6 @@ public class Goal40_50 extends VersionConvertor_40_50 {
tgt.setStatusDateElement(convertDate(src.getStatusDateElement()));
if (src.hasStatusReason())
tgt.setStatusReasonElement(convertString(src.getStatusReasonElement()));
- if (src.hasExpressedBy())
- tgt.setExpressedBy(convertReference(src.getExpressedBy()));
for (org.hl7.fhir.r5.model.Reference t : src.getAddresses()) tgt.addAddresses(convertReference(t));
for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(convertAnnotation(t));
for (CodeableReference t : src.getOutcome()) if (t.hasConcept())
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MeasureReport40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MeasureReport40_50.java
index 35523c585..298f97dd8 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MeasureReport40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MeasureReport40_50.java
@@ -205,8 +205,8 @@ public class MeasureReport40_50 extends VersionConvertor_40_50 {
if (src.hasCode())
tgt.setCode(convertCodeableConcept(src.getCode()));
for (org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupPopulationComponent t : src.getPopulation()) tgt.addPopulation(convertMeasureReportGroupPopulationComponent(t));
- if (src.hasMeasureScore())
- tgt.setMeasureScore(convertQuantity(src.getMeasureScore()));
+ if (src.hasMeasureScoreQuantity())
+ tgt.setMeasureScore(convertQuantity(src.getMeasureScoreQuantity()));
for (org.hl7.fhir.r5.model.MeasureReport.MeasureReportGroupStratifierComponent t : src.getStratifier()) tgt.addStratifier(convertMeasureReportGroupStratifierComponent(t));
return tgt;
}
@@ -278,12 +278,12 @@ public class MeasureReport40_50 extends VersionConvertor_40_50 {
return null;
org.hl7.fhir.r4.model.MeasureReport.StratifierGroupComponent tgt = new org.hl7.fhir.r4.model.MeasureReport.StratifierGroupComponent();
copyElement(src, tgt);
- if (src.hasValue())
- tgt.setValue(convertCodeableConcept(src.getValue()));
+ if (src.hasValueCodeableConcept())
+ tgt.setValue(convertCodeableConcept(src.getValueCodeableConcept()));
for (org.hl7.fhir.r5.model.MeasureReport.StratifierGroupComponentComponent t : src.getComponent()) tgt.addComponent(convertStratifierGroupComponentComponent(t));
for (org.hl7.fhir.r5.model.MeasureReport.StratifierGroupPopulationComponent t : src.getPopulation()) tgt.addPopulation(convertStratifierGroupPopulationComponent(t));
- if (src.hasMeasureScore())
- tgt.setMeasureScore(convertQuantity(src.getMeasureScore()));
+ if (src.hasMeasureScoreQuantity())
+ tgt.setMeasureScore(convertQuantity(src.getMeasureScoreQuantity()));
return tgt;
}
@@ -306,8 +306,8 @@ public class MeasureReport40_50 extends VersionConvertor_40_50 {
copyElement(src, tgt);
if (src.hasCode())
tgt.setCode(convertCodeableConcept(src.getCode()));
- if (src.hasValue())
- tgt.setValue(convertCodeableConcept(src.getValue()));
+ if (src.hasValueCodeableConcept())
+ tgt.setValue(convertCodeableConcept(src.getValueCodeableConcept()));
return tgt;
}
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Medication40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Medication40_50.java
index e282e484b..4bd3457f0 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Medication40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Medication40_50.java
@@ -46,7 +46,7 @@ public class Medication40_50 extends VersionConvertor_40_50 {
if (src.hasStatus())
tgt.setStatusElement(convertMedicationStatus(src.getStatusElement()));
if (src.hasManufacturer())
- tgt.setManufacturer(convertReference(src.getManufacturer()));
+ tgt.setSponsor(convertReference(src.getManufacturer()));
if (src.hasForm())
tgt.setDoseForm(convertCodeableConcept(src.getForm()));
if (src.hasAmount())
@@ -67,8 +67,8 @@ public class Medication40_50 extends VersionConvertor_40_50 {
tgt.setCode(convertCodeableConcept(src.getCode()));
if (src.hasStatus())
tgt.setStatusElement(convertMedicationStatus(src.getStatusElement()));
- if (src.hasManufacturer())
- tgt.setManufacturer(convertReference(src.getManufacturer()));
+ if (src.hasSponsor())
+ tgt.setManufacturer(convertReference(src.getSponsor()));
if (src.hasDoseForm())
tgt.setForm(convertCodeableConcept(src.getDoseForm()));
if (src.hasAmount())
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationKnowledge40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationKnowledge40_50.java
index 4134b86d1..24b9b9d18 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationKnowledge40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationKnowledge40_50.java
@@ -4,6 +4,8 @@ package org.hl7.fhir.convertors.conv40_50;
import org.hl7.fhir.convertors.VersionConvertor_40_50;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.CodeType;
+import org.hl7.fhir.r5.model.CodeableConcept;
+import org.hl7.fhir.r5.model.Coding;
import org.hl7.fhir.r5.model.Enumeration;
import org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgeStatusCodesEnumFactory;
import org.hl7.fhir.r5.model.MedicationKnowledge.MedicationKnowledgePackagingComponent;
@@ -51,7 +53,7 @@ public class MedicationKnowledge40_50 extends VersionConvertor_40_50 {
if (src.hasStatus())
tgt.setStatusElement(convertMedicationKnowledgeStatus(src.getStatusElement()));
if (src.hasManufacturer())
- tgt.setManufacturer(convertReference(src.getManufacturer()));
+ tgt.setSponsor(convertReference(src.getManufacturer()));
if (src.hasDoseForm())
tgt.setDoseForm(convertCodeableConcept(src.getDoseForm()));
if (src.hasAmount())
@@ -90,8 +92,8 @@ public class MedicationKnowledge40_50 extends VersionConvertor_40_50 {
tgt.setCode(convertCodeableConcept(src.getCode()));
if (src.hasStatus())
tgt.setStatusElement(convertMedicationKnowledgeStatus(src.getStatusElement()));
- if (src.hasManufacturer())
- tgt.setManufacturer(convertReference(src.getManufacturer()));
+ if (src.hasSponsor())
+ tgt.setManufacturer(convertReference(src.getSponsor()));
if (src.hasDoseForm())
tgt.setDoseForm(convertCodeableConcept(src.getDoseForm()));
if (src.hasAmount())
@@ -221,8 +223,8 @@ public class MedicationKnowledge40_50 extends VersionConvertor_40_50 {
tgt.getItem().setConcept(convertCodeableConcept(src.getItemCodeableConcept()));
if (src.hasItemReference())
tgt.getItem().setReference(convertReference(src.getItemReference()));
- if (src.hasIsActive())
- tgt.setIsActiveElement(convertBoolean(src.getIsActiveElement()));
+ if (src.getIsActive())
+ tgt.setIsActive(new CodeableConcept(new Coding("ttp://terminology.hl7.org/CodeSystem/v3-RoleClass", "ACTI", "active ingredient ")));
if (src.hasStrength())
tgt.setStrength(convertRatio(src.getStrength()));
return tgt;
@@ -238,7 +240,7 @@ public class MedicationKnowledge40_50 extends VersionConvertor_40_50 {
if (src.getItem().hasReference())
tgt.setItem(convertType(src.getItem().getReference()));
if (src.hasIsActive())
- tgt.setIsActiveElement(convertBoolean(src.getIsActiveElement()));
+ tgt.setIsActive(src.getIsActive().hasCoding("http://terminology.hl7.org/CodeSystem/v3-RoleClass", "ACTI"));
if (src.hasStrengthRatio())
tgt.setStrength(convertRatio(src.getStrengthRatio()));
return tgt;
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationStatement40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationStatement40_50.java
index 53289ed32..3b9995438 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationStatement40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicationStatement40_50.java
@@ -119,7 +119,7 @@ public class MedicationStatement40_50 extends VersionConvertor_40_50 {
VersionConvertor_40_50.copyElement(src, tgt);
switch(src.getValue()) {
case ACTIVE:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ACTIVE);
+ tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.COMPLETED);
break;
case COMPLETED:
tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.COMPLETED);
@@ -128,19 +128,19 @@ public class MedicationStatement40_50 extends VersionConvertor_40_50 {
tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ENTEREDINERROR);
break;
case INTENDED:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.INTENDED);
+ tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.UNKNOWN);
break;
case STOPPED:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.STOPPED);
+ tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.UNKNOWN);
break;
case ONHOLD:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ONHOLD);
+ tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.UNKNOWN);
break;
case UNKNOWN:
tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.UNKNOWN);
break;
case NOTTAKEN:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.NOTTAKEN);
+ tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.COMPLETED);
break;
default:
tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.NULL);
@@ -155,30 +155,30 @@ public class MedicationStatement40_50 extends VersionConvertor_40_50 {
org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatusEnumFactory());
VersionConvertor_40_50.copyElement(src, tgt);
switch(src.getValue()) {
- case ACTIVE:
- tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ACTIVE);
- break;
+// case ACTIVE:
+// tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ACTIVE);
+// break;
case COMPLETED:
tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.COMPLETED);
break;
case ENTEREDINERROR:
tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR);
break;
- case INTENDED:
- tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.INTENDED);
- break;
- case STOPPED:
- tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.STOPPED);
- break;
- case ONHOLD:
- tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ONHOLD);
- break;
+// case UNKNOWN:
+// tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.INTENDED);
+// break;
+// case STOPPED:
+// tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.STOPPED);
+// break;
+// case ONHOLD:
+// tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ONHOLD);
+// break;
case UNKNOWN:
tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.UNKNOWN);
break;
- case NOTTAKEN:
- tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.NOTTAKEN);
- break;
+// case NOTTAKEN:
+// tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.NOTTAKEN);
+// break;
default:
tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.NULL);
break;
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductDefinition40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductDefinition40_50.java
deleted file mode 100644
index 70f84c3f0..000000000
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/MedicinalProductDefinition40_50.java
+++ /dev/null
@@ -1,344 +0,0 @@
-package org.hl7.fhir.convertors.conv40_50;
-
-
-import org.hl7.fhir.convertors.VersionConvertor_40_50;
-import org.hl7.fhir.exceptions.FHIRException;
-import org.hl7.fhir.r4.model.MarketingStatus;
-import org.hl7.fhir.r5.model.CodeableReference;
-
-/*
- Copyright (c) 2011+, HL7, Inc.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of HL7 nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
-*/
-// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
-public class MedicinalProductDefinition40_50 extends VersionConvertor_40_50 {
-
- public static org.hl7.fhir.r5.model.MedicinalProductDefinition convertMedicinalProduct(org.hl7.fhir.r4.model.MedicinalProduct src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r5.model.MedicinalProductDefinition tgt = new org.hl7.fhir.r5.model.MedicinalProductDefinition();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
- if (src.hasType())
- tgt.setType(convertCodeableConcept(src.getType()));
- if (src.hasDomain())
- tgt.getDomain().addCoding(convertCoding(src.getDomain()));
- // version (new)
- // status (new)
- // description (new)
- if (src.hasCombinedPharmaceuticalDoseForm())
- tgt.setCombinedPharmaceuticalDoseForm(convertCodeableConcept(src.getCombinedPharmaceuticalDoseForm()));
- // indication (new)
- if (src.hasLegalStatusOfSupply())
- tgt.setLegalStatusOfSupply(convertCodeableConcept(src.getLegalStatusOfSupply()));
- if (src.hasAdditionalMonitoringIndicator())
- tgt.setAdditionalMonitoringIndicator(convertCodeableConcept(src.getAdditionalMonitoringIndicator()));
- for (org.hl7.fhir.r4.model.StringType t : src.getSpecialMeasures()) {
- // specialMeasures string -> CodeableConcept
- org.hl7.fhir.r5.model.CodeableConcept c = new org.hl7.fhir.r5.model.CodeableConcept();
- tgt.addSpecialMeasures(c);
- c.setTextElement(convertString(t));
- }
- if (src.hasPaediatricUseIndicator())
- tgt.setPaediatricUseIndicator(convertCodeableConcept(src.getPaediatricUseIndicator()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getProductClassification()) tgt.addClassification(convertCodeableConcept(t));
- for (org.hl7.fhir.r4.model.MarketingStatus t : src.getMarketingStatus()) tgt.addMarketingStatus(convertMarketingStatus(t));
- for (org.hl7.fhir.r4.model.Reference t : src.getPharmaceuticalProduct()) tgt.addPharmaceuticalProduct(convertReference(t));
- for (org.hl7.fhir.r4.model.Reference t : src.getPackagedMedicinalProduct()) tgt.addPackagedMedicinalProduct(convertReference(t));
- // ingredient (new)
- for (org.hl7.fhir.r4.model.Reference t : src.getAttachedDocument()) tgt.addAttachedDocument(convertReference(t));
- for (org.hl7.fhir.r4.model.Reference t : src.getMasterFile()) tgt.addMasterFile(convertReference(t));
- for (org.hl7.fhir.r4.model.Reference t : src.getContact()) {
- // contact (Reference -> complex
- org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionContactComponent c = new org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionContactComponent();
- tgt.addContact(c);
- c.setContact(convertReference(t));
- }
- for (org.hl7.fhir.r4.model.Reference t : src.getClinicalTrial()) tgt.addClinicalTrial(convertReference(t));
- for (org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameComponent srcName : src.getName()) {
- org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionNameComponent tgtName = new org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionNameComponent();
- copyElement(srcName, tgtName);
- tgt.addName(tgtName);
- tgtName.setProductNameElement(convertString(srcName.getProductNameElement()));
- //type (new)
- for (org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameNamePartComponent srcPart : srcName.getNamePart()) {
- org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent tgtPart = new org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent();
- copyElement(srcPart, tgtPart);
- tgtName.addNamePart(tgtPart);
- tgtPart.setPartElement(convertString(srcPart.getPartElement()));
- tgtPart.getType().addCoding(convertCoding(srcPart.getType()));
- }
- for (org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameCountryLanguageComponent srcLang : srcName.getCountryLanguage()) {
- org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent tgtLang = new org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent();
- copyElement(srcLang, tgtLang);
- tgtName.addCountryLanguage(tgtLang);
- tgtLang.setCountry(convertCodeableConcept(srcLang.getCountry()));
- tgtLang.setLanguage(convertCodeableConcept(srcLang.getLanguage()));
- }
- }
- for (org.hl7.fhir.r4.model.Identifier t : src.getCrossReference()) {
- // cross-reference Identifier -> complex - todo
-// org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent c = new org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent();
-// tgt.addCrossReference(c);
-// c.setProduct(convertIdentifier(t));
- }
- for (org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent srcMBO : src.getManufacturingBusinessOperation()) {
- org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent tgtMBO = new org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent();
- copyElement(srcMBO, tgtMBO);
- tgt.addManufacturingBusinessOperation(tgtMBO);
- if (srcMBO.hasOperationType()) {
- tgtMBO.getType().setConcept(convertCodeableConcept(srcMBO.getOperationType()));
- // operationType -> type[x]
- }
- if (srcMBO.hasAuthorisationReferenceNumber())
- throw new FHIRException("Converting MedicinalProduct.ManufacturingBusinessOperation.authorizationReferenceNumber is not supported");
- if (srcMBO.hasEffectiveDate()) {
- // effectiveDate - dateTime -> Period
- org.hl7.fhir.r5.model.Period p = new org.hl7.fhir.r5.model.Period();
- tgtMBO.setEffectiveDate(p);
- p.setStartElement(convertDateTime(srcMBO.getEffectiveDateElement()));
- p.setEndElement(convertDateTime(srcMBO.getEffectiveDateElement()));
- }
- if (srcMBO.hasConfidentialityIndicator())
- tgtMBO.setConfidentialityIndicator(convertCodeableConcept(srcMBO.getConfidentialityIndicator()));
- for (org.hl7.fhir.r4.model.Reference t : srcMBO.getManufacturer()) tgtMBO.addManufacturer(convertReference(t));
- if (srcMBO.hasRegulator())
- throw new FHIRException("Converting MedicinalProduct.ManufacturingBusinessOperation.regulator is not supported");
- // added authorization
- }
- if (src.hasSpecialDesignation())
- throw new FHIRException("Converting MedicinalProduct.specialDesignation is not supported");
-
- return tgt;
- }
-// Todo convert references
-
- public static org.hl7.fhir.r4.model.MedicinalProduct convertMedicinalProductDefinition(org.hl7.fhir.r5.model.MedicinalProductDefinition src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r4.model.MedicinalProduct tgt = new org.hl7.fhir.r4.model.MedicinalProduct();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
- if (src.hasType())
- tgt.setType(convertCodeableConcept(src.getType()));
- if (src.getDomain().hasCoding())
- tgt.setDomain(convertCoding(src.getDomain().getCodingFirstRep()));
- if (src.hasVersion())
- throw new FHIRException("Converting MedicinalProductDefinition.version is not supported");
- if (src.hasStatus())
- throw new FHIRException("Converting MedicinalProductDefinition.status is not supported");
- if (src.hasDescription())
- throw new FHIRException("Converting MedicinalProductDefinition.description is not supported");
- if (src.hasCombinedPharmaceuticalDoseForm())
- tgt.setCombinedPharmaceuticalDoseForm(convertCodeableConcept(src.getCombinedPharmaceuticalDoseForm()));
- if (src.hasIndication())
- throw new FHIRException("Converting MedicinalProductDefinition.indication is not supported");
- if (src.hasLegalStatusOfSupply())
- tgt.setLegalStatusOfSupply(convertCodeableConcept(src.getLegalStatusOfSupply()));
- if (src.hasAdditionalMonitoringIndicator())
- tgt.setAdditionalMonitoringIndicator(convertCodeableConcept(src.getAdditionalMonitoringIndicator()));
- for (org.hl7.fhir.r5.model.CodeableConcept t : src.getSpecialMeasures()) {
- // specialMeasures CodeableConcept -> string
- if (t.hasText()) {
- org.hl7.fhir.r4.model.StringType s = tgt.addSpecialMeasuresElement();
- copyElement(t.getTextElement(), s);
- s.setValue(t.getText());
- }
- checkBase(t, "MedicinalProductDefinition.specialMeasures");
- if (t.hasCoding())
- throw new FHIRException("Converting MedicinalProductDefinition.specialMeasures.coding is not supported");
- }
- if (src.hasPaediatricUseIndicator())
- tgt.setPaediatricUseIndicator(convertCodeableConcept(src.getPaediatricUseIndicator()));
- for (org.hl7.fhir.r5.model.CodeableConcept t : src.getClassification()) tgt.addProductClassification(convertCodeableConcept(t));
- for (org.hl7.fhir.r5.model.MarketingStatus t : src.getMarketingStatus()) tgt.addMarketingStatus(convertMarketingStatus(t));
- for (org.hl7.fhir.r5.model.Reference t : src.getPharmaceuticalProduct()) tgt.addPharmaceuticalProduct(convertReference(t));
- for (org.hl7.fhir.r5.model.Reference t : src.getPackagedMedicinalProduct()) tgt.addPackagedMedicinalProduct(convertReference(t));
- // ingredient (new)
- for (org.hl7.fhir.r5.model.Reference t : src.getAttachedDocument()) tgt.addAttachedDocument(convertReference(t));
- for (org.hl7.fhir.r5.model.Reference t : src.getMasterFile()) tgt.addMasterFile(convertReference(t));
- for (org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionContactComponent t : src.getContact()) {
- // contact complex -> reference
- if (t.hasContact()) {
- tgt.addContact(convertReference(t.getContact()));
- }
- checkBase(t, "MedicinalProductDefinition.contact");
- if (t.hasType())
- throw new FHIRException("Converting MedicinalProductDefinition.contact.type is not supported");
- }
- for (org.hl7.fhir.r5.model.Reference t : src.getClinicalTrial()) tgt.addClinicalTrial(convertReference(t));
- for (org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionNameComponent srcName : src.getName()) {
- org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameComponent tgtName = new org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameComponent();
- copyElement(srcName, tgtName);
- tgt.addName(tgtName);
- tgtName.setProductNameElement(convertString(srcName.getProductNameElement()));
- //type (new)
- for (org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionNameNamePartComponent srcPart : srcName.getNamePart()) {
- org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameNamePartComponent tgtPart = new org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameNamePartComponent();
- copyElement(srcPart, tgtPart);
- tgtName.addNamePart(tgtPart);
- tgtPart.setPartElement(convertString(srcPart.getPartElement()));
- if (srcPart.getType().hasCoding()) {
- tgtPart.setType(convertCoding(srcPart.getType().getCodingFirstRep()));
- }
- }
- for (org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionNameCountryLanguageComponent srcLang : srcName.getCountryLanguage()) {
- org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameCountryLanguageComponent tgtLang = new org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductNameCountryLanguageComponent();
- copyElement(srcLang, tgtLang);
- tgtName.addCountryLanguage(tgtLang);
- tgtLang.setCountry(convertCodeableConcept(srcLang.getCountry()));
- tgtLang.setLanguage(convertCodeableConcept(srcLang.getLanguage()));
- }
- }
- for (org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionCrossReferenceComponent t : src.getCrossReference()) {
- // cross-reference complex -> Identifier - todo
-// if (t.hasProduct()) {
-// if (t.getProduct() instanceof org.hl7.fhir.r5.model.Identifier)
-// tgt.addCrossReference(convertIdentifier((org.hl7.fhir.r5.model.Identifier)t.getProduct()));
-// else
-// throw new FHIRException("Converting MedicinalProductDefinition.crossReference.productReference is not supported");
-// }
- checkBase(t, "MedicinalProductDefinition.crossReference");
- if (t.hasType())
- throw new FHIRException("Converting MedicinalProductDefinition.crossReference.type is not supported");
- }
- for (org.hl7.fhir.r5.model.MedicinalProductDefinition.MedicinalProductDefinitionManufacturingBusinessOperationComponent srcMBO : src.getManufacturingBusinessOperation()) {
- org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent tgtMBO = new org.hl7.fhir.r4.model.MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent();
- copyElement(srcMBO, tgtMBO);
- tgt.addManufacturingBusinessOperation(tgtMBO);
- if (srcMBO.hasType()) {
- // type[x] -> operationType
- if (srcMBO.getType().hasConcept())
- tgtMBO.setOperationType(convertCodeableConcept(srcMBO.getType().getConcept()));
- else
- throw new FHIRException("Converting MedicinalProductDefinition.manufacturingBusinessOperation.typeReference is not supported");
- }
- // added authorisationReferenceNumber
- if (srcMBO.hasEffectiveDate()) {
- // effectiveDate - Period -> dateTime
- org.hl7.fhir.r5.model.Period d = srcMBO.getEffectiveDate();
- checkBase(srcMBO, "MedicinalProductDefinition.manufacturingBusinessOperation.effectiveDate");
- if (d.hasStart() || d.hasEnd()) {
- if (d.hasStart() != d.hasEnd() || !d.getStart().equals(d.getEnd()))
- throw new FHIRException("Converting MedicinalProductDefinition.manufacturingBusinessOperation.effectiveDate is not supported when start is not identical to end");
- else
- tgtMBO.setEffectiveDateElement(convertDateTime(d.getStartElement()));
- }
- }
- if (srcMBO.hasAuthorization())
- throw new FHIRException("Converting MedicinalProductDefinition.manufacturingBusinessOperation.authorization is not supported");
- if (srcMBO.hasConfidentialityIndicator())
- tgtMBO.setConfidentialityIndicator(convertCodeableConcept(srcMBO.getConfidentialityIndicator()));
- for (org.hl7.fhir.r5.model.Reference t : srcMBO.getManufacturer()) tgtMBO.addManufacturer(convertReference(t));
- // Added regulator
- // added authorization
- }
- // added specialDesignation
- return tgt;
- }
-
- static public void checkBase(org.hl7.fhir.r5.model.Element e, String path) throws FHIRException {
- if (e.hasId())
- throw new FHIRException ("Converting " + path + ".id is not supported");
- if (e.hasExtension())
- throw new FHIRException ("Converting " + path + ".extension is not supported");
- }
-
- static public org.hl7.fhir.r5.model.Enumeration convertMedicationStatementStatus(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodesEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case ACTIVE:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ACTIVE);
- break;
- case COMPLETED:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.COMPLETED);
- break;
- case ENTEREDINERROR:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ENTEREDINERROR);
- break;
- case INTENDED:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.INTENDED);
- break;
- case STOPPED:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.STOPPED);
- break;
- case ONHOLD:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.ONHOLD);
- break;
- case UNKNOWN:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.UNKNOWN);
- break;
- case NOTTAKEN:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.NOTTAKEN);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r5.model.MedicationUsage.MedicationUsageStatusCodes.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r4.model.Enumeration convertMedicationStatementStatus(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatusEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case ACTIVE:
- tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ACTIVE);
- break;
- case COMPLETED:
- tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.COMPLETED);
- break;
- case ENTEREDINERROR:
- tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR);
- break;
- case INTENDED:
- tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.INTENDED);
- break;
- case STOPPED:
- tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.STOPPED);
- break;
- case ONHOLD:
- tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ONHOLD);
- break;
- case UNKNOWN:
- tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.UNKNOWN);
- break;
- case NOTTAKEN:
- tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.NOTTAKEN);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.NULL);
- break;
- }
- return tgt;
- }
-}
\ No newline at end of file
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ObservationDefinition40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ObservationDefinition40_50.java
index 318430872..455e43472 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ObservationDefinition40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/ObservationDefinition40_50.java
@@ -57,15 +57,15 @@ public class ObservationDefinition40_50 extends VersionConvertor_40_50 {
tgt.setPreferredReportNameElement(convertString(src.getPreferredReportNameElement()));
if (src.hasQuantitativeDetails())
tgt.setQuantitativeDetails(convertObservationDefinitionQuantitativeDetailsComponent(src.getQuantitativeDetails()));
- for (org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent t : src.getQualifiedInterval()) tgt.addQualifiedInterval(convertObservationDefinitionQualifiedIntervalComponent(t));
- if (src.hasValidCodedValueSet())
- tgt.setValidCodedValueSet(convertReference(src.getValidCodedValueSet()));
- if (src.hasNormalCodedValueSet())
- tgt.setNormalCodedValueSet(convertReference(src.getNormalCodedValueSet()));
- if (src.hasAbnormalCodedValueSet())
- tgt.setAbnormalCodedValueSet(convertReference(src.getAbnormalCodedValueSet()));
- if (src.hasCriticalCodedValueSet())
- tgt.setCriticalCodedValueSet(convertReference(src.getCriticalCodedValueSet()));
+// for (org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent t : src.getQualifiedInterval()) tgt.addQualifiedInterval(convertObservationDefinitionQualifiedIntervalComponent(t));
+// if (src.hasValidCodedValueSet())
+// tgt.setValidCodedValueSet(convertReference(src.getValidCodedValueSet()));
+// if (src.hasNormalCodedValueSet())
+// tgt.setNormalCodedValueSet(convertReference(src.getNormalCodedValueSet()));
+// if (src.hasAbnormalCodedValueSet())
+// tgt.setAbnormalCodedValueSet(convertReference(src.getAbnormalCodedValueSet()));
+// if (src.hasCriticalCodedValueSet())
+// tgt.setCriticalCodedValueSet(convertReference(src.getCriticalCodedValueSet()));
return tgt;
}
@@ -90,15 +90,15 @@ public class ObservationDefinition40_50 extends VersionConvertor_40_50 {
tgt.setPreferredReportNameElement(convertString(src.getPreferredReportNameElement()));
if (src.hasQuantitativeDetails())
tgt.setQuantitativeDetails(convertObservationDefinitionQuantitativeDetailsComponent(src.getQuantitativeDetails()));
- for (org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent t : src.getQualifiedInterval()) tgt.addQualifiedInterval(convertObservationDefinitionQualifiedIntervalComponent(t));
- if (src.hasValidCodedValueSet())
- tgt.setValidCodedValueSet(convertReference(src.getValidCodedValueSet()));
- if (src.hasNormalCodedValueSet())
- tgt.setNormalCodedValueSet(convertReference(src.getNormalCodedValueSet()));
- if (src.hasAbnormalCodedValueSet())
- tgt.setAbnormalCodedValueSet(convertReference(src.getAbnormalCodedValueSet()));
- if (src.hasCriticalCodedValueSet())
- tgt.setCriticalCodedValueSet(convertReference(src.getCriticalCodedValueSet()));
+// for (org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent t : src.getQualifiedInterval()) tgt.addQualifiedInterval(convertObservationDefinitionQualifiedIntervalComponent(t));
+// if (src.hasValidCodedValueSet())
+// tgt.setValidCodedValueSet(convertReference(src.getValidCodedValueSet()));
+// if (src.hasNormalCodedValueSet())
+// tgt.setNormalCodedValueSet(convertReference(src.getNormalCodedValueSet()));
+// if (src.hasAbnormalCodedValueSet())
+// tgt.setAbnormalCodedValueSet(convertReference(src.getAbnormalCodedValueSet()));
+// if (src.hasCriticalCodedValueSet())
+// tgt.setCriticalCodedValueSet(convertReference(src.getCriticalCodedValueSet()));
return tgt;
}
@@ -226,51 +226,51 @@ public class ObservationDefinition40_50 extends VersionConvertor_40_50 {
return tgt;
}
- public static org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent convertObservationDefinitionQualifiedIntervalComponent(org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent tgt = new org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
- copyElement(src, tgt);
- if (src.hasCategory())
- tgt.setCategoryElement(convertObservationRangeCategory(src.getCategoryElement()));
- if (src.hasRange())
- tgt.setRange(convertRange(src.getRange()));
- if (src.hasContext())
- tgt.setContext(convertCodeableConcept(src.getContext()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAppliesTo()) tgt.addAppliesTo(convertCodeableConcept(t));
- if (src.hasGender())
- tgt.setGenderElement(Enumerations40_50.convertAdministrativeGender(src.getGenderElement()));
- if (src.hasAge())
- tgt.setAge(convertRange(src.getAge()));
- if (src.hasGestationalAge())
- tgt.setGestationalAge(convertRange(src.getGestationalAge()));
- if (src.hasCondition())
- tgt.setConditionElement(convertString(src.getConditionElement()));
- return tgt;
- }
-
- public static org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent convertObservationDefinitionQualifiedIntervalComponent(org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent tgt = new org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
- copyElement(src, tgt);
- if (src.hasCategory())
- tgt.setCategoryElement(convertObservationRangeCategory(src.getCategoryElement()));
- if (src.hasRange())
- tgt.setRange(convertRange(src.getRange()));
- if (src.hasContext())
- tgt.setContext(convertCodeableConcept(src.getContext()));
- for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAppliesTo()) tgt.addAppliesTo(convertCodeableConcept(t));
- if (src.hasGender())
- tgt.setGenderElement(Enumerations40_50.convertAdministrativeGender(src.getGenderElement()));
- if (src.hasAge())
- tgt.setAge(convertRange(src.getAge()));
- if (src.hasGestationalAge())
- tgt.setGestationalAge(convertRange(src.getGestationalAge()));
- if (src.hasCondition())
- tgt.setConditionElement(convertString(src.getConditionElement()));
- return tgt;
- }
+// public static org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent convertObservationDefinitionQualifiedIntervalComponent(org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent src) throws FHIRException {
+// if (src == null)
+// return null;
+// org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent tgt = new org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
+// copyElement(src, tgt);
+// if (src.hasCategory())
+// tgt.setCategoryElement(convertObservationRangeCategory(src.getCategoryElement()));
+// if (src.hasRange())
+// tgt.setRange(convertRange(src.getRange()));
+// if (src.hasContext())
+// tgt.setContext(convertCodeableConcept(src.getContext()));
+// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAppliesTo()) tgt.addAppliesTo(convertCodeableConcept(t));
+// if (src.hasGender())
+// tgt.setGenderElement(Enumerations40_50.convertAdministrativeGender(src.getGenderElement()));
+// if (src.hasAge())
+// tgt.setAge(convertRange(src.getAge()));
+// if (src.hasGestationalAge())
+// tgt.setGestationalAge(convertRange(src.getGestationalAge()));
+// if (src.hasCondition())
+// tgt.setConditionElement(convertString(src.getConditionElement()));
+// return tgt;
+// }
+//
+// public static org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent convertObservationDefinitionQualifiedIntervalComponent(org.hl7.fhir.r5.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent src) throws FHIRException {
+// if (src == null)
+// return null;
+// org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent tgt = new org.hl7.fhir.r4.model.ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
+// copyElement(src, tgt);
+// if (src.hasCategory())
+// tgt.setCategoryElement(convertObservationRangeCategory(src.getCategoryElement()));
+// if (src.hasRange())
+// tgt.setRange(convertRange(src.getRange()));
+// if (src.hasContext())
+// tgt.setContext(convertCodeableConcept(src.getContext()));
+// for (org.hl7.fhir.r5.model.CodeableConcept t : src.getAppliesTo()) tgt.addAppliesTo(convertCodeableConcept(t));
+// if (src.hasGender())
+// tgt.setGenderElement(Enumerations40_50.convertAdministrativeGender(src.getGenderElement()));
+// if (src.hasAge())
+// tgt.setAge(convertRange(src.getAge()));
+// if (src.hasGestationalAge())
+// tgt.setGestationalAge(convertRange(src.getGestationalAge()));
+// if (src.hasCondition())
+// tgt.setConditionElement(convertString(src.getConditionElement()));
+// return tgt;
+// }
static public org.hl7.fhir.r5.model.Enumeration convertObservationRangeCategory(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
if (src == null || src.isEmpty())
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PaymentReconciliation40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PaymentReconciliation40_50.java
deleted file mode 100644
index 3e832f368..000000000
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PaymentReconciliation40_50.java
+++ /dev/null
@@ -1,287 +0,0 @@
-package org.hl7.fhir.convertors.conv40_50;
-
-
-import org.hl7.fhir.convertors.VersionConvertor_40_50;
-import org.hl7.fhir.exceptions.FHIRException;
-
-/*
- Copyright (c) 2011+, HL7, Inc.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of HL7 nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
-*/
-// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
-public class PaymentReconciliation40_50 extends VersionConvertor_40_50 {
-
- public static org.hl7.fhir.r5.model.PaymentReconciliation convertPaymentReconciliation(org.hl7.fhir.r4.model.PaymentReconciliation src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r5.model.PaymentReconciliation tgt = new org.hl7.fhir.r5.model.PaymentReconciliation();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
- if (src.hasStatus())
- tgt.setStatusElement(convertPaymentReconciliationStatus(src.getStatusElement()));
- if (src.hasPeriod())
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- if (src.hasCreated())
- tgt.setCreatedElement(convertDateTime(src.getCreatedElement()));
- if (src.hasPaymentIssuer())
- tgt.setPaymentIssuer(convertReference(src.getPaymentIssuer()));
- if (src.hasRequest())
- tgt.setRequest(convertReference(src.getRequest()));
- if (src.hasRequestor())
- tgt.setRequestor(convertReference(src.getRequestor()));
- if (src.hasOutcome())
- tgt.setOutcomeElement(convertRemittanceOutcome(src.getOutcomeElement()));
- if (src.hasDisposition())
- tgt.setDispositionElement(convertString(src.getDispositionElement()));
- if (src.hasPaymentDate())
- tgt.setPaymentDateElement(convertDate(src.getPaymentDateElement()));
- if (src.hasPaymentAmount())
- tgt.setPaymentAmount(convertMoney(src.getPaymentAmount()));
- if (src.hasPaymentIdentifier())
- tgt.setPaymentIdentifier(convertIdentifier(src.getPaymentIdentifier()));
- for (org.hl7.fhir.r4.model.PaymentReconciliation.DetailsComponent t : src.getDetail()) tgt.addDetail(convertDetailsComponent(t));
- if (src.hasFormCode())
- tgt.setFormCode(convertCodeableConcept(src.getFormCode()));
- for (org.hl7.fhir.r4.model.PaymentReconciliation.NotesComponent t : src.getProcessNote()) tgt.addProcessNote(convertNotesComponent(t));
- return tgt;
- }
-
- public static org.hl7.fhir.r4.model.PaymentReconciliation convertPaymentReconciliation(org.hl7.fhir.r5.model.PaymentReconciliation src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r4.model.PaymentReconciliation tgt = new org.hl7.fhir.r4.model.PaymentReconciliation();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
- if (src.hasStatus())
- tgt.setStatusElement(convertPaymentReconciliationStatus(src.getStatusElement()));
- if (src.hasPeriod())
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- if (src.hasCreated())
- tgt.setCreatedElement(convertDateTime(src.getCreatedElement()));
- if (src.hasPaymentIssuer())
- tgt.setPaymentIssuer(convertReference(src.getPaymentIssuer()));
- if (src.hasRequest())
- tgt.setRequest(convertReference(src.getRequest()));
- if (src.hasRequestor())
- tgt.setRequestor(convertReference(src.getRequestor()));
- if (src.hasOutcome())
- tgt.setOutcomeElement(convertRemittanceOutcome(src.getOutcomeElement()));
- if (src.hasDisposition())
- tgt.setDispositionElement(convertString(src.getDispositionElement()));
- if (src.hasPaymentDate())
- tgt.setPaymentDateElement(convertDate(src.getPaymentDateElement()));
- if (src.hasPaymentAmount())
- tgt.setPaymentAmount(convertMoney(src.getPaymentAmount()));
- if (src.hasPaymentIdentifier())
- tgt.setPaymentIdentifier(convertIdentifier(src.getPaymentIdentifier()));
- for (org.hl7.fhir.r5.model.PaymentReconciliation.DetailsComponent t : src.getDetail()) tgt.addDetail(convertDetailsComponent(t));
- if (src.hasFormCode())
- tgt.setFormCode(convertCodeableConcept(src.getFormCode()));
- for (org.hl7.fhir.r5.model.PaymentReconciliation.NotesComponent t : src.getProcessNote()) tgt.addProcessNote(convertNotesComponent(t));
- return tgt;
- }
-
- static public org.hl7.fhir.r5.model.Enumeration convertPaymentReconciliationStatus(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodesEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case ACTIVE:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.ACTIVE);
- break;
- case CANCELLED:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.CANCELLED);
- break;
- case DRAFT:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.DRAFT);
- break;
- case ENTEREDINERROR:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.ENTEREDINERROR);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r4.model.Enumeration convertPaymentReconciliationStatus(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.PaymentReconciliation.PaymentReconciliationStatusEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case ACTIVE:
- tgt.setValue(org.hl7.fhir.r4.model.PaymentReconciliation.PaymentReconciliationStatus.ACTIVE);
- break;
- case CANCELLED:
- tgt.setValue(org.hl7.fhir.r4.model.PaymentReconciliation.PaymentReconciliationStatus.CANCELLED);
- break;
- case DRAFT:
- tgt.setValue(org.hl7.fhir.r4.model.PaymentReconciliation.PaymentReconciliationStatus.DRAFT);
- break;
- case ENTEREDINERROR:
- tgt.setValue(org.hl7.fhir.r4.model.PaymentReconciliation.PaymentReconciliationStatus.ENTEREDINERROR);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r4.model.PaymentReconciliation.PaymentReconciliationStatus.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r5.model.Enumeration convertRemittanceOutcome(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodesEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case QUEUED:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.QUEUED);
- break;
- case COMPLETE:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.COMPLETE);
- break;
- case ERROR:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.ERROR);
- break;
- case PARTIAL:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.PARTIAL);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.ClaimProcessingCodes.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r4.model.Enumeration convertRemittanceOutcome(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Enumerations.RemittanceOutcomeEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case QUEUED:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.QUEUED);
- break;
- case COMPLETE:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.COMPLETE);
- break;
- case ERROR:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.ERROR);
- break;
- case PARTIAL:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.PARTIAL);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r4.model.Enumerations.RemittanceOutcome.NULL);
- break;
- }
- return tgt;
- }
-
- public static org.hl7.fhir.r5.model.PaymentReconciliation.DetailsComponent convertDetailsComponent(org.hl7.fhir.r4.model.PaymentReconciliation.DetailsComponent src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r5.model.PaymentReconciliation.DetailsComponent tgt = new org.hl7.fhir.r5.model.PaymentReconciliation.DetailsComponent();
- copyElement(src, tgt);
- if (src.hasIdentifier())
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- if (src.hasPredecessor())
- tgt.setPredecessor(convertIdentifier(src.getPredecessor()));
- if (src.hasType())
- tgt.setType(convertCodeableConcept(src.getType()));
- if (src.hasRequest())
- tgt.setRequest(convertReference(src.getRequest()));
- if (src.hasSubmitter())
- tgt.setSubmitter(convertReference(src.getSubmitter()));
- if (src.hasResponse())
- tgt.setResponse(convertReference(src.getResponse()));
- if (src.hasDate())
- tgt.setDateElement(convertDate(src.getDateElement()));
- if (src.hasResponsible())
- tgt.setResponsible(convertReference(src.getResponsible()));
- if (src.hasPayee())
- tgt.setPayee(convertReference(src.getPayee()));
- if (src.hasAmount())
- tgt.setAmount(convertMoney(src.getAmount()));
- return tgt;
- }
-
- public static org.hl7.fhir.r4.model.PaymentReconciliation.DetailsComponent convertDetailsComponent(org.hl7.fhir.r5.model.PaymentReconciliation.DetailsComponent src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r4.model.PaymentReconciliation.DetailsComponent tgt = new org.hl7.fhir.r4.model.PaymentReconciliation.DetailsComponent();
- copyElement(src, tgt);
- if (src.hasIdentifier())
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- if (src.hasPredecessor())
- tgt.setPredecessor(convertIdentifier(src.getPredecessor()));
- if (src.hasType())
- tgt.setType(convertCodeableConcept(src.getType()));
- if (src.hasRequest())
- tgt.setRequest(convertReference(src.getRequest()));
- if (src.hasSubmitter())
- tgt.setSubmitter(convertReference(src.getSubmitter()));
- if (src.hasResponse())
- tgt.setResponse(convertReference(src.getResponse()));
- if (src.hasDate())
- tgt.setDateElement(convertDate(src.getDateElement()));
- if (src.hasResponsible())
- tgt.setResponsible(convertReference(src.getResponsible()));
- if (src.hasPayee())
- tgt.setPayee(convertReference(src.getPayee()));
- if (src.hasAmount())
- tgt.setAmount(convertMoney(src.getAmount()));
- return tgt;
- }
-
- public static org.hl7.fhir.r5.model.PaymentReconciliation.NotesComponent convertNotesComponent(org.hl7.fhir.r4.model.PaymentReconciliation.NotesComponent src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r5.model.PaymentReconciliation.NotesComponent tgt = new org.hl7.fhir.r5.model.PaymentReconciliation.NotesComponent();
- copyElement(src, tgt);
- if (src.hasType())
- tgt.setTypeElement(Enumerations40_50.convertNoteType(src.getTypeElement()));
- if (src.hasText())
- tgt.setTextElement(convertString(src.getTextElement()));
- return tgt;
- }
-
- public static org.hl7.fhir.r4.model.PaymentReconciliation.NotesComponent convertNotesComponent(org.hl7.fhir.r5.model.PaymentReconciliation.NotesComponent src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r4.model.PaymentReconciliation.NotesComponent tgt = new org.hl7.fhir.r4.model.PaymentReconciliation.NotesComponent();
- copyElement(src, tgt);
- if (src.hasType())
- tgt.setTypeElement(Enumerations40_50.convertNoteType(src.getTypeElement()));
- if (src.hasText())
- tgt.setTextElement(convertString(src.getTextElement()));
- return tgt;
- }
-}
\ No newline at end of file
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PlanDefinition40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PlanDefinition40_50.java
index 784ec7123..f187d45a9 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PlanDefinition40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/PlanDefinition40_50.java
@@ -3,6 +3,9 @@ package org.hl7.fhir.convertors.conv40_50;
import org.hl7.fhir.convertors.VersionConvertor_40_50;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r5.model.DataRequirement;
+import org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionInputComponent;
+import org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionOutputComponent;
/*
Copyright (c) 2011+, HL7, Inc.
@@ -230,7 +233,7 @@ public class PlanDefinition40_50 extends VersionConvertor_40_50 {
tgt.setTextEquivalentElement(convertString(src.getTextEquivalentElement()));
if (src.hasPriority())
tgt.setPriorityElement(convertRequestPriority(src.getPriorityElement()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) tgt.addCode(convertCodeableConcept(t));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCode()) tgt.setCode(convertCodeableConcept(t));
for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason()) tgt.addReason(convertCodeableConcept(t));
for (org.hl7.fhir.r4.model.RelatedArtifact t : src.getDocumentation()) tgt.addDocumentation(convertRelatedArtifact(t));
for (org.hl7.fhir.r4.model.IdType t : src.getGoalId()) tgt.getGoalId().add(convertId(t));
@@ -238,8 +241,8 @@ public class PlanDefinition40_50 extends VersionConvertor_40_50 {
tgt.setSubject(convertType(src.getSubject()));
for (org.hl7.fhir.r4.model.TriggerDefinition t : src.getTrigger()) tgt.addTrigger(convertTriggerDefinition(t));
for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) tgt.addCondition(convertPlanDefinitionActionConditionComponent(t));
- for (org.hl7.fhir.r4.model.DataRequirement t : src.getInput()) tgt.addInput(convertDataRequirement(t));
- for (org.hl7.fhir.r4.model.DataRequirement t : src.getOutput()) tgt.addOutput(convertDataRequirement(t));
+ for (org.hl7.fhir.r4.model.DataRequirement t : src.getInput()) tgt.addInput(wrapInput(convertDataRequirement(t)));
+ for (org.hl7.fhir.r4.model.DataRequirement t : src.getOutput()) tgt.addOutput(wrapOutput(convertDataRequirement(t)));
for (org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t));
if (src.hasTiming())
tgt.setTiming(convertType(src.getTiming()));
@@ -265,6 +268,14 @@ public class PlanDefinition40_50 extends VersionConvertor_40_50 {
return tgt;
}
+ private static PlanDefinitionActionOutputComponent wrapOutput(DataRequirement dr) {
+ return new PlanDefinitionActionOutputComponent().setRequirement(dr);
+ }
+
+ private static PlanDefinitionActionInputComponent wrapInput(DataRequirement dr) {
+ return new PlanDefinitionActionInputComponent().setRequirement(dr);
+ }
+
public static org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionComponent convertPlanDefinitionActionComponent(org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionComponent src) throws FHIRException {
if (src == null)
return null;
@@ -280,7 +291,7 @@ public class PlanDefinition40_50 extends VersionConvertor_40_50 {
tgt.setTextEquivalentElement(convertString(src.getTextEquivalentElement()));
if (src.hasPriority())
tgt.setPriorityElement(convertRequestPriority(src.getPriorityElement()));
- for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCode()) tgt.addCode(convertCodeableConcept(t));
+ if (src.hasCode()) tgt.addCode(convertCodeableConcept(src.getCode()));
for (org.hl7.fhir.r5.model.CodeableConcept t : src.getReason()) tgt.addReason(convertCodeableConcept(t));
for (org.hl7.fhir.r5.model.RelatedArtifact t : src.getDocumentation()) tgt.addDocumentation(convertRelatedArtifact(t));
for (org.hl7.fhir.r5.model.IdType t : src.getGoalId()) tgt.getGoalId().add(convertId(t));
@@ -288,8 +299,8 @@ public class PlanDefinition40_50 extends VersionConvertor_40_50 {
tgt.setSubject(convertType(src.getSubject()));
for (org.hl7.fhir.r5.model.TriggerDefinition t : src.getTrigger()) tgt.addTrigger(convertTriggerDefinition(t));
for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionConditionComponent t : src.getCondition()) tgt.addCondition(convertPlanDefinitionActionConditionComponent(t));
- for (org.hl7.fhir.r5.model.DataRequirement t : src.getInput()) tgt.addInput(convertDataRequirement(t));
- for (org.hl7.fhir.r5.model.DataRequirement t : src.getOutput()) tgt.addOutput(convertDataRequirement(t));
+ for (PlanDefinitionActionInputComponent t : src.getInput()) tgt.addInput(convertDataRequirement(t.getRequirement()));
+ for (PlanDefinitionActionOutputComponent t : src.getOutput()) tgt.addOutput(convertDataRequirement(t.getRequirement()));
for (org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent t : src.getRelatedAction()) tgt.addRelatedAction(convertPlanDefinitionActionRelatedActionComponent(t));
if (src.hasTiming())
tgt.setTiming(convertType(src.getTiming()));
@@ -665,7 +676,7 @@ public class PlanDefinition40_50 extends VersionConvertor_40_50 {
org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.r5.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent();
copyElement(src, tgt);
if (src.hasActionId())
- tgt.setActionIdElement(convertId(src.getActionIdElement()));
+ tgt.setTargetIdElement(convertId(src.getActionIdElement()));
if (src.hasRelationship())
tgt.setRelationshipElement(convertActionRelationshipType(src.getRelationshipElement()));
if (src.hasOffset())
@@ -678,8 +689,8 @@ public class PlanDefinition40_50 extends VersionConvertor_40_50 {
return null;
org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent tgt = new org.hl7.fhir.r4.model.PlanDefinition.PlanDefinitionActionRelatedActionComponent();
copyElement(src, tgt);
- if (src.hasActionId())
- tgt.setActionIdElement(convertId(src.getActionIdElement()));
+ if (src.hasTargetId())
+ tgt.setActionIdElement(convertId(src.getTargetIdElement()));
if (src.hasRelationship())
tgt.setRelationshipElement(convertActionRelationshipType(src.getRelationshipElement()));
if (src.hasOffset())
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Questionnaire40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Questionnaire40_50.java
index 24f9afac1..30478c744 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Questionnaire40_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/Questionnaire40_50.java
@@ -3,7 +3,9 @@ package org.hl7.fhir.convertors.conv40_50;
import org.hl7.fhir.convertors.VersionConvertor_40_50;
import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.r5.model.CodeType;
+import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint;
/*
Copyright (c) 2011+, HL7, Inc.
@@ -137,9 +139,15 @@ public class Questionnaire40_50 extends VersionConvertor_40_50 {
if (src.hasPrefix())
tgt.setPrefixElement(convertString(src.getPrefixElement()));
if (src.hasText())
- tgt.setTextElement(convertString(src.getTextElement()));
- if (src.hasType())
+ tgt.setTextElement(convertStringToMarkdown(src.getTextElement()));
+ if (src.hasType()) {
tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement()));
+ if (src.getType() == QuestionnaireItemType.CHOICE) {
+ tgt.setAnswerConstraint(QuestionnaireAnswerConstraint.OPTIONSONLY);
+ } else if (src.getType() == QuestionnaireItemType.OPENCHOICE) {
+ tgt.setAnswerConstraint(QuestionnaireAnswerConstraint.OPTIONSORSTRING);
+ }
+ }
for (org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t));
if (src.hasEnableBehavior())
tgt.setEnableBehaviorElement(convertEnableWhenBehavior(src.getEnableBehaviorElement()));
@@ -174,7 +182,7 @@ public class Questionnaire40_50 extends VersionConvertor_40_50 {
if (src.hasText())
tgt.setTextElement(convertString(src.getTextElement()));
if (src.hasType())
- tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement()));
+ tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement(), src.getAnswerConstraint()));
for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t));
if (src.hasEnableBehavior())
tgt.setEnableBehaviorElement(convertEnableWhenBehavior(src.getEnableBehaviorElement()));
@@ -237,10 +245,10 @@ public class Questionnaire40_50 extends VersionConvertor_40_50 {
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.URL);
break;
case CHOICE:
- tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CHOICE);
+ tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CODING);
break;
case OPENCHOICE:
- tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.OPENCHOICE);
+ tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CODING);
break;
case ATTACHMENT:
tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.ATTACHMENT);
@@ -258,7 +266,7 @@ public class Questionnaire40_50 extends VersionConvertor_40_50 {
return tgt;
}
- static public org.hl7.fhir.r4.model.Enumeration convertQuestionnaireItemType(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
+ static public org.hl7.fhir.r4.model.Enumeration convertQuestionnaireItemType(org.hl7.fhir.r5.model.Enumeration src, QuestionnaireAnswerConstraint constraint) throws FHIRException {
if (src == null || src.isEmpty())
return null;
org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemTypeEnumFactory());
@@ -298,12 +306,12 @@ public class Questionnaire40_50 extends VersionConvertor_40_50 {
case URL:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.URL);
break;
- case CHOICE:
- tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE);
- break;
- case OPENCHOICE:
+ case CODING:
+ if (constraint == QuestionnaireAnswerConstraint.OPTIONSORSTRING)
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.OPENCHOICE);
- break;
+ else
+ tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.CHOICE);
+ break;
case ATTACHMENT:
tgt.setValue(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType.ATTACHMENT);
break;
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RequestGroup40_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RequestGroup40_50.java
deleted file mode 100644
index 9ebd3f6b2..000000000
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv40_50/RequestGroup40_50.java
+++ /dev/null
@@ -1,790 +0,0 @@
-package org.hl7.fhir.convertors.conv40_50;
-
-
-import org.hl7.fhir.convertors.VersionConvertor_40_50;
-import org.hl7.fhir.exceptions.FHIRException;
-import org.hl7.fhir.r5.model.CodeableReference;
-
-/*
- Copyright (c) 2011+, HL7, Inc.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification,
- are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
- * Neither the name of HL7 nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
-
-*/
-// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
-public class RequestGroup40_50 extends VersionConvertor_40_50 {
-
- public static org.hl7.fhir.r5.model.RequestGroup convertRequestGroup(org.hl7.fhir.r4.model.RequestGroup src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r5.model.RequestGroup tgt = new org.hl7.fhir.r5.model.RequestGroup();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
- for (org.hl7.fhir.r4.model.CanonicalType t : src.getInstantiatesCanonical()) tgt.getInstantiatesCanonical().add(convertCanonical(t));
- for (org.hl7.fhir.r4.model.UriType t : src.getInstantiatesUri()) tgt.getInstantiatesUri().add(convertUri(t));
- for (org.hl7.fhir.r4.model.Reference t : src.getBasedOn()) tgt.addBasedOn(convertReference(t));
- for (org.hl7.fhir.r4.model.Reference t : src.getReplaces()) tgt.addReplaces(convertReference(t));
- if (src.hasGroupIdentifier())
- tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier()));
- if (src.hasStatus())
- tgt.setStatusElement(convertRequestStatus(src.getStatusElement()));
- if (src.hasIntent())
- tgt.setIntentElement(convertRequestIntent(src.getIntentElement()));
- if (src.hasPriority())
- tgt.setPriorityElement(convertRequestPriority(src.getPriorityElement()));
- if (src.hasCode())
- tgt.setCode(convertCodeableConcept(src.getCode()));
- if (src.hasSubject())
- tgt.setSubject(convertReference(src.getSubject()));
- if (src.hasEncounter())
- tgt.setEncounter(convertReference(src.getEncounter()));
- if (src.hasAuthoredOn())
- tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement()));
- if (src.hasAuthor())
- tgt.setAuthor(convertReference(src.getAuthor()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonCode()) tgt.addReason(convertCodeableConceptToCodeableReference(t));
- for (org.hl7.fhir.r4.model.Reference t : src.getReasonReference()) tgt.addReason(convertReferenceToCodeableReference(t));
- for (org.hl7.fhir.r4.model.Annotation t : src.getNote()) tgt.addNote(convertAnnotation(t));
- for (org.hl7.fhir.r4.model.RequestGroup.RequestGroupActionComponent t : src.getAction()) tgt.addAction(convertRequestGroupActionComponent(t));
- return tgt;
- }
-
- public static org.hl7.fhir.r4.model.RequestGroup convertRequestGroup(org.hl7.fhir.r5.model.RequestGroup src) throws FHIRException {
- if (src == null)
- return null;
- org.hl7.fhir.r4.model.RequestGroup tgt = new org.hl7.fhir.r4.model.RequestGroup();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(convertIdentifier(t));
- for (org.hl7.fhir.r5.model.CanonicalType t : src.getInstantiatesCanonical()) tgt.getInstantiatesCanonical().add(convertCanonical(t));
- for (org.hl7.fhir.r5.model.UriType t : src.getInstantiatesUri()) tgt.getInstantiatesUri().add(convertUri(t));
- for (org.hl7.fhir.r5.model.Reference t : src.getBasedOn()) tgt.addBasedOn(convertReference(t));
- for (org.hl7.fhir.r5.model.Reference t : src.getReplaces()) tgt.addReplaces(convertReference(t));
- if (src.hasGroupIdentifier())
- tgt.setGroupIdentifier(convertIdentifier(src.getGroupIdentifier()));
- if (src.hasStatus())
- tgt.setStatusElement(convertRequestStatus(src.getStatusElement()));
- if (src.hasIntent())
- tgt.setIntentElement(convertRequestIntent(src.getIntentElement()));
- if (src.hasPriority())
- tgt.setPriorityElement(convertRequestPriority(src.getPriorityElement()));
- if (src.hasCode())
- tgt.setCode(convertCodeableConcept(src.getCode()));
- if (src.hasSubject())
- tgt.setSubject(convertReference(src.getSubject()));
- if (src.hasEncounter())
- tgt.setEncounter(convertReference(src.getEncounter()));
- if (src.hasAuthoredOn())
- tgt.setAuthoredOnElement(convertDateTime(src.getAuthoredOnElement()));
- if (src.hasAuthor())
- tgt.setAuthor(convertReference(src.getAuthor()));
- for (CodeableReference t : src.getReason()) if (t.hasConcept())
- tgt.addReasonCode(convertCodeableConcept(t.getConcept()));
- for (CodeableReference t : src.getReason()) if (t.hasReference())
- tgt.addReasonReference(convertReference(t.getReference()));
- for (org.hl7.fhir.r5.model.Annotation t : src.getNote()) tgt.addNote(convertAnnotation(t));
- for (org.hl7.fhir.r5.model.RequestGroup.RequestGroupActionComponent t : src.getAction()) tgt.addAction(convertRequestGroupActionComponent(t));
- return tgt;
- }
-
- static public org.hl7.fhir.r5.model.Enumeration convertRequestStatus(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.RequestStatusEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case DRAFT:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.DRAFT);
- break;
- case ACTIVE:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.ACTIVE);
- break;
- case ONHOLD:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.ONHOLD);
- break;
- case REVOKED:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.REVOKED);
- break;
- case COMPLETED:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.COMPLETED);
- break;
- case ENTEREDINERROR:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.ENTEREDINERROR);
- break;
- case UNKNOWN:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.UNKNOWN);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestStatus.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r4.model.Enumeration convertRequestStatus(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.RequestGroup.RequestStatusEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case DRAFT:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestStatus.DRAFT);
- break;
- case ACTIVE:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestStatus.ACTIVE);
- break;
- case ONHOLD:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestStatus.ONHOLD);
- break;
- case REVOKED:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestStatus.REVOKED);
- break;
- case COMPLETED:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestStatus.COMPLETED);
- break;
- case ENTEREDINERROR:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestStatus.ENTEREDINERROR);
- break;
- case UNKNOWN:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestStatus.UNKNOWN);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestStatus.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r5.model.Enumeration convertRequestIntent(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.RequestIntentEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case PROPOSAL:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.PROPOSAL);
- break;
- case PLAN:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.PLAN);
- break;
- case DIRECTIVE:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.DIRECTIVE);
- break;
- case ORDER:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.ORDER);
- break;
- case ORIGINALORDER:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.ORIGINALORDER);
- break;
- case REFLEXORDER:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.REFLEXORDER);
- break;
- case FILLERORDER:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.FILLERORDER);
- break;
- case INSTANCEORDER:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.INSTANCEORDER);
- break;
- case OPTION:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.OPTION);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestIntent.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r4.model.Enumeration convertRequestIntent(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Enumeration tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.RequestGroup.RequestIntentEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case PROPOSAL:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestIntent.PROPOSAL);
- break;
- case PLAN:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestIntent.PLAN);
- break;
- case DIRECTIVE:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestIntent.DIRECTIVE);
- break;
- case ORDER:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestIntent.ORDER);
- break;
- case ORIGINALORDER:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestIntent.ORIGINALORDER);
- break;
- case REFLEXORDER:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestIntent.REFLEXORDER);
- break;
- case FILLERORDER:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestIntent.FILLERORDER);
- break;
- case INSTANCEORDER:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestIntent.INSTANCEORDER);
- break;
- case OPTION:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestIntent.OPTION);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r4.model.RequestGroup.RequestIntent.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r5.model.Enumeration convertRequestPriority(org.hl7.fhir.r4.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r5.model.Enumeration tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.RequestPriorityEnumFactory());
- VersionConvertor_40_50.copyElement(src, tgt);
- switch(src.getValue()) {
- case ROUTINE:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.ROUTINE);
- break;
- case URGENT:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.URGENT);
- break;
- case ASAP:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.ASAP);
- break;
- case STAT:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.STAT);
- break;
- default:
- tgt.setValue(org.hl7.fhir.r5.model.Enumerations.RequestPriority.NULL);
- break;
- }
- return tgt;
- }
-
- static public org.hl7.fhir.r4.model.Enumeration convertRequestPriority(org.hl7.fhir.r5.model.Enumeration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Enumeration