diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/utilities/TranslatingUtilities.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/utilities/TranslatingUtilities.java index ea5bd6e3f8d..2e470d950f1 100644 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/utilities/TranslatingUtilities.java +++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/utilities/TranslatingUtilities.java @@ -20,45 +20,45 @@ package org.hl7.fhir.utilities; * #L% */ - -import java.util.Date; - -public class TranslatingUtilities { - - public interface TranslationServices { - String translate(String context, String value); - String translate(String context, String value, Object... args); - String toStr(int value); - String toStr(Date value); - } - - private TranslationServices translator; - - public TranslationServices getTranslator() { - return translator; - } - - public void setTranslator(TranslationServices translator) { - this.translator = translator; - } - - protected String translate(String context, String value) { - return hasTranslator() ? translator.translate(context, value) : value; - } - - protected String translate(String context, String value, Object... args) { - return hasTranslator() ? translator.translate(context, value, args) : String.format(value, args); - } - - protected boolean hasTranslator() { - return translator != null; - } - - public String toStr(int value) { - return hasTranslator() ? translator.toStr(value) : Integer.toString(value); - } - - public String toStr(Date value) { - return hasTranslator() ? translator.toStr(value) : value.toString(); - } -} + +import java.util.Date; + +public class TranslatingUtilities { + + public interface TranslationServices { + String translate(String context, String value); + String translate(String context, String value, Object... args); + String toStr(int value); + String toStr(Date value); + } + + private TranslationServices translator; + + public TranslationServices getTranslator() { + return translator; + } + + public void setTranslator(TranslationServices translator) { + this.translator = translator; + } + + protected String translate(String context, String value) { + return hasTranslator() ? translator.translate(context, value) : value; + } + + protected String translate(String context, String value, Object... args) { + return hasTranslator() ? translator.translate(context, value, args) : String.format(value, args); + } + + protected boolean hasTranslator() { + return translator != null; + } + + public String toStr(int value) { + return hasTranslator() ? translator.toStr(value) : Integer.toString(value); + } + + public String toStr(Date value) { + return hasTranslator() ? translator.toStr(value) : value.toString(); + } +} diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/utilities/validation/ValidationMessage.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/utilities/validation/ValidationMessage.java index 443c91a7148..b030ba68dc5 100644 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/utilities/validation/ValidationMessage.java +++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/utilities/validation/ValidationMessage.java @@ -20,709 +20,709 @@ package org.hl7.fhir.utilities.validation; * #L% */ - -/* - 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 java.util.Comparator; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.utilities.Utilities; - -public class ValidationMessage implements Comparator, Comparable -{ - public enum Source { - ExampleValidator, - ProfileValidator, - ResourceValidator, - InstanceValidator, - Schema, - Schematron, - Publisher, - Ontology, - ProfileComparer, - QuestionnaireResponseValidator - } - - public enum IssueSeverity { - /** - * The issue caused the action to fail, and no further checking could be performed. - */ - FATAL, - /** - * The issue is sufficiently important to cause the action to fail. - */ - ERROR, - /** - * The issue is not important enough to cause the action to fail, but may cause it to be performed suboptimally or in a way that is not as desired. - */ - WARNING, - /** - * The issue has no relation to the degree of success of the action. - */ - INFORMATION, - /** - * added to help the parsers with the generic types - */ - NULL; - public static IssueSeverity fromCode(String codeString) throws FHIRException { - if (codeString == null || "".equals(codeString)) - return null; - if ("fatal".equals(codeString)) - return FATAL; - if ("error".equals(codeString)) - return ERROR; - if ("warning".equals(codeString)) - return WARNING; - if ("information".equals(codeString)) - return INFORMATION; - else - throw new FHIRException("Unknown IssueSeverity code '"+codeString+"'"); - } - public String toCode() { - switch (this) { - case FATAL: return "fatal"; - case ERROR: return "error"; - case WARNING: return "warning"; - case INFORMATION: return "information"; - default: return "?"; - } - } - public String getSystem() { - switch (this) { - case FATAL: return "http://hl7.org/fhir/issue-severity"; - case ERROR: return "http://hl7.org/fhir/issue-severity"; - case WARNING: return "http://hl7.org/fhir/issue-severity"; - case INFORMATION: return "http://hl7.org/fhir/issue-severity"; - default: return "?"; - } - } - public String getDefinition() { - switch (this) { - case FATAL: return "The issue caused the action to fail, and no further checking could be performed."; - case ERROR: return "The issue is sufficiently important to cause the action to fail."; - case WARNING: return "The issue is not important enough to cause the action to fail, but may cause it to be performed suboptimally or in a way that is not as desired."; - case INFORMATION: return "The issue has no relation to the degree of success of the action."; - default: return "?"; - } - } - public String getDisplay() { - switch (this) { - case FATAL: return "Fatal"; - case ERROR: return "Error"; - case WARNING: return "Warning"; - case INFORMATION: return "Information"; - default: return "?"; - } - } - } - - public enum IssueType { - /** - * Content invalid against the specification or a profile. - */ - INVALID, - /** - * A structural issue in the content such as wrong namespace, or unable to parse the content completely, or invalid json syntax. - */ - STRUCTURE, - /** - * A required element is missing. - */ - REQUIRED, - /** - * An element value is invalid. - */ - VALUE, - /** - * A content validation rule failed - e.g. a schematron rule. - */ - INVARIANT, - /** - * An authentication/authorization/permissions issue of some kind. - */ - SECURITY, - /** - * The client needs to initiate an authentication process. - */ - LOGIN, - /** - * The user or system was not able to be authenticated (either there is no process, or the proferred token is unacceptable). - */ - UNKNOWN, - /** - * User session expired; a login may be required. - */ - EXPIRED, - /** - * The user does not have the rights to perform this action. - */ - FORBIDDEN, - /** - * Some information was not or may not have been returned due to business rules, consent or privacy rules, or access permission constraints. This information may be accessible through alternate processes. - */ - SUPPRESSED, - /** - * Processing issues. These are expected to be final e.g. there is no point resubmitting the same content unchanged. - */ - PROCESSING, - /** - * The resource or profile is not supported. - */ - NOTSUPPORTED, - /** - * An attempt was made to create a duplicate record. - */ - DUPLICATE, - /** - * The reference provided was not found. In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the content is not found further into the application architecture. - */ - NOTFOUND, - /** - * Provided content is too long (typically, this is a denial of service protection type of error). - */ - TOOLONG, - /** - * The code or system could not be understood, or it was not valid in the context of a particular ValueSet.code. - */ - CODEINVALID, - /** - * An extension was found that was not acceptable, could not be resolved, or a modifierExtension was not recognized. - */ - EXTENSION, - /** - * The operation was stopped to protect server resources; e.g. a request for a value set expansion on all of SNOMED CT. - */ - TOOCOSTLY, - /** - * The content/operation failed to pass some business rule, and so could not proceed. - */ - BUSINESSRULE, - /** - * Content could not be accepted because of an edit conflict (i.e. version aware updates) (In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the conflict is discovered further into the application architecture.) - */ - CONFLICT, - /** - * Not all data sources typically accessed could be reached, or responded in time, so the returned information may not be complete. - */ - INCOMPLETE, - /** - * Transient processing issues. The system receiving the error may be able to resubmit the same content once an underlying issue is resolved. - */ - TRANSIENT, - /** - * A resource/record locking failure (usually in an underlying database). - */ - LOCKERROR, - /** - * The persistent store is unavailable; e.g. the database is down for maintenance or similar action. - */ - NOSTORE, - /** - * An unexpected internal error has occurred. - */ - EXCEPTION, - /** - * An internal timeout has occurred. - */ - TIMEOUT, - /** - * The system is not prepared to handle this request due to load management. - */ - THROTTLED, - /** - * A message unrelated to the processing success of the completed operation (examples of the latter include things like reminders of password expiry, system maintenance times, etc.). - */ - INFORMATIONAL, - /** - * added to help the parsers with the generic types - */ - NULL; - public static IssueType fromCode(String codeString) throws FHIRException { - if (codeString == null || "".equals(codeString)) - return null; - if ("invalid".equals(codeString)) - return INVALID; - if ("structure".equals(codeString)) - return STRUCTURE; - if ("required".equals(codeString)) - return REQUIRED; - if ("value".equals(codeString)) - return VALUE; - if ("invariant".equals(codeString)) - return INVARIANT; - if ("security".equals(codeString)) - return SECURITY; - if ("login".equals(codeString)) - return LOGIN; - if ("unknown".equals(codeString)) - return UNKNOWN; - if ("expired".equals(codeString)) - return EXPIRED; - if ("forbidden".equals(codeString)) - return FORBIDDEN; - if ("suppressed".equals(codeString)) - return SUPPRESSED; - if ("processing".equals(codeString)) - return PROCESSING; - if ("not-supported".equals(codeString)) - return NOTSUPPORTED; - if ("duplicate".equals(codeString)) - return DUPLICATE; - if ("not-found".equals(codeString)) - return NOTFOUND; - if ("too-long".equals(codeString)) - return TOOLONG; - if ("code-invalid".equals(codeString)) - return CODEINVALID; - if ("extension".equals(codeString)) - return EXTENSION; - if ("too-costly".equals(codeString)) - return TOOCOSTLY; - if ("business-rule".equals(codeString)) - return BUSINESSRULE; - if ("conflict".equals(codeString)) - return CONFLICT; - if ("incomplete".equals(codeString)) - return INCOMPLETE; - if ("transient".equals(codeString)) - return TRANSIENT; - if ("lock-error".equals(codeString)) - return LOCKERROR; - if ("no-store".equals(codeString)) - return NOSTORE; - if ("exception".equals(codeString)) - return EXCEPTION; - if ("timeout".equals(codeString)) - return TIMEOUT; - if ("throttled".equals(codeString)) - return THROTTLED; - if ("informational".equals(codeString)) - return INFORMATIONAL; - else - throw new FHIRException("Unknown IssueType code '"+codeString+"'"); - } - public String toCode() { - switch (this) { - case INVALID: return "invalid"; - case STRUCTURE: return "structure"; - case REQUIRED: return "required"; - case VALUE: return "value"; - case INVARIANT: return "invariant"; - case SECURITY: return "security"; - case LOGIN: return "login"; - case UNKNOWN: return "unknown"; - case EXPIRED: return "expired"; - case FORBIDDEN: return "forbidden"; - case SUPPRESSED: return "suppressed"; - case PROCESSING: return "processing"; - case NOTSUPPORTED: return "not-supported"; - case DUPLICATE: return "duplicate"; - case NOTFOUND: return "not-found"; - case TOOLONG: return "too-long"; - case CODEINVALID: return "code-invalid"; - case EXTENSION: return "extension"; - case TOOCOSTLY: return "too-costly"; - case BUSINESSRULE: return "business-rule"; - case CONFLICT: return "conflict"; - case INCOMPLETE: return "incomplete"; - case TRANSIENT: return "transient"; - case LOCKERROR: return "lock-error"; - case NOSTORE: return "no-store"; - case EXCEPTION: return "exception"; - case TIMEOUT: return "timeout"; - case THROTTLED: return "throttled"; - case INFORMATIONAL: return "informational"; - default: return "?"; - } - } - public String getSystem() { - switch (this) { - case INVALID: return "http://hl7.org/fhir/issue-type"; - case STRUCTURE: return "http://hl7.org/fhir/issue-type"; - case REQUIRED: return "http://hl7.org/fhir/issue-type"; - case VALUE: return "http://hl7.org/fhir/issue-type"; - case INVARIANT: return "http://hl7.org/fhir/issue-type"; - case SECURITY: return "http://hl7.org/fhir/issue-type"; - case LOGIN: return "http://hl7.org/fhir/issue-type"; - case UNKNOWN: return "http://hl7.org/fhir/issue-type"; - case EXPIRED: return "http://hl7.org/fhir/issue-type"; - case FORBIDDEN: return "http://hl7.org/fhir/issue-type"; - case SUPPRESSED: return "http://hl7.org/fhir/issue-type"; - case PROCESSING: return "http://hl7.org/fhir/issue-type"; - case NOTSUPPORTED: return "http://hl7.org/fhir/issue-type"; - case DUPLICATE: return "http://hl7.org/fhir/issue-type"; - case NOTFOUND: return "http://hl7.org/fhir/issue-type"; - case TOOLONG: return "http://hl7.org/fhir/issue-type"; - case CODEINVALID: return "http://hl7.org/fhir/issue-type"; - case EXTENSION: return "http://hl7.org/fhir/issue-type"; - case TOOCOSTLY: return "http://hl7.org/fhir/issue-type"; - case BUSINESSRULE: return "http://hl7.org/fhir/issue-type"; - case CONFLICT: return "http://hl7.org/fhir/issue-type"; - case INCOMPLETE: return "http://hl7.org/fhir/issue-type"; - case TRANSIENT: return "http://hl7.org/fhir/issue-type"; - case LOCKERROR: return "http://hl7.org/fhir/issue-type"; - case NOSTORE: return "http://hl7.org/fhir/issue-type"; - case EXCEPTION: return "http://hl7.org/fhir/issue-type"; - case TIMEOUT: return "http://hl7.org/fhir/issue-type"; - case THROTTLED: return "http://hl7.org/fhir/issue-type"; - case INFORMATIONAL: return "http://hl7.org/fhir/issue-type"; - default: return "?"; - } - } - public String getDefinition() { - switch (this) { - case INVALID: return "Content invalid against the specification or a profile."; - case STRUCTURE: return "A structural issue in the content such as wrong namespace, or unable to parse the content completely, or invalid json syntax."; - case REQUIRED: return "A required element is missing."; - case VALUE: return "An element value is invalid."; - case INVARIANT: return "A content validation rule failed - e.g. a schematron rule."; - case SECURITY: return "An authentication/authorization/permissions issue of some kind."; - case LOGIN: return "The client needs to initiate an authentication process."; - case UNKNOWN: return "The user or system was not able to be authenticated (either there is no process, or the proferred token is unacceptable)."; - case EXPIRED: return "User session expired; a login may be required."; - case FORBIDDEN: return "The user does not have the rights to perform this action."; - case SUPPRESSED: return "Some information was not or may not have been returned due to business rules, consent or privacy rules, or access permission constraints. This information may be accessible through alternate processes."; - case PROCESSING: return "Processing issues. These are expected to be final e.g. there is no point resubmitting the same content unchanged."; - case NOTSUPPORTED: return "The resource or profile is not supported."; - case DUPLICATE: return "An attempt was made to create a duplicate record."; - case NOTFOUND: return "The reference provided was not found. In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the content is not found further into the application architecture."; - case TOOLONG: return "Provided content is too long (typically, this is a denial of service protection type of error)."; - case CODEINVALID: return "The code or system could not be understood, or it was not valid in the context of a particular ValueSet.code."; - case EXTENSION: return "An extension was found that was not acceptable, could not be resolved, or a modifierExtension was not recognized."; - case TOOCOSTLY: return "The operation was stopped to protect server resources; e.g. a request for a value set expansion on all of SNOMED CT."; - case BUSINESSRULE: return "The content/operation failed to pass some business rule, and so could not proceed."; - case CONFLICT: return "Content could not be accepted because of an edit conflict (i.e. version aware updates) (In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the conflict is discovered further into the application architecture.)"; - case INCOMPLETE: return "Not all data sources typically accessed could be reached, or responded in time, so the returned information may not be complete."; - case TRANSIENT: return "Transient processing issues. The system receiving the error may be able to resubmit the same content once an underlying issue is resolved."; - case LOCKERROR: return "A resource/record locking failure (usually in an underlying database)."; - case NOSTORE: return "The persistent store is unavailable; e.g. the database is down for maintenance or similar action."; - case EXCEPTION: return "An unexpected internal error has occurred."; - case TIMEOUT: return "An internal timeout has occurred."; - case THROTTLED: return "The system is not prepared to handle this request due to load management."; - case INFORMATIONAL: return "A message unrelated to the processing success of the completed operation (examples of the latter include things like reminders of password expiry, system maintenance times, etc.)."; - default: return "?"; - } - } - public String getDisplay() { - switch (this) { - case INVALID: return "Invalid Content"; - case STRUCTURE: return "Structural Issue"; - case REQUIRED: return "Required element missing"; - case VALUE: return "Element value invalid"; - case INVARIANT: return "Validation rule failed"; - case SECURITY: return "Security Problem"; - case LOGIN: return "Login Required"; - case UNKNOWN: return "Unknown User"; - case EXPIRED: return "Session Expired"; - case FORBIDDEN: return "Forbidden"; - case SUPPRESSED: return "Information Suppressed"; - case PROCESSING: return "Processing Failure"; - case NOTSUPPORTED: return "Content not supported"; - case DUPLICATE: return "Duplicate"; - case NOTFOUND: return "Not Found"; - case TOOLONG: return "Content Too Long"; - case CODEINVALID: return "Invalid Code"; - case EXTENSION: return "Unacceptable Extension"; - case TOOCOSTLY: return "Operation Too Costly"; - case BUSINESSRULE: return "Business Rule Violation"; - case CONFLICT: return "Edit Version Conflict"; - case INCOMPLETE: return "Incomplete Results"; - case TRANSIENT: return "Transient Issue"; - case LOCKERROR: return "Lock Error"; - case NOSTORE: return "No Store Available"; - case EXCEPTION: return "Exception"; - case TIMEOUT: return "Timeout"; - case THROTTLED: return "Throttled"; - case INFORMATIONAL: return "Informational Note"; - default: return "?"; - } - } - } - - - private Source source; - private int line; - private int col; - private String location; - private String message; - private IssueType type; - private IssueSeverity level; - private String html; - private String locationLink; - - - /** - * Constructor - */ - public ValidationMessage() { - // nothing - } - - public ValidationMessage(Source source, IssueType type, String path, String message, IssueSeverity level) { - super(); - this.line = -1; - this.col = -1; - this.location = path; - if (message == null) - throw new Error("message is null"); - this.message = message; - this.html = Utilities.escapeXml(message); - this.level = level; - this.source = source; - this.type = type; - if (level == IssueSeverity.NULL) - determineLevel(path); - if (type == null) - throw new Error("A type must be provided"); - } - - public ValidationMessage(Source source, IssueType type, int line, int col, String path, String message, IssueSeverity level) { - super(); - this.line = line; - this.col = col; - this.location = path; - this.message = message; - this.html = Utilities.escapeXml(message); - this.level = level; - this.source = source; - this.type = type; - if (level == IssueSeverity.NULL) - determineLevel(path); - if (type == null) - throw new Error("A type must be provided"); - } - - public ValidationMessage(Source source, IssueType type, String path, String message, String html, IssueSeverity level) { - super(); - this.line = -1; - this.col = -1; - this.location = path; - if (message == null) - throw new Error("message is null"); - this.message = message; - this.html = html; - this.level = level; - this.source = source; - this.type = type; - if (level == IssueSeverity.NULL) - determineLevel(path); - if (type == null) - throw new Error("A type must be provided"); - } - - public ValidationMessage(Source source, IssueType type, int line, int col, String path, String message, String html, IssueSeverity level) { - super(); - this.line = line; - this.col = col; - this.location = path; - if (message == null) - throw new Error("message is null"); - this.message = message; - this.html = html; - this.level = level; - this.source = source; - this.type = type; - if (level == IssueSeverity.NULL) - determineLevel(path); - if (type == null) - throw new Error("A type must be provided"); - } - - public ValidationMessage(Source source, IssueType type, String message, IssueSeverity level) { - super(); - this.line = -1; - this.col = -1; - if (message == null) - throw new Error("message is null"); - this.message = message; - this.level = level; - this.source = source; - this.type = type; - if (type == null) - throw new Error("A type must be provided"); - } - - private IssueSeverity determineLevel(String path) { - if (isGrandfathered(path)) - return IssueSeverity.WARNING; - else - return IssueSeverity.ERROR; - } - - private boolean isGrandfathered(String path) { - if (path.startsWith("xds-documentmanifest.")) - return true; - if (path.startsWith("observation-device-metric-devicemetricobservation.")) - return true; - if (path.startsWith("medicationadministration-immunization-vaccine.")) - return true; - if (path.startsWith("elementdefinition-de-dataelement.")) - return true; - if (path.startsWith("dataelement-sdc-sdcelement.")) - return true; - if (path.startsWith("questionnaireresponse-sdc-structureddatacaptureanswers.")) - return true; - if (path.startsWith("valueset-sdc-structureddatacapturevalueset.")) - return true; - if (path.startsWith("dataelement-sdc-de-sdcelement.")) - return true; - if (path.startsWith("do-uslab-uslabdo.")) - return true; - if (path.startsWith(".")) - return true; - if (path.startsWith(".")) - return true; - if (path.startsWith(".")) - return true; - if (path.startsWith(".")) - return true; - - return false; - } - - public String getMessage() { - return message; - } - public ValidationMessage setMessage(String message) { - this.message = message; - return this; - } - - public IssueSeverity getLevel() { - return level; - } - public ValidationMessage setLevel(IssueSeverity level) { - this.level = level; - return this; - } - - public Source getSource() { - return source; - } - public ValidationMessage setSource(Source source) { - this.source = source; - return this; - } - - public int getLine() { - return line; - } - - public void setLine(int theLine) { - line = theLine; - } - - public int getCol() { - return col; - } - - public void setCol(int theCol) { - col = theCol; - } - - public String getLocation() { - return location; - } - public ValidationMessage setLocation(String location) { - this.location = location; - return this; - } - - public IssueType getType() { - return type; - } - - public ValidationMessage setType(IssueType type) { - this.type = type; - return this; - } - - public String summary() { - return level.toString()+" @ "+location+(line>= 0 && col >= 0 ? " (line "+Integer.toString(line)+", col"+Integer.toString(col)+"): " : ": ") +message +(source != null ? " (src = "+source+")" : ""); - } - - - public String toXML() { - return "" + Utilities.escapeXml(message) + "" + html + ""; - } - - public String getHtml() { - return html == null ? Utilities.escapeXml(message) : html; - } - - public String getDisplay() { - return level + ": " + (location.isEmpty() ? "" : (location + ": ")) + message; - } - - /** - * Returns a representation of this ValidationMessage suitable for logging. The values of - * most of the internal fields are included, so this may not be suitable for display to - * an end user. - */ - @Override - public String toString() { - ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE); - b.append("level", level); - b.append("type", type); - b.append("location", location); - b.append("message", message); - return b.build(); - } - - @Override - public boolean equals(Object o) { - return (this.getMessage() != null && this.getMessage().equals(((ValidationMessage)o).getMessage())) && (this.getLocation() != null && this.getLocation().equals(((ValidationMessage)o).getLocation())); - } - - @Override - public int compare(ValidationMessage x, ValidationMessage y) { - String sx = x.getLevel().getDisplay() + x.getType().getDisplay() + String.format("%06d", x.getLine()) + x.getMessage(); - String sy = y.getLevel().getDisplay() + y.getType().getDisplay() + String.format("%06d", y.getLine()) + y.getMessage(); - return sx.compareTo(sy); - } - - @Override - public int compareTo(ValidationMessage y) { - return compare(this, y); - } - - public String getLocationLink() { - return locationLink; - } - - public ValidationMessage setLocationLink(String locationLink) { - this.locationLink = locationLink; - return this; - } - - -} \ No newline at end of file + +/* + 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 java.util.Comparator; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.utilities.Utilities; + +public class ValidationMessage implements Comparator, Comparable +{ + public enum Source { + ExampleValidator, + ProfileValidator, + ResourceValidator, + InstanceValidator, + Schema, + Schematron, + Publisher, + Ontology, + ProfileComparer, + QuestionnaireResponseValidator + } + + public enum IssueSeverity { + /** + * The issue caused the action to fail, and no further checking could be performed. + */ + FATAL, + /** + * The issue is sufficiently important to cause the action to fail. + */ + ERROR, + /** + * The issue is not important enough to cause the action to fail, but may cause it to be performed suboptimally or in a way that is not as desired. + */ + WARNING, + /** + * The issue has no relation to the degree of success of the action. + */ + INFORMATION, + /** + * added to help the parsers with the generic types + */ + NULL; + public static IssueSeverity fromCode(String codeString) throws FHIRException { + if (codeString == null || "".equals(codeString)) + return null; + if ("fatal".equals(codeString)) + return FATAL; + if ("error".equals(codeString)) + return ERROR; + if ("warning".equals(codeString)) + return WARNING; + if ("information".equals(codeString)) + return INFORMATION; + else + throw new FHIRException("Unknown IssueSeverity code '"+codeString+"'"); + } + public String toCode() { + switch (this) { + case FATAL: return "fatal"; + case ERROR: return "error"; + case WARNING: return "warning"; + case INFORMATION: return "information"; + default: return "?"; + } + } + public String getSystem() { + switch (this) { + case FATAL: return "http://hl7.org/fhir/issue-severity"; + case ERROR: return "http://hl7.org/fhir/issue-severity"; + case WARNING: return "http://hl7.org/fhir/issue-severity"; + case INFORMATION: return "http://hl7.org/fhir/issue-severity"; + default: return "?"; + } + } + public String getDefinition() { + switch (this) { + case FATAL: return "The issue caused the action to fail, and no further checking could be performed."; + case ERROR: return "The issue is sufficiently important to cause the action to fail."; + case WARNING: return "The issue is not important enough to cause the action to fail, but may cause it to be performed suboptimally or in a way that is not as desired."; + case INFORMATION: return "The issue has no relation to the degree of success of the action."; + default: return "?"; + } + } + public String getDisplay() { + switch (this) { + case FATAL: return "Fatal"; + case ERROR: return "Error"; + case WARNING: return "Warning"; + case INFORMATION: return "Information"; + default: return "?"; + } + } + } + + public enum IssueType { + /** + * Content invalid against the specification or a profile. + */ + INVALID, + /** + * A structural issue in the content such as wrong namespace, or unable to parse the content completely, or invalid json syntax. + */ + STRUCTURE, + /** + * A required element is missing. + */ + REQUIRED, + /** + * An element value is invalid. + */ + VALUE, + /** + * A content validation rule failed - e.g. a schematron rule. + */ + INVARIANT, + /** + * An authentication/authorization/permissions issue of some kind. + */ + SECURITY, + /** + * The client needs to initiate an authentication process. + */ + LOGIN, + /** + * The user or system was not able to be authenticated (either there is no process, or the proferred token is unacceptable). + */ + UNKNOWN, + /** + * User session expired; a login may be required. + */ + EXPIRED, + /** + * The user does not have the rights to perform this action. + */ + FORBIDDEN, + /** + * Some information was not or may not have been returned due to business rules, consent or privacy rules, or access permission constraints. This information may be accessible through alternate processes. + */ + SUPPRESSED, + /** + * Processing issues. These are expected to be final e.g. there is no point resubmitting the same content unchanged. + */ + PROCESSING, + /** + * The resource or profile is not supported. + */ + NOTSUPPORTED, + /** + * An attempt was made to create a duplicate record. + */ + DUPLICATE, + /** + * The reference provided was not found. In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the content is not found further into the application architecture. + */ + NOTFOUND, + /** + * Provided content is too long (typically, this is a denial of service protection type of error). + */ + TOOLONG, + /** + * The code or system could not be understood, or it was not valid in the context of a particular ValueSet.code. + */ + CODEINVALID, + /** + * An extension was found that was not acceptable, could not be resolved, or a modifierExtension was not recognized. + */ + EXTENSION, + /** + * The operation was stopped to protect server resources; e.g. a request for a value set expansion on all of SNOMED CT. + */ + TOOCOSTLY, + /** + * The content/operation failed to pass some business rule, and so could not proceed. + */ + BUSINESSRULE, + /** + * Content could not be accepted because of an edit conflict (i.e. version aware updates) (In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the conflict is discovered further into the application architecture.) + */ + CONFLICT, + /** + * Not all data sources typically accessed could be reached, or responded in time, so the returned information may not be complete. + */ + INCOMPLETE, + /** + * Transient processing issues. The system receiving the error may be able to resubmit the same content once an underlying issue is resolved. + */ + TRANSIENT, + /** + * A resource/record locking failure (usually in an underlying database). + */ + LOCKERROR, + /** + * The persistent store is unavailable; e.g. the database is down for maintenance or similar action. + */ + NOSTORE, + /** + * An unexpected internal error has occurred. + */ + EXCEPTION, + /** + * An internal timeout has occurred. + */ + TIMEOUT, + /** + * The system is not prepared to handle this request due to load management. + */ + THROTTLED, + /** + * A message unrelated to the processing success of the completed operation (examples of the latter include things like reminders of password expiry, system maintenance times, etc.). + */ + INFORMATIONAL, + /** + * added to help the parsers with the generic types + */ + NULL; + public static IssueType fromCode(String codeString) throws FHIRException { + if (codeString == null || "".equals(codeString)) + return null; + if ("invalid".equals(codeString)) + return INVALID; + if ("structure".equals(codeString)) + return STRUCTURE; + if ("required".equals(codeString)) + return REQUIRED; + if ("value".equals(codeString)) + return VALUE; + if ("invariant".equals(codeString)) + return INVARIANT; + if ("security".equals(codeString)) + return SECURITY; + if ("login".equals(codeString)) + return LOGIN; + if ("unknown".equals(codeString)) + return UNKNOWN; + if ("expired".equals(codeString)) + return EXPIRED; + if ("forbidden".equals(codeString)) + return FORBIDDEN; + if ("suppressed".equals(codeString)) + return SUPPRESSED; + if ("processing".equals(codeString)) + return PROCESSING; + if ("not-supported".equals(codeString)) + return NOTSUPPORTED; + if ("duplicate".equals(codeString)) + return DUPLICATE; + if ("not-found".equals(codeString)) + return NOTFOUND; + if ("too-long".equals(codeString)) + return TOOLONG; + if ("code-invalid".equals(codeString)) + return CODEINVALID; + if ("extension".equals(codeString)) + return EXTENSION; + if ("too-costly".equals(codeString)) + return TOOCOSTLY; + if ("business-rule".equals(codeString)) + return BUSINESSRULE; + if ("conflict".equals(codeString)) + return CONFLICT; + if ("incomplete".equals(codeString)) + return INCOMPLETE; + if ("transient".equals(codeString)) + return TRANSIENT; + if ("lock-error".equals(codeString)) + return LOCKERROR; + if ("no-store".equals(codeString)) + return NOSTORE; + if ("exception".equals(codeString)) + return EXCEPTION; + if ("timeout".equals(codeString)) + return TIMEOUT; + if ("throttled".equals(codeString)) + return THROTTLED; + if ("informational".equals(codeString)) + return INFORMATIONAL; + else + throw new FHIRException("Unknown IssueType code '"+codeString+"'"); + } + public String toCode() { + switch (this) { + case INVALID: return "invalid"; + case STRUCTURE: return "structure"; + case REQUIRED: return "required"; + case VALUE: return "value"; + case INVARIANT: return "invariant"; + case SECURITY: return "security"; + case LOGIN: return "login"; + case UNKNOWN: return "unknown"; + case EXPIRED: return "expired"; + case FORBIDDEN: return "forbidden"; + case SUPPRESSED: return "suppressed"; + case PROCESSING: return "processing"; + case NOTSUPPORTED: return "not-supported"; + case DUPLICATE: return "duplicate"; + case NOTFOUND: return "not-found"; + case TOOLONG: return "too-long"; + case CODEINVALID: return "code-invalid"; + case EXTENSION: return "extension"; + case TOOCOSTLY: return "too-costly"; + case BUSINESSRULE: return "business-rule"; + case CONFLICT: return "conflict"; + case INCOMPLETE: return "incomplete"; + case TRANSIENT: return "transient"; + case LOCKERROR: return "lock-error"; + case NOSTORE: return "no-store"; + case EXCEPTION: return "exception"; + case TIMEOUT: return "timeout"; + case THROTTLED: return "throttled"; + case INFORMATIONAL: return "informational"; + default: return "?"; + } + } + public String getSystem() { + switch (this) { + case INVALID: return "http://hl7.org/fhir/issue-type"; + case STRUCTURE: return "http://hl7.org/fhir/issue-type"; + case REQUIRED: return "http://hl7.org/fhir/issue-type"; + case VALUE: return "http://hl7.org/fhir/issue-type"; + case INVARIANT: return "http://hl7.org/fhir/issue-type"; + case SECURITY: return "http://hl7.org/fhir/issue-type"; + case LOGIN: return "http://hl7.org/fhir/issue-type"; + case UNKNOWN: return "http://hl7.org/fhir/issue-type"; + case EXPIRED: return "http://hl7.org/fhir/issue-type"; + case FORBIDDEN: return "http://hl7.org/fhir/issue-type"; + case SUPPRESSED: return "http://hl7.org/fhir/issue-type"; + case PROCESSING: return "http://hl7.org/fhir/issue-type"; + case NOTSUPPORTED: return "http://hl7.org/fhir/issue-type"; + case DUPLICATE: return "http://hl7.org/fhir/issue-type"; + case NOTFOUND: return "http://hl7.org/fhir/issue-type"; + case TOOLONG: return "http://hl7.org/fhir/issue-type"; + case CODEINVALID: return "http://hl7.org/fhir/issue-type"; + case EXTENSION: return "http://hl7.org/fhir/issue-type"; + case TOOCOSTLY: return "http://hl7.org/fhir/issue-type"; + case BUSINESSRULE: return "http://hl7.org/fhir/issue-type"; + case CONFLICT: return "http://hl7.org/fhir/issue-type"; + case INCOMPLETE: return "http://hl7.org/fhir/issue-type"; + case TRANSIENT: return "http://hl7.org/fhir/issue-type"; + case LOCKERROR: return "http://hl7.org/fhir/issue-type"; + case NOSTORE: return "http://hl7.org/fhir/issue-type"; + case EXCEPTION: return "http://hl7.org/fhir/issue-type"; + case TIMEOUT: return "http://hl7.org/fhir/issue-type"; + case THROTTLED: return "http://hl7.org/fhir/issue-type"; + case INFORMATIONAL: return "http://hl7.org/fhir/issue-type"; + default: return "?"; + } + } + public String getDefinition() { + switch (this) { + case INVALID: return "Content invalid against the specification or a profile."; + case STRUCTURE: return "A structural issue in the content such as wrong namespace, or unable to parse the content completely, or invalid json syntax."; + case REQUIRED: return "A required element is missing."; + case VALUE: return "An element value is invalid."; + case INVARIANT: return "A content validation rule failed - e.g. a schematron rule."; + case SECURITY: return "An authentication/authorization/permissions issue of some kind."; + case LOGIN: return "The client needs to initiate an authentication process."; + case UNKNOWN: return "The user or system was not able to be authenticated (either there is no process, or the proferred token is unacceptable)."; + case EXPIRED: return "User session expired; a login may be required."; + case FORBIDDEN: return "The user does not have the rights to perform this action."; + case SUPPRESSED: return "Some information was not or may not have been returned due to business rules, consent or privacy rules, or access permission constraints. This information may be accessible through alternate processes."; + case PROCESSING: return "Processing issues. These are expected to be final e.g. there is no point resubmitting the same content unchanged."; + case NOTSUPPORTED: return "The resource or profile is not supported."; + case DUPLICATE: return "An attempt was made to create a duplicate record."; + case NOTFOUND: return "The reference provided was not found. In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the content is not found further into the application architecture."; + case TOOLONG: return "Provided content is too long (typically, this is a denial of service protection type of error)."; + case CODEINVALID: return "The code or system could not be understood, or it was not valid in the context of a particular ValueSet.code."; + case EXTENSION: return "An extension was found that was not acceptable, could not be resolved, or a modifierExtension was not recognized."; + case TOOCOSTLY: return "The operation was stopped to protect server resources; e.g. a request for a value set expansion on all of SNOMED CT."; + case BUSINESSRULE: return "The content/operation failed to pass some business rule, and so could not proceed."; + case CONFLICT: return "Content could not be accepted because of an edit conflict (i.e. version aware updates) (In a pure RESTful environment, this would be an HTTP 404 error, but this code may be used where the conflict is discovered further into the application architecture.)"; + case INCOMPLETE: return "Not all data sources typically accessed could be reached, or responded in time, so the returned information may not be complete."; + case TRANSIENT: return "Transient processing issues. The system receiving the error may be able to resubmit the same content once an underlying issue is resolved."; + case LOCKERROR: return "A resource/record locking failure (usually in an underlying database)."; + case NOSTORE: return "The persistent store is unavailable; e.g. the database is down for maintenance or similar action."; + case EXCEPTION: return "An unexpected internal error has occurred."; + case TIMEOUT: return "An internal timeout has occurred."; + case THROTTLED: return "The system is not prepared to handle this request due to load management."; + case INFORMATIONAL: return "A message unrelated to the processing success of the completed operation (examples of the latter include things like reminders of password expiry, system maintenance times, etc.)."; + default: return "?"; + } + } + public String getDisplay() { + switch (this) { + case INVALID: return "Invalid Content"; + case STRUCTURE: return "Structural Issue"; + case REQUIRED: return "Required element missing"; + case VALUE: return "Element value invalid"; + case INVARIANT: return "Validation rule failed"; + case SECURITY: return "Security Problem"; + case LOGIN: return "Login Required"; + case UNKNOWN: return "Unknown User"; + case EXPIRED: return "Session Expired"; + case FORBIDDEN: return "Forbidden"; + case SUPPRESSED: return "Information Suppressed"; + case PROCESSING: return "Processing Failure"; + case NOTSUPPORTED: return "Content not supported"; + case DUPLICATE: return "Duplicate"; + case NOTFOUND: return "Not Found"; + case TOOLONG: return "Content Too Long"; + case CODEINVALID: return "Invalid Code"; + case EXTENSION: return "Unacceptable Extension"; + case TOOCOSTLY: return "Operation Too Costly"; + case BUSINESSRULE: return "Business Rule Violation"; + case CONFLICT: return "Edit Version Conflict"; + case INCOMPLETE: return "Incomplete Results"; + case TRANSIENT: return "Transient Issue"; + case LOCKERROR: return "Lock Error"; + case NOSTORE: return "No Store Available"; + case EXCEPTION: return "Exception"; + case TIMEOUT: return "Timeout"; + case THROTTLED: return "Throttled"; + case INFORMATIONAL: return "Informational Note"; + default: return "?"; + } + } + } + + + private Source source; + private int line; + private int col; + private String location; + private String message; + private IssueType type; + private IssueSeverity level; + private String html; + private String locationLink; + + + /** + * Constructor + */ + public ValidationMessage() { + // nothing + } + + public ValidationMessage(Source source, IssueType type, String path, String message, IssueSeverity level) { + super(); + this.line = -1; + this.col = -1; + this.location = path; + if (message == null) + throw new Error("message is null"); + this.message = message; + this.html = Utilities.escapeXml(message); + this.level = level; + this.source = source; + this.type = type; + if (level == IssueSeverity.NULL) + determineLevel(path); + if (type == null) + throw new Error("A type must be provided"); + } + + public ValidationMessage(Source source, IssueType type, int line, int col, String path, String message, IssueSeverity level) { + super(); + this.line = line; + this.col = col; + this.location = path; + this.message = message; + this.html = Utilities.escapeXml(message); + this.level = level; + this.source = source; + this.type = type; + if (level == IssueSeverity.NULL) + determineLevel(path); + if (type == null) + throw new Error("A type must be provided"); + } + + public ValidationMessage(Source source, IssueType type, String path, String message, String html, IssueSeverity level) { + super(); + this.line = -1; + this.col = -1; + this.location = path; + if (message == null) + throw new Error("message is null"); + this.message = message; + this.html = html; + this.level = level; + this.source = source; + this.type = type; + if (level == IssueSeverity.NULL) + determineLevel(path); + if (type == null) + throw new Error("A type must be provided"); + } + + public ValidationMessage(Source source, IssueType type, int line, int col, String path, String message, String html, IssueSeverity level) { + super(); + this.line = line; + this.col = col; + this.location = path; + if (message == null) + throw new Error("message is null"); + this.message = message; + this.html = html; + this.level = level; + this.source = source; + this.type = type; + if (level == IssueSeverity.NULL) + determineLevel(path); + if (type == null) + throw new Error("A type must be provided"); + } + + public ValidationMessage(Source source, IssueType type, String message, IssueSeverity level) { + super(); + this.line = -1; + this.col = -1; + if (message == null) + throw new Error("message is null"); + this.message = message; + this.level = level; + this.source = source; + this.type = type; + if (type == null) + throw new Error("A type must be provided"); + } + + private IssueSeverity determineLevel(String path) { + if (isGrandfathered(path)) + return IssueSeverity.WARNING; + else + return IssueSeverity.ERROR; + } + + private boolean isGrandfathered(String path) { + if (path.startsWith("xds-documentmanifest.")) + return true; + if (path.startsWith("observation-device-metric-devicemetricobservation.")) + return true; + if (path.startsWith("medicationadministration-immunization-vaccine.")) + return true; + if (path.startsWith("elementdefinition-de-dataelement.")) + return true; + if (path.startsWith("dataelement-sdc-sdcelement.")) + return true; + if (path.startsWith("questionnaireresponse-sdc-structureddatacaptureanswers.")) + return true; + if (path.startsWith("valueset-sdc-structureddatacapturevalueset.")) + return true; + if (path.startsWith("dataelement-sdc-de-sdcelement.")) + return true; + if (path.startsWith("do-uslab-uslabdo.")) + return true; + if (path.startsWith(".")) + return true; + if (path.startsWith(".")) + return true; + if (path.startsWith(".")) + return true; + if (path.startsWith(".")) + return true; + + return false; + } + + public String getMessage() { + return message; + } + public ValidationMessage setMessage(String message) { + this.message = message; + return this; + } + + public IssueSeverity getLevel() { + return level; + } + public ValidationMessage setLevel(IssueSeverity level) { + this.level = level; + return this; + } + + public Source getSource() { + return source; + } + public ValidationMessage setSource(Source source) { + this.source = source; + return this; + } + + public int getLine() { + return line; + } + + public void setLine(int theLine) { + line = theLine; + } + + public int getCol() { + return col; + } + + public void setCol(int theCol) { + col = theCol; + } + + public String getLocation() { + return location; + } + public ValidationMessage setLocation(String location) { + this.location = location; + return this; + } + + public IssueType getType() { + return type; + } + + public ValidationMessage setType(IssueType type) { + this.type = type; + return this; + } + + public String summary() { + return level.toString()+" @ "+location+(line>= 0 && col >= 0 ? " (line "+Integer.toString(line)+", col"+Integer.toString(col)+"): " : ": ") +message +(source != null ? " (src = "+source+")" : ""); + } + + + public String toXML() { + return "" + Utilities.escapeXml(message) + "" + html + ""; + } + + public String getHtml() { + return html == null ? Utilities.escapeXml(message) : html; + } + + public String getDisplay() { + return level + ": " + (location.isEmpty() ? "" : (location + ": ")) + message; + } + + /** + * Returns a representation of this ValidationMessage suitable for logging. The values of + * most of the internal fields are included, so this may not be suitable for display to + * an end user. + */ + @Override + public String toString() { + ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE); + b.append("level", level); + b.append("type", type); + b.append("location", location); + b.append("message", message); + return b.build(); + } + + @Override + public boolean equals(Object o) { + return (this.getMessage() != null && this.getMessage().equals(((ValidationMessage)o).getMessage())) && (this.getLocation() != null && this.getLocation().equals(((ValidationMessage)o).getLocation())); + } + + @Override + public int compare(ValidationMessage x, ValidationMessage y) { + String sx = x.getLevel().getDisplay() + x.getType().getDisplay() + String.format("%06d", x.getLine()) + x.getMessage(); + String sy = y.getLevel().getDisplay() + y.getType().getDisplay() + String.format("%06d", y.getLine()) + y.getMessage(); + return sx.compareTo(sy); + } + + @Override + public int compareTo(ValidationMessage y) { + return compare(this, y); + } + + public String getLocationLink() { + return locationLink; + } + + public ValidationMessage setLocationLink(String locationLink) { + this.locationLink = locationLink; + return this; + } + + +} diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlComposer.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlComposer.java index 252429655b0..56410bc98af 100644 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlComposer.java +++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlComposer.java @@ -1,31 +1,31 @@ -/* -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. + +*/ package org.hl7.fhir.utilities.xhtml; /* @@ -48,322 +48,322 @@ package org.hl7.fhir.utilities.xhtml; * #L% */ - -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; -import java.io.Writer; - -import org.hl7.fhir.utilities.Utilities; -import org.hl7.fhir.utilities.xml.IXMLWriter; -import org.w3c.dom.Element; - -public class XhtmlComposer { - - public static final String XHTML_NS = "http://www.w3.org/1999/xhtml"; - private boolean pretty; - private boolean xmlOnly; - - - public boolean isPretty() { - return pretty; - } - - public XhtmlComposer setPretty(boolean pretty) { - this.pretty = pretty; - return this; - } - - public boolean isXmlOnly() { - return xmlOnly; - } - - public XhtmlComposer setXmlOnly(boolean xmlOnly) { - this.xmlOnly = xmlOnly; - return this; - } - - - private Writer dst; - - public String compose(XhtmlDocument doc) throws IOException { - StringWriter sdst = new StringWriter(); - dst = sdst; - composeDoc(doc); - return sdst.toString(); - } - - public String compose(XhtmlNode node) throws IOException { - StringWriter sdst = new StringWriter(); - dst = sdst; - writeNode("", node); - return sdst.toString(); - } - - public void compose(OutputStream stream, XhtmlDocument doc) throws IOException { - byte[] bom = new byte[] { (byte)0xEF, (byte)0xBB, (byte)0xBF }; - stream.write(bom); - dst = new OutputStreamWriter(stream, "UTF-8"); - composeDoc(doc); - dst.flush(); - } - - private void composeDoc(XhtmlDocument doc) throws IOException { - // headers.... -// dst.append("" + (isPretty() ? "\r\n" : "")); - for (XhtmlNode c : doc.getChildNodes()) - writeNode(" ", c); -// dst.append("" + (isPretty() ? "\r\n" : "")); - } - - private void writeNode(String indent, XhtmlNode node) throws IOException { - if (node.getNodeType() == NodeType.Comment) - writeComment(indent, node); - else if (node.getNodeType() == NodeType.DocType) - writeDocType(node); - else if (node.getNodeType() == NodeType.Instruction) - writeInstruction(node); - else if (node.getNodeType() == NodeType.Element) - writeElement(indent, node); - else if (node.getNodeType() == NodeType.Document) - writeDocument(indent, node); - else if (node.getNodeType() == NodeType.Text) - writeText(node); - else if (node.getNodeType() == null) - throw new IOException("Null node type"); - else - throw new IOException("Unknown node type: "+node.getNodeType().toString()); - } - - private void writeText(XhtmlNode node) throws IOException { - for (char c : node.getContent().toCharArray()) - { - if (c == '&') - dst.append("&"); - else if (c == '<') - dst.append("<"); - else if (c == '>') - dst.append(">"); - else if (c == '"') - dst.append("""); - else if (xmlOnly) { - dst.append(c); - } else { - if (c == XhtmlNode.NBSP.charAt(0)) - dst.append(" "); - else if (c == (char) 0xA7) - dst.append("§"); - else if (c == (char) 169) - dst.append("©"); - else if (c == (char) 8482) - dst.append("™"); - else if (c == (char) 956) - dst.append("μ"); - else if (c == (char) 174) - dst.append("®"); - else - dst.append(c); - } - } - } - - private void writeComment(String indent, XhtmlNode node) throws IOException { - dst.append(indent + "" + (isPretty() ? "\r\n" : "")); -} - - private void writeDocType(XhtmlNode node) throws IOException { - dst.append("\r\n"); -} - - private void writeInstruction(XhtmlNode node) throws IOException { - dst.append("\r\n"); -} - - private String escapeHtml(String s) { - if (s == null || s.equals("")) - return null; - StringBuilder b = new StringBuilder(); - for (char c : s.toCharArray()) - if (c == '<') - b.append("<"); - else if (c == '>') - b.append(">"); - else if (c == '"') - b.append("""); - else if (c == '&') - b.append("&"); - else - b.append(c); - return b.toString(); - } - - private String attributes(XhtmlNode node) { - StringBuilder s = new StringBuilder(); - for (String n : node.getAttributes().keySet()) - s.append(" " + n + "=\"" + escapeHtml(node.getAttributes().get(n)) + "\""); - return s.toString(); - } - - private void writeElement(String indent, XhtmlNode node) throws IOException { - if (!pretty) - indent = ""; - - if (node.getChildNodes().size() == 0) - dst.append(indent + "<" + node.getName() + attributes(node) + "/>" + (isPretty() ? "\r\n" : "")); - else { - boolean act = node.allChildrenAreText(); - if (act || !pretty) - dst.append(indent + "<" + node.getName() + attributes(node)+">"); - else - dst.append(indent + "<" + node.getName() + attributes(node) + ">\r\n"); - if (node.getName() == "head" && node.getElement("meta") == null) - dst.append(indent + " " + (isPretty() ? "\r\n" : "")); - - - for (XhtmlNode c : node.getChildNodes()) - writeNode(indent + " ", c); - if (act) - dst.append("" + (isPretty() ? "\r\n" : "")); - else if (node.getChildNodes().get(node.getChildNodes().size() - 1).getNodeType() == NodeType.Text) - dst.append((isPretty() ? "\r\n"+ indent : "") + "" + (isPretty() ? "\r\n" : "")); - else - dst.append(indent + "" + (isPretty() ? "\r\n" : "")); - } - } - - private void writeDocument(String indent, XhtmlNode node) throws IOException { - indent = ""; - for (XhtmlNode c : node.getChildNodes()) - writeNode(indent, c); - } - - - public void compose(IXMLWriter xml, XhtmlNode node) throws IOException { - if (node.getNodeType() == NodeType.Comment) - xml.comment(node.getContent(), isPretty()); - else if (node.getNodeType() == NodeType.Element) - composeElement(xml, node); - else if (node.getNodeType() == NodeType.Text) - xml.text(node.getContent()); - else - throw new Error("Unhandled node type: "+node.getNodeType().toString()); - } - - private void composeElement(IXMLWriter xml, XhtmlNode node) throws IOException { - for (String n : node.getAttributes().keySet()) { - if (n.equals("xmlns")) - xml.setDefaultNamespace(node.getAttributes().get(n)); - else if (n.startsWith("xmlns:")) - xml.namespace(n.substring(6), node.getAttributes().get(n)); - else - xml.attribute(n, node.getAttributes().get(n)); - } - xml.enter(XHTML_NS, node.getName()); - for (XhtmlNode n : node.getChildNodes()) - compose(xml, n); - xml.exit(XHTML_NS, node.getName()); - } - - public String composePlainText(XhtmlNode x) { - StringBuilder b = new StringBuilder(); - composePlainText(x, b, false); - return b.toString().trim(); - } - - private boolean composePlainText(XhtmlNode x, StringBuilder b, boolean lastWS) { - if (x.getNodeType() == NodeType.Text) { - String s = x.getContent(); - if (!lastWS & (s.startsWith(" ") || s.startsWith("\r") || s.startsWith("\n") || s.endsWith("\t"))) { - b.append(" "); - lastWS = true; - } - String st = s.trim().replace("\r", " ").replace("\n", " ").replace("\t", " "); - while (st.contains(" ")) - st = st.replace(" ", " "); - if (!Utilities.noString(st)) { - b.append(st); - lastWS = false; - if (!lastWS & (s.endsWith(" ") || s.endsWith("\r") || s.endsWith("\n") || s.endsWith("\t"))) { - b.append(" "); - lastWS = true; - } - } - return lastWS; - } else if (x.getNodeType() == NodeType.Element) { - if (x.getName().equals("li")) { - b.append("* "); - lastWS = true; - } - - for (XhtmlNode n : x.getChildNodes()) { - lastWS = composePlainText(n, b, lastWS); - } - if (x.getName().equals("p")) { - b.append("\r\n\r\n"); - lastWS = true; - } - if (x.getName().equals("br") || x.getName().equals("li")) { - b.append("\r\n"); - lastWS = true; - } - return lastWS; - } else - return lastWS; - } - - public void compose(Element div, XhtmlNode x) { - for (XhtmlNode child : x.getChildNodes()) { - appendChild(div, child); - } - } - - private void appendChild(Element e, XhtmlNode node) { - if (node.getNodeType() == NodeType.Comment) - e.appendChild(e.getOwnerDocument().createComment(node.getContent())); - else if (node.getNodeType() == NodeType.DocType) - throw new Error("not done yet"); - else if (node.getNodeType() == NodeType.Instruction) - e.appendChild(e.getOwnerDocument().createProcessingInstruction("", node.getContent())); - else if (node.getNodeType() == NodeType.Text) - e.appendChild(e.getOwnerDocument().createTextNode(node.getContent())); - else if (node.getNodeType() == NodeType.Element) { - Element child = e.getOwnerDocument().createElementNS(XHTML_NS, node.getName()); - e.appendChild(child); - for (XhtmlNode c : node.getChildNodes()) { - appendChild(child, c); - } - } else - throw new Error("Unknown node type: "+node.getNodeType().toString()); - } - - public void compose(OutputStream stream, XhtmlNode x) throws IOException { - byte[] bom = new byte[] { (byte)0xEF, (byte)0xBB, (byte)0xBF }; - stream.write(bom); - dst = new OutputStreamWriter(stream, "UTF-8"); - dst.append("\r\n"); - writeNode("", x); - dst.append("\r\n"); - dst.flush(); - } - - public void composeDocument(FileOutputStream f, XhtmlNode xhtml) throws IOException { - byte[] bom = new byte[] { (byte)0xEF, (byte)0xBB, (byte)0xBF }; - f.write(bom); - dst = new OutputStreamWriter(f, "UTF-8"); - writeNode("", xhtml); - dst.flush(); - dst.close(); - } - - public String composeEx(XhtmlNode node) { - try { - return compose(node); - } catch (IOException e) { - throw new Error(e); - } - } - -} + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.io.Writer; + +import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.xml.IXMLWriter; +import org.w3c.dom.Element; + +public class XhtmlComposer { + + public static final String XHTML_NS = "http://www.w3.org/1999/xhtml"; + private boolean pretty; + private boolean xmlOnly; + + + public boolean isPretty() { + return pretty; + } + + public XhtmlComposer setPretty(boolean pretty) { + this.pretty = pretty; + return this; + } + + public boolean isXmlOnly() { + return xmlOnly; + } + + public XhtmlComposer setXmlOnly(boolean xmlOnly) { + this.xmlOnly = xmlOnly; + return this; + } + + + private Writer dst; + + public String compose(XhtmlDocument doc) throws IOException { + StringWriter sdst = new StringWriter(); + dst = sdst; + composeDoc(doc); + return sdst.toString(); + } + + public String compose(XhtmlNode node) throws IOException { + StringWriter sdst = new StringWriter(); + dst = sdst; + writeNode("", node); + return sdst.toString(); + } + + public void compose(OutputStream stream, XhtmlDocument doc) throws IOException { + byte[] bom = new byte[] { (byte)0xEF, (byte)0xBB, (byte)0xBF }; + stream.write(bom); + dst = new OutputStreamWriter(stream, "UTF-8"); + composeDoc(doc); + dst.flush(); + } + + private void composeDoc(XhtmlDocument doc) throws IOException { + // headers.... +// dst.append("" + (isPretty() ? "\r\n" : "")); + for (XhtmlNode c : doc.getChildNodes()) + writeNode(" ", c); +// dst.append("" + (isPretty() ? "\r\n" : "")); + } + + private void writeNode(String indent, XhtmlNode node) throws IOException { + if (node.getNodeType() == NodeType.Comment) + writeComment(indent, node); + else if (node.getNodeType() == NodeType.DocType) + writeDocType(node); + else if (node.getNodeType() == NodeType.Instruction) + writeInstruction(node); + else if (node.getNodeType() == NodeType.Element) + writeElement(indent, node); + else if (node.getNodeType() == NodeType.Document) + writeDocument(indent, node); + else if (node.getNodeType() == NodeType.Text) + writeText(node); + else if (node.getNodeType() == null) + throw new IOException("Null node type"); + else + throw new IOException("Unknown node type: "+node.getNodeType().toString()); + } + + private void writeText(XhtmlNode node) throws IOException { + for (char c : node.getContent().toCharArray()) + { + if (c == '&') + dst.append("&"); + else if (c == '<') + dst.append("<"); + else if (c == '>') + dst.append(">"); + else if (c == '"') + dst.append("""); + else if (xmlOnly) { + dst.append(c); + } else { + if (c == XhtmlNode.NBSP.charAt(0)) + dst.append(" "); + else if (c == (char) 0xA7) + dst.append("§"); + else if (c == (char) 169) + dst.append("©"); + else if (c == (char) 8482) + dst.append("™"); + else if (c == (char) 956) + dst.append("μ"); + else if (c == (char) 174) + dst.append("®"); + else + dst.append(c); + } + } + } + + private void writeComment(String indent, XhtmlNode node) throws IOException { + dst.append(indent + "" + (isPretty() ? "\r\n" : "")); +} + + private void writeDocType(XhtmlNode node) throws IOException { + dst.append("\r\n"); +} + + private void writeInstruction(XhtmlNode node) throws IOException { + dst.append("\r\n"); +} + + private String escapeHtml(String s) { + if (s == null || s.equals("")) + return null; + StringBuilder b = new StringBuilder(); + for (char c : s.toCharArray()) + if (c == '<') + b.append("<"); + else if (c == '>') + b.append(">"); + else if (c == '"') + b.append("""); + else if (c == '&') + b.append("&"); + else + b.append(c); + return b.toString(); + } + + private String attributes(XhtmlNode node) { + StringBuilder s = new StringBuilder(); + for (String n : node.getAttributes().keySet()) + s.append(" " + n + "=\"" + escapeHtml(node.getAttributes().get(n)) + "\""); + return s.toString(); + } + + private void writeElement(String indent, XhtmlNode node) throws IOException { + if (!pretty) + indent = ""; + + if (node.getChildNodes().size() == 0) + dst.append(indent + "<" + node.getName() + attributes(node) + "/>" + (isPretty() ? "\r\n" : "")); + else { + boolean act = node.allChildrenAreText(); + if (act || !pretty) + dst.append(indent + "<" + node.getName() + attributes(node)+">"); + else + dst.append(indent + "<" + node.getName() + attributes(node) + ">\r\n"); + if (node.getName() == "head" && node.getElement("meta") == null) + dst.append(indent + " " + (isPretty() ? "\r\n" : "")); + + + for (XhtmlNode c : node.getChildNodes()) + writeNode(indent + " ", c); + if (act) + dst.append("" + (isPretty() ? "\r\n" : "")); + else if (node.getChildNodes().get(node.getChildNodes().size() - 1).getNodeType() == NodeType.Text) + dst.append((isPretty() ? "\r\n"+ indent : "") + "" + (isPretty() ? "\r\n" : "")); + else + dst.append(indent + "" + (isPretty() ? "\r\n" : "")); + } + } + + private void writeDocument(String indent, XhtmlNode node) throws IOException { + indent = ""; + for (XhtmlNode c : node.getChildNodes()) + writeNode(indent, c); + } + + + public void compose(IXMLWriter xml, XhtmlNode node) throws IOException { + if (node.getNodeType() == NodeType.Comment) + xml.comment(node.getContent(), isPretty()); + else if (node.getNodeType() == NodeType.Element) + composeElement(xml, node); + else if (node.getNodeType() == NodeType.Text) + xml.text(node.getContent()); + else + throw new Error("Unhandled node type: "+node.getNodeType().toString()); + } + + private void composeElement(IXMLWriter xml, XhtmlNode node) throws IOException { + for (String n : node.getAttributes().keySet()) { + if (n.equals("xmlns")) + xml.setDefaultNamespace(node.getAttributes().get(n)); + else if (n.startsWith("xmlns:")) + xml.namespace(n.substring(6), node.getAttributes().get(n)); + else + xml.attribute(n, node.getAttributes().get(n)); + } + xml.enter(XHTML_NS, node.getName()); + for (XhtmlNode n : node.getChildNodes()) + compose(xml, n); + xml.exit(XHTML_NS, node.getName()); + } + + public String composePlainText(XhtmlNode x) { + StringBuilder b = new StringBuilder(); + composePlainText(x, b, false); + return b.toString().trim(); + } + + private boolean composePlainText(XhtmlNode x, StringBuilder b, boolean lastWS) { + if (x.getNodeType() == NodeType.Text) { + String s = x.getContent(); + if (!lastWS & (s.startsWith(" ") || s.startsWith("\r") || s.startsWith("\n") || s.endsWith("\t"))) { + b.append(" "); + lastWS = true; + } + String st = s.trim().replace("\r", " ").replace("\n", " ").replace("\t", " "); + while (st.contains(" ")) + st = st.replace(" ", " "); + if (!Utilities.noString(st)) { + b.append(st); + lastWS = false; + if (!lastWS & (s.endsWith(" ") || s.endsWith("\r") || s.endsWith("\n") || s.endsWith("\t"))) { + b.append(" "); + lastWS = true; + } + } + return lastWS; + } else if (x.getNodeType() == NodeType.Element) { + if (x.getName().equals("li")) { + b.append("* "); + lastWS = true; + } + + for (XhtmlNode n : x.getChildNodes()) { + lastWS = composePlainText(n, b, lastWS); + } + if (x.getName().equals("p")) { + b.append("\r\n\r\n"); + lastWS = true; + } + if (x.getName().equals("br") || x.getName().equals("li")) { + b.append("\r\n"); + lastWS = true; + } + return lastWS; + } else + return lastWS; + } + + public void compose(Element div, XhtmlNode x) { + for (XhtmlNode child : x.getChildNodes()) { + appendChild(div, child); + } + } + + private void appendChild(Element e, XhtmlNode node) { + if (node.getNodeType() == NodeType.Comment) + e.appendChild(e.getOwnerDocument().createComment(node.getContent())); + else if (node.getNodeType() == NodeType.DocType) + throw new Error("not done yet"); + else if (node.getNodeType() == NodeType.Instruction) + e.appendChild(e.getOwnerDocument().createProcessingInstruction("", node.getContent())); + else if (node.getNodeType() == NodeType.Text) + e.appendChild(e.getOwnerDocument().createTextNode(node.getContent())); + else if (node.getNodeType() == NodeType.Element) { + Element child = e.getOwnerDocument().createElementNS(XHTML_NS, node.getName()); + e.appendChild(child); + for (XhtmlNode c : node.getChildNodes()) { + appendChild(child, c); + } + } else + throw new Error("Unknown node type: "+node.getNodeType().toString()); + } + + public void compose(OutputStream stream, XhtmlNode x) throws IOException { + byte[] bom = new byte[] { (byte)0xEF, (byte)0xBB, (byte)0xBF }; + stream.write(bom); + dst = new OutputStreamWriter(stream, "UTF-8"); + dst.append("\r\n"); + writeNode("", x); + dst.append("\r\n"); + dst.flush(); + } + + public void composeDocument(FileOutputStream f, XhtmlNode xhtml) throws IOException { + byte[] bom = new byte[] { (byte)0xEF, (byte)0xBB, (byte)0xBF }; + f.write(bom); + dst = new OutputStreamWriter(f, "UTF-8"); + writeNode("", xhtml); + dst.flush(); + dst.close(); + } + + public String composeEx(XhtmlNode node) { + try { + return compose(node); + } catch (IOException e) { + throw new Error(e); + } + } + +} diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/CCDAConverter.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/CCDAConverter.java index 4f3d112b04a..8234205b6e8 100644 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/CCDAConverter.java +++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/CCDAConverter.java @@ -20,1141 +20,1141 @@ package org.hl7.fhir.convertors; * #L% */ - - -/* - 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 java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import org.hl7.fhir.dstu3.context.IWorkerContext; -import org.hl7.fhir.dstu3.model.AllergyIntolerance; -import org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus; -import org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality; -import org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent; -import org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity; -import org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType; -import org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus; -import org.hl7.fhir.dstu3.model.Bundle; -import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent; -import org.hl7.fhir.dstu3.model.CodeableConcept; -import org.hl7.fhir.dstu3.model.Coding; -import org.hl7.fhir.dstu3.model.Comparison; -import org.hl7.fhir.dstu3.model.Composition; -import org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode; -import org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent; -import org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality; -import org.hl7.fhir.dstu3.model.Composition.SectionComponent; -import org.hl7.fhir.dstu3.model.ContactPoint; -import org.hl7.fhir.dstu3.model.Device; -import org.hl7.fhir.dstu3.model.DomainResource; -import org.hl7.fhir.dstu3.model.Encounter; -import org.hl7.fhir.dstu3.model.Extension; -import org.hl7.fhir.dstu3.model.Factory; -import org.hl7.fhir.dstu3.model.Identifier; -import org.hl7.fhir.dstu3.model.InstantType; -import org.hl7.fhir.dstu3.model.ListResource; -import org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent; -import org.hl7.fhir.dstu3.model.Location; -import org.hl7.fhir.dstu3.model.Meta; -import org.hl7.fhir.dstu3.model.Narrative; -import org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus; -import org.hl7.fhir.dstu3.model.Observation; -import org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent; -import org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType; -import org.hl7.fhir.dstu3.model.Observation.ObservationStatus; -import org.hl7.fhir.dstu3.model.Organization; -import org.hl7.fhir.dstu3.model.Patient; -import org.hl7.fhir.dstu3.model.Period; -import org.hl7.fhir.dstu3.model.Practitioner; -import org.hl7.fhir.dstu3.model.Procedure; -import org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent; -import org.hl7.fhir.dstu3.model.Reference; -import org.hl7.fhir.dstu3.model.ResourceFactory; -import org.hl7.fhir.dstu3.utils.NarrativeGenerator; -import org.hl7.fhir.dstu3.utils.ToolingExtensions; -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.utilities.ucum.UcumService; -import org.w3c.dom.Element; - -/** -Advance Directives Section 42348-3 : -Allergies, Adverse Reactions, Alerts Section 48765-2 : List(AlleryIntolerance) processAdverseReactionsSection -Anesthesia Section 59774-0 : -Assessment Section 51848-0 : -Assessment and Plan Section 51487-2 : -Chief Complaint Section 10154-3 : -Chief Complaint and Reason for Visit Section 46239-0 : -Complications 55109-3: -DICOM Object Catalog Section - DCM 121181 : -Discharge Diet Section 42344-2 : -Encounters Section 46240-8: -Family History Section 10157-6 : -Findings Section 18782-3 : -Functional Status Section 47420-5 : -General Status Section 10210-3 : -History of Past Illness Section 11348-0 : -History of Present Illness Section 10164-2 : -Hospital Admission Diagnosis Section 46241-6 : -Hospital Consultations Section 18841-7 : -Hospital Course Section 8648-8 : -Hospital Discharge Diagnosis Section 11535-2 : -Hospital Discharge Instructions Section : -Hospital Discharge Medications Section (entries optional) 10183-2 : -Hospital Discharge Physical Section 10184-0 : -Hospital Discharge Studies Summary Section 11493-4 : -Immunizations Section 11369-6 : -Interventions Section 62387-6 : -Medical Equipment Section 46264-8 : -Medical (General) History Section 11329-0 : -Medications Section 10160-0 : -Medications Administered Section 29549-3 : -Objective Section 61149-1 : -Operative Note Fluid Section 10216-0 : -Operative Note Surgical Procedure Section 10223-6 : -Payers Section 48768-6 : -Physical Exam Section 29545-1 : -Plan of Care Section 18776-5 : -Planned Procedure Section 59772-: -Postoperative Diagnosis Section 10218-6 : -Postprocedure Diagnosis Section 59769-0 : -Preoperative Diagnosis Section 10219-4 : -Problem Section 11450-4 : -Procedure Description Section 29554-3: -Procedure Disposition Section 59775-7 : -Procedure Estimated Blood Loss Section 59770-8 : -Procedure Findings Section 59776-5 : -Procedure Implants Section 59771-6 : -Procedure Indications Section 59768-2 : -Procedure Specimens Taken Section 59773-2 : -Procedures Section 47519-4 : List (Procedure) processProceduresSection -Reason for Referral Section 42349-1 : -Reason for Visit Section 29299-5 : -Results Section 30954-2 : -Review of Systems Section 10187-3 : -Social History Section 29762-2 : List (Observation) processSocialHistorySection -Subjective Section 61150-9: -Surgical Drains Section 11537-8 : -Vital Signs Section 8716-3 : List(Observation) processVitalSignsSection - - -MU Sections: -Allergies/Adverse Reactions -Problems -Encounters -Medications -Results -Vital Signs -Procedures -Immunizations -Reason for Referral -Hospital Discharge Instructions -Functional Status -Plan of Care -Hospital Discharge Medication -All of General Header - - * @author Grahame - * - */ -public class CCDAConverter { - - public enum SocialHistoryType { - SocialHistory, Pregnancy, SmokingStatus, TobaccoUse - - } - - - public enum ProcedureType { - Observation, Procedure, Act - - } - - - protected CDAUtilities cda; - protected Element doc; - protected Convert convert; - protected Bundle feed; - protected Composition composition; - protected Map practitionerCache = new HashMap(); - protected Integer refCounter = 0; - protected UcumService ucumSvc; - protected IWorkerContext context; - - - public CCDAConverter(UcumService ucumSvc, IWorkerContext context) { - super(); - this.ucumSvc = ucumSvc; - this.context = context; - } - - - public Bundle convert(InputStream stream) throws Exception { - - cda = new CDAUtilities(stream); - doc = cda.getElement(); - cda.checkTemplateId(doc, "2.16.840.1.113883.10.20.22.1.1"); - convert = new Convert(cda, ucumSvc, "Z"); - - // check it's a CDA/CCD - feed = new Bundle(); - feed.setMeta(new Meta().setLastUpdatedElement(InstantType.now())); - feed.setId(makeUUIDReference()); - feed.getMeta().getTag().add(new Coding()); // todo-bundle ("http://hl7.org/fhir/tag", "http://hl7.org/fhir/tag/document", "Document")); - - // process the header - makeDocument(); - composition.setSubject(Factory.makeReference(makeSubject())); - for (Element e : cda.getChildren(doc, "author")) - composition.getAuthor().add(Factory.makeReference(makeAuthor(e))); - // todo: data enterer & informant goes in provenance - composition.setCustodian(Factory.makeReference(makeOrganization( - cda.getDescendent(doc, "custodian/assignedCustodian/representedCustodianOrganization"), "Custodian"))); - // todo: informationRecipient - for (Element e : cda.getChildren(doc, "legalAuthenticator")) - composition.getAttester().add(makeAttester(e, CompositionAttestationMode.LEGAL, "Legal Authenticator")); - for (Element e : cda.getChildren(doc, "authenticator")) - composition.getAttester().add(makeAttester(e, CompositionAttestationMode.PROFESSIONAL, "Authenticator")); - - // process the contents - // we do this by section - keep the original section order - Element body = cda.getDescendent(doc, "component/structuredBody"); - processComponentSections(composition.getSection(), body); - return feed; - } - - - protected String addReference(DomainResource r, String title, String id) throws Exception { - if (r.getText() == null) - r.setText(new Narrative()); - if (r.getText().getDiv() == null) { - r.getText().setStatus(NarrativeStatus.GENERATED); -// new NarrativeGenerator("", "", context).generate(r); - } - r.setMeta(new Meta().setLastUpdatedElement(InstantType.now())); - r.setId(id); - feed.getEntry().add(new BundleEntryComponent().setResource(r)); - return id; - } - - protected void makeDocument() throws Exception { - composition = (Composition) ResourceFactory.createResource("Composition"); - addReference(composition, "Composition", makeUUIDReference()); - - Element title = cda.getChild(doc, "title"); - composition.setTitle(title.getTextContent()); - - if (cda.getChild(doc, "setId") != null) { - feed.setId(convert.makeURIfromII(cda.getChild(doc, "id"))); - composition.setIdentifier(convert.makeIdentifierFromII(cda.getChild(doc, "setId"))); - } else - composition.setIdentifier(convert.makeIdentifierFromII(cda.getChild(doc, "id"))); // well, we fall back to id - - composition.setDateElement(convert.makeDateTimeFromTS(cda.getChild(doc, "effectiveTime"))); - composition.setType(convert.makeCodeableConceptFromCD(cda.getChild(doc, "code"))); - composition.setConfidentiality(convertConfidentiality(cda.getChild(doc, "confidentialityCode"))); - if (cda.getChild(doc, "confidentialityCode") != null) - composition.setLanguage(cda.getChild(doc, "confidentialityCode").getAttribute("value")); // todo - fix streaming for this - - Element ee = cda.getChild(doc, "componentOf"); - if (ee != null) - ee = cda.getChild(ee, "encompassingEncounter"); - if (ee != null) { - Encounter visit = new Encounter(); - for (Element e : cda.getChildren(ee, "id")) - visit.getIdentifier().add(convert.makeIdentifierFromII(e)); - visit.setPeriod(convert.makePeriodFromIVL(cda.getChild(ee, "effectiveTime"))); - composition.getEvent().add(new Composition.CompositionEventComponent()); - composition.getEvent().get(0).getCode().add(convert.makeCodeableConceptFromCD(cda.getChild(ee, "code"))); - composition.getEvent().get(0).setPeriod(visit.getPeriod()); - composition.getEvent().get(0).getDetail().add(Factory.makeReference(addReference(visit, "Encounter", makeUUIDReference()))); - } - - // main todo: fill out the narrative, but before we can do that, we have to convert everything else - } - - protected DocumentConfidentiality convertConfidentiality(Element child) throws FHIRException, org.hl7.fhir.exceptions.FHIRException { - // TODO Auto-generated method stub - return DocumentConfidentiality.fromCode(child.getAttribute("code")); - } - - - protected String makeSubject() throws Exception { - Element rt = cda.getChild(doc, "recordTarget"); - Element pr = cda.getChild(rt, "patientRole"); - Element p = cda.getChild(pr, "patient"); - - Patient pat = (Patient) ResourceFactory.createResource("Patient"); - for (Element e : cda.getChildren(pr, "id")) - pat.getIdentifier().add(convert.makeIdentifierFromII(e)); - - for (Element e : cda.getChildren(pr, "addr")) - pat.getAddress().add(convert.makeAddressFromAD(e)); - for (Element e : cda.getChildren(pr, "telecom")) - pat.getTelecom().add(convert.makeContactFromTEL(e)); - for (Element e : cda.getChildren(p, "name")) - pat.getName().add(convert.makeNameFromEN(e)); - pat.setGender(convert.makeGenderFromCD(cda.getChild(p, "administrativeGenderCode"))); - pat.setBirthDateElement(convert.makeDateFromTS(cda.getChild(p, "birthTime"))); - pat.setMaritalStatus(convert.makeCodeableConceptFromCD(cda.getChild(p, "maritalStatusCode"))); - pat.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_RELIGION, convert.makeCodeableConceptFromCD(cda.getChild(p, "religiousAffiliationCode")), false)); - pat.getExtension().add(Factory.newExtension(CcdaExtensions.DAF_NAME_RACE, convert.makeCodeableConceptFromCD(cda.getChild(p, "raceCode")), false)); - pat.getExtension().add(Factory.newExtension(CcdaExtensions.DAF_NAME_ETHNICITY, convert.makeCodeableConceptFromCD(cda.getChild(p, "ethnicGroupCode")), false)); - pat.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_BIRTHPLACE, convert.makeAddressFromAD(cda.getChild(p, new String[] {"birthplace", "place", "addr"})), false)); - - Patient.ContactComponent guardian = new Patient.ContactComponent(); - pat.getContact().add(guardian); - guardian.getRelationship().add(Factory.newCodeableConcept("GUARD", "urn:oid:2.16.840.1.113883.5.110", "guardian")); - Element g = cda.getChild(p, "guardian"); - for (Element e : cda.getChildren(g, "addr")) - if (guardian.getAddress() == null) - guardian.setAddress(convert.makeAddressFromAD(e)); - for (Element e : cda.getChildren(g, "telecom")) - guardian.getTelecom().add(convert.makeContactFromTEL(e)); - g = cda.getChild(g, "guardianPerson"); - for (Element e : cda.getChildren(g, "name")) - if (guardian.getName() == null) - guardian.setName(convert.makeNameFromEN(e)); - - Element l = cda.getChild(p, "languageCommunication"); - CodeableConcept cc = new CodeableConcept(); - Coding c = new Coding(); - c.setCode(cda.getChild(l, "languageCode").getAttribute("code")); - cc.getCoding().add(c); - pat.addCommunication().setLanguage(cc); - - // todo: this got broken.... lang.setMode(convert.makeCodeableConceptFromCD(cda.getChild(l, "modeCode"))); - cc.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_LANG_PROF, convert.makeCodeableConceptFromCD(cda.getChild(l, "modeCode")), false)); - pat.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_RELIGION, convert.makeCodeableConceptFromCD(cda.getChild(p, "religiousAffiliationCode")), false)); - pat.setManagingOrganization(Factory.makeReference(makeOrganization(cda.getChild(pr, "providerOrganization"), "Provider"))); - return addReference(pat, "Subject", makeUUIDReference()); - } - - - protected String makeOrganization(Element org, String name) throws Exception { - Organization o = new Organization(); - for (Element e : cda.getChildren(org, "id")) - o.getIdentifier().add(convert.makeIdentifierFromII(e)); - for (Element e : cda.getChildren(org, "name")) - o.setName(e.getTextContent()); - for (Element e : cda.getChildren(org, "addr")) - o.getAddress().add(convert.makeAddressFromAD(e)); - for (Element e : cda.getChildren(org, "telecom")) - o.getTelecom().add(convert.makeContactFromTEL(e)); - - return addReference(o, name, makeUUIDReference()); - } - - protected String makeAuthor(Element auth) throws Exception { - Element aa = cda.getChild(auth, "assignedAuthor"); - Element ap = cda.getChild(aa, "assignedPerson"); - - Practitioner pr = (Practitioner) ResourceFactory.createResource("Practitioner"); - for (Element e : cda.getChildren(aa, "id")) - pr.getIdentifier().add(convert.makeIdentifierFromII(e)); - for (Element e : cda.getChildren(aa, "addr")) - if (pr.getAddress() == null) - pr.getAddress().add(convert.makeAddressFromAD(e)); - for (Element e : cda.getChildren(aa, "telecom")) - pr.getTelecom().add(convert.makeContactFromTEL(e)); - for (Element e : cda.getChildren(ap, "name")) - if (pr.getName() != null) - pr.addName(convert.makeNameFromEN(e)); - - return addReference(pr, "Author", makeUUIDReference()); - } - - - protected String makeUUIDReference() { - return "urn:uuid:"+UUID.randomUUID().toString().toLowerCase(); - } - - - protected CompositionAttesterComponent makeAttester(Element a1, CompositionAttestationMode mode, String title) throws Exception { - Practitioner pr = (Practitioner) ResourceFactory.createResource("Practitioner"); - Element ass = cda.getChild(a1, "assignedEntity"); - for (Element e : cda.getChildren(ass, "id")) - pr.getIdentifier().add(convert.makeIdentifierFromII(e)); - for (Element e : cda.getChildren(ass, "addr")) - if (pr.getAddress() == null) // just take the first - pr.getAddress().add(convert.makeAddressFromAD(e)); - for (Element e : cda.getChildren(ass, "telecom")) - pr.getTelecom().add(convert.makeContactFromTEL(e)); - Element ap = cda.getChild(ass, "assignedPerson"); - for (Element e : cda.getChildren(ap, "name")) - if (pr.getName() == null) // just take the first - pr.addName(convert.makeNameFromEN(e)); - - - CompositionAttesterComponent att = new CompositionAttesterComponent(); - att.addMode(mode); - att.setTimeElement(convert.makeDateTimeFromTS(cda.getChild(a1,"time"))); - att.setParty(Factory.makeReference(addReference(pr, title, makeUUIDReference()))); - return att; - } - - - protected void processComponentSections(List sections, Element container) throws Exception { - for (Element c : cda.getChildren(container, "component")) { - SectionComponent s = processSection(cda.getChild(c, "section")); - if (s != null) - sections.add(s); - } - - } - - - protected SectionComponent processSection(Element section) throws Exception { - checkNoSubject(section, "Section"); - // this we do by templateId - if (cda.hasTemplateId(section, "2.16.840.1.113883.10.20.22.2.6") || cda.hasTemplateId(section, "2.16.840.1.113883.10.20.22.2.6.1")) - return processAdverseReactionsSection(section); - else if (cda.hasTemplateId(section, "2.16.840.1.113883.10.20.22.2.7") || cda.hasTemplateId(section, "2.16.840.1.113883.10.20.22.2.7.1")) - return processProceduresSection(section); - else if (cda.hasTemplateId(section, "2.16.840.1.113883.10.20.22.2.17")) - return processSocialHistorySection(section); - else if (cda.hasTemplateId(section, "2.16.840.1.113883.10.20.22.2.4") || cda.hasTemplateId(section, "2.16.840.1.113883.10.20.22.2.4.1")) - return processVitalSignsSection(section); - else - // todo: error? - return null; - } - - - protected void checkNoSubject(Element act, String path) throws Exception { - if (cda.getChild(act, "subject") != null) - throw new Exception("The conversion program cannot accept a nullFlavor at the location "+path); - } - - - protected SectionComponent processProceduresSection(Element section) throws Exception { - ListResource list = new ListResource(); - for (Element entry : cda.getChildren(section, "entry")) { - Element procedure = cda.getlastChild(entry); - - if (cda.hasTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.14")) { - processProcedure(list, procedure, ProcedureType.Procedure); - } else if (cda.hasTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.13")) { - processProcedure(list, procedure, ProcedureType.Observation); - } else if (cda.hasTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.12")) { - processProcedure(list, procedure, ProcedureType.Act); - } else - throw new Exception("Unhandled Section template ids: "+cda.showTemplateIds(procedure)); - } - - // todo: text - SectionComponent s = new Composition.SectionComponent(); - s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code"))); - // todo: check subject - s.addEntry(Factory.makeReference(addReference(list, "Procedures", makeUUIDReference()))); - return s; - - } - - protected void processProcedure(ListResource list, Element procedure, ProcedureType type) throws Exception { - switch (type) { - case Procedure : - cda.checkTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.14"); - break; - case Observation: - cda.checkTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.13"); - break; - case Act: - cda.checkTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.12"); - } - checkNoNegationOrNullFlavor(procedure, "Procedure ("+type.toString()+")"); - checkNoSubject(procedure, "Procedure ("+type.toString()+")"); - - Procedure p = new Procedure(); - addItemToList(list, p); - - // moodCode is either INT or EVN. INT is not handled yet. INT is deprecated anyway - if (procedure.getAttribute("moodCode").equals("INT")) - p.getModifierExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-planned", Factory.newBoolean(true), false)); - - // SHALL contain at least one [1..*] id (CONF:7655). - for (Element e : cda.getChildren(procedure, "id")) - p.getIdentifier().add(convert.makeIdentifierFromII(e)); - - // SHALL contain exactly one [1..1] code (CONF:7656). - // This code @code in a procedure activity SHOULD be selected from LOINC or SNOMED CT and MAY be selected from CPT-4, ICD9 Procedures, ICD10 Procedures - p.setCode(convert.makeCodeableConceptFromCD(cda.getChild(procedure, "code"))); - - // SHALL contain exactly one [1..1] statusCode/@code, which SHALL be selected from ValueSet 2.16.840.1.113883.11.20.9.22 ProcedureAct - // completed | active | aborted | cancelled - not in FHIR - p.getModifierExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-status", Factory.newCode(cda.getStatus(procedure)), false)); - - // SHOULD contain zero or one [0..1] effectiveTime (CONF:7662). - p.setPerformed(convert.makePeriodFromIVL(cda.getChild(procedure, "effectiveTime"))); - - // MAY contain zero or one [0..1] priorityCode/@code, which SHALL be selected from ValueSet 2.16.840.1.113883.1.11.16866 ActPriority DYNAMIC (CONF:7668) - p.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-priority", convert.makeCodeableConceptFromCD(cda.getChild(procedure, "priorityCode")), false)); - - // MAY contain zero or one [0..1] methodCode (CONF:7670). - p.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-method", convert.makeCodeableConceptFromCD(cda.getChild(procedure, "methodCode")), false)); - - if (type == ProcedureType.Observation) { - // for Procedure-Observation: - // 9. SHALL contain exactly one [1..1] value (CONF:16846). - // don't know what this is. It's not the actual result of the procedure (that goes in results "This section records ... procedure observations"), and there seems to be no value. The example as which is not valid - // so we ignore this for now - } - - // SHOULD contain zero or more [0..*] targetSiteCode/@code, which SHALL be selected from ValueSet 2.16.840.1.113883.3.88.12.3221.8.9 Body site DYNAMIC (CONF:7683). - for (Element e : cda.getChildren(procedure, "targetSiteCode")) - p.addBodySite(convert.makeCodeableConceptFromCD(e)); - - // MAY contain zero or more [0..*] specimen (CONF:7697). - // todo: add these as extensions when specimens are done. - - // SHOULD contain zero or more [0..*] performer (CONF:7718) such that it - for (Element e : cda.getChildren(procedure, "performer")) { - ProcedurePerformerComponent pp = new ProcedurePerformerComponent(); - p.getPerformer().add(pp); - pp.setActor(makeReferenceToPractitionerForAssignedEntity(e, p)); - } - - for (Element participant : cda.getChildren(procedure, "participant")) { - Element participantRole = cda.getlastChild(participant); - if (type == ProcedureType.Procedure && cda.hasTemplateId(participantRole, "2.16.840.1.113883.10.20.22.4.37")) { - // MAY contain zero or more [0..*] participant (CONF:7751) such that it SHALL contain exactly one [1..1] @typeCode="DEV" Device - // implanted devices - p.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/implanted-devices", Factory.makeReference(processDevice(participantRole, p)), false)); - } else if (cda.hasTemplateId(participantRole, "2.16.840.1.113883.10.20.22.4.32")) { - // MAY contain zero or more [0..*] participant (CONF:7765) such that it SHALL contain exactly one [1..1] Service Delivery Location (templateId:2.16.840.1.113883.10.20.22.4.32) (CONF:7767) - p.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/location", Factory.makeReference(processSDLocation(participantRole, p)), false)); - } - } - - for (Element e : cda.getChildren(procedure, "entryRelationship")) { - Element a /* act*/ = cda.getlastChild(e); - if (a.getLocalName().equals("encounter")) { - // MAY contain zero or more [0..*] entryRelationship (CONF:7768) such that it SHALL contain exactly one encounter which SHALL contain exactly one [1..1] id (CONF:7773). - // todo - and process as a full encounter while we're at it - } else if (cda.hasTemplateId(a, "2.16.840.1.113883.10.20.22.4.20")) { - // MAY contain zero or one [0..1] entryRelationship (CONF:7775) such that it SHALL contain exactly one [1..1] Instructions (templateId:2.16.840.1.113883.10.20.22.4.20) (CONF:7778). - // had code for type, plus text for instructions - Extension n = Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-instructions", null, true); - n.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-instructions-type", convert.makeCodeableConceptFromCD(cda.getChild(a, "code")), false)); - n.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-instructions-text", convert.makeStringFromED(cda.getChild(a, "text")), false)); - p.getExtension().add(n); - } else if (cda.hasTemplateId(a, "2.16.840.1.113883.10.20.22.4.19")) { - // MAY contain zero or more [0..*] entryRelationship (CONF:7779) such that it SHALL contain exactly one [1..1] Indication (templateId:2.16.840.1.113883.10.20.22.4.19) (CONF:7781). - p.addReasonCode(processIndication(a)); - } else if (cda.hasTemplateId(cda.getlastChild(e), "2.16.840.1.113883.10.20.22.4.16")) { - // MAY contain zero or one [0..1] entryRelationship (CONF:7886) such that it SHALL contain exactly one [1..1] Medication Activity (templateId:2.16.840.1.113883.10.20.22.4.16) (CONF:7888). - // todo - } - } - } - - - protected String processSDLocation(Element participantRole, DomainResource r) throws Exception { - Location l = new Location(); - l.setType(convert.makeCodeableConceptFromCD(cda.getChild(participantRole, "code"))); - for (Element id : cda.getChildren(participantRole, "id")) { - if (l.getIdentifier() == null) - l.getIdentifier().add(convert.makeIdentifierFromII(id)); - } - for (Element addr : cda.getChildren(participantRole, "addr")) { - if (l.getAddress() == null) - l.setAddress(convert.makeAddressFromAD(addr)); - } - - for (Element telecom : cda.getChildren(participantRole, "telecom")) { - l.getTelecom().add(convert.makeContactFromTEL(telecom)); - } - - - Element place = cda.getChild(participantRole, "playingDevice"); - if (cda.getChild(place, "name") != null) - l.setName(cda.getChild(place, "name").getTextContent()); - - String id = nextRef(); - l.setId(id); - r.getContained().add(l); - return "#"+id; - } - - - protected String processDevice(Element participantRole, DomainResource r) throws Exception { - Device d = new Device(); - for (Element id : cda.getChildren(participantRole, "id")) { - // todo: check for UDIs, how? - d.getIdentifier().add(convert.makeIdentifierFromII(id)); - } - Element device = cda.getChild(participantRole, "playingDevice"); - // todo: if (cda.getChild(device, "code") != null) - d.setType(convert.makeCodeableConceptFromCD(cda.getChild(device, "code"))); - - // CCDA has an id - this is manufacturer? We just call it the name, but what to do about this? - Element org = cda.getChild(participantRole, "scopingEntity"); - d.setManufacturer(convert.makeURIfromII(cda.getChild(org, "id"))); - - String id = nextRef(); - d.setId(id); - r.getContained().add(d); - return "#"+id; - } - - - protected CodeableConcept processIndication(Element obs) throws Exception { - Element v = cda.getChild(obs, "value"); - if (v == null) { - // have to find it by ID - Element o = cda.getById(cda.getChild(obs, "id"), "value"); - if (o != null) - v = cda.getChild(obs, "value"); - } - if (v != null) - return convert.makeCodeableConceptFromCD(v); - else - return null; - } - - protected Reference makeReferenceToPractitionerForAssignedEntity(Element assignedEntity, DomainResource r) throws Exception { - - Reference ref = null; - // do we have this by id? - String uri = getIdForEntity(assignedEntity); - Practitioner p = null; - if (uri != null) { - ref = Factory.makeReference(uri); - p = practitionerCache.get(uri); - } - if (p == null) { - p = new Practitioner(); - if (uri == null) { - // make a contained practitioner - String n = nextRef(); - p.setId(n); - r.getContained().add(p); - ref = Factory.makeReference("#"+n); - } else { - // add this to feed - ref = Factory.makeReference(addReference(p, "Practitioner", uri)); - } - } - // ref and p are both sorted. now we fill out p as much as we can (remembering it might already be populated) -// p.addRole().setCode(convert.makeCodeableConceptFromCD(cda.getChild(assignedEntity, "code"))); - for (Element e : cda.getChildren(assignedEntity, "id")) - addToIdList(p.getIdentifier(), convert.makeIdentifierFromII(e)); - for (Element e : cda.getChildren(assignedEntity, "addr")) - if (p.getAddress() == null) - p.getAddress().add(convert.makeAddressFromAD(e)); - for (Element e : cda.getChildren(assignedEntity, "telecom")) - addToContactList(p.getTelecom(), convert.makeContactFromTEL(e)); - for (Element e : cda.getChildren(cda.getChild(assignedEntity, "assignedPerson"), "name")) - if (p.getName() == null) - p.addName(convert.makeNameFromEN(e)); - // todo: - // representedOrganization - return ref; - } - - - protected void addToContactList(List list, ContactPoint c) throws Exception { - for (ContactPoint item : list) { - if (Comparison.matches(item, c, null)) - Comparison.merge(item, c); - } - list.add(c); - } - - - protected void addToIdList(List list, Identifier id) throws Exception { - for (Identifier item : list) { - if (Comparison.matches(item, id, null)) - Comparison.merge(item, id); - } - list.add(id); - } - - - protected void addToCodeableList(List list, CodeableConcept code) throws Exception { - for (CodeableConcept item : list) { - if (Comparison.matches(item, code, null)) - Comparison.merge(item, code); - } - list.add(code); - } - - - protected String getIdForEntity(Element assignedEntity) throws Exception { - Element id = cda.getChild(assignedEntity, "id"); // for now, just grab the first - if (id == null) - return null; - if (id.getAttribute("extension") == null) { - if (convert.isGuid(id.getAttribute("root"))) - return "urn:uuid:"+id.getAttribute("root"); - else - return "urn:oid:"+id.getAttribute("root"); - } else - return "ii:"+id.getAttribute("root")+"::"+id.getAttribute("extension"); - } - - - protected SectionComponent processAdverseReactionsSection(Element section) throws Exception { - ListResource list = new ListResource(); - for (Element entry : cda.getChildren(section, "entry")) { - Element concern = cda.getChild(entry, "act"); - if (cda.hasTemplateId(concern, "2.16.840.1.113883.10.20.22.4.30")) { - processAllergyProblemAct(list, concern); - } else - throw new Exception("Unhandled Section template ids: "+cda.showTemplateIds(concern)); - } - - - // todo: text - SectionComponent s = new Composition.SectionComponent(); - s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code"))); - // todo: check subject - s.addEntry(Factory.makeReference(addReference(list, "Allergies, Adverse Reactions, Alerts", makeUUIDReference()))); - return s; - } - - - protected void processAllergyProblemAct(ListResource list, Element concern) throws Exception { - cda.checkTemplateId(concern, "2.16.840.1.113883.10.20.22.4.30"); - // Allergy Problem Act - this is a concern - we treat the concern as information about it's place in the list - checkNoNegationOrNullFlavor(concern, "Allergy Problem Act"); - checkNoSubject(concern, "Allergy Problem Act"); - - // SHALL contain at least one [1..*] entryRelationship (CONF:7509) such that it - // SHALL contain exactly one [1..1] Allergy - intolerance Observation - for (Element entry : cda.getChildren(concern, "entryRelationship")) { - Element obs = cda.getChild(entry, "observation"); - cda.checkTemplateId(obs, "2.16.840.1.113883.10.20.22.4.7"); - checkNoNegationOrNullFlavor(obs, "Allergy - intolerance Observation"); - checkNoSubject(obs, "Allergy Problem Act"); - - AllergyIntolerance ai = new AllergyIntolerance(); - ListEntryComponent item = addItemToList(list, ai); - - // this first section comes from the concern, and is processed once for each observation in the concern group - // SHALL contain at least one [1..*] id (CONF:7472). - for (Element e : cda.getChildren(concern, "id")) - ai.getIdentifier().add(convert.makeIdentifierFromII(e)); - - // SHALL contain exactly one [1..1] statusCode, which SHALL be selected from ValueSet 2.16.840.1.113883.3.88.12.80.68 HITSPProblemStatus DYNAMIC (CONF:7485) - // the status code is about the concern (e.g. the entry in the list) - // possible values: active, suspended, aborted, completed, with an effective time - String s = cda.getStatus(concern); - item.setFlag(Factory.newCodeableConcept(s, "http://hl7.org/fhir/v3/ActStatus", s)); - if (s.equals("aborted")) // only on this condition? - item.setDeleted(true); - - // SHALL contain exactly one [1..1] effectiveTime (CONF:7498) - Period p = convert.makePeriodFromIVL(cda.getChild(concern, "effectiveTime")); - item.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/list-period", p, false)); - if (p.getEnd() != null) - item.setDate(p.getEnd()); - else - item.setDate(p.getStart()); - - //ok, now process the actual observation - // SHALL contain at least one [1..*] id (CONF:7382) - for (Element e : cda.getChildren(obs, "id")) - ai.getIdentifier().add(convert.makeIdentifierFromII(e)); - - - // SHALL contain exactly one [1..1] effectiveTime (CONF:7387) - ai.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/allergyintolerance-period", convert.makePeriodFromIVL(cda.getChild(obs, "effectiveTime")), false)); - - // SHALL contain exactly one [1..1] value with @xsi:type="CD" (CONF:7390) - CodeableConcept type = convert.makeCodeableConceptFromCD(cda.getChild(obs, "value")); - // This value SHALL contain @code, which SHALL be selected from ValueSet 2.16.840.1.113883.3.88.12.3221.6.2 Allergy/Adverse Event Type - String ss = type.getCoding().get(0).getCode(); - if (ss.equals("416098002") || ss.equals("414285001")) - ai.setType(AllergyIntoleranceType.ALLERGY); - else if (ss.equals("59037007") || ss.equals("235719002")) - ai.setType(AllergyIntoleranceType.INTOLERANCE); - ai.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/allergy-category", type, false)); - - // SHOULD contain zero or one [0..1] participant (CONF:7402) such that it - // ......This playingEntity SHALL contain exactly one [1..1] code - ai.setCode(convert.makeCodeableConceptFromCD(cda.getDescendent(obs, "participant/participantRole/playingEntity/code"))); - - // MAY contain zero or one [0..1] entryRelationship (CONF:7440) such that it SHALL contain exactly one [1..1] Alert Status Observation - // SHOULD contain zero or more [0..*] entryRelationship (CONF:7447) such that it SHALL contain exactly one [1..1] Reaction Observation (templateId:2.16.840.1.113883.10.20.22.4.9) (CONF:7450). - for (Element e : cda.getChildren(obs, "entryRelationship")) { - Element child = cda.getChild(e, "observation"); - if (cda.hasTemplateId(child, "2.16.840.1.113883.10.20.22.4.28") && ai.getClinicalStatus() == null) { - // SHALL contain exactly one [1..1] value with @xsi:type="CE", where the @code SHALL be selected from ValueSet Problem Status Value Set 2.16.840.1.113883.3.88.12.80.68 DYNAMIC (CONF:7322). - // 55561003 SNOMED CT Active - // 73425007 SNOMED CT Inactive - // 413322009 SNOMED CT Resolved - String sc = cda.getChild(child, "value").getAttribute("code"); - if (sc.equals("55561003")) { - ai.setClinicalStatus(AllergyIntoleranceClinicalStatus.ACTIVE); - ai.setVerificationStatus(AllergyIntoleranceVerificationStatus.CONFIRMED); - } else - ai.setClinicalStatus(AllergyIntoleranceClinicalStatus.RESOLVED); - } else if (cda.hasTemplateId(child, "2.16.840.1.113883.10.20.22.4.9")) { - ai.getReaction().add(processAdverseReactionObservation(child)); - } - } - - // SHOULD contain zero or one [0..1] entryRelationship (CONF:9961) such that it SHALL contain exactly one [1..1] Severity Observation (templateId:2.16.840.1.113883.10.20.22.4.8) (CONF:9963). - ai.setCriticality(readCriticality(cda.getSeverity(obs))); - } - } - - - // this is going to be a contained resource, so we aren't going to generate any narrative - protected AllergyIntoleranceReactionComponent processAdverseReactionObservation(Element reaction) throws Exception { - checkNoNegationOrNullFlavor(reaction, "Adverse Reaction Observation"); - checkNoSubject(reaction, "Adverse Reaction Observation"); - - // This clinical statement represents an undesired symptom, finding, etc., due to an administered or exposed substance. A reaction can be defined with respect to its severity, and can have been treated by one or more interventions. - AllergyIntoleranceReactionComponent ar = new AllergyIntoleranceReactionComponent(); - - // SHALL contain exactly one [1..1] id (CONF:7329). - for (Element e : cda.getChildren(reaction, "id")) - ToolingExtensions.addIdentifier(ar, convert.makeIdentifierFromII(e)); - - // SHALL contain exactly one [1..1] code (CONF:7327). The value set for this code element has not been specified. - // todo: what the heck is this? - - // SHOULD contain zero or one [0..1] text (CONF:7330). - // todo: so what is this? how can we know whether to ignore it? - - // 8. SHOULD contain zero or one [0..1] effectiveTime (CONF:7332). - // a. This effectiveTime SHOULD contain zero or one [0..1] low (CONF:7333). - // b. This effectiveTime SHOULD contain zero or one [0..1] high (CONF:7334). - // !this is a problem because FHIR just has a date, not a period. - ar.setOnsetElement(convert.makeDateTimeFromIVL(cda.getChild(reaction, "effectiveTime"))); - - // SHALL contain exactly one [1..1] value with @xsi:type="CD", where the @code SHALL be selected from ValueSet 2.16.840.1.113883.3.88.12.3221.7.4 Problem DYNAMIC (CONF:7335). - ar.getManifestation().add(convert.makeCodeableConceptFromCD(cda.getChild(reaction, "value"))); - - // SHOULD contain zero or one [0..1] entryRelationship (CONF:7580) such that it SHALL contain exactly one [1..1] Severity Observation (templateId:2.16.840.1.113883.10.20.22.4.8) (CONF:7582). - ar.setSeverity(readSeverity(cda.getSeverity(reaction))); - - // MAY contain zero or more [0..*] entryRelationship (CONF:7337) such that it SHALL contain exactly one [1..1] Procedure Activity Procedure (templateId:2.16.840.1.113883.10.20.22.4.14) (CONF:7339). - // i. This procedure activity is intended to contain information about procedures that were performed in response to an allergy reaction - // todo: process these into an procedure and add as an extension - - // MAY contain zero or more [0..*] entryRelationship (CONF:7340) such that it SHALL contain exactly one [1..1] Medication Activity (templateId:2.16.840.1.113883.10.20.22.4.16) (CONF:7342). - // i. This medication activity is intended to contain information about medications that were administered in response to an allergy reaction. (CONF:7584). - // todo: process these into an medication statement and add as an extension - - return ar; - } - - - protected SectionComponent processSocialHistorySection(Element section) throws Exception { - ListResource list = new ListResource(); - for (Element entry : cda.getChildren(section, "entry")) { - Element observation = cda.getlastChild(entry); - - if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.22.4.38")) { - processSocialObservation(list, observation, SocialHistoryType.SocialHistory); - } else if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.15.3.8")) { - processSocialObservation(list, observation, SocialHistoryType.Pregnancy); - } else if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.22.4.78")) { - processSocialObservation(list, observation, SocialHistoryType.SmokingStatus); - } else if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.22.4.85")) { - processSocialObservation(list, observation, SocialHistoryType.TobaccoUse); - } else - throw new Exception("Unhandled Section template ids: "+cda.showTemplateIds(observation)); - } - - // todo: text - SectionComponent s = new Composition.SectionComponent(); - s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code"))); - // todo: check subject - s.addEntry(Factory.makeReference(addReference(list, "Procedures", makeUUIDReference()))); - return s; - - } - - - - protected void processSocialObservation(ListResource list, Element so, SocialHistoryType type) throws Exception { - Observation obs = new Observation(); - addItemToList(list, obs); - - switch (type) { - case SocialHistory : - cda.checkTemplateId(so, "2.16.840.1.113883.10.20.22.4.38"); - // SHALL contain exactly one [1..1] code (CONF:8558/). - obs.setCode(convert.makeCodeableConceptFromCD(cda.getChild(so, "code"))); - break; - case Pregnancy: - cda.checkTemplateId(so, "2.16.840.1.113883.10.20.15.3.8"); - // SHALL contain exactly one [1..1] code (CONF:8558/), which SHALL be an assertion - obs.setCode(Factory.newCodeableConcept("11449-6", "http://loinc.org", "Pregnancy Status")); - break; - case SmokingStatus: - cda.checkTemplateId(so, "2.16.840.1.113883.10.20.22.4.78"); - // SHALL contain exactly one [1..1] code (CONF:8558/), which SHALL be an assertion - obs.setCode(Factory.newCodeableConcept("72166-2", "http://loinc.org", "Tobacco Smoking Status")); - break; - case TobaccoUse: - cda.checkTemplateId(so, "2.16.840.1.113883.10.20.22.4.12"); - // SHALL contain exactly one [1..1] code (CONF:8558/), which SHALL be an assertion - obs.setCode(Factory.newCodeableConcept("11367-0", "http://loinc.org", "History of Tobacco Use")); - } - - // SHALL contain at least one [1..*] id (8551). - for (Element e : cda.getChildren(so, "id")) - obs.getIdentifier().add(convert.makeIdentifierFromII(e)); - - - // SHALL contain exactly one [1..1] statusCode (CONF:8553/455/14809). - // a. This statusCode SHALL contain exactly one [1..1] @code="completed" Completed (CodeSystem: ActStatus 2.16.840.1.113883.5.14 STATIC) (CONF:19117). - obs.setStatus(ObservationStatus.FINAL); - - // SHOULD contain zero or one [0..1] effectiveTime (CONF:2018/14814). - // for smoking status/tobacco: low only. in R2, this is just value. So we treat low only as just a value - Element et = cda.getChild(so, "effectiveTime"); - if (et != null) { - if (cda.getChild(et, "low") != null) - obs.setEffective(convert.makeDateTimeFromTS(cda.getChild(et, "low"))); - else - obs.setEffective(convert.makeDateTimeFromIVL(et)); - } - - // SHOULD contain zero or one [0..1] value (CONF:8559). - // a. Observation/value can be any data type. - for (Element e : cda.getChildren(so, "value")) - if (obs.getValue() == null) { // only one in FHIR - // special case for pregnancy: - if (type == SocialHistoryType.Pregnancy && "true".equals(e.getAttribute("negationInd"))) { - obs.setValue(Factory.newCodeableConcept("60001007", "http://snomed.info/sct", "Not pregnant")); - } else { - // negationInd is not described. but it might well be used. For now, we blow up - checkNoNegation(so, "Social Observation ("+type.toString()+")"); - - if (so.hasAttribute("nullFlavor")) - obs.setValue(convert.makeCodeableConceptFromNullFlavor(so.getAttribute("nullFlavor"))); - else if (e.hasAttribute("nullFlavor") && !"OTH".equals(e.getAttribute("nullFlavor"))) - obs.setValue(convert.makeCodeableConceptFromNullFlavor(e.getAttribute("nullFlavor"))); - else - obs.setValue(convert.makeTypeFromANY(e)); - } - } else - throw new Exception("too many values on Social Observation"); - - if (type == SocialHistoryType.Pregnancy) { - for (Element e : cda.getChildren(so, "entyRelationship")) { - Element dd = cda.getChild(e, "observation"); - checkNoNegationOrNullFlavor(dd, "Estimated Date of Delivery"); - // MAY contain zero or one [0..1] entryRelationship (CONF:458) such that it - // SHALL contain exactly one [1..1] @typeCode="REFR" Refers to (CodeSystem: HL7ActRelationshipType 2.16.840.1.113883.5.1002 STATIC) (CONF:459). - // SHALL contain exactly one [1..1] Estimated Date of Delivery (templateId:2.16.840.1.113883.10.20.15.3.1) (CONF:15584). - Observation co = new Observation(); - String id = nextRef(); - co.setId(id); - obs.getContained().add(co); - ObservationRelatedComponent or = new ObservationRelatedComponent(); - obs.getRelated().add(or); - or.setType(ObservationRelationshipType.HASMEMBER); - or.setTarget(Factory.makeReference("#"+id)); - co.setCode(Factory.newCodeableConcept("11778-8", "http://loinc.org", "Delivery date Estimated")); - co.setValue(convert.makeDateTimeFromTS(cda.getChild(dd, "value"))); // not legal, see gForge http://gforge.hl7.org/gf/project/fhir/tracker/?action=TrackerItemEdit&tracker_item_id=3125&start=0 - } - } - } - - - protected void checkNoNegation(Element act, String path) throws Exception { - if ("true".equals(act.getAttribute("negationInd"))) - throw new Exception("The conversion program cannot accept a negationInd at the location "+path); - } - - protected void checkNoNegationOrNullFlavor(Element act, String path) throws Exception { - if (act.hasAttribute("nullFlavor")) - throw new Exception("The conversion program cannot accept a nullFlavor at the location "+path); - if ("true".equals(act.getAttribute("negationInd"))) - throw new Exception("The conversion program cannot accept a negationInd at the location "+path); - } - - - protected ListEntryComponent addItemToList(ListResource list, DomainResource ai) - throws Exception { - list.getContained().add(ai); - String n = nextRef(); - ai.setId(n); - ListEntryComponent item = new ListResource.ListEntryComponent(); - list.getEntry().add(item); - item.setItem(Factory.makeReference("#"+n)); - return item; - } - - - protected String nextRef() { - refCounter++; - String n = refCounter.toString(); - return n; - } - - protected AllergyIntoleranceCriticality readCriticality(String severity) { - if ("255604002".equals(severity)) // Mild - return AllergyIntoleranceCriticality.LOW; - if ("371923003".equals(severity)) // Mild to moderate - return AllergyIntoleranceCriticality.LOW; - if ("6736007".equals(severity)) // Moderate - return AllergyIntoleranceCriticality.LOW; - if ("371924009".equals(severity)) // Moderate to severe - return AllergyIntoleranceCriticality.HIGH; - if ("24484000".equals(severity)) // Severe - return AllergyIntoleranceCriticality.HIGH; - if ("399166001".equals(severity)) // Fatal - return AllergyIntoleranceCriticality.HIGH; - return null; - } - - - protected AllergyIntoleranceSeverity readSeverity(String severity) { - if ("255604002".equals(severity)) // Mild - return AllergyIntoleranceSeverity.MILD; - if ("371923003".equals(severity)) // Mild to moderate - return AllergyIntoleranceSeverity.MODERATE; - if ("6736007".equals(severity)) // Moderate - return AllergyIntoleranceSeverity.MODERATE; - if ("371924009".equals(severity)) // Moderate to severe - return AllergyIntoleranceSeverity.SEVERE; - if ("24484000".equals(severity)) // Severe - return AllergyIntoleranceSeverity.SEVERE; - if ("399166001".equals(severity)) // Fatal - return AllergyIntoleranceSeverity.SEVERE; - return null; - } - - - protected SectionComponent processVitalSignsSection(Element section) throws Exception { - ListResource list = new ListResource(); - for (Element entry : cda.getChildren(section, "entry")) { - Element organizer = cda.getlastChild(entry); - - if (cda.hasTemplateId(organizer, "2.16.840.1.113883.10.20.22.4.26")) { - processVitalSignsOrganizer(list, organizer); - } else - throw new Exception("Unhandled Section template ids: "+cda.showTemplateIds(organizer)); - } - - // todo: text - SectionComponent s = new Composition.SectionComponent(); - s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code"))); - // todo: check subject - s.addEntry(Factory.makeReference(addReference(list, "Vital Signs", makeUUIDReference()))); - return s; - - } - - protected void processVitalSignsOrganizer(ListResource list, Element organizer) throws Exception { - - cda.checkTemplateId(organizer, "2.16.840.1.113883.10.20.22.4.26"); - checkNoNegationOrNullFlavor(organizer, "Vital Signs Organizer"); - checkNoSubject(organizer, "Vital Signs Organizer"); - // moodCode is EVN. - - Observation obs = new Observation(); - addItemToList(list, obs); - - // SHALL contain at least one [1..*] id (CONF:7282). - for (Element e : cda.getChildren(organizer, "id")) - obs.getIdentifier().add(convert.makeIdentifierFromII(e)); - - // SHALL contain exactly one [1..1] code (CONF:19176). - // This code SHALL contain exactly one [1..1] @code="46680005" Vital signs (CodeSystem: SNOMED-CT 2.16.840.1.113883.6.96 STATIC) (CONF:19177). - obs.setCode(convert.makeCodeableConceptFromCD(cda.getChild(organizer, "code"))); - - - // SHALL contain exactly one [1..1] effectiveTime (CONF:7288). - obs.setEffective(convert.makeMatchingTypeFromIVL(cda.getChild(organizer, "effectiveTime"))); - - // SHALL contain at least one [1..*] component (CONF:7285) such that it - // SHALL contain exactly one [1..1] Vital Sign Observation (templateId:2.16.840.1.113883.10.20.22.4.27) (CONF:15946). - for (Element e : cda.getChildren(organizer, "component")){ - ObservationRelatedComponent ro = new ObservationRelatedComponent(); - ro.setType(ObservationRelationshipType.HASMEMBER); - ro.setTarget(Factory.makeReference("#"+processVitalSignsObservation(e, list))); - } - } - - - protected String processVitalSignsObservation(Element comp, ListResource list) throws Exception { - Element observation = cda.getChild(comp, "observation"); - cda.checkTemplateId(observation, "2.16.840.1.113883.10.20.22.4.27"); - checkNoNegationOrNullFlavor(observation, "Vital Signs Observation"); - checkNoSubject(observation, "Vital Signs Observation"); - - Observation obs = new Observation(); - - // SHALL contain at least one [1..*] id (CONF:7300). - for (Element e : cda.getChildren(observation, "id")) - obs.getIdentifier().add(convert.makeIdentifierFromII(e)); - - // SHALL contain exactly one [1..1] code, which SHOULD be selected from ValueSet Vital Sign Result Value Set 2.16.840.1.113883.3.88.12.80.62 DYNAMIC (CONF:7301). - obs.setCode(convert.makeCodeableConceptFromCD(cda.getChild(observation, "code"))); // all loinc codes - - // SHOULD contain zero or one [0..1] text (CONF:7302). - // The text, if present, SHOULD contain zero or one [0..1] reference (CONF:15943). - // The reference, if present, SHOULD contain zero or one [0..1] @value (CONF:15944). - // This reference/@value SHALL begin with a '#' and SHALL point to its corresponding narrative (using the approach defined in CDA Release 2, section 4.3.5.1) (CONF:15945). - // todo: put this in narrative if it exists? - - - // SHALL contain exactly one [1..1] statusCode (CONF:7303). This statusCode SHALL contain exactly one [1..1] @code="completed" Completed (CodeSystem: ActStatus 2.16.840.1.113883.5.14 STATIC) (CONF:19119). - // ignore - - // SHALL contain exactly one [1..1] effectiveTime (CONF:7304). - obs.setEffective(convert.makeMatchingTypeFromIVL(cda.getChild(observation, "effectiveTime"))); - - // SHALL contain exactly one [1..1] value with @xsi:type="PQ" (CONF:7305). - obs.setValue(convert.makeQuantityFromPQ(cda.getChild(observation, "value"))); - - // MAY contain zero or one [0..1] interpretationCode (CONF:7307). - obs.setInterpretation(convert.makeCodeableConceptFromCD(cda.getChild(observation, "interpretationCode"))); - - // MAY contain zero or one [0..1] methodCode (CONF:7308). - obs.setMethod(convert.makeCodeableConceptFromCD(cda.getChild(observation, "methodCode"))); - - // MAY contain zero or one [0..1] targetSiteCode (CONF:7309). - obs.setBodySite(convert.makeCodeableConceptFromCD(cda.getChild(observation, "targetSiteCode"))); - - // MAY contain zero or one [0..1] author (CONF:7310). - if (cda.getChild(observation, "author") != null) - obs.getPerformer().add(makeReferenceToPractitionerForAssignedEntity(cda.getChild(observation, "author"), composition)); - - // make a contained practitioner - String n = nextRef(); - obs.setId(n); - list.getContained().add(obs); - return n; - } -} + + +/* + 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 java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.hl7.fhir.dstu3.context.IWorkerContext; +import org.hl7.fhir.dstu3.model.AllergyIntolerance; +import org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus; +import org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality; +import org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent; +import org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity; +import org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType; +import org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus; +import org.hl7.fhir.dstu3.model.Bundle; +import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.dstu3.model.CodeableConcept; +import org.hl7.fhir.dstu3.model.Coding; +import org.hl7.fhir.dstu3.model.Comparison; +import org.hl7.fhir.dstu3.model.Composition; +import org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode; +import org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent; +import org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality; +import org.hl7.fhir.dstu3.model.Composition.SectionComponent; +import org.hl7.fhir.dstu3.model.ContactPoint; +import org.hl7.fhir.dstu3.model.Device; +import org.hl7.fhir.dstu3.model.DomainResource; +import org.hl7.fhir.dstu3.model.Encounter; +import org.hl7.fhir.dstu3.model.Extension; +import org.hl7.fhir.dstu3.model.Factory; +import org.hl7.fhir.dstu3.model.Identifier; +import org.hl7.fhir.dstu3.model.InstantType; +import org.hl7.fhir.dstu3.model.ListResource; +import org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent; +import org.hl7.fhir.dstu3.model.Location; +import org.hl7.fhir.dstu3.model.Meta; +import org.hl7.fhir.dstu3.model.Narrative; +import org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus; +import org.hl7.fhir.dstu3.model.Observation; +import org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent; +import org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType; +import org.hl7.fhir.dstu3.model.Observation.ObservationStatus; +import org.hl7.fhir.dstu3.model.Organization; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.dstu3.model.Period; +import org.hl7.fhir.dstu3.model.Practitioner; +import org.hl7.fhir.dstu3.model.Procedure; +import org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent; +import org.hl7.fhir.dstu3.model.Reference; +import org.hl7.fhir.dstu3.model.ResourceFactory; +import org.hl7.fhir.dstu3.utils.NarrativeGenerator; +import org.hl7.fhir.dstu3.utils.ToolingExtensions; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.utilities.ucum.UcumService; +import org.w3c.dom.Element; + +/** +Advance Directives Section 42348-3 : +Allergies, Adverse Reactions, Alerts Section 48765-2 : List(AlleryIntolerance) processAdverseReactionsSection +Anesthesia Section 59774-0 : +Assessment Section 51848-0 : +Assessment and Plan Section 51487-2 : +Chief Complaint Section 10154-3 : +Chief Complaint and Reason for Visit Section 46239-0 : +Complications 55109-3: +DICOM Object Catalog Section - DCM 121181 : +Discharge Diet Section 42344-2 : +Encounters Section 46240-8: +Family History Section 10157-6 : +Findings Section 18782-3 : +Functional Status Section 47420-5 : +General Status Section 10210-3 : +History of Past Illness Section 11348-0 : +History of Present Illness Section 10164-2 : +Hospital Admission Diagnosis Section 46241-6 : +Hospital Consultations Section 18841-7 : +Hospital Course Section 8648-8 : +Hospital Discharge Diagnosis Section 11535-2 : +Hospital Discharge Instructions Section : +Hospital Discharge Medications Section (entries optional) 10183-2 : +Hospital Discharge Physical Section 10184-0 : +Hospital Discharge Studies Summary Section 11493-4 : +Immunizations Section 11369-6 : +Interventions Section 62387-6 : +Medical Equipment Section 46264-8 : +Medical (General) History Section 11329-0 : +Medications Section 10160-0 : +Medications Administered Section 29549-3 : +Objective Section 61149-1 : +Operative Note Fluid Section 10216-0 : +Operative Note Surgical Procedure Section 10223-6 : +Payers Section 48768-6 : +Physical Exam Section 29545-1 : +Plan of Care Section 18776-5 : +Planned Procedure Section 59772-: +Postoperative Diagnosis Section 10218-6 : +Postprocedure Diagnosis Section 59769-0 : +Preoperative Diagnosis Section 10219-4 : +Problem Section 11450-4 : +Procedure Description Section 29554-3: +Procedure Disposition Section 59775-7 : +Procedure Estimated Blood Loss Section 59770-8 : +Procedure Findings Section 59776-5 : +Procedure Implants Section 59771-6 : +Procedure Indications Section 59768-2 : +Procedure Specimens Taken Section 59773-2 : +Procedures Section 47519-4 : List (Procedure) processProceduresSection +Reason for Referral Section 42349-1 : +Reason for Visit Section 29299-5 : +Results Section 30954-2 : +Review of Systems Section 10187-3 : +Social History Section 29762-2 : List (Observation) processSocialHistorySection +Subjective Section 61150-9: +Surgical Drains Section 11537-8 : +Vital Signs Section 8716-3 : List(Observation) processVitalSignsSection + + +MU Sections: +Allergies/Adverse Reactions +Problems +Encounters +Medications +Results +Vital Signs +Procedures +Immunizations +Reason for Referral +Hospital Discharge Instructions +Functional Status +Plan of Care +Hospital Discharge Medication +All of General Header + + * @author Grahame + * + */ +public class CCDAConverter { + + public enum SocialHistoryType { + SocialHistory, Pregnancy, SmokingStatus, TobaccoUse + + } + + + public enum ProcedureType { + Observation, Procedure, Act + + } + + + protected CDAUtilities cda; + protected Element doc; + protected Convert convert; + protected Bundle feed; + protected Composition composition; + protected Map practitionerCache = new HashMap(); + protected Integer refCounter = 0; + protected UcumService ucumSvc; + protected IWorkerContext context; + + + public CCDAConverter(UcumService ucumSvc, IWorkerContext context) { + super(); + this.ucumSvc = ucumSvc; + this.context = context; + } + + + public Bundle convert(InputStream stream) throws Exception { + + cda = new CDAUtilities(stream); + doc = cda.getElement(); + cda.checkTemplateId(doc, "2.16.840.1.113883.10.20.22.1.1"); + convert = new Convert(cda, ucumSvc, "Z"); + + // check it's a CDA/CCD + feed = new Bundle(); + feed.setMeta(new Meta().setLastUpdatedElement(InstantType.now())); + feed.setId(makeUUIDReference()); + feed.getMeta().getTag().add(new Coding()); // todo-bundle ("http://hl7.org/fhir/tag", "http://hl7.org/fhir/tag/document", "Document")); + + // process the header + makeDocument(); + composition.setSubject(Factory.makeReference(makeSubject())); + for (Element e : cda.getChildren(doc, "author")) + composition.getAuthor().add(Factory.makeReference(makeAuthor(e))); + // todo: data enterer & informant goes in provenance + composition.setCustodian(Factory.makeReference(makeOrganization( + cda.getDescendent(doc, "custodian/assignedCustodian/representedCustodianOrganization"), "Custodian"))); + // todo: informationRecipient + for (Element e : cda.getChildren(doc, "legalAuthenticator")) + composition.getAttester().add(makeAttester(e, CompositionAttestationMode.LEGAL, "Legal Authenticator")); + for (Element e : cda.getChildren(doc, "authenticator")) + composition.getAttester().add(makeAttester(e, CompositionAttestationMode.PROFESSIONAL, "Authenticator")); + + // process the contents + // we do this by section - keep the original section order + Element body = cda.getDescendent(doc, "component/structuredBody"); + processComponentSections(composition.getSection(), body); + return feed; + } + + + protected String addReference(DomainResource r, String title, String id) throws Exception { + if (r.getText() == null) + r.setText(new Narrative()); + if (r.getText().getDiv() == null) { + r.getText().setStatus(NarrativeStatus.GENERATED); +// new NarrativeGenerator("", "", context).generate(r); + } + r.setMeta(new Meta().setLastUpdatedElement(InstantType.now())); + r.setId(id); + feed.getEntry().add(new BundleEntryComponent().setResource(r)); + return id; + } + + protected void makeDocument() throws Exception { + composition = (Composition) ResourceFactory.createResource("Composition"); + addReference(composition, "Composition", makeUUIDReference()); + + Element title = cda.getChild(doc, "title"); + composition.setTitle(title.getTextContent()); + + if (cda.getChild(doc, "setId") != null) { + feed.setId(convert.makeURIfromII(cda.getChild(doc, "id"))); + composition.setIdentifier(convert.makeIdentifierFromII(cda.getChild(doc, "setId"))); + } else + composition.setIdentifier(convert.makeIdentifierFromII(cda.getChild(doc, "id"))); // well, we fall back to id + + composition.setDateElement(convert.makeDateTimeFromTS(cda.getChild(doc, "effectiveTime"))); + composition.setType(convert.makeCodeableConceptFromCD(cda.getChild(doc, "code"))); + composition.setConfidentiality(convertConfidentiality(cda.getChild(doc, "confidentialityCode"))); + if (cda.getChild(doc, "confidentialityCode") != null) + composition.setLanguage(cda.getChild(doc, "confidentialityCode").getAttribute("value")); // todo - fix streaming for this + + Element ee = cda.getChild(doc, "componentOf"); + if (ee != null) + ee = cda.getChild(ee, "encompassingEncounter"); + if (ee != null) { + Encounter visit = new Encounter(); + for (Element e : cda.getChildren(ee, "id")) + visit.getIdentifier().add(convert.makeIdentifierFromII(e)); + visit.setPeriod(convert.makePeriodFromIVL(cda.getChild(ee, "effectiveTime"))); + composition.getEvent().add(new Composition.CompositionEventComponent()); + composition.getEvent().get(0).getCode().add(convert.makeCodeableConceptFromCD(cda.getChild(ee, "code"))); + composition.getEvent().get(0).setPeriod(visit.getPeriod()); + composition.getEvent().get(0).getDetail().add(Factory.makeReference(addReference(visit, "Encounter", makeUUIDReference()))); + } + + // main todo: fill out the narrative, but before we can do that, we have to convert everything else + } + + protected DocumentConfidentiality convertConfidentiality(Element child) throws FHIRException, org.hl7.fhir.exceptions.FHIRException { + // TODO Auto-generated method stub + return DocumentConfidentiality.fromCode(child.getAttribute("code")); + } + + + protected String makeSubject() throws Exception { + Element rt = cda.getChild(doc, "recordTarget"); + Element pr = cda.getChild(rt, "patientRole"); + Element p = cda.getChild(pr, "patient"); + + Patient pat = (Patient) ResourceFactory.createResource("Patient"); + for (Element e : cda.getChildren(pr, "id")) + pat.getIdentifier().add(convert.makeIdentifierFromII(e)); + + for (Element e : cda.getChildren(pr, "addr")) + pat.getAddress().add(convert.makeAddressFromAD(e)); + for (Element e : cda.getChildren(pr, "telecom")) + pat.getTelecom().add(convert.makeContactFromTEL(e)); + for (Element e : cda.getChildren(p, "name")) + pat.getName().add(convert.makeNameFromEN(e)); + pat.setGender(convert.makeGenderFromCD(cda.getChild(p, "administrativeGenderCode"))); + pat.setBirthDateElement(convert.makeDateFromTS(cda.getChild(p, "birthTime"))); + pat.setMaritalStatus(convert.makeCodeableConceptFromCD(cda.getChild(p, "maritalStatusCode"))); + pat.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_RELIGION, convert.makeCodeableConceptFromCD(cda.getChild(p, "religiousAffiliationCode")), false)); + pat.getExtension().add(Factory.newExtension(CcdaExtensions.DAF_NAME_RACE, convert.makeCodeableConceptFromCD(cda.getChild(p, "raceCode")), false)); + pat.getExtension().add(Factory.newExtension(CcdaExtensions.DAF_NAME_ETHNICITY, convert.makeCodeableConceptFromCD(cda.getChild(p, "ethnicGroupCode")), false)); + pat.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_BIRTHPLACE, convert.makeAddressFromAD(cda.getChild(p, new String[] {"birthplace", "place", "addr"})), false)); + + Patient.ContactComponent guardian = new Patient.ContactComponent(); + pat.getContact().add(guardian); + guardian.getRelationship().add(Factory.newCodeableConcept("GUARD", "urn:oid:2.16.840.1.113883.5.110", "guardian")); + Element g = cda.getChild(p, "guardian"); + for (Element e : cda.getChildren(g, "addr")) + if (guardian.getAddress() == null) + guardian.setAddress(convert.makeAddressFromAD(e)); + for (Element e : cda.getChildren(g, "telecom")) + guardian.getTelecom().add(convert.makeContactFromTEL(e)); + g = cda.getChild(g, "guardianPerson"); + for (Element e : cda.getChildren(g, "name")) + if (guardian.getName() == null) + guardian.setName(convert.makeNameFromEN(e)); + + Element l = cda.getChild(p, "languageCommunication"); + CodeableConcept cc = new CodeableConcept(); + Coding c = new Coding(); + c.setCode(cda.getChild(l, "languageCode").getAttribute("code")); + cc.getCoding().add(c); + pat.addCommunication().setLanguage(cc); + + // todo: this got broken.... lang.setMode(convert.makeCodeableConceptFromCD(cda.getChild(l, "modeCode"))); + cc.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_LANG_PROF, convert.makeCodeableConceptFromCD(cda.getChild(l, "modeCode")), false)); + pat.getExtension().add(Factory.newExtension(CcdaExtensions.NAME_RELIGION, convert.makeCodeableConceptFromCD(cda.getChild(p, "religiousAffiliationCode")), false)); + pat.setManagingOrganization(Factory.makeReference(makeOrganization(cda.getChild(pr, "providerOrganization"), "Provider"))); + return addReference(pat, "Subject", makeUUIDReference()); + } + + + protected String makeOrganization(Element org, String name) throws Exception { + Organization o = new Organization(); + for (Element e : cda.getChildren(org, "id")) + o.getIdentifier().add(convert.makeIdentifierFromII(e)); + for (Element e : cda.getChildren(org, "name")) + o.setName(e.getTextContent()); + for (Element e : cda.getChildren(org, "addr")) + o.getAddress().add(convert.makeAddressFromAD(e)); + for (Element e : cda.getChildren(org, "telecom")) + o.getTelecom().add(convert.makeContactFromTEL(e)); + + return addReference(o, name, makeUUIDReference()); + } + + protected String makeAuthor(Element auth) throws Exception { + Element aa = cda.getChild(auth, "assignedAuthor"); + Element ap = cda.getChild(aa, "assignedPerson"); + + Practitioner pr = (Practitioner) ResourceFactory.createResource("Practitioner"); + for (Element e : cda.getChildren(aa, "id")) + pr.getIdentifier().add(convert.makeIdentifierFromII(e)); + for (Element e : cda.getChildren(aa, "addr")) + if (pr.getAddress() == null) + pr.getAddress().add(convert.makeAddressFromAD(e)); + for (Element e : cda.getChildren(aa, "telecom")) + pr.getTelecom().add(convert.makeContactFromTEL(e)); + for (Element e : cda.getChildren(ap, "name")) + if (pr.getName() != null) + pr.addName(convert.makeNameFromEN(e)); + + return addReference(pr, "Author", makeUUIDReference()); + } + + + protected String makeUUIDReference() { + return "urn:uuid:"+UUID.randomUUID().toString().toLowerCase(); + } + + + protected CompositionAttesterComponent makeAttester(Element a1, CompositionAttestationMode mode, String title) throws Exception { + Practitioner pr = (Practitioner) ResourceFactory.createResource("Practitioner"); + Element ass = cda.getChild(a1, "assignedEntity"); + for (Element e : cda.getChildren(ass, "id")) + pr.getIdentifier().add(convert.makeIdentifierFromII(e)); + for (Element e : cda.getChildren(ass, "addr")) + if (pr.getAddress() == null) // just take the first + pr.getAddress().add(convert.makeAddressFromAD(e)); + for (Element e : cda.getChildren(ass, "telecom")) + pr.getTelecom().add(convert.makeContactFromTEL(e)); + Element ap = cda.getChild(ass, "assignedPerson"); + for (Element e : cda.getChildren(ap, "name")) + if (pr.getName() == null) // just take the first + pr.addName(convert.makeNameFromEN(e)); + + + CompositionAttesterComponent att = new CompositionAttesterComponent(); + att.addMode(mode); + att.setTimeElement(convert.makeDateTimeFromTS(cda.getChild(a1,"time"))); + att.setParty(Factory.makeReference(addReference(pr, title, makeUUIDReference()))); + return att; + } + + + protected void processComponentSections(List sections, Element container) throws Exception { + for (Element c : cda.getChildren(container, "component")) { + SectionComponent s = processSection(cda.getChild(c, "section")); + if (s != null) + sections.add(s); + } + + } + + + protected SectionComponent processSection(Element section) throws Exception { + checkNoSubject(section, "Section"); + // this we do by templateId + if (cda.hasTemplateId(section, "2.16.840.1.113883.10.20.22.2.6") || cda.hasTemplateId(section, "2.16.840.1.113883.10.20.22.2.6.1")) + return processAdverseReactionsSection(section); + else if (cda.hasTemplateId(section, "2.16.840.1.113883.10.20.22.2.7") || cda.hasTemplateId(section, "2.16.840.1.113883.10.20.22.2.7.1")) + return processProceduresSection(section); + else if (cda.hasTemplateId(section, "2.16.840.1.113883.10.20.22.2.17")) + return processSocialHistorySection(section); + else if (cda.hasTemplateId(section, "2.16.840.1.113883.10.20.22.2.4") || cda.hasTemplateId(section, "2.16.840.1.113883.10.20.22.2.4.1")) + return processVitalSignsSection(section); + else + // todo: error? + return null; + } + + + protected void checkNoSubject(Element act, String path) throws Exception { + if (cda.getChild(act, "subject") != null) + throw new Exception("The conversion program cannot accept a nullFlavor at the location "+path); + } + + + protected SectionComponent processProceduresSection(Element section) throws Exception { + ListResource list = new ListResource(); + for (Element entry : cda.getChildren(section, "entry")) { + Element procedure = cda.getlastChild(entry); + + if (cda.hasTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.14")) { + processProcedure(list, procedure, ProcedureType.Procedure); + } else if (cda.hasTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.13")) { + processProcedure(list, procedure, ProcedureType.Observation); + } else if (cda.hasTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.12")) { + processProcedure(list, procedure, ProcedureType.Act); + } else + throw new Exception("Unhandled Section template ids: "+cda.showTemplateIds(procedure)); + } + + // todo: text + SectionComponent s = new Composition.SectionComponent(); + s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code"))); + // todo: check subject + s.addEntry(Factory.makeReference(addReference(list, "Procedures", makeUUIDReference()))); + return s; + + } + + protected void processProcedure(ListResource list, Element procedure, ProcedureType type) throws Exception { + switch (type) { + case Procedure : + cda.checkTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.14"); + break; + case Observation: + cda.checkTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.13"); + break; + case Act: + cda.checkTemplateId(procedure, "2.16.840.1.113883.10.20.22.4.12"); + } + checkNoNegationOrNullFlavor(procedure, "Procedure ("+type.toString()+")"); + checkNoSubject(procedure, "Procedure ("+type.toString()+")"); + + Procedure p = new Procedure(); + addItemToList(list, p); + + // moodCode is either INT or EVN. INT is not handled yet. INT is deprecated anyway + if (procedure.getAttribute("moodCode").equals("INT")) + p.getModifierExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-planned", Factory.newBoolean(true), false)); + + // SHALL contain at least one [1..*] id (CONF:7655). + for (Element e : cda.getChildren(procedure, "id")) + p.getIdentifier().add(convert.makeIdentifierFromII(e)); + + // SHALL contain exactly one [1..1] code (CONF:7656). + // This code @code in a procedure activity SHOULD be selected from LOINC or SNOMED CT and MAY be selected from CPT-4, ICD9 Procedures, ICD10 Procedures + p.setCode(convert.makeCodeableConceptFromCD(cda.getChild(procedure, "code"))); + + // SHALL contain exactly one [1..1] statusCode/@code, which SHALL be selected from ValueSet 2.16.840.1.113883.11.20.9.22 ProcedureAct + // completed | active | aborted | cancelled - not in FHIR + p.getModifierExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-status", Factory.newCode(cda.getStatus(procedure)), false)); + + // SHOULD contain zero or one [0..1] effectiveTime (CONF:7662). + p.setPerformed(convert.makePeriodFromIVL(cda.getChild(procedure, "effectiveTime"))); + + // MAY contain zero or one [0..1] priorityCode/@code, which SHALL be selected from ValueSet 2.16.840.1.113883.1.11.16866 ActPriority DYNAMIC (CONF:7668) + p.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-priority", convert.makeCodeableConceptFromCD(cda.getChild(procedure, "priorityCode")), false)); + + // MAY contain zero or one [0..1] methodCode (CONF:7670). + p.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-method", convert.makeCodeableConceptFromCD(cda.getChild(procedure, "methodCode")), false)); + + if (type == ProcedureType.Observation) { + // for Procedure-Observation: + // 9. SHALL contain exactly one [1..1] value (CONF:16846). + // don't know what this is. It's not the actual result of the procedure (that goes in results "This section records ... procedure observations"), and there seems to be no value. The example as which is not valid + // so we ignore this for now + } + + // SHOULD contain zero or more [0..*] targetSiteCode/@code, which SHALL be selected from ValueSet 2.16.840.1.113883.3.88.12.3221.8.9 Body site DYNAMIC (CONF:7683). + for (Element e : cda.getChildren(procedure, "targetSiteCode")) + p.addBodySite(convert.makeCodeableConceptFromCD(e)); + + // MAY contain zero or more [0..*] specimen (CONF:7697). + // todo: add these as extensions when specimens are done. + + // SHOULD contain zero or more [0..*] performer (CONF:7718) such that it + for (Element e : cda.getChildren(procedure, "performer")) { + ProcedurePerformerComponent pp = new ProcedurePerformerComponent(); + p.getPerformer().add(pp); + pp.setActor(makeReferenceToPractitionerForAssignedEntity(e, p)); + } + + for (Element participant : cda.getChildren(procedure, "participant")) { + Element participantRole = cda.getlastChild(participant); + if (type == ProcedureType.Procedure && cda.hasTemplateId(participantRole, "2.16.840.1.113883.10.20.22.4.37")) { + // MAY contain zero or more [0..*] participant (CONF:7751) such that it SHALL contain exactly one [1..1] @typeCode="DEV" Device + // implanted devices + p.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/implanted-devices", Factory.makeReference(processDevice(participantRole, p)), false)); + } else if (cda.hasTemplateId(participantRole, "2.16.840.1.113883.10.20.22.4.32")) { + // MAY contain zero or more [0..*] participant (CONF:7765) such that it SHALL contain exactly one [1..1] Service Delivery Location (templateId:2.16.840.1.113883.10.20.22.4.32) (CONF:7767) + p.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/location", Factory.makeReference(processSDLocation(participantRole, p)), false)); + } + } + + for (Element e : cda.getChildren(procedure, "entryRelationship")) { + Element a /* act*/ = cda.getlastChild(e); + if (a.getLocalName().equals("encounter")) { + // MAY contain zero or more [0..*] entryRelationship (CONF:7768) such that it SHALL contain exactly one encounter which SHALL contain exactly one [1..1] id (CONF:7773). + // todo - and process as a full encounter while we're at it + } else if (cda.hasTemplateId(a, "2.16.840.1.113883.10.20.22.4.20")) { + // MAY contain zero or one [0..1] entryRelationship (CONF:7775) such that it SHALL contain exactly one [1..1] Instructions (templateId:2.16.840.1.113883.10.20.22.4.20) (CONF:7778). + // had code for type, plus text for instructions + Extension n = Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-instructions", null, true); + n.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-instructions-type", convert.makeCodeableConceptFromCD(cda.getChild(a, "code")), false)); + n.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/procedure-instructions-text", convert.makeStringFromED(cda.getChild(a, "text")), false)); + p.getExtension().add(n); + } else if (cda.hasTemplateId(a, "2.16.840.1.113883.10.20.22.4.19")) { + // MAY contain zero or more [0..*] entryRelationship (CONF:7779) such that it SHALL contain exactly one [1..1] Indication (templateId:2.16.840.1.113883.10.20.22.4.19) (CONF:7781). + p.addReasonCode(processIndication(a)); + } else if (cda.hasTemplateId(cda.getlastChild(e), "2.16.840.1.113883.10.20.22.4.16")) { + // MAY contain zero or one [0..1] entryRelationship (CONF:7886) such that it SHALL contain exactly one [1..1] Medication Activity (templateId:2.16.840.1.113883.10.20.22.4.16) (CONF:7888). + // todo + } + } + } + + + protected String processSDLocation(Element participantRole, DomainResource r) throws Exception { + Location l = new Location(); + l.setType(convert.makeCodeableConceptFromCD(cda.getChild(participantRole, "code"))); + for (Element id : cda.getChildren(participantRole, "id")) { + if (l.getIdentifier() == null) + l.getIdentifier().add(convert.makeIdentifierFromII(id)); + } + for (Element addr : cda.getChildren(participantRole, "addr")) { + if (l.getAddress() == null) + l.setAddress(convert.makeAddressFromAD(addr)); + } + + for (Element telecom : cda.getChildren(participantRole, "telecom")) { + l.getTelecom().add(convert.makeContactFromTEL(telecom)); + } + + + Element place = cda.getChild(participantRole, "playingDevice"); + if (cda.getChild(place, "name") != null) + l.setName(cda.getChild(place, "name").getTextContent()); + + String id = nextRef(); + l.setId(id); + r.getContained().add(l); + return "#"+id; + } + + + protected String processDevice(Element participantRole, DomainResource r) throws Exception { + Device d = new Device(); + for (Element id : cda.getChildren(participantRole, "id")) { + // todo: check for UDIs, how? + d.getIdentifier().add(convert.makeIdentifierFromII(id)); + } + Element device = cda.getChild(participantRole, "playingDevice"); + // todo: if (cda.getChild(device, "code") != null) + d.setType(convert.makeCodeableConceptFromCD(cda.getChild(device, "code"))); + + // CCDA has an id - this is manufacturer? We just call it the name, but what to do about this? + Element org = cda.getChild(participantRole, "scopingEntity"); + d.setManufacturer(convert.makeURIfromII(cda.getChild(org, "id"))); + + String id = nextRef(); + d.setId(id); + r.getContained().add(d); + return "#"+id; + } + + + protected CodeableConcept processIndication(Element obs) throws Exception { + Element v = cda.getChild(obs, "value"); + if (v == null) { + // have to find it by ID + Element o = cda.getById(cda.getChild(obs, "id"), "value"); + if (o != null) + v = cda.getChild(obs, "value"); + } + if (v != null) + return convert.makeCodeableConceptFromCD(v); + else + return null; + } + + protected Reference makeReferenceToPractitionerForAssignedEntity(Element assignedEntity, DomainResource r) throws Exception { + + Reference ref = null; + // do we have this by id? + String uri = getIdForEntity(assignedEntity); + Practitioner p = null; + if (uri != null) { + ref = Factory.makeReference(uri); + p = practitionerCache.get(uri); + } + if (p == null) { + p = new Practitioner(); + if (uri == null) { + // make a contained practitioner + String n = nextRef(); + p.setId(n); + r.getContained().add(p); + ref = Factory.makeReference("#"+n); + } else { + // add this to feed + ref = Factory.makeReference(addReference(p, "Practitioner", uri)); + } + } + // ref and p are both sorted. now we fill out p as much as we can (remembering it might already be populated) +// p.addRole().setCode(convert.makeCodeableConceptFromCD(cda.getChild(assignedEntity, "code"))); + for (Element e : cda.getChildren(assignedEntity, "id")) + addToIdList(p.getIdentifier(), convert.makeIdentifierFromII(e)); + for (Element e : cda.getChildren(assignedEntity, "addr")) + if (p.getAddress() == null) + p.getAddress().add(convert.makeAddressFromAD(e)); + for (Element e : cda.getChildren(assignedEntity, "telecom")) + addToContactList(p.getTelecom(), convert.makeContactFromTEL(e)); + for (Element e : cda.getChildren(cda.getChild(assignedEntity, "assignedPerson"), "name")) + if (p.getName() == null) + p.addName(convert.makeNameFromEN(e)); + // todo: + // representedOrganization + return ref; + } + + + protected void addToContactList(List list, ContactPoint c) throws Exception { + for (ContactPoint item : list) { + if (Comparison.matches(item, c, null)) + Comparison.merge(item, c); + } + list.add(c); + } + + + protected void addToIdList(List list, Identifier id) throws Exception { + for (Identifier item : list) { + if (Comparison.matches(item, id, null)) + Comparison.merge(item, id); + } + list.add(id); + } + + + protected void addToCodeableList(List list, CodeableConcept code) throws Exception { + for (CodeableConcept item : list) { + if (Comparison.matches(item, code, null)) + Comparison.merge(item, code); + } + list.add(code); + } + + + protected String getIdForEntity(Element assignedEntity) throws Exception { + Element id = cda.getChild(assignedEntity, "id"); // for now, just grab the first + if (id == null) + return null; + if (id.getAttribute("extension") == null) { + if (convert.isGuid(id.getAttribute("root"))) + return "urn:uuid:"+id.getAttribute("root"); + else + return "urn:oid:"+id.getAttribute("root"); + } else + return "ii:"+id.getAttribute("root")+"::"+id.getAttribute("extension"); + } + + + protected SectionComponent processAdverseReactionsSection(Element section) throws Exception { + ListResource list = new ListResource(); + for (Element entry : cda.getChildren(section, "entry")) { + Element concern = cda.getChild(entry, "act"); + if (cda.hasTemplateId(concern, "2.16.840.1.113883.10.20.22.4.30")) { + processAllergyProblemAct(list, concern); + } else + throw new Exception("Unhandled Section template ids: "+cda.showTemplateIds(concern)); + } + + + // todo: text + SectionComponent s = new Composition.SectionComponent(); + s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code"))); + // todo: check subject + s.addEntry(Factory.makeReference(addReference(list, "Allergies, Adverse Reactions, Alerts", makeUUIDReference()))); + return s; + } + + + protected void processAllergyProblemAct(ListResource list, Element concern) throws Exception { + cda.checkTemplateId(concern, "2.16.840.1.113883.10.20.22.4.30"); + // Allergy Problem Act - this is a concern - we treat the concern as information about it's place in the list + checkNoNegationOrNullFlavor(concern, "Allergy Problem Act"); + checkNoSubject(concern, "Allergy Problem Act"); + + // SHALL contain at least one [1..*] entryRelationship (CONF:7509) such that it + // SHALL contain exactly one [1..1] Allergy - intolerance Observation + for (Element entry : cda.getChildren(concern, "entryRelationship")) { + Element obs = cda.getChild(entry, "observation"); + cda.checkTemplateId(obs, "2.16.840.1.113883.10.20.22.4.7"); + checkNoNegationOrNullFlavor(obs, "Allergy - intolerance Observation"); + checkNoSubject(obs, "Allergy Problem Act"); + + AllergyIntolerance ai = new AllergyIntolerance(); + ListEntryComponent item = addItemToList(list, ai); + + // this first section comes from the concern, and is processed once for each observation in the concern group + // SHALL contain at least one [1..*] id (CONF:7472). + for (Element e : cda.getChildren(concern, "id")) + ai.getIdentifier().add(convert.makeIdentifierFromII(e)); + + // SHALL contain exactly one [1..1] statusCode, which SHALL be selected from ValueSet 2.16.840.1.113883.3.88.12.80.68 HITSPProblemStatus DYNAMIC (CONF:7485) + // the status code is about the concern (e.g. the entry in the list) + // possible values: active, suspended, aborted, completed, with an effective time + String s = cda.getStatus(concern); + item.setFlag(Factory.newCodeableConcept(s, "http://hl7.org/fhir/v3/ActStatus", s)); + if (s.equals("aborted")) // only on this condition? + item.setDeleted(true); + + // SHALL contain exactly one [1..1] effectiveTime (CONF:7498) + Period p = convert.makePeriodFromIVL(cda.getChild(concern, "effectiveTime")); + item.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/list-period", p, false)); + if (p.getEnd() != null) + item.setDate(p.getEnd()); + else + item.setDate(p.getStart()); + + //ok, now process the actual observation + // SHALL contain at least one [1..*] id (CONF:7382) + for (Element e : cda.getChildren(obs, "id")) + ai.getIdentifier().add(convert.makeIdentifierFromII(e)); + + + // SHALL contain exactly one [1..1] effectiveTime (CONF:7387) + ai.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/allergyintolerance-period", convert.makePeriodFromIVL(cda.getChild(obs, "effectiveTime")), false)); + + // SHALL contain exactly one [1..1] value with @xsi:type="CD" (CONF:7390) + CodeableConcept type = convert.makeCodeableConceptFromCD(cda.getChild(obs, "value")); + // This value SHALL contain @code, which SHALL be selected from ValueSet 2.16.840.1.113883.3.88.12.3221.6.2 Allergy/Adverse Event Type + String ss = type.getCoding().get(0).getCode(); + if (ss.equals("416098002") || ss.equals("414285001")) + ai.setType(AllergyIntoleranceType.ALLERGY); + else if (ss.equals("59037007") || ss.equals("235719002")) + ai.setType(AllergyIntoleranceType.INTOLERANCE); + ai.getExtension().add(Factory.newExtension("http://www.healthintersections.com.au/fhir/extensions/allergy-category", type, false)); + + // SHOULD contain zero or one [0..1] participant (CONF:7402) such that it + // ......This playingEntity SHALL contain exactly one [1..1] code + ai.setCode(convert.makeCodeableConceptFromCD(cda.getDescendent(obs, "participant/participantRole/playingEntity/code"))); + + // MAY contain zero or one [0..1] entryRelationship (CONF:7440) such that it SHALL contain exactly one [1..1] Alert Status Observation + // SHOULD contain zero or more [0..*] entryRelationship (CONF:7447) such that it SHALL contain exactly one [1..1] Reaction Observation (templateId:2.16.840.1.113883.10.20.22.4.9) (CONF:7450). + for (Element e : cda.getChildren(obs, "entryRelationship")) { + Element child = cda.getChild(e, "observation"); + if (cda.hasTemplateId(child, "2.16.840.1.113883.10.20.22.4.28") && ai.getClinicalStatus() == null) { + // SHALL contain exactly one [1..1] value with @xsi:type="CE", where the @code SHALL be selected from ValueSet Problem Status Value Set 2.16.840.1.113883.3.88.12.80.68 DYNAMIC (CONF:7322). + // 55561003 SNOMED CT Active + // 73425007 SNOMED CT Inactive + // 413322009 SNOMED CT Resolved + String sc = cda.getChild(child, "value").getAttribute("code"); + if (sc.equals("55561003")) { + ai.setClinicalStatus(AllergyIntoleranceClinicalStatus.ACTIVE); + ai.setVerificationStatus(AllergyIntoleranceVerificationStatus.CONFIRMED); + } else + ai.setClinicalStatus(AllergyIntoleranceClinicalStatus.RESOLVED); + } else if (cda.hasTemplateId(child, "2.16.840.1.113883.10.20.22.4.9")) { + ai.getReaction().add(processAdverseReactionObservation(child)); + } + } + + // SHOULD contain zero or one [0..1] entryRelationship (CONF:9961) such that it SHALL contain exactly one [1..1] Severity Observation (templateId:2.16.840.1.113883.10.20.22.4.8) (CONF:9963). + ai.setCriticality(readCriticality(cda.getSeverity(obs))); + } + } + + + // this is going to be a contained resource, so we aren't going to generate any narrative + protected AllergyIntoleranceReactionComponent processAdverseReactionObservation(Element reaction) throws Exception { + checkNoNegationOrNullFlavor(reaction, "Adverse Reaction Observation"); + checkNoSubject(reaction, "Adverse Reaction Observation"); + + // This clinical statement represents an undesired symptom, finding, etc., due to an administered or exposed substance. A reaction can be defined with respect to its severity, and can have been treated by one or more interventions. + AllergyIntoleranceReactionComponent ar = new AllergyIntoleranceReactionComponent(); + + // SHALL contain exactly one [1..1] id (CONF:7329). + for (Element e : cda.getChildren(reaction, "id")) + ToolingExtensions.addIdentifier(ar, convert.makeIdentifierFromII(e)); + + // SHALL contain exactly one [1..1] code (CONF:7327). The value set for this code element has not been specified. + // todo: what the heck is this? + + // SHOULD contain zero or one [0..1] text (CONF:7330). + // todo: so what is this? how can we know whether to ignore it? + + // 8. SHOULD contain zero or one [0..1] effectiveTime (CONF:7332). + // a. This effectiveTime SHOULD contain zero or one [0..1] low (CONF:7333). + // b. This effectiveTime SHOULD contain zero or one [0..1] high (CONF:7334). + // !this is a problem because FHIR just has a date, not a period. + ar.setOnsetElement(convert.makeDateTimeFromIVL(cda.getChild(reaction, "effectiveTime"))); + + // SHALL contain exactly one [1..1] value with @xsi:type="CD", where the @code SHALL be selected from ValueSet 2.16.840.1.113883.3.88.12.3221.7.4 Problem DYNAMIC (CONF:7335). + ar.getManifestation().add(convert.makeCodeableConceptFromCD(cda.getChild(reaction, "value"))); + + // SHOULD contain zero or one [0..1] entryRelationship (CONF:7580) such that it SHALL contain exactly one [1..1] Severity Observation (templateId:2.16.840.1.113883.10.20.22.4.8) (CONF:7582). + ar.setSeverity(readSeverity(cda.getSeverity(reaction))); + + // MAY contain zero or more [0..*] entryRelationship (CONF:7337) such that it SHALL contain exactly one [1..1] Procedure Activity Procedure (templateId:2.16.840.1.113883.10.20.22.4.14) (CONF:7339). + // i. This procedure activity is intended to contain information about procedures that were performed in response to an allergy reaction + // todo: process these into an procedure and add as an extension + + // MAY contain zero or more [0..*] entryRelationship (CONF:7340) such that it SHALL contain exactly one [1..1] Medication Activity (templateId:2.16.840.1.113883.10.20.22.4.16) (CONF:7342). + // i. This medication activity is intended to contain information about medications that were administered in response to an allergy reaction. (CONF:7584). + // todo: process these into an medication statement and add as an extension + + return ar; + } + + + protected SectionComponent processSocialHistorySection(Element section) throws Exception { + ListResource list = new ListResource(); + for (Element entry : cda.getChildren(section, "entry")) { + Element observation = cda.getlastChild(entry); + + if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.22.4.38")) { + processSocialObservation(list, observation, SocialHistoryType.SocialHistory); + } else if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.15.3.8")) { + processSocialObservation(list, observation, SocialHistoryType.Pregnancy); + } else if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.22.4.78")) { + processSocialObservation(list, observation, SocialHistoryType.SmokingStatus); + } else if (cda.hasTemplateId(observation, "2.16.840.1.113883.10.20.22.4.85")) { + processSocialObservation(list, observation, SocialHistoryType.TobaccoUse); + } else + throw new Exception("Unhandled Section template ids: "+cda.showTemplateIds(observation)); + } + + // todo: text + SectionComponent s = new Composition.SectionComponent(); + s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code"))); + // todo: check subject + s.addEntry(Factory.makeReference(addReference(list, "Procedures", makeUUIDReference()))); + return s; + + } + + + + protected void processSocialObservation(ListResource list, Element so, SocialHistoryType type) throws Exception { + Observation obs = new Observation(); + addItemToList(list, obs); + + switch (type) { + case SocialHistory : + cda.checkTemplateId(so, "2.16.840.1.113883.10.20.22.4.38"); + // SHALL contain exactly one [1..1] code (CONF:8558/). + obs.setCode(convert.makeCodeableConceptFromCD(cda.getChild(so, "code"))); + break; + case Pregnancy: + cda.checkTemplateId(so, "2.16.840.1.113883.10.20.15.3.8"); + // SHALL contain exactly one [1..1] code (CONF:8558/), which SHALL be an assertion + obs.setCode(Factory.newCodeableConcept("11449-6", "http://loinc.org", "Pregnancy Status")); + break; + case SmokingStatus: + cda.checkTemplateId(so, "2.16.840.1.113883.10.20.22.4.78"); + // SHALL contain exactly one [1..1] code (CONF:8558/), which SHALL be an assertion + obs.setCode(Factory.newCodeableConcept("72166-2", "http://loinc.org", "Tobacco Smoking Status")); + break; + case TobaccoUse: + cda.checkTemplateId(so, "2.16.840.1.113883.10.20.22.4.12"); + // SHALL contain exactly one [1..1] code (CONF:8558/), which SHALL be an assertion + obs.setCode(Factory.newCodeableConcept("11367-0", "http://loinc.org", "History of Tobacco Use")); + } + + // SHALL contain at least one [1..*] id (8551). + for (Element e : cda.getChildren(so, "id")) + obs.getIdentifier().add(convert.makeIdentifierFromII(e)); + + + // SHALL contain exactly one [1..1] statusCode (CONF:8553/455/14809). + // a. This statusCode SHALL contain exactly one [1..1] @code="completed" Completed (CodeSystem: ActStatus 2.16.840.1.113883.5.14 STATIC) (CONF:19117). + obs.setStatus(ObservationStatus.FINAL); + + // SHOULD contain zero or one [0..1] effectiveTime (CONF:2018/14814). + // for smoking status/tobacco: low only. in R2, this is just value. So we treat low only as just a value + Element et = cda.getChild(so, "effectiveTime"); + if (et != null) { + if (cda.getChild(et, "low") != null) + obs.setEffective(convert.makeDateTimeFromTS(cda.getChild(et, "low"))); + else + obs.setEffective(convert.makeDateTimeFromIVL(et)); + } + + // SHOULD contain zero or one [0..1] value (CONF:8559). + // a. Observation/value can be any data type. + for (Element e : cda.getChildren(so, "value")) + if (obs.getValue() == null) { // only one in FHIR + // special case for pregnancy: + if (type == SocialHistoryType.Pregnancy && "true".equals(e.getAttribute("negationInd"))) { + obs.setValue(Factory.newCodeableConcept("60001007", "http://snomed.info/sct", "Not pregnant")); + } else { + // negationInd is not described. but it might well be used. For now, we blow up + checkNoNegation(so, "Social Observation ("+type.toString()+")"); + + if (so.hasAttribute("nullFlavor")) + obs.setValue(convert.makeCodeableConceptFromNullFlavor(so.getAttribute("nullFlavor"))); + else if (e.hasAttribute("nullFlavor") && !"OTH".equals(e.getAttribute("nullFlavor"))) + obs.setValue(convert.makeCodeableConceptFromNullFlavor(e.getAttribute("nullFlavor"))); + else + obs.setValue(convert.makeTypeFromANY(e)); + } + } else + throw new Exception("too many values on Social Observation"); + + if (type == SocialHistoryType.Pregnancy) { + for (Element e : cda.getChildren(so, "entyRelationship")) { + Element dd = cda.getChild(e, "observation"); + checkNoNegationOrNullFlavor(dd, "Estimated Date of Delivery"); + // MAY contain zero or one [0..1] entryRelationship (CONF:458) such that it + // SHALL contain exactly one [1..1] @typeCode="REFR" Refers to (CodeSystem: HL7ActRelationshipType 2.16.840.1.113883.5.1002 STATIC) (CONF:459). + // SHALL contain exactly one [1..1] Estimated Date of Delivery (templateId:2.16.840.1.113883.10.20.15.3.1) (CONF:15584). + Observation co = new Observation(); + String id = nextRef(); + co.setId(id); + obs.getContained().add(co); + ObservationRelatedComponent or = new ObservationRelatedComponent(); + obs.getRelated().add(or); + or.setType(ObservationRelationshipType.HASMEMBER); + or.setTarget(Factory.makeReference("#"+id)); + co.setCode(Factory.newCodeableConcept("11778-8", "http://loinc.org", "Delivery date Estimated")); + co.setValue(convert.makeDateTimeFromTS(cda.getChild(dd, "value"))); // not legal, see gForge http://gforge.hl7.org/gf/project/fhir/tracker/?action=TrackerItemEdit&tracker_item_id=3125&start=0 + } + } + } + + + protected void checkNoNegation(Element act, String path) throws Exception { + if ("true".equals(act.getAttribute("negationInd"))) + throw new Exception("The conversion program cannot accept a negationInd at the location "+path); + } + + protected void checkNoNegationOrNullFlavor(Element act, String path) throws Exception { + if (act.hasAttribute("nullFlavor")) + throw new Exception("The conversion program cannot accept a nullFlavor at the location "+path); + if ("true".equals(act.getAttribute("negationInd"))) + throw new Exception("The conversion program cannot accept a negationInd at the location "+path); + } + + + protected ListEntryComponent addItemToList(ListResource list, DomainResource ai) + throws Exception { + list.getContained().add(ai); + String n = nextRef(); + ai.setId(n); + ListEntryComponent item = new ListResource.ListEntryComponent(); + list.getEntry().add(item); + item.setItem(Factory.makeReference("#"+n)); + return item; + } + + + protected String nextRef() { + refCounter++; + String n = refCounter.toString(); + return n; + } + + protected AllergyIntoleranceCriticality readCriticality(String severity) { + if ("255604002".equals(severity)) // Mild + return AllergyIntoleranceCriticality.LOW; + if ("371923003".equals(severity)) // Mild to moderate + return AllergyIntoleranceCriticality.LOW; + if ("6736007".equals(severity)) // Moderate + return AllergyIntoleranceCriticality.LOW; + if ("371924009".equals(severity)) // Moderate to severe + return AllergyIntoleranceCriticality.HIGH; + if ("24484000".equals(severity)) // Severe + return AllergyIntoleranceCriticality.HIGH; + if ("399166001".equals(severity)) // Fatal + return AllergyIntoleranceCriticality.HIGH; + return null; + } + + + protected AllergyIntoleranceSeverity readSeverity(String severity) { + if ("255604002".equals(severity)) // Mild + return AllergyIntoleranceSeverity.MILD; + if ("371923003".equals(severity)) // Mild to moderate + return AllergyIntoleranceSeverity.MODERATE; + if ("6736007".equals(severity)) // Moderate + return AllergyIntoleranceSeverity.MODERATE; + if ("371924009".equals(severity)) // Moderate to severe + return AllergyIntoleranceSeverity.SEVERE; + if ("24484000".equals(severity)) // Severe + return AllergyIntoleranceSeverity.SEVERE; + if ("399166001".equals(severity)) // Fatal + return AllergyIntoleranceSeverity.SEVERE; + return null; + } + + + protected SectionComponent processVitalSignsSection(Element section) throws Exception { + ListResource list = new ListResource(); + for (Element entry : cda.getChildren(section, "entry")) { + Element organizer = cda.getlastChild(entry); + + if (cda.hasTemplateId(organizer, "2.16.840.1.113883.10.20.22.4.26")) { + processVitalSignsOrganizer(list, organizer); + } else + throw new Exception("Unhandled Section template ids: "+cda.showTemplateIds(organizer)); + } + + // todo: text + SectionComponent s = new Composition.SectionComponent(); + s.setCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code"))); + // todo: check subject + s.addEntry(Factory.makeReference(addReference(list, "Vital Signs", makeUUIDReference()))); + return s; + + } + + protected void processVitalSignsOrganizer(ListResource list, Element organizer) throws Exception { + + cda.checkTemplateId(organizer, "2.16.840.1.113883.10.20.22.4.26"); + checkNoNegationOrNullFlavor(organizer, "Vital Signs Organizer"); + checkNoSubject(organizer, "Vital Signs Organizer"); + // moodCode is EVN. + + Observation obs = new Observation(); + addItemToList(list, obs); + + // SHALL contain at least one [1..*] id (CONF:7282). + for (Element e : cda.getChildren(organizer, "id")) + obs.getIdentifier().add(convert.makeIdentifierFromII(e)); + + // SHALL contain exactly one [1..1] code (CONF:19176). + // This code SHALL contain exactly one [1..1] @code="46680005" Vital signs (CodeSystem: SNOMED-CT 2.16.840.1.113883.6.96 STATIC) (CONF:19177). + obs.setCode(convert.makeCodeableConceptFromCD(cda.getChild(organizer, "code"))); + + + // SHALL contain exactly one [1..1] effectiveTime (CONF:7288). + obs.setEffective(convert.makeMatchingTypeFromIVL(cda.getChild(organizer, "effectiveTime"))); + + // SHALL contain at least one [1..*] component (CONF:7285) such that it + // SHALL contain exactly one [1..1] Vital Sign Observation (templateId:2.16.840.1.113883.10.20.22.4.27) (CONF:15946). + for (Element e : cda.getChildren(organizer, "component")){ + ObservationRelatedComponent ro = new ObservationRelatedComponent(); + ro.setType(ObservationRelationshipType.HASMEMBER); + ro.setTarget(Factory.makeReference("#"+processVitalSignsObservation(e, list))); + } + } + + + protected String processVitalSignsObservation(Element comp, ListResource list) throws Exception { + Element observation = cda.getChild(comp, "observation"); + cda.checkTemplateId(observation, "2.16.840.1.113883.10.20.22.4.27"); + checkNoNegationOrNullFlavor(observation, "Vital Signs Observation"); + checkNoSubject(observation, "Vital Signs Observation"); + + Observation obs = new Observation(); + + // SHALL contain at least one [1..*] id (CONF:7300). + for (Element e : cda.getChildren(observation, "id")) + obs.getIdentifier().add(convert.makeIdentifierFromII(e)); + + // SHALL contain exactly one [1..1] code, which SHOULD be selected from ValueSet Vital Sign Result Value Set 2.16.840.1.113883.3.88.12.80.62 DYNAMIC (CONF:7301). + obs.setCode(convert.makeCodeableConceptFromCD(cda.getChild(observation, "code"))); // all loinc codes + + // SHOULD contain zero or one [0..1] text (CONF:7302). + // The text, if present, SHOULD contain zero or one [0..1] reference (CONF:15943). + // The reference, if present, SHOULD contain zero or one [0..1] @value (CONF:15944). + // This reference/@value SHALL begin with a '#' and SHALL point to its corresponding narrative (using the approach defined in CDA Release 2, section 4.3.5.1) (CONF:15945). + // todo: put this in narrative if it exists? + + + // SHALL contain exactly one [1..1] statusCode (CONF:7303). This statusCode SHALL contain exactly one [1..1] @code="completed" Completed (CodeSystem: ActStatus 2.16.840.1.113883.5.14 STATIC) (CONF:19119). + // ignore + + // SHALL contain exactly one [1..1] effectiveTime (CONF:7304). + obs.setEffective(convert.makeMatchingTypeFromIVL(cda.getChild(observation, "effectiveTime"))); + + // SHALL contain exactly one [1..1] value with @xsi:type="PQ" (CONF:7305). + obs.setValue(convert.makeQuantityFromPQ(cda.getChild(observation, "value"))); + + // MAY contain zero or one [0..1] interpretationCode (CONF:7307). + obs.setInterpretation(convert.makeCodeableConceptFromCD(cda.getChild(observation, "interpretationCode"))); + + // MAY contain zero or one [0..1] methodCode (CONF:7308). + obs.setMethod(convert.makeCodeableConceptFromCD(cda.getChild(observation, "methodCode"))); + + // MAY contain zero or one [0..1] targetSiteCode (CONF:7309). + obs.setBodySite(convert.makeCodeableConceptFromCD(cda.getChild(observation, "targetSiteCode"))); + + // MAY contain zero or one [0..1] author (CONF:7310). + if (cda.getChild(observation, "author") != null) + obs.getPerformer().add(makeReferenceToPractitionerForAssignedEntity(cda.getChild(observation, "author"), composition)); + + // make a contained practitioner + String n = nextRef(); + obs.setId(n); + list.getContained().add(obs); + return n; + } +} diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/CDAUtilities.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/CDAUtilities.java index fbd7b3a19eb..66a45aa0c64 100644 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/CDAUtilities.java +++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/CDAUtilities.java @@ -20,263 +20,263 @@ package org.hl7.fhir.convertors; * #L% */ - - -/* - 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 java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - -import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; -import org.hl7.fhir.utilities.xml.XMLUtil; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -public class CDAUtilities { - - private Document doc; - - public CDAUtilities(InputStream stream) throws Exception { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); - DocumentBuilder builder = factory.newDocumentBuilder(); - - doc = builder.parse(stream); - basicChecks(); - } - - private void basicChecks() throws Exception { - Element e = doc.getDocumentElement(); - rule(e.getNamespaceURI().equals("urn:hl7-org:v3"), "CDA namespace must be "); - rule(e.getNodeName().equals("ClinicalDocument"), "CDA root name must be ClinicalDocument"); - - } - - private void rule(boolean test, String message) throws Exception { - if (!test) - throw new Exception(message); - - } - - public Element getElement() { - return doc.getDocumentElement(); - } - - public void checkTemplateId(Element e, String templateId) throws Exception { - rule(hasTemplateId(e, templateId), "Template Id '"+templateId+"' not found"); - - } - - public Element getChild(Element e, String[] names) throws Exception { - for (String n : names) { - if (e == null) - return null; - e = getChild(e, n); - } - return e; - } - - public Element getChild(Element element, String name) throws Exception { - if (element == null) - return null; - - Element e = null; - Node n = element.getFirstChild(); - while (n != null) { - if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name)) { - if (e == null) { - e = (Element) n; - } else { - throw new Exception("multiple matches found for "+name); - } - } - n = n.getNextSibling(); - } - return e; - } - - public Element getChildByAttribute(Element element, String name, String attrname, String value) throws Exception { - if (element == null) - return null; - - Element e = null; - Node n = element.getFirstChild(); - while (n != null) { - if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name) && value.equals(((Element) n).getAttribute(attrname))) { - if (e == null) { - e = (Element) n; - } else { - throw new Exception("multiple matches found for "+name); - } - } - n = n.getNextSibling(); - } - return e; - } - - - public List getChildren(Element element, String name) { - List l = new ArrayList(); - if (element != null) { - Node n = element.getFirstChild(); - while (n != null) { - if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name)) { - l.add((Element) n); - } - n = n.getNextSibling(); - } - } - return l; - } - - public Element getDescendent(Element element, String path) throws Exception { - String[] p = path.split("\\/"); - return getDescendent(element, p); - } - - public Element getDescendent(Element e, String[] path) throws Exception { - for (String n : path) { - if (e == null) - return e; - e = getChild(e, n); - } - return e; - } - - public boolean hasTemplateId(Element e, String tid) { - if (e == null) - return false; - boolean found = false; - Node n = e.getFirstChild(); - while (n != null && !found) { - if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals("templateId") && tid.equals(((Element) n).getAttribute("root"))) - found = true; - n = n.getNextSibling(); - } - return found; - } - - public String getStatus(Element act) throws Exception { - if (act == null) - return null; - Element sc = getChild(act, "statusCode"); - if (sc == null) - return null; - else - return sc.getAttribute("code"); - } - - public String getSeverity(Element observation) throws Exception { - for (Element e : getChildren(observation, "entryRelationship")) { - Element child = getChild(e, "observation"); - if (hasTemplateId(child, "2.16.840.1.113883.10.20.22.4.8")) - return getChild(child, "value").getAttribute("code"); - } - return null; - } - - public String showTemplateIds(Element element) { - List list = getChildren(element, "templateId"); - CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); - for (Element e : list) { - if (e.hasAttribute("extension")) - b.append(e.getAttribute("root")+"::"+e.getAttribute("extension")); - else - b.append(e.getAttribute("root")); - } - return b.toString(); - } - - public Element getlastChild(Element e) { - Node n = e.getLastChild(); - while (n != null && n.getNodeType() != Node.ELEMENT_NODE) - n = n.getPreviousSibling(); - return n == null ? null : (Element) n; - } - - /** - * This method looks up an object by it's id, and only returns it if has a child by the given name - * (resolving identifier based cross references) - * - * @param id - * @param childName - * @return - * @throws Exception - */ - public Element getById(Element id, String childName) throws Exception { - return getById(doc.getDocumentElement(), id, childName); - } - - private Element getById(Element e, Element id, String childName) throws Exception { - Element c = XMLUtil.getFirstChild(e); - while (c != null) { - Element i = getChild(c, "id"); - if (i != null && matchesAsId(i, id) && getChild(c, childName) != null) - return c; - Element m = getById(c, id, childName); - if (m != null) - return m; - c = XMLUtil.getNextSibling(c); - } - return null; - } - - private boolean matchesAsId(Element i1, Element i2) { - String r1 = i1.getAttribute("root"); - String r2 = i2.getAttribute("root"); - String e1 = i1.getAttribute("extension"); - String e2 = i2.getAttribute("extension"); - return (r1 != null && r1.equals(r2)) && ((e1 == null && e2 == null) || (e1 != null && e1.equals(e2))); - } - - public Element getByXmlId(String id) { - return getByXmlId(doc.getDocumentElement(), id); - } - - private Element getByXmlId(Element e, String value) { - Element c = XMLUtil.getFirstChild(e); - while (c != null) { - String id = c.getAttribute("ID"); - if (id != null && id.equals(value)) - return c; - Element m = getByXmlId(c, value); - if (m != null) - return m; - c = XMLUtil.getNextSibling(c); - } - return null; - } - -} + + +/* + 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 java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; +import org.hl7.fhir.utilities.xml.XMLUtil; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +public class CDAUtilities { + + private Document doc; + + public CDAUtilities(InputStream stream) throws Exception { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + factory.setNamespaceAware(true); + DocumentBuilder builder = factory.newDocumentBuilder(); + + doc = builder.parse(stream); + basicChecks(); + } + + private void basicChecks() throws Exception { + Element e = doc.getDocumentElement(); + rule(e.getNamespaceURI().equals("urn:hl7-org:v3"), "CDA namespace must be "); + rule(e.getNodeName().equals("ClinicalDocument"), "CDA root name must be ClinicalDocument"); + + } + + private void rule(boolean test, String message) throws Exception { + if (!test) + throw new Exception(message); + + } + + public Element getElement() { + return doc.getDocumentElement(); + } + + public void checkTemplateId(Element e, String templateId) throws Exception { + rule(hasTemplateId(e, templateId), "Template Id '"+templateId+"' not found"); + + } + + public Element getChild(Element e, String[] names) throws Exception { + for (String n : names) { + if (e == null) + return null; + e = getChild(e, n); + } + return e; + } + + public Element getChild(Element element, String name) throws Exception { + if (element == null) + return null; + + Element e = null; + Node n = element.getFirstChild(); + while (n != null) { + if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name)) { + if (e == null) { + e = (Element) n; + } else { + throw new Exception("multiple matches found for "+name); + } + } + n = n.getNextSibling(); + } + return e; + } + + public Element getChildByAttribute(Element element, String name, String attrname, String value) throws Exception { + if (element == null) + return null; + + Element e = null; + Node n = element.getFirstChild(); + while (n != null) { + if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name) && value.equals(((Element) n).getAttribute(attrname))) { + if (e == null) { + e = (Element) n; + } else { + throw new Exception("multiple matches found for "+name); + } + } + n = n.getNextSibling(); + } + return e; + } + + + public List getChildren(Element element, String name) { + List l = new ArrayList(); + if (element != null) { + Node n = element.getFirstChild(); + while (n != null) { + if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals(name)) { + l.add((Element) n); + } + n = n.getNextSibling(); + } + } + return l; + } + + public Element getDescendent(Element element, String path) throws Exception { + String[] p = path.split("\\/"); + return getDescendent(element, p); + } + + public Element getDescendent(Element e, String[] path) throws Exception { + for (String n : path) { + if (e == null) + return e; + e = getChild(e, n); + } + return e; + } + + public boolean hasTemplateId(Element e, String tid) { + if (e == null) + return false; + boolean found = false; + Node n = e.getFirstChild(); + while (n != null && !found) { + if (n.getNodeType() == Node.ELEMENT_NODE && n.getNodeName().equals("templateId") && tid.equals(((Element) n).getAttribute("root"))) + found = true; + n = n.getNextSibling(); + } + return found; + } + + public String getStatus(Element act) throws Exception { + if (act == null) + return null; + Element sc = getChild(act, "statusCode"); + if (sc == null) + return null; + else + return sc.getAttribute("code"); + } + + public String getSeverity(Element observation) throws Exception { + for (Element e : getChildren(observation, "entryRelationship")) { + Element child = getChild(e, "observation"); + if (hasTemplateId(child, "2.16.840.1.113883.10.20.22.4.8")) + return getChild(child, "value").getAttribute("code"); + } + return null; + } + + public String showTemplateIds(Element element) { + List list = getChildren(element, "templateId"); + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + for (Element e : list) { + if (e.hasAttribute("extension")) + b.append(e.getAttribute("root")+"::"+e.getAttribute("extension")); + else + b.append(e.getAttribute("root")); + } + return b.toString(); + } + + public Element getlastChild(Element e) { + Node n = e.getLastChild(); + while (n != null && n.getNodeType() != Node.ELEMENT_NODE) + n = n.getPreviousSibling(); + return n == null ? null : (Element) n; + } + + /** + * This method looks up an object by it's id, and only returns it if has a child by the given name + * (resolving identifier based cross references) + * + * @param id + * @param childName + * @return + * @throws Exception + */ + public Element getById(Element id, String childName) throws Exception { + return getById(doc.getDocumentElement(), id, childName); + } + + private Element getById(Element e, Element id, String childName) throws Exception { + Element c = XMLUtil.getFirstChild(e); + while (c != null) { + Element i = getChild(c, "id"); + if (i != null && matchesAsId(i, id) && getChild(c, childName) != null) + return c; + Element m = getById(c, id, childName); + if (m != null) + return m; + c = XMLUtil.getNextSibling(c); + } + return null; + } + + private boolean matchesAsId(Element i1, Element i2) { + String r1 = i1.getAttribute("root"); + String r2 = i2.getAttribute("root"); + String e1 = i1.getAttribute("extension"); + String e2 = i2.getAttribute("extension"); + return (r1 != null && r1.equals(r2)) && ((e1 == null && e2 == null) || (e1 != null && e1.equals(e2))); + } + + public Element getByXmlId(String id) { + return getByXmlId(doc.getDocumentElement(), id); + } + + private Element getByXmlId(Element e, String value) { + Element c = XMLUtil.getFirstChild(e); + while (c != null) { + String id = c.getAttribute("ID"); + if (id != null && id.equals(value)) + return c; + Element m = getByXmlId(c, value); + if (m != null) + return m; + c = XMLUtil.getNextSibling(c); + } + return null; + } + +} diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/CcdaExtensions.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/CcdaExtensions.java index 9ef87da1412..ed7d5c16d8e 100644 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/CcdaExtensions.java +++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/CcdaExtensions.java @@ -20,15 +20,15 @@ package org.hl7.fhir.convertors; * #L% */ - -public class CcdaExtensions { - public final static String DAF_NAME_RACE = "http://hl7.org/fhir/StructureDefinition/us-core-race"; - public final static String DAF_NAME_ETHNICITY = "http://hl7.org/fhir/StructureDefinition/us-core-ethnicity"; - - public final static String BASE = "http://hl7.org/ccda"; - public final static String NAME_RELIGION = BASE+"/religious-affiliation"; - public final static String NAME_BIRTHPLACE = BASE+"birthplace"; - public final static String NAME_LANG_PROF = BASE+"proficiency-level"; - - -} + +public class CcdaExtensions { + public final static String DAF_NAME_RACE = "http://hl7.org/fhir/StructureDefinition/us-core-race"; + public final static String DAF_NAME_ETHNICITY = "http://hl7.org/fhir/StructureDefinition/us-core-ethnicity"; + + public final static String BASE = "http://hl7.org/ccda"; + public final static String NAME_RELIGION = BASE+"/religious-affiliation"; + public final static String NAME_BIRTHPLACE = BASE+"birthplace"; + public final static String NAME_LANG_PROF = BASE+"proficiency-level"; + + +} diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/Convert.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/Convert.java index bea63267e89..517a67a4b64 100644 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/Convert.java +++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/Convert.java @@ -20,629 +20,629 @@ package org.hl7.fhir.convertors; * #L% */ - - -/* - 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 java.math.BigDecimal; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.UUID; - -import org.hl7.fhir.dstu3.model.Address; -import org.hl7.fhir.dstu3.model.Address.AddressUse; -import org.hl7.fhir.dstu3.model.CodeableConcept; -import org.hl7.fhir.dstu3.model.Coding; -import org.hl7.fhir.dstu3.model.ContactPoint; -import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem; -import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse; -import org.hl7.fhir.dstu3.model.DateTimeType; -import org.hl7.fhir.dstu3.model.DateType; -import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender; -import org.hl7.fhir.dstu3.model.Factory; -import org.hl7.fhir.dstu3.model.HumanName; -import org.hl7.fhir.dstu3.model.HumanName.NameUse; -import org.hl7.fhir.dstu3.model.Identifier; -import org.hl7.fhir.dstu3.model.InstantType; -import org.hl7.fhir.dstu3.model.Period; -import org.hl7.fhir.dstu3.model.Quantity; -import org.hl7.fhir.dstu3.model.Range; -import org.hl7.fhir.dstu3.model.SimpleQuantity; -import org.hl7.fhir.dstu3.model.StringType; -import org.hl7.fhir.dstu3.model.Timing; -import org.hl7.fhir.dstu3.model.Timing.EventTiming; -import org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent; -import org.hl7.fhir.dstu3.model.Timing.UnitsOfTime; -import org.hl7.fhir.dstu3.model.Type; -import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; -import org.hl7.fhir.utilities.OIDUtils; -import org.hl7.fhir.utilities.Utilities; -import org.hl7.fhir.utilities.ucum.UcumService; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -public class Convert { - - private CDAUtilities cda; - private UcumService ucumSvc; - private Set oids = new HashSet(); - private String defaultTimezone; - private boolean generateMissingExtensions; - - public Convert(CDAUtilities cda, UcumService ucumSvc, String defaultTimezone) { - super(); - this.cda = cda; - this.ucumSvc = ucumSvc; - this.defaultTimezone = defaultTimezone; - } - - public Identifier makeIdentifierFromII(Element e) throws Exception { - Identifier id = new Identifier(); - String r = e.getAttribute("root"); - String ex; - if (e.hasAttribute("extension") && Utilities.noString(e.getAttribute("extension"))) { - if (generateMissingExtensions) - ex = UUID.randomUUID().toString(); - else - throw new Exception("Broken identifier - extension is blank"); - } else - ex = e.getAttribute("extension"); - - if (Utilities.noString(ex)) { - id.setSystem("urn:ietf:rfc:3986"); - if (isGuid(r)) - id.setValue("urn:uuid:"+r); - else if (UriForOid(r) != null) - id.setValue(UriForOid(r)); - else - id.setValue(UriForOid(r)); - } else { - if (isGuid(r)) - id.setSystem("urn:uuid:"+r); - else if (UriForOid(r) != null) - id.setSystem(UriForOid(r)); - else - id.setSystem("urn:oid:"+r); - id.setValue(ex); - } - return id; - } - - public String makeURIfromII(Element e) { - String r = e.getAttribute("root"); - if (Utilities.noString(e.getAttribute("extension"))) { - if (isGuid(r)) - return "urn:uuid:"+r; - else if (UriForOid(r) != null) - return UriForOid(r); - else - return UriForOid(r); - } else { - if (isGuid(r)) - return "urn:uuid:"+r+"::"+e.getAttribute("extension"); - else if (UriForOid(r) != null) - return UriForOid(r)+"::"+e.getAttribute("extension"); - else - return "urn:oid:"+r+"::"+e.getAttribute("extension"); - } - } - - private String UriForOid(String r) { - String uri = OIDUtils.getUriForOid(r); - if (uri != null) - return uri; - else { - oids.add(r); - return "urn:oid:"+r; - } - } - - public boolean isGuid(String r) { - return r.matches("[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"); - } - - public InstantType makeInstantFromTS(Element child) throws Exception { - InstantType i = InstantType.parseV3(child.getAttribute("value")); - return i; - } - - public CodeableConcept makeCodeableConceptFromCD(Element cv) throws Exception { - if (cv == null) - return null; - CodeableConcept cc = new CodeableConcept(); - cc.addCoding(makeCodingFromCV(cv)); - for (Element e : cda.getChildren(cv, "translation")) - cc.addCoding(makeCodingFromCV(e)); - if (cda.getChild(cv, "originalText") != null) { - Element ote = cda.getChild(cv, "originalText"); -// if (cda.getChild(ote, "reference") != null) { -// if (cda.getChild(ote, "reference").getAttribute("value").startsWith("#")) { -// Element t = cda.getByXmlId(cda.getChild(ote, "reference").getAttribute("value").substring(1)); -// String ot = t.getTextContent().trim(); -// cc.setText(Utilities.noString(ot) ? null : ot); -// } else -// throw new Exception("external references not handled yet "+cda.getChild(ote, "reference").getAttribute("value")); -// } else { - String ot = ote.getTextContent().trim(); - cc.setText(Utilities.noString(ot) ? null : ot); - //} - } - return cc; - } - - public Coding makeCodingFromCV(Element cd) throws Exception { - if (cd == null || Utilities.noString(cd.getAttribute("code"))) - return null; - Coding c = new Coding(); - c.setCode(cd.getAttribute("code")); - c.setDisplay(cd.getAttribute("displayName")); - String r = cd.getAttribute("codeSystem"); - String uri = getUriForOID(r); - if (uri != null) - c.setSystem(uri); - else if (isGuid(r)) - c.setSystem("urn:uuid:"+r); - else if (UriForOid(r) != null) - c.setSystem(UriForOid(r)); - else - c.setSystem("urn:oid:"+r); - return c; - } - - private String getUriForOID(String r) { - if (r.equals("2.16.840.1.113883.6.1")) - return "http://loinc.org"; - if (r.equals("2.16.840.1.113883.6.96")) - return "http://snomed.info/sct"; - return null; - } - - public Address makeAddressFromAD(Element e) { - if (e == null) - return null; - Address a = new Address(); - String use = e.getAttribute("use"); - if (use != null) { - if (use.equals("H") || use.equals("HP") || use.equals("HV")) - a.setUse(AddressUse.HOME); - else if (use.equals("WP") || use.equals("DIR") || use.equals("PUB")) - a.setUse(AddressUse.WORK); - else if (use.equals("TMP")) - a.setUse(AddressUse.TEMP); - else if (use.equals("BAD")) - a.setUse(AddressUse.OLD); - } - Node n = e.getFirstChild(); - while (n != null) { - if (n.getNodeType() == Node.ELEMENT_NODE) { - String v = n.getTextContent(); - if (n.getLocalName().equals("additionalLocator")) - a.getLine().add(makeString(v)); -// else if (e.getLocalName().equals("unitID")) -// else if (e.getLocalName().equals("unitType")) - else if (n.getLocalName().equals("deliveryAddressLine")) - a.getLine().add(makeString(v)); -// else if (e.getLocalName().equals("deliveryInstallationType")) -// else if (e.getLocalName().equals("deliveryInstallationArea")) -// else if (e.getLocalName().equals("deliveryInstallationQualifier")) -// else if (e.getLocalName().equals("deliveryMode")) -// else if (e.getLocalName().equals("deliveryModeIdentifier")) - else if (n.getLocalName().equals("streetAddressLine")) - a.getLine().add(makeString(v)); -// else if (e.getLocalName().equals("houseNumber")) -// else if (e.getLocalName().equals("buildingNumberSuffix")) -// else if (e.getLocalName().equals("postBox")) -// else if (e.getLocalName().equals("houseNumberNumeric")) -// else if (e.getLocalName().equals("streetName")) -// else if (e.getLocalName().equals("streetNameBase")) -// else if (e.getLocalName().equals("streetNameType")) - else if (n.getLocalName().equals("direction")) - a.getLine().add(makeString(v)); - else if (n.getLocalName().equals("careOf")) - a.getLine().add(makeString(v)); -// else if (e.getLocalName().equals("censusTract")) - else if (n.getLocalName().equals("country")) - a.setCountry(v); - //else if (e.getLocalName().equals("county")) - else if (n.getLocalName().equals("city")) - a.setCity(v); -// else if (e.getLocalName().equals("delimiter")) -// else if (e.getLocalName().equals("precinct")) - else if (n.getLocalName().equals("state")) - a.setState(v); - else if (n.getLocalName().equals("postalCode")) - a.setPostalCode(v); - } - n = n.getNextSibling(); - } - return a; - } - - public StringType makeString(String v) { - StringType s = new StringType(); - s.setValue(v); - return s; - } - - public ContactPoint makeContactFromTEL(Element e) throws Exception { - if (e == null) - return null; - if (e.hasAttribute("nullFlavor")) - return null; - ContactPoint c = new ContactPoint(); - String use = e.getAttribute("use"); - if (use != null) { - if (use.equals("H") || use.equals("HP") || use.equals("HV")) - c.setUse(ContactPointUse.HOME); - else if (use.equals("WP") || use.equals("DIR") || use.equals("PUB")) - c.setUse(ContactPointUse.WORK); - else if (use.equals("TMP")) - c.setUse(ContactPointUse.TEMP); - else if (use.equals("BAD")) - c.setUse(ContactPointUse.OLD); - } - if (e.getAttribute("value") != null) { - String[] url = e.getAttribute("value").split(":"); - if (url.length == 1) { - c.setValue(url[0].trim()); - c.setSystem(ContactPointSystem.PHONE); - } else { - if (url[0].equals("tel")) - c.setSystem(ContactPointSystem.PHONE); - else if (url[0].equals("mailto")) - c.setSystem(ContactPointSystem.EMAIL); - else if (e.getAttribute("value").contains(":")) - c.setSystem(ContactPointSystem.OTHER); - else - c.setSystem(ContactPointSystem.PHONE); - c.setValue(url[1].trim()); - } - } - return c; - - } - - public HumanName makeNameFromEN(Element e) { - if (e == null) - return null; - HumanName hn = new HumanName(); - String use = e.getAttribute("use"); - if (use != null) { - if (use.equals("L")) - hn.setUse(NameUse.USUAL); - else if (use.equals("C")) - hn.setUse(NameUse.OFFICIAL); - else if (use.equals("P") || use.equals("A")) - hn.setUse(NameUse.ANONYMOUS); - else if (use.equals("TMP")) - hn.setUse(NameUse.TEMP); - else if (use.equals("BAD")) - hn.setUse(NameUse.OLD); - } - - Node n = e.getFirstChild(); - while (n != null) { - if (n.getNodeType() == Node.ELEMENT_NODE) { - String v = n.getTextContent(); - if (n.getLocalName().equals("family")) - hn.setFamilyElement(makeString(v)); - else if (n.getLocalName().equals("given")) - hn.getGiven().add(makeString(v)); - else if (n.getLocalName().equals("prefix")) - hn.getPrefix().add(makeString(v)); - else if (n.getLocalName().equals("suffix")) - hn.getSuffix().add(makeString(v)); - } - n = n.getNextSibling(); - } - return hn; - } - - public DateTimeType makeDateTimeFromTS(Element ts) throws Exception { - if (ts == null) - return null; - - String v = ts.getAttribute("value"); - if (Utilities.noString(v)) - return null; - - if (v.length() > 8 && !hasTimezone(v)) - v += defaultTimezone; - DateTimeType d = DateTimeType.parseV3(v); - return d; - } - - private boolean hasTimezone(String v) { - return v.contains("+") || v.contains("-") || v.endsWith("Z"); - } - - - public DateType makeDateFromTS(Element ts) throws Exception { - if (ts == null) - return null; - - String v = ts.getAttribute("value"); - if (Utilities.noString(v)) - return null; - DateType d = DateType.parseV3(v); - return d; - } - - public Period makePeriodFromIVL(Element ivl) throws Exception { - if (ivl == null) - return null; - Period p = new Period(); - Element low = cda.getChild(ivl, "low"); - if (low != null) - p.setStartElement(makeDateTimeFromTS(low)); - Element high = cda.getChild(ivl, "high"); - if (high != null) - p.setEndElement(makeDateTimeFromTS(high)); - - if (p.getStartElement() != null || p.getEndElement() != null) - return p; - else - return null; - } - - // this is a weird one - where CDA has an IVL, and FHIR has a date - public DateTimeType makeDateTimeFromIVL(Element ivl) throws Exception { - if (ivl == null) - return null; - if (ivl.hasAttribute("value")) - return makeDateTimeFromTS(ivl); - Element high = cda.getChild(ivl, "high"); - if (high != null) - return makeDateTimeFromTS(high); - Element low = cda.getChild(ivl, "low"); - if (low != null) - return makeDateTimeFromTS(low); - return null; - } - - public Type makeStringFromED(Element e) throws Exception { - if (e == null) - return null; - if (cda.getChild(e, "reference") != null) { - if (cda.getChild(e, "reference").getAttribute("value").startsWith("#")) { - Element t = cda.getByXmlId(cda.getChild(e, "reference").getAttribute("value").substring(1)); - String ot = t.getTextContent().trim(); - return Utilities.noString(ot) ? null : Factory.newString_(ot); - } else - throw new Exception("external references not handled yet "+cda.getChild(e, "reference").getAttribute("value")); - } - return Factory.newString_(e.getTextContent()); - } - - public Type makeTypeFromANY(Element e) throws Exception { - if (e == null) - return null; - String t = e.getAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "type"); - if (Utilities.noString(t)) - throw new Exception("Missing type on RIM attribute with type any"); - if (t.equals("CD") || t.equals("CE")) - return makeCodeableConceptFromCD(e); - else if (t.equals("ST")) - return makeStringFromED(e); - else - throw new Exception("Not done yet (type = "+t+")"); - } - - public Type makeMatchingTypeFromIVL(Element ivl) throws Exception { - if (ivl == null) - return null; - if (ivl.getAttribute("value") != null) - return makeDateTimeFromIVL(ivl); - if (cda.getChild(ivl, "low") != null || cda.getChild(ivl, "high") != null ) - return makePeriodFromIVL(ivl); - throw new Exception("not handled yet"); - } - - public Type makeCodeableConceptFromNullFlavor(String nf) throws Exception { - // Some nullFlavors have explicit values in value sets. This can only be called where there aren't. - if (nf == null || "".equals(nf)) - return null; - if ("NI".equals(nf)) - return null; // there's no code for this - if ("NA".equals(nf)) - return Factory.newCodeableConcept("unsupported", "http://hl7.org/fhir/data-absent-reason", "Unsupported"); // todo: is this reasonable? Why else would you use N/A? - if ("UNK".equals(nf)) - return Factory.newCodeableConcept("unknown", "http://hl7.org/fhir/data-absent-reason", "Unknown"); - if ("ASKU".equals(nf)) - return Factory.newCodeableConcept("asked", "http://hl7.org/fhir/data-absent-reason", "Asked/Unknown"); - if ("NAV".equals(nf)) - return Factory.newCodeableConcept("temp", "http://hl7.org/fhir/data-absent-reason", "Temporarily Unavailable"); - if ("NASK".equals(nf)) - return Factory.newCodeableConcept("notasked", "http://hl7.org/fhir/data-absent-reason", "Not Asked"); - if ("MSK".equals(nf)) - return Factory.newCodeableConcept("masked", "http://hl7.org/fhir/data-absent-reason", "Masked"); - if ("OTH".equals(nf)) - return null; // well, what should be done? - return null; // well, what should be done? - - } - - public Range makeRangeFromIVLPQ(Element ivlpq) throws Exception { - if (ivlpq == null) - return null; - Element low = cda.getChild(ivlpq, "low"); - Element high = cda.getChild(ivlpq, "high"); - if (low == null && high == null) - return null; - Range r = new Range(); - r.setLow(makeSimpleQuantityFromPQ(low, ivlpq.getAttribute("unit"))); - r.setHigh(makeSimpleQuantityFromPQ(high, ivlpq.getAttribute("unit"))); - return r; - } - - public Quantity makeQuantityFromPQ(Element pq) throws Exception { - return makeQuantityFromPQ(pq, null); - } - - public Quantity makeQuantityFromPQ(Element pq, String units) throws Exception { - if (pq == null) - return null; - Quantity qty = new Quantity(); - String n = pq.getAttribute("value").replace(",", "").trim(); - try { - qty.setValue(new BigDecimal(n)); - } catch (Exception e) { - throw new Exception("Unable to process value '"+n+"'", e); - } - units = Utilities.noString(pq.getAttribute("unit")) ? units : pq.getAttribute("unit"); - if (!Utilities.noString(units)) { - if (ucumSvc == null || ucumSvc.validate(units) != null) - qty.setUnit(units); - else { - qty.setCode(units); - qty.setSystem("http://unitsofmeasure.org"); - qty.setUnit(ucumSvc.getCommonDisplay(units)); - } - } - return qty; - } - - public SimpleQuantity makeSimpleQuantityFromPQ(Element pq, String units) throws Exception { - if (pq == null) - return null; - SimpleQuantity qty = new SimpleQuantity(); - String n = pq.getAttribute("value").replace(",", "").trim(); - try { - qty.setValue(new BigDecimal(n)); - } catch (Exception e) { - throw new Exception("Unable to process value '"+n+"'", e); - } - units = Utilities.noString(pq.getAttribute("unit")) ? units : pq.getAttribute("unit"); - if (!Utilities.noString(units)) { - if (ucumSvc == null || ucumSvc.validate(units) != null) - qty.setUnit(units); - else { - qty.setCode(units); - qty.setSystem("http://unitsofmeasure.org"); - qty.setUnit(ucumSvc.getCommonDisplay(units)); - } - } - return qty; - } - - public AdministrativeGender makeGenderFromCD(Element cd) throws Exception { - String code = cd.getAttribute("code"); - String system = cd.getAttribute("codeSystem"); - if ("2.16.840.1.113883.5.1".equals(system)) { - if ("F".equals(code)) - return AdministrativeGender.FEMALE; - if ("M".equals(code)) - return AdministrativeGender.MALE; - } - throw new Exception("Unable to read Gender "+system+"::"+code); - } - - /* - /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:EIVL_TS]: 389 - /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:EIVL_TS]/event: 389 - /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:IVL_TS]: 33470 - /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:IVL_TS]/high: 20566 - /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:IVL_TS]/high[nullFlavor:NA]: 9581 - /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:IVL_TS]/low: 32501 - /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:IVL_TS]/low[nullFlavor:UNK]: 969 - /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:PIVL_TS]: 17911 - /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:PIVL_TS]/period: 17911 - */ - public Type makeSomethingFromGTS(List children) throws Exception { - if (children.isEmpty()) - return null; - if (children.size() == 1) { - String type = children.get(0).getAttribute("xsi:type"); - if (type.equals("IVL_TS")) - return makePeriodFromIVL(children.get(0)); - else - throw new Exception("Unknown GTS type '"+type+"'"); - } - CommaSeparatedStringBuilder t = new CommaSeparatedStringBuilder(); - for (Element c : children) - t.append(c.getAttribute("xsi:type")); - if (t.toString().equals("IVL_TS, PIVL_TS")) - return makeTimingFromBoundedPIVL(children.get(0), children.get(1)); - if (t.toString().equals("IVL_TS, EIVL_TS")) - return makeTimingFromBoundedEIVL(children.get(0), children.get(1)); - throw new Exception("Unknown GTS pattern '"+t.toString()+"'"); - } - - private Type makeTimingFromBoundedEIVL(Element ivl, Element eivl) throws Exception { - Timing t = new Timing(); - t.setRepeat(new TimingRepeatComponent()); - Element e = cda.getChild(eivl, "event"); - t.getRepeat().setBounds(makePeriodFromIVL(ivl)); - t.getRepeat().addWhen(convertEventTiming(e.getAttribute("code"))); - return t; - } - - private EventTiming convertEventTiming(String e) throws Exception { - if ("HS".equals(e)) - return EventTiming.HS; - throw new Exception("Unknown event "+e); - } - - private Timing makeTimingFromBoundedPIVL(Element ivl, Element pivl) throws Exception { - Timing t = new Timing(); - t.setRepeat(new TimingRepeatComponent()); - Element p = cda.getChild(pivl, "period"); - t.getRepeat().setBounds(makePeriodFromIVL(ivl)); - t.getRepeat().setPeriod(new BigDecimal(p.getAttribute("value"))); - t.getRepeat().setPeriodUnit(convertTimeUnit(p.getAttribute("unit"))); - return t; - } - - private UnitsOfTime convertTimeUnit(String u) throws Exception { - if ("h".equals(u)) - return UnitsOfTime.H; - if ("d".equals(u)) - return UnitsOfTime.D; - if ("w".equals(u)) - return UnitsOfTime.WK; - throw new Exception("Unknown unit of time "+u); - } - - public Set getOids() { - return oids; - } - - public boolean isGenerateMissingExtensions() { - return generateMissingExtensions; - } - - public void setGenerateMissingExtensions(boolean generateMissingExtensions) { - this.generateMissingExtensions = generateMissingExtensions; - } - - -} + + +/* + 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 java.math.BigDecimal; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.UUID; + +import org.hl7.fhir.dstu3.model.Address; +import org.hl7.fhir.dstu3.model.Address.AddressUse; +import org.hl7.fhir.dstu3.model.CodeableConcept; +import org.hl7.fhir.dstu3.model.Coding; +import org.hl7.fhir.dstu3.model.ContactPoint; +import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem; +import org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse; +import org.hl7.fhir.dstu3.model.DateTimeType; +import org.hl7.fhir.dstu3.model.DateType; +import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender; +import org.hl7.fhir.dstu3.model.Factory; +import org.hl7.fhir.dstu3.model.HumanName; +import org.hl7.fhir.dstu3.model.HumanName.NameUse; +import org.hl7.fhir.dstu3.model.Identifier; +import org.hl7.fhir.dstu3.model.InstantType; +import org.hl7.fhir.dstu3.model.Period; +import org.hl7.fhir.dstu3.model.Quantity; +import org.hl7.fhir.dstu3.model.Range; +import org.hl7.fhir.dstu3.model.SimpleQuantity; +import org.hl7.fhir.dstu3.model.StringType; +import org.hl7.fhir.dstu3.model.Timing; +import org.hl7.fhir.dstu3.model.Timing.EventTiming; +import org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent; +import org.hl7.fhir.dstu3.model.Timing.UnitsOfTime; +import org.hl7.fhir.dstu3.model.Type; +import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; +import org.hl7.fhir.utilities.OIDUtils; +import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.ucum.UcumService; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +public class Convert { + + private CDAUtilities cda; + private UcumService ucumSvc; + private Set oids = new HashSet(); + private String defaultTimezone; + private boolean generateMissingExtensions; + + public Convert(CDAUtilities cda, UcumService ucumSvc, String defaultTimezone) { + super(); + this.cda = cda; + this.ucumSvc = ucumSvc; + this.defaultTimezone = defaultTimezone; + } + + public Identifier makeIdentifierFromII(Element e) throws Exception { + Identifier id = new Identifier(); + String r = e.getAttribute("root"); + String ex; + if (e.hasAttribute("extension") && Utilities.noString(e.getAttribute("extension"))) { + if (generateMissingExtensions) + ex = UUID.randomUUID().toString(); + else + throw new Exception("Broken identifier - extension is blank"); + } else + ex = e.getAttribute("extension"); + + if (Utilities.noString(ex)) { + id.setSystem("urn:ietf:rfc:3986"); + if (isGuid(r)) + id.setValue("urn:uuid:"+r); + else if (UriForOid(r) != null) + id.setValue(UriForOid(r)); + else + id.setValue(UriForOid(r)); + } else { + if (isGuid(r)) + id.setSystem("urn:uuid:"+r); + else if (UriForOid(r) != null) + id.setSystem(UriForOid(r)); + else + id.setSystem("urn:oid:"+r); + id.setValue(ex); + } + return id; + } + + public String makeURIfromII(Element e) { + String r = e.getAttribute("root"); + if (Utilities.noString(e.getAttribute("extension"))) { + if (isGuid(r)) + return "urn:uuid:"+r; + else if (UriForOid(r) != null) + return UriForOid(r); + else + return UriForOid(r); + } else { + if (isGuid(r)) + return "urn:uuid:"+r+"::"+e.getAttribute("extension"); + else if (UriForOid(r) != null) + return UriForOid(r)+"::"+e.getAttribute("extension"); + else + return "urn:oid:"+r+"::"+e.getAttribute("extension"); + } + } + + private String UriForOid(String r) { + String uri = OIDUtils.getUriForOid(r); + if (uri != null) + return uri; + else { + oids.add(r); + return "urn:oid:"+r; + } + } + + public boolean isGuid(String r) { + return r.matches("[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"); + } + + public InstantType makeInstantFromTS(Element child) throws Exception { + InstantType i = InstantType.parseV3(child.getAttribute("value")); + return i; + } + + public CodeableConcept makeCodeableConceptFromCD(Element cv) throws Exception { + if (cv == null) + return null; + CodeableConcept cc = new CodeableConcept(); + cc.addCoding(makeCodingFromCV(cv)); + for (Element e : cda.getChildren(cv, "translation")) + cc.addCoding(makeCodingFromCV(e)); + if (cda.getChild(cv, "originalText") != null) { + Element ote = cda.getChild(cv, "originalText"); +// if (cda.getChild(ote, "reference") != null) { +// if (cda.getChild(ote, "reference").getAttribute("value").startsWith("#")) { +// Element t = cda.getByXmlId(cda.getChild(ote, "reference").getAttribute("value").substring(1)); +// String ot = t.getTextContent().trim(); +// cc.setText(Utilities.noString(ot) ? null : ot); +// } else +// throw new Exception("external references not handled yet "+cda.getChild(ote, "reference").getAttribute("value")); +// } else { + String ot = ote.getTextContent().trim(); + cc.setText(Utilities.noString(ot) ? null : ot); + //} + } + return cc; + } + + public Coding makeCodingFromCV(Element cd) throws Exception { + if (cd == null || Utilities.noString(cd.getAttribute("code"))) + return null; + Coding c = new Coding(); + c.setCode(cd.getAttribute("code")); + c.setDisplay(cd.getAttribute("displayName")); + String r = cd.getAttribute("codeSystem"); + String uri = getUriForOID(r); + if (uri != null) + c.setSystem(uri); + else if (isGuid(r)) + c.setSystem("urn:uuid:"+r); + else if (UriForOid(r) != null) + c.setSystem(UriForOid(r)); + else + c.setSystem("urn:oid:"+r); + return c; + } + + private String getUriForOID(String r) { + if (r.equals("2.16.840.1.113883.6.1")) + return "http://loinc.org"; + if (r.equals("2.16.840.1.113883.6.96")) + return "http://snomed.info/sct"; + return null; + } + + public Address makeAddressFromAD(Element e) { + if (e == null) + return null; + Address a = new Address(); + String use = e.getAttribute("use"); + if (use != null) { + if (use.equals("H") || use.equals("HP") || use.equals("HV")) + a.setUse(AddressUse.HOME); + else if (use.equals("WP") || use.equals("DIR") || use.equals("PUB")) + a.setUse(AddressUse.WORK); + else if (use.equals("TMP")) + a.setUse(AddressUse.TEMP); + else if (use.equals("BAD")) + a.setUse(AddressUse.OLD); + } + Node n = e.getFirstChild(); + while (n != null) { + if (n.getNodeType() == Node.ELEMENT_NODE) { + String v = n.getTextContent(); + if (n.getLocalName().equals("additionalLocator")) + a.getLine().add(makeString(v)); +// else if (e.getLocalName().equals("unitID")) +// else if (e.getLocalName().equals("unitType")) + else if (n.getLocalName().equals("deliveryAddressLine")) + a.getLine().add(makeString(v)); +// else if (e.getLocalName().equals("deliveryInstallationType")) +// else if (e.getLocalName().equals("deliveryInstallationArea")) +// else if (e.getLocalName().equals("deliveryInstallationQualifier")) +// else if (e.getLocalName().equals("deliveryMode")) +// else if (e.getLocalName().equals("deliveryModeIdentifier")) + else if (n.getLocalName().equals("streetAddressLine")) + a.getLine().add(makeString(v)); +// else if (e.getLocalName().equals("houseNumber")) +// else if (e.getLocalName().equals("buildingNumberSuffix")) +// else if (e.getLocalName().equals("postBox")) +// else if (e.getLocalName().equals("houseNumberNumeric")) +// else if (e.getLocalName().equals("streetName")) +// else if (e.getLocalName().equals("streetNameBase")) +// else if (e.getLocalName().equals("streetNameType")) + else if (n.getLocalName().equals("direction")) + a.getLine().add(makeString(v)); + else if (n.getLocalName().equals("careOf")) + a.getLine().add(makeString(v)); +// else if (e.getLocalName().equals("censusTract")) + else if (n.getLocalName().equals("country")) + a.setCountry(v); + //else if (e.getLocalName().equals("county")) + else if (n.getLocalName().equals("city")) + a.setCity(v); +// else if (e.getLocalName().equals("delimiter")) +// else if (e.getLocalName().equals("precinct")) + else if (n.getLocalName().equals("state")) + a.setState(v); + else if (n.getLocalName().equals("postalCode")) + a.setPostalCode(v); + } + n = n.getNextSibling(); + } + return a; + } + + public StringType makeString(String v) { + StringType s = new StringType(); + s.setValue(v); + return s; + } + + public ContactPoint makeContactFromTEL(Element e) throws Exception { + if (e == null) + return null; + if (e.hasAttribute("nullFlavor")) + return null; + ContactPoint c = new ContactPoint(); + String use = e.getAttribute("use"); + if (use != null) { + if (use.equals("H") || use.equals("HP") || use.equals("HV")) + c.setUse(ContactPointUse.HOME); + else if (use.equals("WP") || use.equals("DIR") || use.equals("PUB")) + c.setUse(ContactPointUse.WORK); + else if (use.equals("TMP")) + c.setUse(ContactPointUse.TEMP); + else if (use.equals("BAD")) + c.setUse(ContactPointUse.OLD); + } + if (e.getAttribute("value") != null) { + String[] url = e.getAttribute("value").split(":"); + if (url.length == 1) { + c.setValue(url[0].trim()); + c.setSystem(ContactPointSystem.PHONE); + } else { + if (url[0].equals("tel")) + c.setSystem(ContactPointSystem.PHONE); + else if (url[0].equals("mailto")) + c.setSystem(ContactPointSystem.EMAIL); + else if (e.getAttribute("value").contains(":")) + c.setSystem(ContactPointSystem.OTHER); + else + c.setSystem(ContactPointSystem.PHONE); + c.setValue(url[1].trim()); + } + } + return c; + + } + + public HumanName makeNameFromEN(Element e) { + if (e == null) + return null; + HumanName hn = new HumanName(); + String use = e.getAttribute("use"); + if (use != null) { + if (use.equals("L")) + hn.setUse(NameUse.USUAL); + else if (use.equals("C")) + hn.setUse(NameUse.OFFICIAL); + else if (use.equals("P") || use.equals("A")) + hn.setUse(NameUse.ANONYMOUS); + else if (use.equals("TMP")) + hn.setUse(NameUse.TEMP); + else if (use.equals("BAD")) + hn.setUse(NameUse.OLD); + } + + Node n = e.getFirstChild(); + while (n != null) { + if (n.getNodeType() == Node.ELEMENT_NODE) { + String v = n.getTextContent(); + if (n.getLocalName().equals("family")) + hn.setFamilyElement(makeString(v)); + else if (n.getLocalName().equals("given")) + hn.getGiven().add(makeString(v)); + else if (n.getLocalName().equals("prefix")) + hn.getPrefix().add(makeString(v)); + else if (n.getLocalName().equals("suffix")) + hn.getSuffix().add(makeString(v)); + } + n = n.getNextSibling(); + } + return hn; + } + + public DateTimeType makeDateTimeFromTS(Element ts) throws Exception { + if (ts == null) + return null; + + String v = ts.getAttribute("value"); + if (Utilities.noString(v)) + return null; + + if (v.length() > 8 && !hasTimezone(v)) + v += defaultTimezone; + DateTimeType d = DateTimeType.parseV3(v); + return d; + } + + private boolean hasTimezone(String v) { + return v.contains("+") || v.contains("-") || v.endsWith("Z"); + } + + + public DateType makeDateFromTS(Element ts) throws Exception { + if (ts == null) + return null; + + String v = ts.getAttribute("value"); + if (Utilities.noString(v)) + return null; + DateType d = DateType.parseV3(v); + return d; + } + + public Period makePeriodFromIVL(Element ivl) throws Exception { + if (ivl == null) + return null; + Period p = new Period(); + Element low = cda.getChild(ivl, "low"); + if (low != null) + p.setStartElement(makeDateTimeFromTS(low)); + Element high = cda.getChild(ivl, "high"); + if (high != null) + p.setEndElement(makeDateTimeFromTS(high)); + + if (p.getStartElement() != null || p.getEndElement() != null) + return p; + else + return null; + } + + // this is a weird one - where CDA has an IVL, and FHIR has a date + public DateTimeType makeDateTimeFromIVL(Element ivl) throws Exception { + if (ivl == null) + return null; + if (ivl.hasAttribute("value")) + return makeDateTimeFromTS(ivl); + Element high = cda.getChild(ivl, "high"); + if (high != null) + return makeDateTimeFromTS(high); + Element low = cda.getChild(ivl, "low"); + if (low != null) + return makeDateTimeFromTS(low); + return null; + } + + public Type makeStringFromED(Element e) throws Exception { + if (e == null) + return null; + if (cda.getChild(e, "reference") != null) { + if (cda.getChild(e, "reference").getAttribute("value").startsWith("#")) { + Element t = cda.getByXmlId(cda.getChild(e, "reference").getAttribute("value").substring(1)); + String ot = t.getTextContent().trim(); + return Utilities.noString(ot) ? null : Factory.newString_(ot); + } else + throw new Exception("external references not handled yet "+cda.getChild(e, "reference").getAttribute("value")); + } + return Factory.newString_(e.getTextContent()); + } + + public Type makeTypeFromANY(Element e) throws Exception { + if (e == null) + return null; + String t = e.getAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "type"); + if (Utilities.noString(t)) + throw new Exception("Missing type on RIM attribute with type any"); + if (t.equals("CD") || t.equals("CE")) + return makeCodeableConceptFromCD(e); + else if (t.equals("ST")) + return makeStringFromED(e); + else + throw new Exception("Not done yet (type = "+t+")"); + } + + public Type makeMatchingTypeFromIVL(Element ivl) throws Exception { + if (ivl == null) + return null; + if (ivl.getAttribute("value") != null) + return makeDateTimeFromIVL(ivl); + if (cda.getChild(ivl, "low") != null || cda.getChild(ivl, "high") != null ) + return makePeriodFromIVL(ivl); + throw new Exception("not handled yet"); + } + + public Type makeCodeableConceptFromNullFlavor(String nf) throws Exception { + // Some nullFlavors have explicit values in value sets. This can only be called where there aren't. + if (nf == null || "".equals(nf)) + return null; + if ("NI".equals(nf)) + return null; // there's no code for this + if ("NA".equals(nf)) + return Factory.newCodeableConcept("unsupported", "http://hl7.org/fhir/data-absent-reason", "Unsupported"); // todo: is this reasonable? Why else would you use N/A? + if ("UNK".equals(nf)) + return Factory.newCodeableConcept("unknown", "http://hl7.org/fhir/data-absent-reason", "Unknown"); + if ("ASKU".equals(nf)) + return Factory.newCodeableConcept("asked", "http://hl7.org/fhir/data-absent-reason", "Asked/Unknown"); + if ("NAV".equals(nf)) + return Factory.newCodeableConcept("temp", "http://hl7.org/fhir/data-absent-reason", "Temporarily Unavailable"); + if ("NASK".equals(nf)) + return Factory.newCodeableConcept("notasked", "http://hl7.org/fhir/data-absent-reason", "Not Asked"); + if ("MSK".equals(nf)) + return Factory.newCodeableConcept("masked", "http://hl7.org/fhir/data-absent-reason", "Masked"); + if ("OTH".equals(nf)) + return null; // well, what should be done? + return null; // well, what should be done? + + } + + public Range makeRangeFromIVLPQ(Element ivlpq) throws Exception { + if (ivlpq == null) + return null; + Element low = cda.getChild(ivlpq, "low"); + Element high = cda.getChild(ivlpq, "high"); + if (low == null && high == null) + return null; + Range r = new Range(); + r.setLow(makeSimpleQuantityFromPQ(low, ivlpq.getAttribute("unit"))); + r.setHigh(makeSimpleQuantityFromPQ(high, ivlpq.getAttribute("unit"))); + return r; + } + + public Quantity makeQuantityFromPQ(Element pq) throws Exception { + return makeQuantityFromPQ(pq, null); + } + + public Quantity makeQuantityFromPQ(Element pq, String units) throws Exception { + if (pq == null) + return null; + Quantity qty = new Quantity(); + String n = pq.getAttribute("value").replace(",", "").trim(); + try { + qty.setValue(new BigDecimal(n)); + } catch (Exception e) { + throw new Exception("Unable to process value '"+n+"'", e); + } + units = Utilities.noString(pq.getAttribute("unit")) ? units : pq.getAttribute("unit"); + if (!Utilities.noString(units)) { + if (ucumSvc == null || ucumSvc.validate(units) != null) + qty.setUnit(units); + else { + qty.setCode(units); + qty.setSystem("http://unitsofmeasure.org"); + qty.setUnit(ucumSvc.getCommonDisplay(units)); + } + } + return qty; + } + + public SimpleQuantity makeSimpleQuantityFromPQ(Element pq, String units) throws Exception { + if (pq == null) + return null; + SimpleQuantity qty = new SimpleQuantity(); + String n = pq.getAttribute("value").replace(",", "").trim(); + try { + qty.setValue(new BigDecimal(n)); + } catch (Exception e) { + throw new Exception("Unable to process value '"+n+"'", e); + } + units = Utilities.noString(pq.getAttribute("unit")) ? units : pq.getAttribute("unit"); + if (!Utilities.noString(units)) { + if (ucumSvc == null || ucumSvc.validate(units) != null) + qty.setUnit(units); + else { + qty.setCode(units); + qty.setSystem("http://unitsofmeasure.org"); + qty.setUnit(ucumSvc.getCommonDisplay(units)); + } + } + return qty; + } + + public AdministrativeGender makeGenderFromCD(Element cd) throws Exception { + String code = cd.getAttribute("code"); + String system = cd.getAttribute("codeSystem"); + if ("2.16.840.1.113883.5.1".equals(system)) { + if ("F".equals(code)) + return AdministrativeGender.FEMALE; + if ("M".equals(code)) + return AdministrativeGender.MALE; + } + throw new Exception("Unable to read Gender "+system+"::"+code); + } + + /* + /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:EIVL_TS]: 389 + /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:EIVL_TS]/event: 389 + /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:IVL_TS]: 33470 + /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:IVL_TS]/high: 20566 + /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:IVL_TS]/high[nullFlavor:NA]: 9581 + /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:IVL_TS]/low: 32501 + /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:IVL_TS]/low[nullFlavor:UNK]: 969 + /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:PIVL_TS]: 17911 + /entry[COMP]/substanceAdministration[SBADM,EVN]/effectiveTime[type:PIVL_TS]/period: 17911 + */ + public Type makeSomethingFromGTS(List children) throws Exception { + if (children.isEmpty()) + return null; + if (children.size() == 1) { + String type = children.get(0).getAttribute("xsi:type"); + if (type.equals("IVL_TS")) + return makePeriodFromIVL(children.get(0)); + else + throw new Exception("Unknown GTS type '"+type+"'"); + } + CommaSeparatedStringBuilder t = new CommaSeparatedStringBuilder(); + for (Element c : children) + t.append(c.getAttribute("xsi:type")); + if (t.toString().equals("IVL_TS, PIVL_TS")) + return makeTimingFromBoundedPIVL(children.get(0), children.get(1)); + if (t.toString().equals("IVL_TS, EIVL_TS")) + return makeTimingFromBoundedEIVL(children.get(0), children.get(1)); + throw new Exception("Unknown GTS pattern '"+t.toString()+"'"); + } + + private Type makeTimingFromBoundedEIVL(Element ivl, Element eivl) throws Exception { + Timing t = new Timing(); + t.setRepeat(new TimingRepeatComponent()); + Element e = cda.getChild(eivl, "event"); + t.getRepeat().setBounds(makePeriodFromIVL(ivl)); + t.getRepeat().addWhen(convertEventTiming(e.getAttribute("code"))); + return t; + } + + private EventTiming convertEventTiming(String e) throws Exception { + if ("HS".equals(e)) + return EventTiming.HS; + throw new Exception("Unknown event "+e); + } + + private Timing makeTimingFromBoundedPIVL(Element ivl, Element pivl) throws Exception { + Timing t = new Timing(); + t.setRepeat(new TimingRepeatComponent()); + Element p = cda.getChild(pivl, "period"); + t.getRepeat().setBounds(makePeriodFromIVL(ivl)); + t.getRepeat().setPeriod(new BigDecimal(p.getAttribute("value"))); + t.getRepeat().setPeriodUnit(convertTimeUnit(p.getAttribute("unit"))); + return t; + } + + private UnitsOfTime convertTimeUnit(String u) throws Exception { + if ("h".equals(u)) + return UnitsOfTime.H; + if ("d".equals(u)) + return UnitsOfTime.D; + if ("w".equals(u)) + return UnitsOfTime.WK; + throw new Exception("Unknown unit of time "+u); + } + + public Set getOids() { + return oids; + } + + public boolean isGenerateMissingExtensions() { + return generateMissingExtensions; + } + + public void setGenerateMissingExtensions(boolean generateMissingExtensions) { + this.generateMissingExtensions = generateMissingExtensions; + } + + +} diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/ConverterBase.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/ConverterBase.java index 613556746d3..5f9d4f0ce22 100644 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/ConverterBase.java +++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/ConverterBase.java @@ -20,7 +20,7 @@ package org.hl7.fhir.convertors; * #L% */ - -public class ConverterBase { - -} + +public class ConverterBase { + +} diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor.java index 785f53c8d3b..ba9806cd30b 100644 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor.java +++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertorAdvisor.java @@ -20,19 +20,19 @@ package org.hl7.fhir.convertors; * #L% */ - -import org.hl7.fhir.dstu3.model.CodeSystem; -import org.hl7.fhir.dstu3.model.ValueSet; -import org.hl7.fhir.exceptions.FHIRException; - -public interface VersionConvertorAdvisor { - boolean ignoreEntry(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src); - - // called ? - org.hl7.fhir.instance.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(CodeSystem tgtcs, ValueSet source); - - CodeSystem getCodeSystem(ValueSet src); -} \ No newline at end of file + +import org.hl7.fhir.dstu3.model.CodeSystem; +import org.hl7.fhir.dstu3.model.ValueSet; +import org.hl7.fhir.exceptions.FHIRException; + +public interface VersionConvertorAdvisor { + boolean ignoreEntry(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src); + + // called ? + org.hl7.fhir.instance.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(CodeSystem tgtcs, ValueSet source); + + CodeSystem getCodeSystem(ValueSet src); +} diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_20.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_20.java index ed8acdf4260..2cc4313fd9a 100644 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_20.java +++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_20.java @@ -20,13093 +20,13093 @@ package org.hl7.fhir.convertors; * #L% */ - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.codec.binary.Base64; -import org.hl7.fhir.instance.model.CodeableConcept; -import org.hl7.fhir.instance.model.Reference; -import org.hl7.fhir.dstu2.utils.ToolingExtensions; -import org.hl7.fhir.dstu3.conformance.ProfileUtilities; -import org.hl7.fhir.dstu3.model.Annotation; -import org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction; -import org.hl7.fhir.dstu3.model.CodeSystem; -import org.hl7.fhir.dstu3.model.Coding; -import org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode; -import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent; -import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent; -import org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority; -import org.hl7.fhir.dstu3.model.ConceptMap; -import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent; -import org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent; -import org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus; -import org.hl7.fhir.dstu3.model.Dosage; -import org.hl7.fhir.dstu3.model.ElementDefinition; -import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; -import org.hl7.fhir.dstu3.model.Enumeration; -import org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent; -import org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority; -import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind; -import org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule; -import org.hl7.fhir.dstu3.model.Timing.EventTiming; -import org.hl7.fhir.dstu3.model.UriType; -import org.hl7.fhir.dstu3.terminologies.CodeSystemUtilities; -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.utilities.Utilities; - -/* - 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 Thu, Apr 7, 2016 02:14+1000 for FHIR v1.4.0 - - -public class VersionConvertor_10_20 { - - public VersionConvertorAdvisor advisor; - - public VersionConvertor_10_20(VersionConvertorAdvisor advisor) { - super(); - this.advisor = advisor; - } - - public void copyElement(org.hl7.fhir.instance.model.Element src, org.hl7.fhir.dstu3.model.Element tgt) throws FHIRException { - tgt.setId(src.getId()); - for (org.hl7.fhir.instance.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); - } - } - - public void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.instance.model.Element tgt) throws FHIRException { - tgt.setId(src.getId()); - for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); - } - } - - public void copyElement(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.instance.model.Element tgt) throws FHIRException { - tgt.setId(src.getId()); - for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); - } - } - - public void copyBackboneElement(org.hl7.fhir.instance.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - public void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.instance.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - public org.hl7.fhir.dstu3.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.instance.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.dstu3.model.Base64BinaryType tgt = new org.hl7.fhir.dstu3.model.Base64BinaryType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu3.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.instance.model.Base64BinaryType tgt = new org.hl7.fhir.instance.model.Base64BinaryType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.BooleanType convertBoolean(org.hl7.fhir.instance.model.BooleanType src) throws FHIRException { - org.hl7.fhir.dstu3.model.BooleanType tgt = new org.hl7.fhir.dstu3.model.BooleanType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.BooleanType convertBoolean(org.hl7.fhir.dstu3.model.BooleanType src) throws FHIRException { - org.hl7.fhir.instance.model.BooleanType tgt = new org.hl7.fhir.instance.model.BooleanType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CodeType convertCode(org.hl7.fhir.instance.model.CodeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.CodeType convertCode(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { - org.hl7.fhir.instance.model.CodeType tgt = new org.hl7.fhir.instance.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.UriType convertCodeToUri(org.hl7.fhir.instance.model.CodeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.CodeType convertUriToCode(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { - org.hl7.fhir.instance.model.CodeType tgt = new org.hl7.fhir.instance.model.CodeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.instance.model.DateType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.instance.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { - org.hl7.fhir.instance.model.DateType tgt = new org.hl7.fhir.instance.model.DateType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.instance.model.DateType tgt = new org.hl7.fhir.instance.model.DateType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DateTimeType convertDateTime(org.hl7.fhir.instance.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.DateTimeType convertDateTime(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.instance.model.DateTimeType tgt = new org.hl7.fhir.instance.model.DateTimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DecimalType convertDecimal(org.hl7.fhir.instance.model.DecimalType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.DecimalType convertDecimal(org.hl7.fhir.dstu3.model.DecimalType src) throws FHIRException { - org.hl7.fhir.instance.model.DecimalType tgt = new org.hl7.fhir.instance.model.DecimalType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.IdType convertId(org.hl7.fhir.instance.model.IdType src) throws FHIRException { - org.hl7.fhir.dstu3.model.IdType tgt = new org.hl7.fhir.dstu3.model.IdType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.IdType convertId(org.hl7.fhir.dstu3.model.IdType src) throws FHIRException { - org.hl7.fhir.instance.model.IdType tgt = new org.hl7.fhir.instance.model.IdType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.InstantType convertInstant(org.hl7.fhir.instance.model.InstantType src) throws FHIRException { - org.hl7.fhir.dstu3.model.InstantType tgt = new org.hl7.fhir.dstu3.model.InstantType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.InstantType convertInstant(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException { - org.hl7.fhir.instance.model.InstantType tgt = new org.hl7.fhir.instance.model.InstantType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.IntegerType convertInteger(org.hl7.fhir.instance.model.IntegerType src) throws FHIRException { - org.hl7.fhir.dstu3.model.IntegerType tgt = new org.hl7.fhir.dstu3.model.IntegerType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.IntegerType convertInteger(org.hl7.fhir.dstu3.model.IntegerType src) throws FHIRException { - org.hl7.fhir.instance.model.IntegerType tgt = new org.hl7.fhir.instance.model.IntegerType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MarkdownType convertMarkdown(org.hl7.fhir.instance.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.dstu3.model.MarkdownType tgt = new org.hl7.fhir.dstu3.model.MarkdownType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu3.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.instance.model.MarkdownType tgt = new org.hl7.fhir.instance.model.MarkdownType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OidType convertOid(org.hl7.fhir.instance.model.OidType src) throws FHIRException { - org.hl7.fhir.dstu3.model.OidType tgt = new org.hl7.fhir.dstu3.model.OidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.OidType convertOid(org.hl7.fhir.dstu3.model.OidType src) throws FHIRException { - org.hl7.fhir.instance.model.OidType tgt = new org.hl7.fhir.instance.model.OidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.PositiveIntType convertPositiveInt(org.hl7.fhir.instance.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.dstu3.model.PositiveIntType tgt = new org.hl7.fhir.dstu3.model.PositiveIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu3.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.instance.model.PositiveIntType tgt = new org.hl7.fhir.instance.model.PositiveIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.StringType convertString(org.hl7.fhir.instance.model.StringType src) throws FHIRException { - org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.StringType convertString(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException { - org.hl7.fhir.instance.model.StringType tgt = new org.hl7.fhir.instance.model.StringType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.instance.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.TimeType tgt = new org.hl7.fhir.dstu3.model.TimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { - org.hl7.fhir.instance.model.TimeType tgt = new org.hl7.fhir.instance.model.TimeType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.instance.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UnsignedIntType tgt = new org.hl7.fhir.dstu3.model.UnsignedIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu3.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.instance.model.UnsignedIntType tgt = new org.hl7.fhir.instance.model.UnsignedIntType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.UriType convertUri(org.hl7.fhir.instance.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.UriType convertUri(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { - org.hl7.fhir.instance.model.UriType tgt = new org.hl7.fhir.instance.model.UriType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.UuidType convertUuid(org.hl7.fhir.instance.model.UuidType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UuidType tgt = new org.hl7.fhir.dstu3.model.UuidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.instance.model.UuidType convertUuid(org.hl7.fhir.dstu3.model.UuidType src) throws FHIRException { - org.hl7.fhir.instance.model.UuidType tgt = new org.hl7.fhir.instance.model.UuidType(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Extension convertExtension(org.hl7.fhir.instance.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Extension tgt = new org.hl7.fhir.dstu3.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.instance.model.Extension convertExtension(org.hl7.fhir.dstu3.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Extension tgt = new org.hl7.fhir.instance.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.instance.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - public org.hl7.fhir.instance.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Narrative tgt = new org.hl7.fhir.instance.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.instance.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Annotation convertAnnotation(org.hl7.fhir.instance.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Annotation tgt = new org.hl7.fhir.dstu3.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.instance.model.Annotation convertAnnotation(org.hl7.fhir.dstu3.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Annotation tgt = new org.hl7.fhir.instance.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Attachment convertAttachment(org.hl7.fhir.instance.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Attachment tgt = new org.hl7.fhir.dstu3.model.Attachment(); - copyElement(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setLanguage(src.getLanguage()); - tgt.setData(src.getData()); - tgt.setUrl(src.getUrl()); - tgt.setSize(src.getSize()); - tgt.setHash(src.getHash()); - tgt.setTitle(src.getTitle()); - tgt.setCreation(src.getCreation()); - return tgt; - } - - public org.hl7.fhir.instance.model.Attachment convertAttachment(org.hl7.fhir.dstu3.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Attachment tgt = new org.hl7.fhir.instance.model.Attachment(); - copyElement(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setLanguage(src.getLanguage()); - tgt.setData(src.getData()); - tgt.setUrl(src.getUrl()); - tgt.setSize(src.getSize()); - tgt.setHash(src.getHash()); - tgt.setTitle(src.getTitle()); - tgt.setCreation(src.getCreation()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.instance.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeableConcept tgt = new org.hl7.fhir.dstu3.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.instance.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.CodeableConcept tgt = new org.hl7.fhir.instance.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.instance.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public org.hl7.fhir.instance.model.Coding convertCoding(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Coding tgt = new org.hl7.fhir.instance.model.Coding(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - - - public org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.instance.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); - copyElement(src, tgt); - tgt.setUse(convertIdentifierUse(src.getUse())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setSystem(src.getSystem()); - tgt.setValue(src.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public org.hl7.fhir.instance.model.Identifier convertIdentifier(org.hl7.fhir.dstu3.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Identifier tgt = new org.hl7.fhir.instance.model.Identifier(); - copyElement(src, tgt); - if (src.hasUse()) - tgt.setUse(convertIdentifierUse(src.getUse())); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - if (src.hasAssigner()) - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.instance.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.NULL; - } - } - - public org.hl7.fhir.instance.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Period convertPeriod(org.hl7.fhir.instance.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Period tgt = new org.hl7.fhir.dstu3.model.Period(); - copyElement(src, tgt); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - return tgt; - } - - public org.hl7.fhir.instance.model.Period convertPeriod(org.hl7.fhir.dstu3.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Period tgt = new org.hl7.fhir.instance.model.Period(); - copyElement(src, tgt); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Quantity convertQuantity(org.hl7.fhir.instance.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Quantity tgt = new org.hl7.fhir.dstu3.model.Quantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.instance.model.Quantity convertQuantity(org.hl7.fhir.dstu3.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Quantity tgt = new org.hl7.fhir.instance.model.Quantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.instance.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.NULL; - } - } - - public org.hl7.fhir.instance.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Range convertRange(org.hl7.fhir.instance.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Range tgt = new org.hl7.fhir.dstu3.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public org.hl7.fhir.instance.model.Range convertRange(org.hl7.fhir.dstu3.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Range tgt = new org.hl7.fhir.instance.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Ratio convertRatio(org.hl7.fhir.instance.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Ratio tgt = new org.hl7.fhir.dstu3.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public org.hl7.fhir.instance.model.Ratio convertRatio(org.hl7.fhir.dstu3.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Ratio tgt = new org.hl7.fhir.instance.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.instance.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); - copyElement(src, tgt); - tgt.setReference(src.getReference()); - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public org.hl7.fhir.instance.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Reference tgt = new org.hl7.fhir.instance.model.Reference(); - copyElement(src, tgt); - tgt.setReference(src.getReference()); - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.SampledData convertSampledData(org.hl7.fhir.instance.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SampledData tgt = new org.hl7.fhir.dstu3.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - tgt.setFactor(src.getFactor()); - tgt.setLowerLimit(src.getLowerLimit()); - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public org.hl7.fhir.instance.model.SampledData convertSampledData(org.hl7.fhir.dstu3.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.SampledData tgt = new org.hl7.fhir.instance.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - tgt.setFactor(src.getFactor()); - tgt.setLowerLimit(src.getLowerLimit()); - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Signature convertSignature(org.hl7.fhir.instance.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Signature tgt = new org.hl7.fhir.dstu3.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - tgt.setWho(convertType(src.getWho())); - tgt.setContentType(src.getContentType()); - tgt.setBlob(src.getBlob()); - return tgt; - } - - public org.hl7.fhir.instance.model.Signature convertSignature(org.hl7.fhir.dstu3.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Signature tgt = new org.hl7.fhir.instance.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - tgt.setWho(convertType(src.getWho())); - tgt.setContentType(src.getContentType()); - tgt.setBlob(src.getBlob()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Address convertAddress(org.hl7.fhir.instance.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Address tgt = new org.hl7.fhir.dstu3.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - tgt.setText(src.getText()); - for (org.hl7.fhir.instance.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - tgt.setCity(src.getCity()); - tgt.setDistrict(src.getDistrict()); - tgt.setState(src.getState()); - tgt.setPostalCode(src.getPostalCode()); - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.Address convertAddress(org.hl7.fhir.dstu3.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Address tgt = new org.hl7.fhir.instance.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - tgt.setCity(src.getCity()); - tgt.setDistrict(src.getDistrict()); - tgt.setState(src.getState()); - tgt.setPostalCode(src.getPostalCode()); - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Address.AddressUse convertAddressUse(org.hl7.fhir.instance.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu3.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.dstu3.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.dstu3.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.dstu3.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.dstu3.model.Address.AddressUse.NULL; - } - } - - public org.hl7.fhir.instance.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu3.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.instance.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.instance.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.instance.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.instance.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.instance.model.Address.AddressUse.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Address.AddressType convertAddressType(org.hl7.fhir.instance.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.dstu3.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.dstu3.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.dstu3.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.dstu3.model.Address.AddressType.NULL; - } - } - - public org.hl7.fhir.instance.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu3.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.instance.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.instance.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.instance.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.instance.model.Address.AddressType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactPoint convertContactPoint(org.hl7.fhir.instance.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactPoint tgt = new org.hl7.fhir.dstu3.model.ContactPoint(); - copyElement(src, tgt); - tgt.setSystem(convertContactPointSystem(src.getSystem())); - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu3.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ContactPoint tgt = new org.hl7.fhir.instance.model.ContactPoint(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(convertContactPointSystem(src.getSystem())); - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - tgt.setRank(src.getRank()); - if (src.hasPeriod()) - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER; - case OTHER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL; - } - } - - public org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.PAGER; - case OTHER: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.OTHER; - case URL: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.instance.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL; - } - } - - public org.hl7.fhir.instance.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ElementDefinition convertElementDefinition(org.hl7.fhir.instance.model.ElementDefinition src, List slicePaths) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition tgt = new org.hl7.fhir.dstu3.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.instance.model.Enumeration t : src.getRepresentation()) - tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); - if (src.hasName()) { - if (slicePaths.contains(src.getPath())) - tgt.setSliceName(src.getName()); - tgt.setId(src.getName()); - } - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.instance.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComments()) - tgt.setComment(src.getComments()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.instance.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasNameReference()) - tgt.setContentReference("#"+src.getNameReference()); - for (org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent t : src.getType()) - tgt.addType(convertElementDefinitionTypeComponent(t)); - if (src.hasDefaultValue()) - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - if (src.hasFixed()) - tgt.setFixed(convertType(src.getFixed())); - if (src.hasPattern()) - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); - if (src.hasMinValue()) - tgt.setMinValue(convertType(src.getMinValue())); - if (src.hasMaxValue()) - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.instance.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ElementDefinition tgt = new org.hl7.fhir.instance.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getRepresentation()) - tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); - if (src.hasSliceName()) - tgt.setName(src.getSliceName()); - else - tgt.setName(src.getId()); - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - tgt.setShort(src.getShort()); - tgt.setDefinition(src.getDefinition()); - tgt.setComments(src.getComment()); - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setNameReference(src.getContentReference().substring(1)); - for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) - tgt.addType(convertElementDefinitionTypeComponent(t)); - tgt.setDefaultValue(convertType(src.getDefaultValue())); - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - tgt.setFixed(convertType(src.getFixed())); - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.setExample(convertType(src.getExampleFirstRep().getValue())); - tgt.setMinValue(convertType(src.getMinValue())); - tgt.setMaxValue(convertType(src.getMaxValue())); - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.dstu3.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - tgt.setMustSupport(src.getMustSupport()); - tgt.setIsModifier(src.getIsModifier()); - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL; - } - } - - public org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation.XMLATTR; - default: return org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.StringType t : src.getDiscriminator()) - tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue())); - tgt.setDescription(src.getDescription()); - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) - tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); - tgt.setDescription(src.getDescription()); - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.instance.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.NULL; - } - } - - public org.hl7.fhir.instance.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCodeElement(convertCodeToUri(src.getCodeElement())); - for (org.hl7.fhir.instance.model.UriType t : src.getProfile()) - if (src.hasCode() && "Reference".equals(src.getCode())) - tgt.setTargetProfile(t.getValueAsString()); - else - tgt.setProfile(t.getValue()); - for (org.hl7.fhir.instance.model.Enumeration t : src.getAggregation()) - tgt.addAggregation(convertAggregationMode(t.getValue())); - return tgt; - } - - public org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCodeElement(convertUriToCode(src.getCodeElement())); - if (src.hasCode() && "Reference".equals(src.getCode())) { - if (src.hasTargetProfile()) - tgt.addProfile(src.getTargetProfile()); - } else if (src.hasProfile()) - tgt.addProfile(src.getProfile()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getAggregation()) - tgt.addAggregation(convertAggregationMode(t.getValue())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.instance.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.NULL; - } - } - - public org.hl7.fhir.instance.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - ToolingExtensions.addStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.NULL; - } - } - - public org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setDescription(src.getDescription()); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setDescription(src.getDescription()); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.instance.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.NULL; - } - } - - public org.hl7.fhir.instance.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.instance.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - tgt.setText(src.getText()); - for (org.hl7.fhir.instance.model.StringType t : src.getFamily()) - tgt.setFamily(t.getValue()); - for (org.hl7.fhir.instance.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.instance.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.instance.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.HumanName convertHumanName(org.hl7.fhir.dstu3.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.HumanName tgt = new org.hl7.fhir.instance.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - tgt.setText(src.getText()); - if (src.hasFamily()) - tgt.addFamily(src.getFamily()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.HumanName.NameUse convertNameUse(org.hl7.fhir.instance.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu3.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.dstu3.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.dstu3.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NULL; - } - } - - public org.hl7.fhir.instance.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu3.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.instance.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.instance.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.instance.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.instance.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.instance.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.instance.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.instance.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.instance.model.HumanName.NameUse.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.instance.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); - copyElement(src, tgt); - tgt.setVersionId(src.getVersionId()); - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.instance.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.instance.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.instance.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Meta convertMeta(org.hl7.fhir.dstu3.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Meta tgt = new org.hl7.fhir.instance.model.Meta(); - copyElement(src, tgt); - tgt.setVersionId(src.getVersionId()); - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Timing convertTiming(org.hl7.fhir.instance.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Timing tgt = new org.hl7.fhir.dstu3.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.instance.model.Timing convertTiming(org.hl7.fhir.dstu3.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Timing tgt = new org.hl7.fhir.instance.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.instance.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - tgt.setCount(src.getCount()); - tgt.setDuration(src.getDuration()); - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnits())); - tgt.setFrequency(src.getFrequency()); - tgt.setFrequencyMax(src.getFrequencyMax()); - tgt.setPeriod(src.getPeriod()); - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnits())); - tgt.addWhen(convertEventTiming(src.getWhen())); - return tgt; - } - - public org.hl7.fhir.instance.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.instance.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - tgt.setCount(src.getCount()); - tgt.setDuration(src.getDuration()); - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnits(convertUnitsOfTime(src.getDurationUnit())); - tgt.setFrequency(src.getFrequency()); - tgt.setFrequencyMax(src.getFrequencyMax()); - tgt.setPeriod(src.getPeriod()); - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnits(convertUnitsOfTime(src.getPeriodUnit())); - for (Enumeration t : src.getWhen()) - tgt.setWhen(convertEventTiming(t.getValue())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.instance.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.NULL; - } - } - - public org.hl7.fhir.instance.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.instance.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.dstu3.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.dstu3.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.dstu3.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.dstu3.model.Timing.EventTiming.NULL; - } - } - - public org.hl7.fhir.instance.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu3.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.instance.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.instance.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.instance.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.instance.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.instance.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.instance.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.instance.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.instance.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.instance.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.instance.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.instance.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.instance.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.instance.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.instance.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.instance.model.Timing.EventTiming.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Age convertAge(org.hl7.fhir.instance.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Age tgt = new org.hl7.fhir.dstu3.model.Age(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.instance.model.Age convertAge(org.hl7.fhir.dstu3.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Age tgt = new org.hl7.fhir.instance.model.Age(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Count convertCount(org.hl7.fhir.instance.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Count tgt = new org.hl7.fhir.dstu3.model.Count(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.instance.model.Count convertCount(org.hl7.fhir.dstu3.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Count tgt = new org.hl7.fhir.instance.model.Count(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Distance convertDistance(org.hl7.fhir.instance.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Distance tgt = new org.hl7.fhir.dstu3.model.Distance(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.instance.model.Distance convertDistance(org.hl7.fhir.dstu3.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Distance tgt = new org.hl7.fhir.instance.model.Distance(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Duration convertDuration(org.hl7.fhir.instance.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Duration tgt = new org.hl7.fhir.dstu3.model.Duration(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.instance.model.Duration convertDuration(org.hl7.fhir.dstu3.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Duration tgt = new org.hl7.fhir.instance.model.Duration(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Money convertMoney(org.hl7.fhir.instance.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Money tgt = new org.hl7.fhir.dstu3.model.Money(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.instance.model.Money convertMoney(org.hl7.fhir.dstu3.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Money tgt = new org.hl7.fhir.instance.model.Money(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.instance.model.SimpleQuantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SimpleQuantity tgt = new org.hl7.fhir.dstu3.model.SimpleQuantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.instance.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.SimpleQuantity tgt = new org.hl7.fhir.instance.model.SimpleQuantity(); - copyElement(src, tgt); - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - tgt.setUnit(src.getUnit()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Type convertType(org.hl7.fhir.instance.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.instance.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.instance.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.instance.model.BooleanType) - return convertBoolean((org.hl7.fhir.instance.model.BooleanType) src); - if (src instanceof org.hl7.fhir.instance.model.CodeType) - return convertCode((org.hl7.fhir.instance.model.CodeType) src); - if (src instanceof org.hl7.fhir.instance.model.DateType) - return convertDate((org.hl7.fhir.instance.model.DateType) src); - if (src instanceof org.hl7.fhir.instance.model.DateTimeType) - return convertDateTime((org.hl7.fhir.instance.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.instance.model.DecimalType) - return convertDecimal((org.hl7.fhir.instance.model.DecimalType) src); - if (src instanceof org.hl7.fhir.instance.model.IdType) - return convertId((org.hl7.fhir.instance.model.IdType) src); - if (src instanceof org.hl7.fhir.instance.model.InstantType) - return convertInstant((org.hl7.fhir.instance.model.InstantType) src); - if (src instanceof org.hl7.fhir.instance.model.IntegerType) - return convertInteger((org.hl7.fhir.instance.model.IntegerType) src); - if (src instanceof org.hl7.fhir.instance.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.instance.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.instance.model.OidType) - return convertOid((org.hl7.fhir.instance.model.OidType) src); - if (src instanceof org.hl7.fhir.instance.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.instance.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.instance.model.StringType) - return convertString((org.hl7.fhir.instance.model.StringType) src); - if (src instanceof org.hl7.fhir.instance.model.TimeType) - return convertTime((org.hl7.fhir.instance.model.TimeType) src); - if (src instanceof org.hl7.fhir.instance.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.instance.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.instance.model.UriType) - return convertUri((org.hl7.fhir.instance.model.UriType) src); - if (src instanceof org.hl7.fhir.instance.model.UuidType) - return convertUuid((org.hl7.fhir.instance.model.UuidType) src); - if (src instanceof org.hl7.fhir.instance.model.Extension) - return convertExtension((org.hl7.fhir.instance.model.Extension) src); - if (src instanceof org.hl7.fhir.instance.model.Narrative) - return convertNarrative((org.hl7.fhir.instance.model.Narrative) src); - if (src instanceof org.hl7.fhir.instance.model.Annotation) - return convertAnnotation((org.hl7.fhir.instance.model.Annotation) src); - if (src instanceof org.hl7.fhir.instance.model.Attachment) - return convertAttachment((org.hl7.fhir.instance.model.Attachment) src); - if (src instanceof org.hl7.fhir.instance.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.instance.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.instance.model.Coding) - return convertCoding((org.hl7.fhir.instance.model.Coding) src); - if (src instanceof org.hl7.fhir.instance.model.Identifier) - return convertIdentifier((org.hl7.fhir.instance.model.Identifier) src); - if (src instanceof org.hl7.fhir.instance.model.Period) - return convertPeriod((org.hl7.fhir.instance.model.Period) src); - if (src instanceof org.hl7.fhir.instance.model.Quantity) - return convertQuantity((org.hl7.fhir.instance.model.Quantity) src); - if (src instanceof org.hl7.fhir.instance.model.Range) - return convertRange((org.hl7.fhir.instance.model.Range) src); - if (src instanceof org.hl7.fhir.instance.model.Ratio) - return convertRatio((org.hl7.fhir.instance.model.Ratio) src); - if (src instanceof org.hl7.fhir.instance.model.Reference) - return convertReference((org.hl7.fhir.instance.model.Reference) src); - if (src instanceof org.hl7.fhir.instance.model.SampledData) - return convertSampledData((org.hl7.fhir.instance.model.SampledData) src); - if (src instanceof org.hl7.fhir.instance.model.Signature) - return convertSignature((org.hl7.fhir.instance.model.Signature) src); - if (src instanceof org.hl7.fhir.instance.model.Address) - return convertAddress((org.hl7.fhir.instance.model.Address) src); - if (src instanceof org.hl7.fhir.instance.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.instance.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.instance.model.ElementDefinition) - return convertElementDefinition((org.hl7.fhir.instance.model.ElementDefinition) src, new ArrayList()); - if (src instanceof org.hl7.fhir.instance.model.HumanName) - return convertHumanName((org.hl7.fhir.instance.model.HumanName) src); - if (src instanceof org.hl7.fhir.instance.model.Meta) - return convertMeta((org.hl7.fhir.instance.model.Meta) src); - if (src instanceof org.hl7.fhir.instance.model.Timing) - return convertTiming((org.hl7.fhir.instance.model.Timing) src); - if (src instanceof org.hl7.fhir.instance.model.Age) - return convertAge((org.hl7.fhir.instance.model.Age) src); - if (src instanceof org.hl7.fhir.instance.model.Count) - return convertCount((org.hl7.fhir.instance.model.Count) src); - if (src instanceof org.hl7.fhir.instance.model.Distance) - return convertDistance((org.hl7.fhir.instance.model.Distance) src); - if (src instanceof org.hl7.fhir.instance.model.Duration) - return convertDuration((org.hl7.fhir.instance.model.Duration) src); - if (src instanceof org.hl7.fhir.instance.model.Money) - return convertMoney((org.hl7.fhir.instance.model.Money) src); - if (src instanceof org.hl7.fhir.instance.model.SimpleQuantity) - return convertSimpleQuantity((org.hl7.fhir.instance.model.SimpleQuantity) src); - throw new Error("Unknown type "+src.getClass()); - } - - public org.hl7.fhir.instance.model.Type convertType(org.hl7.fhir.dstu3.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu3.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.dstu3.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.dstu3.model.BooleanType) - return convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeType) - return convertCode((org.hl7.fhir.dstu3.model.CodeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DateType) - return convertDate((org.hl7.fhir.dstu3.model.DateType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DateTimeType) - return convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DecimalType) - return convertDecimal((org.hl7.fhir.dstu3.model.DecimalType) src); - if (src instanceof org.hl7.fhir.dstu3.model.IdType) - return convertId((org.hl7.fhir.dstu3.model.IdType) src); - if (src instanceof org.hl7.fhir.dstu3.model.InstantType) - return convertInstant((org.hl7.fhir.dstu3.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); - if (src instanceof org.hl7.fhir.dstu3.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.dstu3.model.OidType) - return convertOid((org.hl7.fhir.dstu3.model.OidType) src); - if (src instanceof org.hl7.fhir.dstu3.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.dstu3.model.StringType) - return convertString((org.hl7.fhir.dstu3.model.StringType) src); - if (src instanceof org.hl7.fhir.dstu3.model.TimeType) - return convertTime((org.hl7.fhir.dstu3.model.TimeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UriType) - return convertUri((org.hl7.fhir.dstu3.model.UriType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UuidType) - return convertUuid((org.hl7.fhir.dstu3.model.UuidType) src); - if (src instanceof org.hl7.fhir.dstu3.model.Extension) - return convertExtension((org.hl7.fhir.dstu3.model.Extension) src); - if (src instanceof org.hl7.fhir.dstu3.model.Narrative) - return convertNarrative((org.hl7.fhir.dstu3.model.Narrative) src); - if (src instanceof org.hl7.fhir.dstu3.model.Annotation) - return convertAnnotation((org.hl7.fhir.dstu3.model.Annotation) src); - if (src instanceof org.hl7.fhir.dstu3.model.Attachment) - return convertAttachment((org.hl7.fhir.dstu3.model.Attachment) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.dstu3.model.Coding) - return convertCoding((org.hl7.fhir.dstu3.model.Coding) src); - if (src instanceof org.hl7.fhir.dstu3.model.Identifier) - return convertIdentifier((org.hl7.fhir.dstu3.model.Identifier) src); - if (src instanceof org.hl7.fhir.dstu3.model.Period) - return convertPeriod((org.hl7.fhir.dstu3.model.Period) src); - if (src instanceof org.hl7.fhir.dstu3.model.Quantity) - return convertQuantity((org.hl7.fhir.dstu3.model.Quantity) src); - if (src instanceof org.hl7.fhir.dstu3.model.Range) - return convertRange((org.hl7.fhir.dstu3.model.Range) src); - if (src instanceof org.hl7.fhir.dstu3.model.Ratio) - return convertRatio((org.hl7.fhir.dstu3.model.Ratio) src); - if (src instanceof org.hl7.fhir.dstu3.model.Reference) - return convertReference((org.hl7.fhir.dstu3.model.Reference) src); - if (src instanceof org.hl7.fhir.dstu3.model.SampledData) - return convertSampledData((org.hl7.fhir.dstu3.model.SampledData) src); - if (src instanceof org.hl7.fhir.dstu3.model.Signature) - return convertSignature((org.hl7.fhir.dstu3.model.Signature) src); - if (src instanceof org.hl7.fhir.dstu3.model.Address) - return convertAddress((org.hl7.fhir.dstu3.model.Address) src); - if (src instanceof org.hl7.fhir.dstu3.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.dstu3.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.dstu3.model.ElementDefinition) - return convertElementDefinition((org.hl7.fhir.dstu3.model.ElementDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.HumanName) - return convertHumanName((org.hl7.fhir.dstu3.model.HumanName) src); - if (src instanceof org.hl7.fhir.dstu3.model.Meta) - return convertMeta((org.hl7.fhir.dstu3.model.Meta) src); - if (src instanceof org.hl7.fhir.dstu3.model.Timing) - return convertTiming((org.hl7.fhir.dstu3.model.Timing) src); - if (src instanceof org.hl7.fhir.dstu3.model.Age) - return convertAge((org.hl7.fhir.dstu3.model.Age) src); - if (src instanceof org.hl7.fhir.dstu3.model.Count) - return convertCount((org.hl7.fhir.dstu3.model.Count) src); - if (src instanceof org.hl7.fhir.dstu3.model.Distance) - return convertDistance((org.hl7.fhir.dstu3.model.Distance) src); - if (src instanceof org.hl7.fhir.dstu3.model.Duration) - return convertDuration((org.hl7.fhir.dstu3.model.Duration) src); - if (src instanceof org.hl7.fhir.dstu3.model.Money) - return convertMoney((org.hl7.fhir.dstu3.model.Money) src); - if (src instanceof org.hl7.fhir.dstu3.model.SimpleQuantity) - return convertSimpleQuantity((org.hl7.fhir.dstu3.model.SimpleQuantity) src); - throw new Error("Unknown type "+src.fhirType()); - } - - public void copyDomainResource(org.hl7.fhir.instance.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException { - copyResource(src, tgt); - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.instance.model.Resource t : src.getContained()) - tgt.addContained(convertResource(t)); - for (org.hl7.fhir.instance.model.Extension t : src.getExtension()) - tgt.addExtension(convertExtension(t)); - for (org.hl7.fhir.instance.model.Extension t : src.getModifierExtension()) - tgt.addModifierExtension(convertExtension(t)); - } - public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.instance.model.DomainResource tgt) throws FHIRException { - copyResource(src, tgt); - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.dstu3.model.Resource t : src.getContained()) - tgt.getContained().add(convertResource(t)); - for (org.hl7.fhir.dstu3.model.Extension t : src.getExtension()) - tgt.addExtension(convertExtension(t)); - for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension()) - tgt.addModifierExtension(convertExtension(t)); - } - - public org.hl7.fhir.dstu3.model.Parameters convertParameters(org.hl7.fhir.instance.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Parameters tgt = new org.hl7.fhir.dstu3.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Parameters convertParameters(org.hl7.fhir.dstu3.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Parameters tgt = new org.hl7.fhir.instance.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - public void copyResource(org.hl7.fhir.instance.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException { - tgt.setId(src.getId()); - tgt.setMeta(convertMeta(src.getMeta())); - tgt.setImplicitRules(src.getImplicitRules()); - tgt.setLanguage(src.getLanguage()); - } - public void copyResource(org.hl7.fhir.dstu3.model.Resource src, org.hl7.fhir.instance.model.Resource tgt) throws FHIRException { - tgt.setId(src.getId()); - if (src.hasMeta()) - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - - public org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.instance.model.Enumerations.AdministrativeGender src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MALE: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.MALE; - case FEMALE: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.FEMALE; - case OTHER: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.OTHER; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.NULL; - } - } - - public org.hl7.fhir.instance.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MALE: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.MALE; - case FEMALE: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.FEMALE; - case OTHER: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.OTHER; - case UNKNOWN: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.UNKNOWN; - default: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.instance.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL; - } - } - - public org.hl7.fhir.instance.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Account convertAccount(org.hl7.fhir.instance.model.Account src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Account tgt = new org.hl7.fhir.dstu3.model.Account(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasType()) - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setStatus(convertAccountStatus(src.getStatus())); - tgt.setActive(convertPeriod(src.getActivePeriod())); - tgt.setBalance(convertMoney(src.getBalance())); -// tgt.setCoveragePeriod(convertPeriod(src.getCoveragePeriod())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setOwner(convertReference(src.getOwner())); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.instance.model.Account convertAccount(org.hl7.fhir.dstu3.model.Account src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Account tgt = new org.hl7.fhir.instance.model.Account(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setName(src.getName()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setStatus(convertAccountStatus(src.getStatus())); - tgt.setActivePeriod(convertPeriod(src.getActive())); - tgt.setBalance(convertMoney(src.getBalance())); -// tgt.setCoveragePeriod(convertPeriod(src.getCoveragePeriod())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setOwner(convertReference(src.getOwner())); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Account.AccountStatus convertAccountStatus(org.hl7.fhir.instance.model.Account.AccountStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Account.AccountStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.dstu3.model.Account.AccountStatus.INACTIVE; - default: return org.hl7.fhir.dstu3.model.Account.AccountStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Account.AccountStatus convertAccountStatus(org.hl7.fhir.dstu3.model.Account.AccountStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.instance.model.Account.AccountStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.instance.model.Account.AccountStatus.INACTIVE; - default: return org.hl7.fhir.instance.model.Account.AccountStatus.NULL; - } - } - - - public org.hl7.fhir.dstu3.model.Appointment convertAppointment(org.hl7.fhir.instance.model.Appointment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Appointment tgt = new org.hl7.fhir.dstu3.model.Appointment(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertAppointmentStatus(src.getStatus())); - if (src.hasType()) - tgt.addServiceType(convertCodeableConcept(src.getType())); -// tgt.setReason(convertCodeableConcept(src.getReason())); - tgt.setPriority(src.getPriority()); - tgt.setDescription(src.getDescription()); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setMinutesDuration(src.getMinutesDuration()); - for (org.hl7.fhir.instance.model.Reference t : src.getSlot()) - tgt.addSlot(convertReference(t)); - tgt.setComment(src.getComment()); - for (org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertAppointmentParticipantComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Appointment convertAppointment(org.hl7.fhir.dstu3.model.Appointment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Appointment tgt = new org.hl7.fhir.instance.model.Appointment(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertAppointmentStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) - tgt.setType(convertCodeableConcept(t)); -// tgt.setReason(convertCodeableConcept(src.getReason())); - tgt.setPriority(src.getPriority()); - tgt.setDescription(src.getDescription()); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setMinutesDuration(src.getMinutesDuration()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSlot()) - tgt.addSlot(convertReference(t)); - tgt.setComment(src.getComment()); - for (org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertAppointmentParticipantComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.instance.model.Appointment.AppointmentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PROPOSED; - case PENDING: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PENDING; - case BOOKED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.BOOKED; - case ARRIVED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ARRIVED; - case FULFILLED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.FULFILLED; - case CANCELLED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.CANCELLED; - case NOSHOW: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NOSHOW; - default: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.PROPOSED; - case PENDING: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.PENDING; - case BOOKED: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.BOOKED; - case ARRIVED: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.ARRIVED; - case FULFILLED: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.FULFILLED; - case CANCELLED: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.CANCELLED; - case NOSHOW: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.NOSHOW; - default: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setRequired(convertParticipantRequired(src.getRequired())); - tgt.setStatus(convertParticipationStatus(src.getStatus())); - return tgt; - } - - public org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setRequired(convertParticipantRequired(src.getRequired())); - tgt.setStatus(convertParticipationStatus(src.getStatus())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.instance.model.Appointment.ParticipantRequired src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.REQUIRED; - case OPTIONAL: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.OPTIONAL; - case INFORMATIONONLY: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.INFORMATIONONLY; - default: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.NULL; - } - } - - public org.hl7.fhir.instance.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.REQUIRED; - case OPTIONAL: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.OPTIONAL; - case INFORMATIONONLY: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.INFORMATIONONLY; - default: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.instance.model.Appointment.ParticipationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.NEEDSACTION; - default: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.instance.model.AppointmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.AppointmentResponse tgt = new org.hl7.fhir.dstu3.model.AppointmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setAppointment(convertReference(src.getAppointment())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getParticipantType()) - tgt.addParticipantType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); - tgt.setComment(src.getComment()); - return tgt; - } - - private org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus src) { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.TENTATIVE; - case INPROCESS: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case COMPLETED: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case NEEDSACTION: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; - default: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NULL; - } - } - - private org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus src) { - if (src == null) - return null; - switch (src) { - case ACCEPTED: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.ACCEPTED; - case DECLINED: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.DECLINED; - case TENTATIVE: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.TENTATIVE; - case NEEDSACTION: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; - default: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu3.model.AppointmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.AppointmentResponse tgt = new org.hl7.fhir.instance.model.AppointmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setAppointment(convertReference(src.getAppointment())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getParticipantType()) - tgt.addParticipantType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActor())); - tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.AuditEvent convertAuditEvent(org.hl7.fhir.instance.model.AuditEvent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.AuditEvent tgt = new org.hl7.fhir.dstu3.model.AuditEvent(); - copyDomainResource(src, tgt); - if (src.hasEvent()) { - tgt.setType(convertCoding(src.getEvent().getType())); - for (org.hl7.fhir.instance.model.Coding t : src.getEvent().getSubtype()) - tgt.addSubtype(convertCoding(t)); - tgt.setAction(convertAuditEventAction(src.getEvent().getAction())); - tgt.setRecorded(src.getEvent().getDateTime()); - tgt.setOutcome(convertAuditEventOutcome(src.getEvent().getOutcome())); - tgt.setOutcomeDesc(src.getEvent().getOutcomeDesc()); - for (org.hl7.fhir.instance.model.Coding t : src.getEvent().getPurposeOfEvent()) - tgt.addPurposeOfEvent().addCoding(convertCoding(t)); - } - for (org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantComponent t : src.getParticipant()) - tgt.addAgent(convertAuditEventAgentComponent(t)); - tgt.setSource(convertAuditEventSourceComponent(src.getSource())); - for (org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent t : src.getObject()) - tgt.addEntity(convertAuditEventEntityComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu3.model.AuditEvent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.AuditEvent tgt = new org.hl7.fhir.instance.model.AuditEvent(); - copyDomainResource(src, tgt); - tgt.getEvent().setType(convertCoding(src.getType())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSubtype()) - tgt.getEvent().addSubtype(convertCoding(t)); - tgt.getEvent().setAction(convertAuditEventAction(src.getAction())); - tgt.getEvent().setDateTime(src.getRecorded()); - tgt.getEvent().setOutcome(convertAuditEventOutcome(src.getOutcome())); - tgt.getEvent().setOutcomeDesc(src.getOutcomeDesc()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfEvent()) - for (org.hl7.fhir.dstu3.model.Coding cc : t.getCoding()) - tgt.getEvent().addPurposeOfEvent(convertCoding(cc)); - for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) - tgt.addParticipant(convertAuditEventAgentComponent(t)); - tgt.setSource(convertAuditEventSourceComponent(src.getSource())); - for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) - tgt.addObject(convertAuditEventEntityComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.instance.model.AuditEvent.AuditEventAction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case C: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.C; - case R: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.R; - case U: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.U; - case D: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.D; - case E: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.E; - default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.NULL; - } - } - - public org.hl7.fhir.instance.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case C: return org.hl7.fhir.instance.model.AuditEvent.AuditEventAction.C; - case R: return org.hl7.fhir.instance.model.AuditEvent.AuditEventAction.R; - case U: return org.hl7.fhir.instance.model.AuditEvent.AuditEventAction.U; - case D: return org.hl7.fhir.instance.model.AuditEvent.AuditEventAction.D; - case E: return org.hl7.fhir.instance.model.AuditEvent.AuditEventAction.E; - default: return org.hl7.fhir.instance.model.AuditEvent.AuditEventAction.NULL; - } - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _0: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._0; - case _4: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._4; - case _8: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._8; - case _12: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._12; - default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome.NULL; - } - } - - public org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _0: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._0; - case _4: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._4; - case _8: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._8; - case _12: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._12; - default: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome.NULL; - } - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - tgt.setReference(convertReference(src.getReference())); - tgt.setUserId(convertIdentifier(src.getUserId())); - tgt.setAltId(src.getAltId()); - tgt.setName(src.getName()); - tgt.setRequestor(src.getRequestor()); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.instance.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - tgt.setMedia(convertCoding(src.getMedia())); - tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); - for (org.hl7.fhir.instance.model.Coding t : src.getPurposeOfUse()) - tgt.addPurposeOfUse().addCoding(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - tgt.setReference(convertReference(src.getReference())); - tgt.setUserId(convertIdentifier(src.getUserId())); - tgt.setAltId(src.getAltId()); - tgt.setName(src.getName()); - tgt.setRequestor(src.getRequestor()); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - tgt.setMedia(convertCoding(src.getMedia())); - tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfUse()) - for (org.hl7.fhir.dstu3.model.Coding cc : t.getCoding()) - tgt.addPurposeOfUse(convertCoding(cc)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent(); - copyElement(src, tgt); - tgt.setAddress(src.getAddress()); - tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkComponent(); - copyElement(src, tgt); - tgt.setAddress(src.getAddress()); - tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _1: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._1; - case _2: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._2; - case _3: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._3; - case _4: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._4; - case _5: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._5; - default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType.NULL; - } - } - - public org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case _1: return org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType._1; - case _2: return org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType._2; - case _3: return org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType._3; - case _4: return org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType._4; - case _5: return org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType._5; - default: return org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent(); - copyElement(src, tgt); - tgt.setSite(src.getSite()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - for (org.hl7.fhir.instance.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventSourceComponent(); - copyElement(src, tgt); - tgt.setSite(src.getSite()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setReference(convertReference(src.getReference())); - tgt.setType(convertCoding(src.getType())); - tgt.setRole(convertCoding(src.getRole())); - tgt.setLifecycle(convertCoding(src.getLifecycle())); - for (org.hl7.fhir.instance.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setQuery(src.getQuery()); - for (org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent t : src.getDetail()) - tgt.addDetail(convertAuditEventEntityDetailComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setReference(convertReference(src.getReference())); - tgt.setType(convertCoding(src.getType())); - tgt.setRole(convertCoding(src.getRole())); - tgt.setLifecycle(convertCoding(src.getLifecycle())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCoding(t)); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setQuery(src.getQuery()); - for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) - tgt.addDetail(convertAuditEventEntityDetailComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Basic convertBasic(org.hl7.fhir.instance.model.Basic src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Basic tgt = new org.hl7.fhir.dstu3.model.Basic(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setCreated(src.getCreated()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public org.hl7.fhir.instance.model.Basic convertBasic(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Basic tgt = new org.hl7.fhir.instance.model.Basic(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setCreated(src.getCreated()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.instance.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - public org.hl7.fhir.instance.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Binary tgt = new org.hl7.fhir.instance.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Bundle convertBundle(org.hl7.fhir.instance.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle tgt = new org.hl7.fhir.dstu3.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.instance.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.instance.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - public org.hl7.fhir.instance.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Bundle tgt = new org.hl7.fhir.instance.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - if (src.hasSignature()) - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Bundle.BundleType convertBundleType(org.hl7.fhir.instance.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.dstu3.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.dstu3.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.dstu3.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.dstu3.model.Bundle.BundleType.NULL; - } - } - - public org.hl7.fhir.instance.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu3.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.instance.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.instance.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.instance.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.instance.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.instance.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.instance.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.instance.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.instance.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.instance.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.instance.model.Bundle.BundleType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.instance.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.instance.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.instance.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - tgt.setFullUrl(src.getFullUrl()); - tgt.setResource(convertResource(src.getResource())); - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public org.hl7.fhir.instance.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (advisor.ignoreEntry(src)) - return null; - - org.hl7.fhir.instance.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - tgt.setFullUrl(src.getFullUrl()); - org.hl7.fhir.instance.model.Resource res = advisor.convert(src.getResource()); - if (res == null) - res = convertResource(src.getResource()); - tgt.setResource(res); - if (src.hasSearch()) - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - if (src.hasRequest()) - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - if (src.hasResponse()) - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - tgt.setScore(src.getScore()); - return tgt; - } - - public org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - tgt.setScore(src.getScore()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.instance.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.NULL; - } - } - - public org.hl7.fhir.instance.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - tgt.setIfNoneMatch(src.getIfNoneMatch()); - tgt.setIfModifiedSince(src.getIfModifiedSince()); - tgt.setIfMatch(src.getIfMatch()); - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - public org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - tgt.setIfNoneMatch(src.getIfNoneMatch()); - tgt.setIfModifiedSince(src.getIfModifiedSince()); - tgt.setIfMatch(src.getIfMatch()); - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.instance.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.NULL; - } - } - - public org.hl7.fhir.instance.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.instance.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - tgt.setLocation(src.getLocation()); - tgt.setEtag(src.getEtag()); - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public org.hl7.fhir.instance.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - tgt.setLocation(src.getLocation()); - tgt.setEtag(src.getEtag()); - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CarePlan convertCarePlan(org.hl7.fhir.instance.model.CarePlan src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CarePlan tgt = new org.hl7.fhir.dstu3.model.CarePlan(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setStatus(convertCarePlanStatus(src.getStatus())); - tgt.setContext(convertReference(src.getContext())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.instance.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); -// tgt.setModified(src.getModified()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.Reference t : src.getAddresses()) - tgt.addAddresses(convertReference(t)); -// for (org.hl7.fhir.instance.model.Reference t : src.getSupport()) -// tgt.addSupport(convertReference(t)); -// for (org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent t : src.getRelatedPlan()) -// tgt.addRelatedPlan(convertCarePlanRelatedPlanComponent(t)); -// for (org.hl7.fhir.instance.model.CarePlan.CarePlanParticipantComponent t : src.getParticipant()) -// tgt.addParticipant(convertCarePlanParticipantComponent(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - for (org.hl7.fhir.instance.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) - tgt.addActivity(convertCarePlanActivityComponent(t)); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - public org.hl7.fhir.instance.model.CarePlan convertCarePlan(org.hl7.fhir.dstu3.model.CarePlan src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.CarePlan tgt = new org.hl7.fhir.instance.model.CarePlan(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setStatus(convertCarePlanStatus(src.getStatus())); - tgt.setContext(convertReference(src.getContext())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); -// tgt.setModified(src.getModified()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) - tgt.addAddresses(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getSupport()) -// tgt.addSupport(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent t : src.getRelatedPlan()) -// tgt.addRelatedPlan(convertCarePlanRelatedPlanComponent(t)); -// for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanParticipantComponent t : src.getParticipant()) -// tgt.addParticipant(convertCarePlanParticipantComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) - tgt.addActivity(convertCarePlanActivityComponent(t)); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.instance.model.CarePlan.CarePlanStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT; - case DRAFT: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.CANCELLED; - default: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { -// case PROPOSED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.PROPOSED; - case DRAFT: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.CANCELLED; - default: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.NULL; - } - } - -// public org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent(); -// copyElement(src, tgt); -// tgt.setCode(convertCarePlanRelationship(src.getCode())); -// tgt.setPlan(convertReference(src.getPlan())); -// return tgt; -// } - -// public org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent(); -// copyElement(src, tgt); -// tgt.setCode(convertCarePlanRelationship(src.getCode())); -// tgt.setPlan(convertReference(src.getPlan())); -// return tgt; -// } - -// public org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case INCLUDES: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship.INCLUDES; -// case REPLACES: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship.REPLACES; -// case FULFILLS: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship.FULFILLS; -// default: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship.NULL; -// } -// } - -// public org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case INCLUDES: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.INCLUDES; -// case REPLACES: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.REPLACES; -// case FULFILLS: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.FULFILLS; -// default: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.NULL; -// } -// } - -// public org.hl7.fhir.dstu3.model.CarePlan.CarePlanParticipantComponent convertCarePlanParticipantComponent(org.hl7.fhir.instance.model.CarePlan.CarePlanParticipantComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.CarePlan.CarePlanParticipantComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanParticipantComponent(); -// copyElement(src, tgt); -// tgt.setRole(convertCodeableConcept(src.getRole())); -// tgt.setMember(convertReference(src.getMember())); -// return tgt; -// } -// -// public org.hl7.fhir.instance.model.CarePlan.CarePlanParticipantComponent convertCarePlanParticipantComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanParticipantComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.CarePlan.CarePlanParticipantComponent tgt = new org.hl7.fhir.instance.model.CarePlan.CarePlanParticipantComponent(); -// copyElement(src, tgt); -// tgt.setRole(convertCodeableConcept(src.getRole())); -// tgt.setMember(convertReference(src.getMember())); -// return tgt; -// } -// - public org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.instance.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent(); - copyElement(src, tgt); -// for (org.hl7.fhir.instance.model.Reference t : src.getActionResulting()) -// tgt.addActionResulting(convertReference(t)); - for (org.hl7.fhir.instance.model.Annotation t : src.getProgress()) - tgt.addProgress(convertAnnotation(t)); - tgt.setReference(convertReference(src.getReference())); - tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); - return tgt; - } - - public org.hl7.fhir.instance.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.instance.model.CarePlan.CarePlanActivityComponent(); - copyElement(src, tgt); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getActionResulting()) -// tgt.addActionResulting(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getProgress()) - tgt.addProgress(convertAnnotation(t)); - tgt.setReference(convertReference(src.getReference())); - tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.instance.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent(); - copyElement(src, tgt); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); -// tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); - tgt.setProhibited(src.getProhibited()); - tgt.setScheduled(convertType(src.getScheduled())); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.instance.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setProduct(convertType(src.getProduct())); - tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.instance.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.instance.model.CarePlan.CarePlanActivityDetailComponent(); - copyElement(src, tgt); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReasonCode(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) - tgt.addReasonReference(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) - tgt.addGoal(convertReference(t)); - tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); -// tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); - tgt.setProhibited(src.getProhibited()); - tgt.setScheduled(convertType(src.getScheduled())); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setProduct(convertType(src.getProduct())); - tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSTARTED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; - case SCHEDULED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.SCHEDULED; - case INPROGRESS: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.ONHOLD; - case COMPLETED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.CANCELLED; - default: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSTARTED: return org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; - case SCHEDULED: return org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus.SCHEDULED; - case INPROGRESS: return org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus.ONHOLD; - case COMPLETED: return org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus.CANCELLED; - default: return org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.instance.model.ClinicalImpression src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ClinicalImpression tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression(); - copyDomainResource(src, tgt); - tgt.setSubject(convertReference(src.getPatient())); - tgt.setAssessor(convertReference(src.getAssessor())); - tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - tgt.setPrevious(convertReference(src.getPrevious())); - for (org.hl7.fhir.instance.model.Reference t : src.getProblem()) - tgt.addProblem(convertReference(t)); -// for (org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent t : src.getInvestigations()) -// tgt.addInvestigations(convertClinicalImpressionInvestigationsComponent(t)); - tgt.addProtocol(src.getProtocol()); - tgt.setSummary(src.getSummary()); - for (org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) - tgt.addFinding(convertClinicalImpressionFindingComponent(t)); - if (src.hasPrognosis()) - tgt.addPrognosisCodeableConcept ().setText(src.getPrognosis()); -// for (org.hl7.fhir.instance.model.Reference t : src.getPlan()) -// tgt.addPlan(convertReference(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getAction()) - tgt.addAction(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.dstu3.model.ClinicalImpression src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ClinicalImpression tgt = new org.hl7.fhir.instance.model.ClinicalImpression(); - copyDomainResource(src, tgt); - tgt.setPatient(convertReference(src.getSubject())); - tgt.setAssessor(convertReference(src.getAssessor())); - tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - tgt.setPrevious(convertReference(src.getPrevious())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProblem()) - tgt.addProblem(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent t : src.getInvestigations()) -// tgt.addInvestigations(convertClinicalImpressionInvestigationsComponent(t)); - for (UriType t : src.getProtocol()) - tgt.setProtocol(t.asStringValue()); - tgt.setSummary(src.getSummary()); - for (org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) - tgt.addFinding(convertClinicalImpressionFindingComponent(t)); - tgt.setPrognosis(src.getPrognosisCodeableConceptFirstRep().getText()); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getPlan()) -// tgt.addPlan(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAction()) - tgt.addAction(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.DRAFT; - case COMPLETED: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionStatus.NULL; - } - } - -// public org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); -// copyElement(src, tgt); -// tgt.setCode(convertCodeableConcept(src.getCode())); -// for (org.hl7.fhir.instance.model.Reference t : src.getItem()) -// tgt.addItem(convertReference(t)); -// return tgt; -// } -// -// public org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); -// copyElement(src, tgt); -// tgt.setCode(convertCodeableConcept(src.getCode())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getItem()) -// tgt.addItem(convertReference(t)); -// return tgt; -// } - - public org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent(); - copyElement(src, tgt); - tgt.setItem(convertCodeableConcept(src.getItem())); -// tgt.setCause(src.getCause()); - return tgt; - } - - public org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent(); - copyElement(src, tgt); - if (src.hasItemCodeableConcept()) - try { - tgt.setItem(convertCodeableConcept(src.getItemCodeableConcept())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - } -// tgt.setCause(src.getCause()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Communication convertCommunication(org.hl7.fhir.instance.model.Communication src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Communication tgt = new org.hl7.fhir.dstu3.model.Communication(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.instance.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.instance.model.Communication.CommunicationPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationPayloadComponent(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.setStatus(convertCommunicationStatus(src.getStatus())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setSent(src.getSent()); - tgt.setReceived(src.getReceived()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason()) - tgt.addReasonCode(convertCodeableConcept(t)); - tgt.setSubject(convertReference(src.getSubject())); - return tgt; - } - - public org.hl7.fhir.instance.model.Communication convertCommunication(org.hl7.fhir.dstu3.model.Communication src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Communication tgt = new org.hl7.fhir.instance.model.Communication(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationPayloadComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.setStatus(convertCommunicationStatus(src.getStatus())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setSent(src.getSent()); - tgt.setReceived(src.getReceived()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(convertCodeableConcept(t)); - tgt.setSubject(convertReference(src.getSubject())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.instance.model.Communication.CommunicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.SUSPENDED; - case REJECTED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ENTEREDINERROR; - case FAILED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ABORTED; - default: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.SUSPENDED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.REJECTED; - case ABORTED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.FAILED; - default: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.instance.model.Communication.CommunicationPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.instance.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.instance.model.Communication.CommunicationPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.instance.model.CommunicationRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CommunicationRequest tgt = new org.hl7.fhir.dstu3.model.CommunicationRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.instance.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.getRequester().setAgent(convertReference(src.getRequester())); - tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setOccurrence(convertType(src.getScheduled())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason()) - tgt.addReasonCode(convertCodeableConcept(t)); - tgt.setAuthoredOn(src.getRequestedOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setPriority(convertPriorityCode(src.getPriority())); - return tgt; - } - - private org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority convertPriorityCode(org.hl7.fhir.instance.model.CodeableConcept priority) { - for (org.hl7.fhir.instance.model.Coding c : priority.getCoding()) { - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.ROUTINE; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.URGENT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.STAT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.ASAP; - } - return null; - } - - public org.hl7.fhir.instance.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.dstu3.model.CommunicationRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.CommunicationRequest tgt = new org.hl7.fhir.instance.model.CommunicationRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); - tgt.setSender(convertReference(src.getSender())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) - tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getMedium()) - tgt.addMedium(convertCodeableConcept(t)); - tgt.setRequester(convertReference(src.getRequester().getAgent())); - tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setScheduled(convertType(src.getOccurrence())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) - tgt.addReason(convertCodeableConcept(t)); - tgt.setRequestedOn(src.getAuthoredOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setPriority(convertPriorityCode(src.getPriority())); - return tgt; - } - - private org.hl7.fhir.instance.model.CodeableConcept convertPriorityCode(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority priority) { - org.hl7.fhir.instance.model.CodeableConcept cc = new org.hl7.fhir.instance.model.CodeableConcept(); - switch (priority) { - case ROUTINE: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); break; - case URGENT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); break; - case STAT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); break; - case ASAP: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); break; - default: return null; - } - return cc; - } - - public org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.DRAFT; - case PLANNED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; - case REQUESTED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; - case RECEIVED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; - case ACCEPTED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; - case INPROGRESS: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED; - case REJECTED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ENTEREDINERROR; -// case FAILED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.FAILED; - default: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.PROPOSED; -// case PLANNED: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.ACCEPTED; - case ACTIVE: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.REJECTED; -// case FAILED: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.FAILED; - default: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Composition convertComposition(org.hl7.fhir.instance.model.Composition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Composition tgt = new org.hl7.fhir.dstu3.model.Composition(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setClass_(convertCodeableConcept(src.getClass_())); - tgt.setTitle(src.getTitle()); - tgt.setStatus(convertCompositionStatus(src.getStatus())); - try { - tgt.setConfidentiality(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.fromCode(src.getConfidentiality())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.instance.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - for (org.hl7.fhir.instance.model.Composition.CompositionAttesterComponent t : src.getAttester()) - tgt.addAttester(convertCompositionAttesterComponent(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.instance.model.Composition.CompositionEventComponent t : src.getEvent()) - tgt.addEvent(convertCompositionEventComponent(t)); - tgt.setEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.instance.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Composition convertComposition(org.hl7.fhir.dstu3.model.Composition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Composition tgt = new org.hl7.fhir.instance.model.Composition(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setClass_(convertCodeableConcept(src.getClass_())); - tgt.setTitle(src.getTitle()); - tgt.setStatus(convertCompositionStatus(src.getStatus())); - tgt.setConfidentiality(src.getConfidentiality().toCode()); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent t : src.getAttester()) - tgt.addAttester(convertCompositionAttesterComponent(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - for (org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent t : src.getEvent()) - tgt.addEvent(convertCompositionEventComponent(t)); - tgt.setEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.instance.model.Composition.CompositionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu3.model.Composition.CompositionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRELIMINARY: return org.hl7.fhir.instance.model.Composition.CompositionStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.instance.model.Composition.CompositionStatus.FINAL; - case AMENDED: return org.hl7.fhir.instance.model.Composition.CompositionStatus.AMENDED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.Composition.CompositionStatus.ENTEREDINERROR; - default: return org.hl7.fhir.instance.model.Composition.CompositionStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.instance.model.Composition.CompositionAttesterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.Enumeration t : src.getMode()) - tgt.addMode(convertCompositionAttestationMode(t.getValue())); - tgt.setTime(src.getTime()); - tgt.setParty(convertReference(src.getParty())); - return tgt; - } - - public org.hl7.fhir.instance.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.instance.model.Composition.CompositionAttesterComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getMode()) - tgt.addMode(convertCompositionAttestationMode(t.getValue())); - tgt.setTime(src.getTime()); - tgt.setParty(convertReference(src.getParty())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.instance.model.Composition.CompositionAttestationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSONAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PERSONAL; - case PROFESSIONAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PROFESSIONAL; - case LEGAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.LEGAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.OFFICIAL; - default: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.NULL; - } - } - - public org.hl7.fhir.instance.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSONAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.PERSONAL; - case PROFESSIONAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.PROFESSIONAL; - case LEGAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.LEGAL; - case OFFICIAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.OFFICIAL; - default: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.instance.model.Composition.CompositionEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.instance.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.instance.model.Composition.CompositionEventComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) - tgt.addCode(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.instance.model.Composition.SectionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu3.model.Composition.SectionComponent(); - copyElement(src, tgt); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setText(convertNarrative(src.getText())); - try { - tgt.setMode(org.hl7.fhir.dstu3.model.Composition.SectionMode.fromCode(src.getMode())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.instance.model.Reference t : src.getEntry()) - tgt.addEntry(convertReference(t)); - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - for (org.hl7.fhir.instance.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Composition.SectionComponent tgt = new org.hl7.fhir.instance.model.Composition.SectionComponent(); - copyElement(src, tgt); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setText(convertNarrative(src.getText())); - tgt.setMode(src.getMode().toCode()); - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEntry()) - tgt.addEntry(convertReference(t)); - tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); - for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) - tgt.addSection(convertSectionComponent(t)); - return tgt; - } - - private class SourceElementComponentWrapper { - public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { - super(); - this.source = source; - this.target = target; - this.comp = comp; - } - private String source; - private String target; - private org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent comp; - - } - - public org.hl7.fhir.dstu3.model.ConceptMap convertConceptMap(org.hl7.fhir.instance.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ConceptMap tgt = new org.hl7.fhir.dstu3.model.ConceptMap(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - tgt.setSource(convertType(src.getSource())); - tgt.setTarget(convertType(src.getTarget())); - for (org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent t : src.getElement()) { - List ws = convertSourceElementComponent(t); - for (SourceElementComponentWrapper w : ws) - getGroup(tgt, w.source, w.target).addElement(w.comp); - } - return tgt; - } - - public org.hl7.fhir.dstu3.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.instance.model.CodeableConcept t) throws FHIRException { - org.hl7.fhir.dstu3.model.UsageContext result = new org.hl7.fhir.dstu3.model.UsageContext(); - // todo: set type.. - result.setValue(convertCodeableConcept(t)); - return result; - } - - - private ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { - for (ConceptMapGroupComponent grp : map.getGroup()) { - if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) - return grp; - } - ConceptMapGroupComponent grp = map.addGroup(); - grp.setSource(srcs); - grp.setTarget(tgts); - return grp; - } - - - public org.hl7.fhir.instance.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu3.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ConceptMap tgt = new org.hl7.fhir.instance.model.ConceptMap(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setSource(convertType(src.getSource())); - tgt.setTarget(convertType(src.getTarget())); - for (org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) - for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : g.getElement()) - tgt.addElement(convertSourceElementComponent(t, g)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.RETIRED; - default: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.instance.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.ConceptMapContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public List convertSourceElementComponent(org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent src) throws FHIRException { - List res = new ArrayList(); - if (src == null || src.isEmpty()) - return res; - for (org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent t : src.getTarget()) { - org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.addTarget(convertTargetElementComponent(t)); - res.add(new SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem())); - } - return res; - } - - public org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - tgt.setCodeSystem(g.getSource()); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent t : src.getTarget()) - tgt.addTarget(convertTargetElementComponent(t, g)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - tgt.setComment(src.getComments()); - for (org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - tgt.setCodeSystem(g.getTarget()); - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - tgt.setComments(src.getComment()); - for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case EQUAL: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUAL; - case WIDER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER; - case SUBSUMES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SUBSUMES; - case NARROWER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER; - case SPECIALIZES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; - case INEXACT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.INEXACT; - case UNMATCHED: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED; - case DISJOINT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL; - } - } - - public org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case EQUAL: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.EQUAL; - case WIDER: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.WIDER; - case SUBSUMES: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.SUBSUMES; - case NARROWER: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.NARROWER; - case SPECIALIZES: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; - case INEXACT: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.INEXACT; - case UNMATCHED: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.UNMATCHED; - case DISJOINT: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getElement()); - tgt.setSystem(src.getCodeSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setElement(src.getProperty()); - tgt.setCodeSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Condition convertCondition(org.hl7.fhir.instance.model.Condition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Condition tgt = new org.hl7.fhir.dstu3.model.Condition(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getPatient())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasDateRecorded()) - tgt.setAssertedDate(src.getDateRecorded()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - try { - tgt.setClinicalStatus(org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.fromCode(src.getClinicalStatus())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); - tgt.setSeverity(convertCodeableConcept(src.getSeverity())); - tgt.setOnset(convertType(src.getOnset())); - tgt.setAbatement(convertType(src.getAbatement())); - tgt.setStage(convertConditionStageComponent(src.getStage())); - for (org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) - tgt.addEvidence(convertConditionEvidenceComponent(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); -// tgt.setNotes(src.getNotes()); - return tgt; - } - - public org.hl7.fhir.instance.model.Condition convertCondition(org.hl7.fhir.dstu3.model.Condition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Condition tgt = new org.hl7.fhir.instance.model.Condition(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setAsserter(convertReference(src.getAsserter())); - if (src.hasAssertedDate()) - tgt.setDateRecorded(src.getAssertedDate()); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.setCategory(convertCodeableConcept(t)); - tgt.setClinicalStatus(src.getClinicalStatus().toCode()); - tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); - tgt.setSeverity(convertCodeableConcept(src.getSeverity())); - tgt.setOnset(convertType(src.getOnset())); - tgt.setAbatement(convertType(src.getAbatement())); - tgt.setStage(convertConditionStageComponent(src.getStage())); - for (org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) - tgt.addEvidence(convertConditionEvidenceComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); -// tgt.setNotes(src.getNotes()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROVISIONAL: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.PROVISIONAL; - case DIFFERENTIAL: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; - case CONFIRMED: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.CONFIRMED; - case REFUTED: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.REFUTED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROVISIONAL: return org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus.PROVISIONAL; - case DIFFERENTIAL: return org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; - case CONFIRMED: return org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus.CONFIRMED; - case REFUTED: return org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus.REFUTED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus.UNKNOWN; - default: return org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.instance.model.Condition.ConditionStageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent(); - copyElement(src, tgt); - tgt.setSummary(convertCodeableConcept(src.getSummary())); - for (org.hl7.fhir.instance.model.Reference t : src.getAssessment()) - tgt.addAssessment(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.instance.model.Condition.ConditionStageComponent(); - copyElement(src, tgt); - tgt.setSummary(convertCodeableConcept(src.getSummary())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAssessment()) - tgt.addAssessment(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent(); - copyElement(src, tgt); - tgt.addCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.instance.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept cc : src.getCode()) - tgt.setCode(convertCodeableConcept(cc)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) - tgt.addDetail(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement convertConformance(org.hl7.fhir.instance.model.Conformance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.Conformance.ConformanceContactComponent t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); - tgt.setFhirVersion(src.getFhirVersion()); - tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); - for (org.hl7.fhir.instance.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); - for (org.hl7.fhir.instance.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.instance.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance convertConformance(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance tgt = new org.hl7.fhir.instance.model.Conformance(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - if (src.hasImplementation()) - tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); - tgt.setFhirVersion(src.getFhirVersion()); - tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.instance.model.Conformance.UnknownContentCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NO: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NO; - case EXTENSIONS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; - case ELEMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.ELEMENTS; - case BOTH: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.BOTH; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NO: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.NO; - case EXTENSIONS: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.EXTENSIONS; - case ELEMENTS: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.ELEMENTS; - case BOTH: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.BOTH; - default: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.instance.model.Conformance.ConformanceContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setVersion(src.getVersion()); - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setVersion(src.getVersion()); - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.instance.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - for (org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - if (src.getTransactionMode() == org.hl7.fhir.instance.model.Conformance.TransactionMode.BATCH || src.getTransactionMode() == org.hl7.fhir.instance.model.Conformance.TransactionMode.BOTH) - tgt.addInteraction().setCode(SystemRestfulInteraction.BATCH); - for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.instance.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - boolean batch = false; - boolean transaction = false; - for (org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) { - if (t.getCode().equals(SystemRestfulInteraction.BATCH)) - batch = true; - else - tgt.addInteraction(convertSystemInteractionComponent(t)); - if (t.getCode().equals(SystemRestfulInteraction.TRANSACTION)) - transaction = true; - } - if (batch) - tgt.setTransactionMode(transaction ? org.hl7.fhir.instance.model.Conformance.TransactionMode.BOTH : org.hl7.fhir.instance.model.Conformance.TransactionMode.BATCH); - else - tgt.setTransactionMode(transaction ? org.hl7.fhir.instance.model.Conformance.TransactionMode.TRANSACTION : org.hl7.fhir.instance.model.Conformance.TransactionMode.NOTSUPPORTED); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; - case SERVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.SERVER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.CLIENT; - case SERVER: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.SERVER; - default: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.NULL; - } - } - - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); - copyElement(src, tgt); - tgt.setCors(src.getCors()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent t : src.getCertificate()) - tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent(); - copyElement(src, tgt); - tgt.setCors(src.getCors()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent t : src.getCertificate()) - tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setBlob(src.getBlob()); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setBlob(src.getBlob()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - for (org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - tgt.setReadHistory(src.getReadHistory()); - tgt.setUpdateCreate(src.getUpdateCreate()); - tgt.setConditionalCreate(src.getConditionalCreate()); - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.instance.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.instance.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(convertReference(src.getProfile())); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - tgt.setReadHistory(src.getReadHistory()); - tgt.setUpdateCreate(src.getUpdateCreate()); - tgt.setConditionalCreate(src.getConditionalCreate()); - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(convertReference(src.getDefinition())); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(convertReference(src.getDefinition())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.instance.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - tgt.setReliableCache(src.getReliableCache()); - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) - tgt.addEvent(convertConformanceMessagingEventComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - tgt.setReliableCache(src.getReliableCache()); - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent t : src.getEvent()) - tgt.addEvent(convertConformanceMessagingEventComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent(); - copyElement(src, tgt); - tgt.setCode(convertCoding(src.getCode())); - tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); - tgt.setMode(convertConformanceEventMode(src.getMode())); - tgt.setFocus(src.getFocus()); - tgt.setRequest(convertReference(src.getRequest())); - tgt.setResponse(convertReference(src.getResponse())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEventComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEventComponent(); - copyElement(src, tgt); - tgt.setCode(convertCoding(src.getCode())); - tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); - tgt.setMode(convertConformanceEventMode(src.getMode())); - tgt.setFocus(src.getFocus()); - tgt.setRequest(convertReference(src.getRequest())); - tgt.setResponse(convertReference(src.getResponse())); - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONSEQUENCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CONSEQUENCE; - case CURRENCY: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CURRENCY; - case NOTIFICATION: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NOTIFICATION; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONSEQUENCE: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.CONSEQUENCE; - case CURRENCY: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.CURRENCY; - case NOTIFICATION: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.NOTIFICATION; - default: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.instance.model.Conformance.ConformanceEventMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.SENDER; - case RECEIVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.RECEIVER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.SENDER; - case RECEIVER: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.RECEIVER; - default: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.NULL; - } - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - public org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.instance.model.Conformance.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.CONSUMER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.NULL; - } - } - - public org.hl7.fhir.instance.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.instance.model.Conformance.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.instance.model.Conformance.DocumentMode.CONSUMER; - default: return org.hl7.fhir.instance.model.Conformance.DocumentMode.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Contract convertContract(org.hl7.fhir.instance.model.Contract src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract tgt = new org.hl7.fhir.dstu3.model.Contract(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setIssued(src.getIssued()); - tgt.setApplies(convertPeriod(src.getApplies())); - for (org.hl7.fhir.instance.model.Reference t : src.getSubject()) - tgt.addSubject(convertReference(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getAuthority()) - tgt.addAuthority(convertReference(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getDomain()) - tgt.addDomain(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getSubType()) - tgt.addSubType(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getAction()) - tgt.addAction(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getActionReason()) - tgt.addActionReason(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.Contract.ActorComponent t : src.getActor()) - tgt.addAgent(convertAgentComponent(t)); - for (org.hl7.fhir.instance.model.Contract.SignatoryComponent t : src.getSigner()) - tgt.addSigner(convertSignatoryComponent(t)); - for (org.hl7.fhir.instance.model.Contract.ValuedItemComponent t : src.getValuedItem()) - tgt.addValuedItem(convertValuedItemComponent(t)); - for (org.hl7.fhir.instance.model.Contract.TermComponent t : src.getTerm()) - tgt.addTerm(convertTermComponent(t)); - tgt.setBinding(convertType(src.getBinding())); - for (org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) - tgt.addFriendly(convertFriendlyLanguageComponent(t)); - for (org.hl7.fhir.instance.model.Contract.LegalLanguageComponent t : src.getLegal()) - tgt.addLegal(convertLegalLanguageComponent(t)); - for (org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent t : src.getRule()) - tgt.addRule(convertComputableLanguageComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract convertContract(org.hl7.fhir.dstu3.model.Contract src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract tgt = new org.hl7.fhir.instance.model.Contract(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setIssued(src.getIssued()); - tgt.setApplies(convertPeriod(src.getApplies())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSubject()) - tgt.addSubject(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthority()) - tgt.addAuthority(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDomain()) - tgt.addDomain(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSubType()) - tgt.addSubType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) - tgt.addAction(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getActionReason()) - tgt.addActionReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Contract.AgentComponent t : src.getAgent()) - tgt.addActor(convertAgentComponent(t)); - for (org.hl7.fhir.dstu3.model.Contract.SignatoryComponent t : src.getSigner()) - tgt.addSigner(convertSignatoryComponent(t)); - for (org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent t : src.getValuedItem()) - tgt.addValuedItem(convertValuedItemComponent(t)); - for (org.hl7.fhir.dstu3.model.Contract.TermComponent t : src.getTerm()) - tgt.addTerm(convertTermComponent(t)); - tgt.setBinding(convertType(src.getBinding())); - for (org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) - tgt.addFriendly(convertFriendlyLanguageComponent(t)); - for (org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent t : src.getLegal()) - tgt.addLegal(convertLegalLanguageComponent(t)); - for (org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent t : src.getRule()) - tgt.addRule(convertComputableLanguageComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.instance.model.Contract.ActorComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.AgentComponent tgt = new org.hl7.fhir.dstu3.model.Contract.AgentComponent(); - copyElement(src, tgt); - tgt.setActor(convertReference(src.getEntity())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.ActorComponent convertAgentComponent(org.hl7.fhir.dstu3.model.Contract.AgentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.ActorComponent tgt = new org.hl7.fhir.instance.model.Contract.ActorComponent(); - copyElement(src, tgt); - tgt.setEntity(convertReference(src.getActor())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.instance.model.Contract.SignatoryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.dstu3.model.Contract.SignatoryComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setParty(convertReference(src.getParty())); - if (src.hasSignature()) - tgt.addSignature(new org.hl7.fhir.dstu3.model.Signature().setBlob(src.getSignature().getBytes())); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.dstu3.model.Contract.SignatoryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.instance.model.Contract.SignatoryComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setParty(convertReference(src.getParty())); - for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) - tgt.setSignature(Base64.encodeBase64String(t.getBlob())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.instance.model.Contract.ValuedItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent(); - copyElement(src, tgt); - tgt.setEntity(convertType(src.getEntity())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setEffectiveTime(src.getEffectiveTime()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setUnitPrice(convertMoney(src.getUnitPrice())); - tgt.setFactor(src.getFactor()); - tgt.setPoints(src.getPoints()); - tgt.setNet(convertMoney(src.getNet())); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.instance.model.Contract.ValuedItemComponent(); - copyElement(src, tgt); - tgt.setEntity(convertType(src.getEntity())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setEffectiveTime(src.getEffectiveTime()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setUnitPrice(convertMoney(src.getUnitPrice())); - tgt.setFactor(src.getFactor()); - tgt.setPoints(src.getPoints()); - tgt.setNet(convertMoney(src.getNet())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.instance.model.Contract.TermComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.TermComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setIssued(src.getIssued()); - tgt.setApplies(convertPeriod(src.getApplies())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setSubType(convertCodeableConcept(src.getSubType())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getAction()) - tgt.addAction(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getActionReason()) - tgt.addActionReason(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.Contract.TermActorComponent t : src.getActor()) - tgt.addAgent(convertTermAgentComponent(t)); - tgt.setText(src.getText()); - for (org.hl7.fhir.instance.model.Contract.TermValuedItemComponent t : src.getValuedItem()) - tgt.addValuedItem(convertTermValuedItemComponent(t)); - for (org.hl7.fhir.instance.model.Contract.TermComponent t : src.getGroup()) - tgt.addGroup(convertTermComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.dstu3.model.Contract.TermComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.TermComponent tgt = new org.hl7.fhir.instance.model.Contract.TermComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setIssued(src.getIssued()); - tgt.setApplies(convertPeriod(src.getApplies())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setSubType(convertCodeableConcept(src.getSubType())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) - tgt.addAction(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getActionReason()) - tgt.addActionReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Contract.TermAgentComponent t : src.getAgent()) - tgt.addActor(convertTermAgentComponent(t)); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent t : src.getValuedItem()) - tgt.addValuedItem(convertTermValuedItemComponent(t)); - for (org.hl7.fhir.dstu3.model.Contract.TermComponent t : src.getGroup()) - tgt.addGroup(convertTermComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.TermAgentComponent convertTermAgentComponent(org.hl7.fhir.instance.model.Contract.TermActorComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.TermAgentComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermAgentComponent(); - copyElement(src, tgt); - tgt.setActor(convertReference(src.getEntity())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.TermActorComponent convertTermAgentComponent(org.hl7.fhir.dstu3.model.Contract.TermAgentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.TermActorComponent tgt = new org.hl7.fhir.instance.model.Contract.TermActorComponent(); - copyElement(src, tgt); - tgt.setEntity(convertReference(src.getActor())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) - tgt.addRole(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.instance.model.Contract.TermValuedItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent(); - copyElement(src, tgt); - tgt.setEntity(convertType(src.getEntity())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setEffectiveTime(src.getEffectiveTime()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setUnitPrice(convertMoney(src.getUnitPrice())); - tgt.setFactor(src.getFactor()); - tgt.setPoints(src.getPoints()); - tgt.setNet(convertMoney(src.getNet())); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.instance.model.Contract.TermValuedItemComponent(); - copyElement(src, tgt); - tgt.setEntity(convertType(src.getEntity())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setEffectiveTime(src.getEffectiveTime()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setUnitPrice(convertMoney(src.getUnitPrice())); - tgt.setFactor(src.getFactor()); - tgt.setPoints(src.getPoints()); - tgt.setNet(convertMoney(src.getNet())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.instance.model.Contract.LegalLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.LegalLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - public org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent(); - copyElement(src, tgt); - tgt.setContent(convertType(src.getContent())); - return tgt; - } - - - public org.hl7.fhir.dstu3.model.DataElement convertDataElement(org.hl7.fhir.instance.model.DataElement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DataElement tgt = new org.hl7.fhir.dstu3.model.DataElement(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.DataElement.DataElementContactComponent t : src.getContact()) - tgt.addContact(convertDataElementContactComponent(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setCopyright(src.getCopyright()); - tgt.setStringency(convertDataElementStringency(src.getStringency())); - for (org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent t : src.getMapping()) - tgt.addMapping(convertDataElementMappingComponent(t)); - List slicePaths = new ArrayList(); - for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) { - if (t.hasSlicing()) - slicePaths.add(t.getPath()); - tgt.addElement(convertElementDefinition(t, slicePaths)); - } - return tgt; - } - - public org.hl7.fhir.instance.model.DataElement convertDataElement(org.hl7.fhir.dstu3.model.DataElement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DataElement tgt = new org.hl7.fhir.instance.model.DataElement(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertDataElementContactComponent(t)); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setCopyright(src.getCopyright()); - tgt.setStringency(convertDataElementStringency(src.getStringency())); - for (org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent t : src.getMapping()) - tgt.addMapping(convertDataElementMappingComponent(t)); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.instance.model.DataElement.DataElementStringency src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPARABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.COMPARABLE; - case FULLYSPECIFIED: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FULLYSPECIFIED; - case EQUIVALENT: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.EQUIVALENT; - case CONVERTABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.CONVERTABLE; - case SCALEABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.SCALEABLE; - case FLEXIBLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FLEXIBLE; - default: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.NULL; - } - } - - public org.hl7.fhir.instance.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPARABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.COMPARABLE; - case FULLYSPECIFIED: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.FULLYSPECIFIED; - case EQUIVALENT: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.EQUIVALENT; - case CONVERTABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.CONVERTABLE; - case SCALEABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.SCALEABLE; - case FLEXIBLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.FLEXIBLE; - default: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.instance.model.DataElement.DataElementContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.instance.model.DataElement.DataElementContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComment(src.getComments()); - return tgt; - } - - public org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComments(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.instance.model.DetectedIssue src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DetectedIssue tgt = new org.hl7.fhir.dstu3.model.DetectedIssue(); - copyDomainResource(src, tgt); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); - for (org.hl7.fhir.instance.model.Reference t : src.getImplicated()) - tgt.addImplicated(convertReference(t)); - tgt.setDetail(src.getDetail()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setReference(src.getReference()); - for (org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) - tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu3.model.DetectedIssue src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DetectedIssue tgt = new org.hl7.fhir.instance.model.DetectedIssue(); - copyDomainResource(src, tgt); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getImplicated()) - tgt.addImplicated(convertReference(t)); - tgt.setDetail(src.getDetail()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setReference(src.getReference()); - for (org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) - tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HIGH: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.HIGH; - case MODERATE: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.MODERATE; - case LOW: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.LOW; - default: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.NULL; - } - } - - public org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HIGH: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.HIGH; - case MODERATE: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.MODERATE; - case LOW: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.LOW; - default: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent(); - copyElement(src, tgt); - tgt.setAction(convertCodeableConcept(src.getAction())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueMitigationComponent(); - copyElement(src, tgt); - tgt.setAction(convertCodeableConcept(src.getAction())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setAuthor(convertReference(src.getAuthor())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Device convertDevice(org.hl7.fhir.instance.model.Device src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Device tgt = new org.hl7.fhir.dstu3.model.Device(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setUdi((new org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent()).setDeviceIdentifier(src.getUdi())); - tgt.setStatus(convertDeviceStatus(src.getStatus())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setLotNumber(src.getLotNumber()); - tgt.setManufacturer(src.getManufacturer()); - tgt.setManufactureDate(src.getManufactureDate()); - tgt.setExpirationDate(src.getExpiry()); - tgt.setModel(src.getModel()); - tgt.setVersion(src.getVersion()); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setOwner(convertReference(src.getOwner())); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.instance.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Device convertDevice(org.hl7.fhir.dstu3.model.Device src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Device tgt = new org.hl7.fhir.instance.model.Device(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasUdi()) - tgt.setUdi(src.getUdi().getDeviceIdentifier()); - tgt.setStatus(convertDeviceStatus(src.getStatus())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setLotNumber(src.getLotNumber()); - tgt.setManufacturer(src.getManufacturer()); - tgt.setManufactureDate(src.getManufactureDate()); - tgt.setExpiry(src.getExpirationDate()); - tgt.setModel(src.getModel()); - tgt.setVersion(src.getVersion()); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setOwner(convertReference(src.getOwner())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus convertDeviceStatus(org.hl7.fhir.instance.model.Device.DeviceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case AVAILABLE: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ACTIVE; - case NOTAVAILABLE: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Device.DeviceStatus convertDeviceStatus(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.instance.model.Device.DeviceStatus.AVAILABLE; - case INACTIVE: return org.hl7.fhir.instance.model.Device.DeviceStatus.NOTAVAILABLE; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.Device.DeviceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.instance.model.Device.DeviceStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.instance.model.DeviceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DeviceComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent(); - copyDomainResource(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setLastSystemChange(src.getLastSystemChange()); - tgt.setSource(convertReference(src.getSource())); - tgt.setParent(convertReference(src.getParent())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getOperationalStatus()) - tgt.addOperationalStatus(convertCodeableConcept(t)); - tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); - tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); - for (org.hl7.fhir.instance.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) - tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); - tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); - return tgt; - } - - public org.hl7.fhir.instance.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.dstu3.model.DeviceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DeviceComponent tgt = new org.hl7.fhir.instance.model.DeviceComponent(); - copyDomainResource(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setLastSystemChange(src.getLastSystemChange()); - tgt.setSource(convertReference(src.getSource())); - tgt.setParent(convertReference(src.getParent())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOperationalStatus()) - tgt.addOperationalStatus(convertCodeableConcept(t)); - tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); - tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); - for (org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) - tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); - tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OTHER: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OTHER; - case CHEMICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; - case ELECTRICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; - case IMPEDANCE: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; - case NUCLEAR: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; - case OPTICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OPTICAL; - case THERMAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.THERMAL; - case BIOLOGICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; - case MECHANICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; - case ACOUSTICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; - case MANUAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MANUAL; - default: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NULL; - } - } - - public org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OTHER: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.OTHER; - case CHEMICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; - case ELECTRICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; - case IMPEDANCE: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; - case NUCLEAR: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; - case OPTICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.OPTICAL; - case THERMAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.THERMAL; - case BIOLOGICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; - case MECHANICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; - case ACOUSTICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; - case MANUAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.MANUAL; - default: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.instance.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); - copyElement(src, tgt); - tgt.setSpecType(convertCodeableConcept(src.getSpecType())); - tgt.setComponentId(convertIdentifier(src.getComponentId())); - tgt.setProductionSpec(src.getProductionSpec()); - return tgt; - } - - public org.hl7.fhir.instance.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.instance.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); - copyElement(src, tgt); - tgt.setSpecType(convertCodeableConcept(src.getSpecType())); - tgt.setComponentId(convertIdentifier(src.getComponentId())); - tgt.setProductionSpec(src.getProductionSpec()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.instance.model.DeviceMetric src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DeviceMetric tgt = new org.hl7.fhir.dstu3.model.DeviceMetric(); - copyDomainResource(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setUnit(convertCodeableConcept(src.getUnit())); - tgt.setSource(convertReference(src.getSource())); - tgt.setParent(convertReference(src.getParent())); - tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); - tgt.setColor(convertDeviceMetricColor(src.getColor())); - tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); - tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); - for (org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) - tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.dstu3.model.DeviceMetric src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DeviceMetric tgt = new org.hl7.fhir.instance.model.DeviceMetric(); - copyDomainResource(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setUnit(convertCodeableConcept(src.getUnit())); - tgt.setSource(convertReference(src.getSource())); - tgt.setParent(convertReference(src.getParent())); - tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); - tgt.setColor(convertDeviceMetricColor(src.getColor())); - tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); - tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); - for (org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) - tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ON: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.ON; - case OFF: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; - case STANDBY: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; - default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ON: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.ON; - case OFF: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; - case STANDBY: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; - default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BLACK: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLACK; - case RED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.RED; - case GREEN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.GREEN; - case YELLOW: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.YELLOW; - case BLUE: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLUE; - case MAGENTA: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.MAGENTA; - case CYAN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.CYAN; - case WHITE: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.WHITE; - default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.NULL; - } - } - - public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BLACK: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.BLACK; - case RED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.RED; - case GREEN: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.GREEN; - case YELLOW: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.YELLOW; - case BLUE: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.BLUE; - case MAGENTA: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.MAGENTA; - case CYAN: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.CYAN; - case WHITE: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.WHITE; - default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MEASUREMENT: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; - case SETTING: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.SETTING; - case CALCULATION: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.CALCULATION; - case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; - default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.NULL; - } - } - - public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MEASUREMENT: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; - case SETTING: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.SETTING; - case CALCULATION: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.CALCULATION; - case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; - default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent(); - copyElement(src, tgt); - tgt.setType(convertDeviceMetricCalibrationType(src.getType())); - tgt.setState(convertDeviceMetricCalibrationState(src.getState())); - tgt.setTime(src.getTime()); - return tgt; - } - - public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent(); - copyElement(src, tgt); - tgt.setType(convertDeviceMetricCalibrationType(src.getType())); - tgt.setState(convertDeviceMetricCalibrationState(src.getState())); - tgt.setTime(src.getTime()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; - case OFFSET: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; - case GAIN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; - case TWOPOINT: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; - default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.NULL; - } - } - - public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; - case OFFSET: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; - case GAIN: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; - case TWOPOINT: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; - default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTCALIBRATED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; - case CALIBRATIONREQUIRED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; - case CALIBRATED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; - case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; - default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NULL; - } - } - - public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTCALIBRATED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; - case CALIBRATIONREQUIRED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; - case CALIBRATED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; - case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; - default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.instance.model.DeviceUseStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu3.model.DeviceUseStatement(); - copyDomainResource(src, tgt); - if (src.hasBodySiteCodeableConcept()) - tgt.setBodySite(convertCodeableConcept(src.getBodySiteCodeableConcept())); - tgt.setWhenUsed(convertPeriod(src.getWhenUsed())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getIndication()) - tgt.addIndication(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.StringType t : src.getNotes()) - tgt.addNote().setText(t.getValue()); - tgt.setRecordedOn(src.getRecordedOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setTiming(convertType(src.getTiming())); - return tgt; - } - - public org.hl7.fhir.instance.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu3.model.DeviceUseStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DeviceUseStatement tgt = new org.hl7.fhir.instance.model.DeviceUseStatement(); - copyDomainResource(src, tgt); - tgt.setBodySite(convertType(src.getBodySite())); - tgt.setWhenUsed(convertPeriod(src.getWhenUsed())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getIndication()) - tgt.addIndication(convertCodeableConcept(t)); - for (Annotation t : src.getNote()) - tgt.addNotes(t.getText()); - tgt.setRecordedOn(src.getRecordedOn()); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setTiming(convertType(src.getTiming())); - return tgt; - } - -// public org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus convertDiagnosticOrderStatus(org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus src) throws FHIRException { -// if (src ==/* null || src.isEmpty()*/) -// return null; -// switch (src) { -// case PROPOSED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.PROPOSED; -// case DRAFT: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.DRAFT; -// case PLANNED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.ACCEPTED; -// case INPROGRESS: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.INPROGRESS; -// case REVIEW: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.REVIEW; -// case COMPLETED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.COMPLETED; -// case CANCELLED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.CANCELLED; -// case SUSPENDED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.SUSPENDED; -// case REJECTED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.REJECTED; -// case FAILED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.FAILED; -// default: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.NULL; -// } -// } -// -// public org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus convertDiagnosticOrderStatus(org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus src) throws FHIRException { -// if (src ==/* null || src.isEmpty()*/) -// return null; -// switch (src) { -// case PROPOSED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.PROPOSED; -// case DRAFT: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.DRAFT; -// case PLANNED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.PLANNED; -// case REQUESTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.ACCEPTED; -// case INPROGRESS: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.INPROGRESS; -// case REVIEW: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REVIEW; -// case COMPLETED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.COMPLETED; -// case CANCELLED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.CANCELLED; -// case SUSPENDED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.SUSPENDED; -// case REJECTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REJECTED; -// case FAILED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.FAILED; -// default: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.NULL; -// } -// } - - - public org.hl7.fhir.dstu3.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.instance.model.DiagnosticReport src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DiagnosticReport tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); -// tgt.setPerformer(convertReference(src.getPerformer())); -// for (org.hl7.fhir.instance.model.Reference t : src.getRequest()) -// tgt.addRequest(convertReference(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getSpecimen()) - tgt.addSpecimen(convertReference(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getResult()) - tgt.addResult(convertReference(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getImagingStudy()) - tgt.addImagingStudy(convertReference(t)); - for (org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) - tgt.addImage(convertDiagnosticReportImageComponent(t)); - tgt.setConclusion(src.getConclusion()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCodedDiagnosis()) - tgt.addCodedDiagnosis(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.Attachment t : src.getPresentedForm()) - tgt.addPresentedForm(convertAttachment(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu3.model.DiagnosticReport src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DiagnosticReport tgt = new org.hl7.fhir.instance.model.DiagnosticReport(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); -// tgt.setPerformer(convertReference(src.getPerformer())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getRequest()) -// tgt.addRequest(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSpecimen()) - tgt.addSpecimen(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getResult()) - tgt.addResult(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getImagingStudy()) - tgt.addImagingStudy(convertReference(t)); - for (org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) - tgt.addImage(convertDiagnosticReportImageComponent(t)); - tgt.setConclusion(src.getConclusion()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCodedDiagnosis()) - tgt.addCodedDiagnosis(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPresentedForm()) - tgt.addPresentedForm(convertAttachment(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; - case PARTIAL: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; - case FINAL: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.FINAL; - case CORRECTED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; - case APPENDED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; - case CANCELLED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; - case PARTIAL: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; - case FINAL: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.FINAL; - case CORRECTED: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; - case APPENDED: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; - case CANCELLED: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; - default: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent(); - copyElement(src, tgt); - tgt.setComment(src.getComment()); - tgt.setLink(convertReference(src.getLink())); - return tgt; - } - - public org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent(); - copyElement(src, tgt); - tgt.setComment(src.getComment()); - tgt.setLink(convertReference(src.getLink())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.instance.model.DocumentManifest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentManifest tgt = new org.hl7.fhir.dstu3.model.DocumentManifest(); - copyDomainResource(src, tgt); - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.instance.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.instance.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - tgt.setCreated(src.getCreated()); - tgt.setSource(src.getSource()); - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) - tgt.addContent(convertDocumentManifestContentComponent(t)); - for (org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) - tgt.addRelated(convertDocumentManifestRelatedComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.dstu3.model.DocumentManifest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DocumentManifest tgt = new org.hl7.fhir.instance.model.DocumentManifest(); - copyDomainResource(src, tgt); - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - tgt.setCreated(src.getCreated()); - tgt.setSource(src.getSource()); - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) - tgt.addContent(convertDocumentManifestContentComponent(t)); - for (org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) - tgt.addRelated(convertDocumentManifestRelatedComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.CURRENT; - case SUPERSEDED: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.CURRENT; - case SUPERSEDED: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; - default: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent(); - copyElement(src, tgt); - tgt.setP(convertType(src.getP())); - return tgt; - } - - public org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestContentComponent(); - copyElement(src, tgt); - tgt.setP(convertType(src.getP())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - public org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestRelatedComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DocumentReference convertDocumentReference(org.hl7.fhir.instance.model.DocumentReference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentReference tgt = new org.hl7.fhir.dstu3.model.DocumentReference(); - copyDomainResource(src, tgt); - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setClass_(convertCodeableConcept(src.getClass_())); - for (org.hl7.fhir.instance.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - tgt.setAuthenticator(convertReference(src.getAuthenticator())); - tgt.setCreated(src.getCreated()); - tgt.setIndexed(src.getIndexed()); - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - tgt.setDocStatus(convertDocStatus(src.getDocStatus())); - for (org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) - tgt.addContent(convertDocumentReferenceContentComponent(t)); - tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); - return tgt; - } - - private ReferredDocumentStatus convertDocStatus(CodeableConcept cc) { - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "preliminary")) - return ReferredDocumentStatus.PRELIMINARY; - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "final")) - return ReferredDocumentStatus.FINAL; - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "amended")) - return ReferredDocumentStatus.AMENDED; - if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "entered-in-error")) - return ReferredDocumentStatus.ENTEREDINERROR; - - return null; - } - - private CodeableConcept convertDocStatus(ReferredDocumentStatus docStatus) { - CodeableConcept cc = new CodeableConcept (); - switch (docStatus) { - case AMENDED: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("amended"); break; - case ENTEREDINERROR: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("entered-in-error"); break; - case FINAL: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("final"); break; - case PRELIMINARY: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("preliminary"); break; - default: return null; - } - return cc; - } - - public org.hl7.fhir.instance.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu3.model.DocumentReference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DocumentReference tgt = new org.hl7.fhir.instance.model.DocumentReference(); - copyDomainResource(src, tgt); - tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setClass_(convertCodeableConcept(src.getClass_())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) - tgt.addAuthor(convertReference(t)); - tgt.setCustodian(convertReference(src.getCustodian())); - tgt.setAuthenticator(convertReference(src.getAuthenticator())); - tgt.setCreated(src.getCreated()); - tgt.setIndexed(src.getIndexed()); - tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); - tgt.setDocStatus(convertDocStatus(src.getDocStatus())); - for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) - tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSecurityLabel()) - tgt.addSecurityLabel(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) - tgt.addContent(convertDocumentReferenceContentComponent(t)); - tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); - return tgt; - } - - - public org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent(); - copyElement(src, tgt); - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent(); - copyElement(src, tgt); - tgt.setCode(convertDocumentRelationshipType(src.getCode())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.NULL; - } - } - - public org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACES: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.REPLACES; - case TRANSFORMS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; - case SIGNS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.SIGNS; - case APPENDS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.APPENDS; - default: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent(); - copyElement(src, tgt); - tgt.setAttachment(convertAttachment(src.getAttachment())); - for (org.hl7.fhir.instance.model.Coding t : src.getFormat()) - tgt.setFormat(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContentComponent(); - copyElement(src, tgt); - tgt.setAttachment(convertAttachment(src.getAttachment())); - tgt.addFormat(convertCoding(src.getFormat())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent(); - copyElement(src, tgt); - tgt.setEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getEvent()) - tgt.addEvent(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); - tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); - tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); - for (org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) - tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextComponent(); - copyElement(src, tgt); - tgt.setEncounter(convertReference(src.getEncounter())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getEvent()) - tgt.addEvent(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); - tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); - tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); - for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) - tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - public org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextRelatedComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setRef(convertReference(src.getRef())); - return tgt; - } - - - public org.hl7.fhir.dstu3.model.Encounter convertEncounter(org.hl7.fhir.instance.model.Encounter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Encounter tgt = new org.hl7.fhir.dstu3.model.Encounter(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEncounterState(src.getStatus())); -// for (org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent t : src.getStatusHistory()) -// tgt.addStatusHistory(convertEncounterStatusHistoryComponent(t)); - tgt.setClass_(convertEncounterClass(src.getClass_())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPriority(convertCodeableConcept(src.getPriority())); - tgt.setSubject(convertReference(src.getPatient())); - for (org.hl7.fhir.instance.model.Reference t : src.getEpisodeOfCare()) - tgt.addEpisodeOfCare(convertReference(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getIncomingReferral()) - tgt.addIncomingReferral(convertReference(t)); - for (org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertEncounterParticipantComponent(t)); - tgt.setAppointment(convertReference(src.getAppointment())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setLength(convertDuration(src.getLength())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); - for (org.hl7.fhir.instance.model.Encounter.EncounterLocationComponent t : src.getLocation()) - tgt.addLocation(convertEncounterLocationComponent(t)); - tgt.setServiceProvider(convertReference(src.getServiceProvider())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.instance.model.Encounter convertEncounter(org.hl7.fhir.dstu3.model.Encounter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Encounter tgt = new org.hl7.fhir.instance.model.Encounter(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEncounterState(src.getStatus())); -// for (org.hl7.fhir.dstu3.model.Encounter.EncounterStatusHistoryComponent t : src.getStatusHistory()) -// tgt.addStatusHistory(convertEncounterStatusHistoryComponent(t)); - tgt.setClass_(convertEncounterClass(src.getClass_())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPriority(convertCodeableConcept(src.getPriority())); - tgt.setPatient(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getEpisodeOfCare()) - tgt.addEpisodeOfCare(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) - tgt.addIncomingReferral(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) - tgt.addParticipant(convertEncounterParticipantComponent(t)); - tgt.setAppointment(convertReference(src.getAppointment())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setLength(convertDuration(src.getLength())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); - for (org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent t : src.getLocation()) - tgt.addLocation(convertEncounterLocationComponent(t)); - tgt.setServiceProvider(convertReference(src.getServiceProvider())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Encounter.EncounterStatus convertEncounterState(org.hl7.fhir.instance.model.Encounter.EncounterState src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.PLANNED; - case ARRIVED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ARRIVED; - case INPROGRESS: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.INPROGRESS; - case ONLEAVE: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ONLEAVE; - case FINISHED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.CANCELLED; - default: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Encounter.EncounterState convertEncounterState(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.instance.model.Encounter.EncounterState.PLANNED; - case ARRIVED: return org.hl7.fhir.instance.model.Encounter.EncounterState.ARRIVED; - case INPROGRESS: return org.hl7.fhir.instance.model.Encounter.EncounterState.INPROGRESS; - case ONLEAVE: return org.hl7.fhir.instance.model.Encounter.EncounterState.ONLEAVE; - case FINISHED: return org.hl7.fhir.instance.model.Encounter.EncounterState.FINISHED; - case CANCELLED: return org.hl7.fhir.instance.model.Encounter.EncounterState.CANCELLED; - default: return org.hl7.fhir.instance.model.Encounter.EncounterState.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Coding convertEncounterClass(org.hl7.fhir.instance.model.Encounter.EncounterClass src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPATIENT: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("IMP"); - case OUTPATIENT: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("AMB"); - case AMBULATORY: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("AMB"); - case EMERGENCY: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("EMER"); - case HOME: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("HH"); - case FIELD: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("FLD"); - case DAYTIME: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("SS"); - case VIRTUAL: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("VR"); - default: return null; - } - } - - public org.hl7.fhir.instance.model.Encounter.EncounterClass convertEncounterClass(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src.getSystem().equals("http://hl7.org/fhir/v3/ActCode")) { - if (src.getCode().equals("IMP")) return org.hl7.fhir.instance.model.Encounter.EncounterClass.INPATIENT; - if (src.getCode().equals("AMB")) return org.hl7.fhir.instance.model.Encounter.EncounterClass.AMBULATORY; - if (src.getCode().equals("EMER")) return org.hl7.fhir.instance.model.Encounter.EncounterClass.EMERGENCY; - if (src.getCode().equals("HH")) return org.hl7.fhir.instance.model.Encounter.EncounterClass.HOME; - if (src.getCode().equals("FLD")) return org.hl7.fhir.instance.model.Encounter.EncounterClass.FIELD; - if (src.getCode().equals("")) return org.hl7.fhir.instance.model.Encounter.EncounterClass.DAYTIME; - if (src.getCode().equals("VR")) return org.hl7.fhir.instance.model.Encounter.EncounterClass.VIRTUAL; - } - return org.hl7.fhir.instance.model.Encounter.EncounterClass.NULL; - } - -// public org.hl7.fhir.dstu3.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterStatusHistoryComponent(); -// copyElement(src, tgt); -// tgt.setStatus(convertEncounterState(src.getStatus())); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// return tgt; -// } - -// public org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent(); -// copyElement(src, tgt); -// tgt.setStatus(convertEncounterState(src.getStatus())); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// return tgt; -// } - - public org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIndividual(convertReference(src.getIndividual())); - return tgt; - } - - public org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIndividual(convertReference(src.getIndividual())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.instance.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent(); - copyElement(src, tgt); - tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); - tgt.setOrigin(convertReference(src.getOrigin())); - tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); - tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getDietPreference()) - tgt.addDietPreference(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getSpecialCourtesy()) - tgt.addSpecialCourtesy(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getSpecialArrangement()) - tgt.addSpecialArrangement(convertCodeableConcept(t)); - tgt.setDestination(convertReference(src.getDestination())); - tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); - return tgt; - } - - public org.hl7.fhir.instance.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterHospitalizationComponent(); - copyElement(src, tgt); - tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); - tgt.setOrigin(convertReference(src.getOrigin())); - tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); - tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getDietPreference()) - tgt.addDietPreference(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialCourtesy()) - tgt.addSpecialCourtesy(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialArrangement()) - tgt.addSpecialArrangement(convertCodeableConcept(t)); - tgt.setDestination(convertReference(src.getDestination())); - tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.instance.model.Encounter.EncounterLocationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent(); - copyElement(src, tgt); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterLocationComponent(); - copyElement(src, tgt); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.instance.model.Encounter.EncounterLocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.PLANNED; - case ACTIVE: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.ACTIVE; - case RESERVED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.RESERVED; - case COMPLETED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.COMPLETED; - default: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.instance.model.Encounter.EncounterLocationStatus.PLANNED; - case ACTIVE: return org.hl7.fhir.instance.model.Encounter.EncounterLocationStatus.ACTIVE; - case RESERVED: return org.hl7.fhir.instance.model.Encounter.EncounterLocationStatus.RESERVED; - case COMPLETED: return org.hl7.fhir.instance.model.Encounter.EncounterLocationStatus.COMPLETED; - default: return org.hl7.fhir.instance.model.Encounter.EncounterLocationStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.instance.model.EnrollmentRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.EnrollmentRequest tgt = new org.hl7.fhir.dstu3.model.EnrollmentRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCreated(src.getCreated()); -// tgt.setTarget(convertReference(src.getTarget())); - tgt.setProvider(convertReference(src.getProvider())); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setCoverage(convertReference(src.getCoverage())); -// tgt.setRelationship(convertCoding(src.getRelationship())); - return tgt; - } - - public org.hl7.fhir.instance.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.dstu3.model.EnrollmentRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.EnrollmentRequest tgt = new org.hl7.fhir.instance.model.EnrollmentRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCreated(src.getCreated()); -// tgt.setTarget(convertReference(src.getTarget())); -// tgt.setProvider(convertReference(src.getProvider())); -// tgt.setOrganization(convertReference(src.getOrganization())); -// tgt.setSubject(convertReference(src.getSubject())); - tgt.setCoverage(convertReference(src.getCoverage())); -// tgt.setRelationship(convertCoding(src.getRelationship())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.instance.model.EnrollmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.EnrollmentResponse tgt = new org.hl7.fhir.dstu3.model.EnrollmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setRequest(convertReference(src.getRequest())); -// tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); - tgt.setDisposition(src.getDisposition()); - tgt.setCreated(src.getCreated()); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setRequestProvider(convertReference(src.getRequestProvider())); - tgt.setRequestOrganization(convertReference(src.getRequestOrganization())); - return tgt; - } - - public org.hl7.fhir.instance.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.dstu3.model.EnrollmentResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.EnrollmentResponse tgt = new org.hl7.fhir.instance.model.EnrollmentResponse(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); -// tgt.setRequest(convertReference(src.getRequestReference())); -// tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); - tgt.setDisposition(src.getDisposition()); - tgt.setCreated(src.getCreated()); -// tgt.setOrganization(convertReference(src.getOrganizationReference())); -// tgt.setRequestProvider(convertReference(src.getRequestProviderReference())); -// tgt.setRequestOrganization(convertReference(src.getRequestOrganizationReference())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.instance.model.EpisodeOfCare src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - for (org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.instance.model.Reference t : src.getReferralRequest()) - tgt.addReferralRequest(convertReference(t)); - tgt.setCareManager(convertReference(src.getCareManager())); - return tgt; - } - - public org.hl7.fhir.instance.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu3.model.EpisodeOfCare src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.EpisodeOfCare tgt = new org.hl7.fhir.instance.model.EpisodeOfCare(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) - tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReferralRequest()) - tgt.addReferralRequest(convertReference(t)); - tgt.setCareManager(convertReference(src.getCareManager())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; - case WAITLIST: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; - case ACTIVE: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; - case FINISHED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; - default: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PLANNED: return org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; - case WAITLIST: return org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; - case ACTIVE: return org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; - case ONHOLD: return org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; - case FINISHED: return org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; - case CANCELLED: return org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; - default: return org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); - copyElement(src, tgt); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); - copyElement(src, tgt); - tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - - public org.hl7.fhir.dstu3.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.instance.model.FamilyMemberHistory src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBorn(convertType(src.getBorn())); - tgt.setAge(convertType(src.getAge())); - tgt.setDeceased(convertType(src.getDeceased())); -// tgt.setNote(convertAnnotation(src.getNote())); - for (org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) - tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu3.model.FamilyMemberHistory src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.FamilyMemberHistory tgt = new org.hl7.fhir.instance.model.FamilyMemberHistory(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBorn(convertType(src.getBorn())); - tgt.setAge(convertType(src.getAge())); - tgt.setDeceased(convertType(src.getDeceased())); -// tgt.setNote(convertAnnotation(src.getNote())); - for (org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) - tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PARTIAL: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; - case COMPLETED: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; - case HEALTHUNKNOWN: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; - default: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PARTIAL: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; - case COMPLETED: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; - case HEALTHUNKNOWN: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; - default: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setOnset(convertType(src.getOnset())); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - public org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setOnset(convertType(src.getOnset())); -// tgt.setNote(convertAnnotation(src.getNote())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Flag convertFlag(org.hl7.fhir.instance.model.Flag src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Flag tgt = new org.hl7.fhir.dstu3.model.Flag(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setStatus(convertFlagStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.instance.model.Flag convertFlag(org.hl7.fhir.dstu3.model.Flag src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Flag tgt = new org.hl7.fhir.instance.model.Flag(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setStatus(convertFlagStatus(src.getStatus())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.instance.model.Flag.FlagStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu3.model.Flag.FlagStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.instance.model.Flag.FlagStatus.ACTIVE; - case INACTIVE: return org.hl7.fhir.instance.model.Flag.FlagStatus.INACTIVE; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.Flag.FlagStatus.ENTEREDINERROR; - default: return org.hl7.fhir.instance.model.Flag.FlagStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Group convertGroup(org.hl7.fhir.instance.model.Group src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Group tgt = new org.hl7.fhir.dstu3.model.Group(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setType(convertGroupType(src.getType())); - tgt.setActual(src.getActual()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setName(src.getName()); - tgt.setQuantity(src.getQuantity()); - for (org.hl7.fhir.instance.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) - tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); - for (org.hl7.fhir.instance.model.Group.GroupMemberComponent t : src.getMember()) - tgt.addMember(convertGroupMemberComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Group convertGroup(org.hl7.fhir.dstu3.model.Group src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Group tgt = new org.hl7.fhir.instance.model.Group(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setType(convertGroupType(src.getType())); - tgt.setActual(src.getActual()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setName(src.getName()); - tgt.setQuantity(src.getQuantity()); - for (org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) - tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); - for (org.hl7.fhir.dstu3.model.Group.GroupMemberComponent t : src.getMember()) - tgt.addMember(convertGroupMemberComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Group.GroupType convertGroupType(org.hl7.fhir.instance.model.Group.GroupType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSON: return org.hl7.fhir.dstu3.model.Group.GroupType.PERSON; - case ANIMAL: return org.hl7.fhir.dstu3.model.Group.GroupType.ANIMAL; - case PRACTITIONER: return org.hl7.fhir.dstu3.model.Group.GroupType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu3.model.Group.GroupType.DEVICE; - case MEDICATION: return org.hl7.fhir.dstu3.model.Group.GroupType.MEDICATION; - case SUBSTANCE: return org.hl7.fhir.dstu3.model.Group.GroupType.SUBSTANCE; - default: return org.hl7.fhir.dstu3.model.Group.GroupType.NULL; - } - } - - public org.hl7.fhir.instance.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu3.model.Group.GroupType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PERSON: return org.hl7.fhir.instance.model.Group.GroupType.PERSON; - case ANIMAL: return org.hl7.fhir.instance.model.Group.GroupType.ANIMAL; - case PRACTITIONER: return org.hl7.fhir.instance.model.Group.GroupType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.instance.model.Group.GroupType.DEVICE; - case MEDICATION: return org.hl7.fhir.instance.model.Group.GroupType.MEDICATION; - case SUBSTANCE: return org.hl7.fhir.instance.model.Group.GroupType.SUBSTANCE; - default: return org.hl7.fhir.instance.model.Group.GroupType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.instance.model.Group.GroupCharacteristicComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setExclude(src.getExclude()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.instance.model.Group.GroupCharacteristicComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setExclude(src.getExclude()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.instance.model.Group.GroupMemberComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupMemberComponent(); - copyElement(src, tgt); - tgt.setEntity(convertReference(src.getEntity())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setInactive(src.getInactive()); - return tgt; - } - - public org.hl7.fhir.instance.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu3.model.Group.GroupMemberComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.instance.model.Group.GroupMemberComponent(); - copyElement(src, tgt); - tgt.setEntity(convertReference(src.getEntity())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setInactive(src.getInactive()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.HealthcareService convertHealthcareService(org.hl7.fhir.instance.model.HealthcareService src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.HealthcareService tgt = new org.hl7.fhir.dstu3.model.HealthcareService(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setProvidedBy(convertReference(src.getProvidedBy())); -// tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategory())); - for (org.hl7.fhir.instance.model.HealthcareService.ServiceTypeComponent t : src.getServiceType()) { -// if (t.hasType()) -// tgt.addServiceType(convertCodeableConcept(t.getType())); - for (org.hl7.fhir.instance.model.CodeableConcept tj : t.getSpecialty()) - tgt.addSpecialty(convertCodeableConcept(tj)); - } - tgt.addLocation(convertReference(src.getLocation())); -// tgt.setServiceName(src.getServiceName()); - tgt.setComment(src.getComment()); - tgt.setExtraDetails(src.getExtraDetails()); - tgt.setPhoto(convertAttachment(src.getPhoto())); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getCoverageArea()) - tgt.addCoverageArea(convertReference(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getServiceProvisionCode()) - tgt.addServiceProvisionCode(convertCodeableConcept(t)); - tgt.setEligibility(convertCodeableConcept(src.getEligibility())); - tgt.setEligibilityNote(src.getEligibilityNote()); - for (org.hl7.fhir.instance.model.StringType t : src.getProgramName()) - tgt.addProgramName(t.getValue()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCharacteristic()) - tgt.addCharacteristic(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReferralMethod()) - tgt.addReferralMethod(convertCodeableConcept(t)); -// tgt.setPublicKey(src.getPublicKey()); - tgt.setAppointmentRequired(src.getAppointmentRequired()); - for (org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); - for (org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - return tgt; - } - - public org.hl7.fhir.instance.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu3.model.HealthcareService src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.HealthcareService tgt = new org.hl7.fhir.instance.model.HealthcareService(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setProvidedBy(convertReference(src.getProvidedBy())); -// tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategory())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) -// tgt.addServiceType().setType(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) { - if (!tgt.hasServiceType()) - tgt.addServiceType(); - tgt.getServiceType().get(0).addSpecialty(convertCodeableConcept(t)); - } - for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) - tgt.setLocation(convertReference(t)); -// tgt.setServiceName(src.getServiceName()); - tgt.setComment(src.getComment()); - tgt.setExtraDetails(src.getExtraDetails()); - tgt.setPhoto(convertAttachment(src.getPhoto())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getCoverageArea()) - tgt.addCoverageArea(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceProvisionCode()) - tgt.addServiceProvisionCode(convertCodeableConcept(t)); - tgt.setEligibility(convertCodeableConcept(src.getEligibility())); - tgt.setEligibilityNote(src.getEligibilityNote()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getProgramName()) - tgt.addProgramName(t.getValue()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCharacteristic()) - tgt.addCharacteristic(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReferralMethod()) - tgt.addReferralMethod(convertCodeableConcept(t)); -// tgt.setPublicKey(src.getPublicKey()); - tgt.setAppointmentRequired(src.getAppointmentRequired()); - for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) - tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); - for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) - tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); - tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.Enumeration t : src.getDaysOfWeek()) - tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); - tgt.setAllDay(src.getAllDay()); - tgt.setAvailableStartTime(src.getAvailableStartTime()); - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - public org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDaysOfWeek()) - tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); - tgt.setAllDay(src.getAllDay()); - tgt.setAvailableStartTime(src.getAvailableStartTime()); - tgt.setAvailableEndTime(src.getAvailableEndTime()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.WED; - case THU: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SUN; - default: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.NULL; - } - } - - public org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MON: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.MON; - case TUE: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.TUE; - case WED: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.WED; - case THU: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.THU; - case FRI: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.FRI; - case SAT: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.SAT; - case SUN: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.SUN; - default: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.NULL; - } - } - - public org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - - public org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceNotAvailableComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - tgt.setDuring(convertPeriod(src.getDuring())); - return tgt; - } - -// public org.hl7.fhir.dstu3.model.ImagingObjectSelection convertImagingObjectSelection(org.hl7.fhir.instance.model.ImagingObjectSelection src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.ImagingObjectSelection tgt = new org.hl7.fhir.dstu3.model.ImagingObjectSelection(); -// copyDomainResource(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setAuthoringTime(src.getAuthoringTime()); -// tgt.setAuthor(convertReference(src.getAuthor())); -// tgt.setTitle(convertCodeableConcept(src.getTitle())); -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.instance.model.ImagingObjectSelection.StudyComponent t : src.getStudy()) -// tgt.addStudy(convertStudyComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.instance.model.ImagingObjectSelection convertImagingObjectSelection(org.hl7.fhir.dstu3.model.ImagingObjectSelection src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.ImagingObjectSelection tgt = new org.hl7.fhir.instance.model.ImagingObjectSelection(); -// copyDomainResource(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setAuthoringTime(src.getAuthoringTime()); -// tgt.setAuthor(convertReference(src.getAuthor())); -// tgt.setTitle(convertCodeableConcept(src.getTitle())); -// tgt.setDescription(src.getDescription()); -// for (org.hl7.fhir.dstu3.model.ImagingObjectSelection.StudyComponent t : src.getStudy()) -// tgt.addStudy(convertStudyComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu3.model.ImagingObjectSelection.StudyComponent convertStudyComponent(org.hl7.fhir.instance.model.ImagingObjectSelection.StudyComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.ImagingObjectSelection.StudyComponent tgt = new org.hl7.fhir.dstu3.model.ImagingObjectSelection.StudyComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// tgt.setImagingStudy(convertReference(src.getImagingStudy())); -// for (org.hl7.fhir.instance.model.ImagingObjectSelection.SeriesComponent t : src.getSeries()) -// tgt.addSeries(convertSeriesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.instance.model.ImagingObjectSelection.StudyComponent convertStudyComponent(org.hl7.fhir.dstu3.model.ImagingObjectSelection.StudyComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.ImagingObjectSelection.StudyComponent tgt = new org.hl7.fhir.instance.model.ImagingObjectSelection.StudyComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// tgt.setImagingStudy(convertReference(src.getImagingStudy())); -// for (org.hl7.fhir.dstu3.model.ImagingObjectSelection.SeriesComponent t : src.getSeries()) -// tgt.addSeries(convertSeriesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu3.model.ImagingObjectSelection.SeriesComponent convertSeriesComponent(org.hl7.fhir.instance.model.ImagingObjectSelection.SeriesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.ImagingObjectSelection.SeriesComponent tgt = new org.hl7.fhir.dstu3.model.ImagingObjectSelection.SeriesComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.instance.model.ImagingObjectSelection.InstanceComponent t : src.getInstance()) -// tgt.addInstance(convertInstanceComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.instance.model.ImagingObjectSelection.SeriesComponent convertSeriesComponent(org.hl7.fhir.dstu3.model.ImagingObjectSelection.SeriesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.ImagingObjectSelection.SeriesComponent tgt = new org.hl7.fhir.instance.model.ImagingObjectSelection.SeriesComponent(); -// copyElement(src, tgt); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.dstu3.model.ImagingObjectSelection.InstanceComponent t : src.getInstance()) -// tgt.addInstance(convertInstanceComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu3.model.ImagingObjectSelection.InstanceComponent convertInstanceComponent(org.hl7.fhir.instance.model.ImagingObjectSelection.InstanceComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.ImagingObjectSelection.InstanceComponent tgt = new org.hl7.fhir.dstu3.model.ImagingObjectSelection.InstanceComponent(); -// copyElement(src, tgt); -// tgt.setSopClass(src.getSopClass()); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.instance.model.ImagingObjectSelection.FramesComponent t : src.getFrames()) -// tgt.addFrame(convertFramesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.instance.model.ImagingObjectSelection.InstanceComponent convertInstanceComponent(org.hl7.fhir.dstu3.model.ImagingObjectSelection.InstanceComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.ImagingObjectSelection.InstanceComponent tgt = new org.hl7.fhir.instance.model.ImagingObjectSelection.InstanceComponent(); -// copyElement(src, tgt); -// tgt.setSopClass(src.getSopClass()); -// tgt.setUid(src.getUid()); -// tgt.setUrl(src.getUrl()); -// for (org.hl7.fhir.dstu3.model.ImagingObjectSelection.FramesComponent t : src.getFrame()) -// tgt.addFrames(convertFramesComponent(t)); -// return tgt; -// } -// -// public org.hl7.fhir.dstu3.model.ImagingObjectSelection.FramesComponent convertFramesComponent(org.hl7.fhir.instance.model.ImagingObjectSelection.FramesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.ImagingObjectSelection.FramesComponent tgt = new org.hl7.fhir.dstu3.model.ImagingObjectSelection.FramesComponent(); -// copyElement(src, tgt); -// for (org.hl7.fhir.instance.model.UnsignedIntType t : src.getFrameNumbers()) -// tgt.addNumber(t.getValue()); -// tgt.setUrl(src.getUrl()); -// return tgt; -// } -// -// public org.hl7.fhir.instance.model.ImagingObjectSelection.FramesComponent convertFramesComponent(org.hl7.fhir.dstu3.model.ImagingObjectSelection.FramesComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.ImagingObjectSelection.FramesComponent tgt = new org.hl7.fhir.instance.model.ImagingObjectSelection.FramesComponent(); -// copyElement(src, tgt); -// for (org.hl7.fhir.dstu3.model.UnsignedIntType t : src.getNumber()) -// tgt.addFrameNumbers(t.getValue()); -// tgt.setUrl(src.getUrl()); -// return tgt; -// } -// - public org.hl7.fhir.dstu3.model.ImagingStudy convertImagingStudy(org.hl7.fhir.instance.model.ImagingStudy src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImagingStudy tgt = new org.hl7.fhir.dstu3.model.ImagingStudy(); - copyDomainResource(src, tgt); - tgt.setUid(src.getUid()); - tgt.setAccession(convertIdentifier(src.getAccession())); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); - for (org.hl7.fhir.instance.model.Coding t : src.getModalityList()) - tgt.addModalityList(convertCoding(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setStarted(src.getStarted()); - tgt.setReferrer(convertReference(src.getReferrer())); - tgt.addInterpreter(convertReference(src.getInterpreter())); - tgt.setNumberOfSeries(src.getNumberOfSeries()); - tgt.setNumberOfInstances(src.getNumberOfInstances()); - for (org.hl7.fhir.instance.model.Reference t : src.getProcedure()) - tgt.addProcedureReference(convertReference(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) - tgt.addSeries(convertImagingStudySeriesComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ImagingStudy convertImagingStudy(org.hl7.fhir.dstu3.model.ImagingStudy src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ImagingStudy tgt = new org.hl7.fhir.instance.model.ImagingStudy(); - copyDomainResource(src, tgt); - tgt.setUid(src.getUid()); - tgt.setAccession(convertIdentifier(src.getAccession())); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); - for (org.hl7.fhir.dstu3.model.Coding t : src.getModalityList()) - tgt.addModalityList(convertCoding(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setStarted(src.getStarted()); - tgt.setReferrer(convertReference(src.getReferrer())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getInterpreter()) - tgt.setInterpreter(convertReference(t)); - tgt.setNumberOfSeries(src.getNumberOfSeries()); - tgt.setNumberOfInstances(src.getNumberOfInstances()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProcedureReference()) - tgt.addProcedure(convertReference(t)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) - tgt.addSeries(convertImagingStudySeriesComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ONLINE: return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.ONLINE; - case OFFLINE: return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.OFFLINE; - case NEARLINE: return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.NEARLINE; - case UNAVAILABLE: return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.UNAVAILABLE; - default: return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.NULL; - } - } - - public org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ONLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.ONLINE; - case OFFLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.OFFLINE; - case NEARLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.NEARLINE; - case UNAVAILABLE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.UNAVAILABLE; - default: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent(); - copyElement(src, tgt); - tgt.setUid(src.getUid()); - tgt.setNumber(src.getNumber()); - tgt.setModality(convertCoding(src.getModality())); - tgt.setDescription(src.getDescription()); - tgt.setNumberOfInstances(src.getNumberOfInstances()); - tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); - tgt.setBodySite(convertCoding(src.getBodySite())); - tgt.setLaterality(convertCoding(src.getLaterality())); - tgt.setStarted(src.getStarted()); - for (org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) - tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesComponent(); - copyElement(src, tgt); - tgt.setUid(src.getUid()); - tgt.setNumber(src.getNumber()); - tgt.setModality(convertCoding(src.getModality())); - tgt.setDescription(src.getDescription()); - tgt.setNumberOfInstances(src.getNumberOfInstances()); - tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); - tgt.setBodySite(convertCoding(src.getBodySite())); - tgt.setLaterality(convertCoding(src.getLaterality())); - tgt.setStarted(src.getStarted()); - for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) - tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); - copyElement(src, tgt); - tgt.setUid(src.getUid()); - tgt.setNumber(src.getNumber()); - tgt.setSopClass(src.getSopClass()); - tgt.setTitle(src.getTitle()); - return tgt; - } - - public org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); - copyElement(src, tgt); - tgt.setUid(src.getUid()); - tgt.setNumber(src.getNumber()); - tgt.setSopClass(src.getSopClass()); - tgt.setTitle(src.getTitle()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Immunization convertImmunization(org.hl7.fhir.instance.model.Immunization src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Immunization tgt = new org.hl7.fhir.dstu3.model.Immunization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - try { - tgt.setStatus(org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.fromCode(src.getStatus())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setNotGiven(src.getWasNotGiven()); - tgt.setPrimarySource(!src.getReported()); - if (src.hasPerformer()) - tgt.addPractitioner().setActor(convertReference(src.getPerformer())).setRole(new org.hl7.fhir.dstu3.model.CodeableConcept().addCoding(new Coding().setSystem("http://hl7.org/fhir/v2/0443").setCode("AP"))); - if (src.hasRequester()) - tgt.addPractitioner().setActor(convertReference(src.getRequester())).setRole(new org.hl7.fhir.dstu3.model.CodeableConcept().addCoding(new Coding().setSystem("http://hl7.org/fhir/v2/0443").setCode("OP"))); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setManufacturer(convertReference(src.getManufacturer())); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setLotNumber(src.getLotNumber()); - tgt.setExpirationDate(src.getExpirationDate()); - tgt.setSite(convertCodeableConcept(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setDoseQuantity(convertSimpleQuantity(src.getDoseQuantity())); - for (org.hl7.fhir.instance.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - tgt.setExplanation(convertImmunizationExplanationComponent(src.getExplanation())); - for (org.hl7.fhir.instance.model.Immunization.ImmunizationReactionComponent t : src.getReaction()) - tgt.addReaction(convertImmunizationReactionComponent(t)); - for (org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent t : src.getVaccinationProtocol()) - tgt.addVaccinationProtocol(convertImmunizationVaccinationProtocolComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Immunization convertImmunization(org.hl7.fhir.dstu3.model.Immunization src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Immunization tgt = new org.hl7.fhir.instance.model.Immunization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(src.getStatus().toCode()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setWasNotGiven(src.getNotGiven()); - tgt.setReported(!src.getPrimarySource()); - tgt.setPerformer(convertReference(getPerformer(src.getPractitioner()))); - tgt.setRequester(convertReference(getRequester(src.getPractitioner()))); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setManufacturer(convertReference(src.getManufacturer())); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setLotNumber(src.getLotNumber()); - tgt.setExpirationDate(src.getExpirationDate()); - tgt.setSite(convertCodeableConcept(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setDoseQuantity(convertSimpleQuantity(src.getDoseQuantity())); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.addNote(convertAnnotation(t)); - tgt.setExplanation(convertImmunizationExplanationComponent(src.getExplanation())); - for (org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent t : src.getReaction()) - tgt.addReaction(convertImmunizationReactionComponent(t)); - for (org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent t : src.getVaccinationProtocol()) - tgt.addVaccinationProtocol(convertImmunizationVaccinationProtocolComponent(t)); - return tgt; - } - - private org.hl7.fhir.dstu3.model.Reference getPerformer(List practitioner) { - for (ImmunizationPractitionerComponent p : practitioner) { - if (hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "AP")) - return p.getActor(); - } - return null; - } - - private org.hl7.fhir.dstu3.model.Reference getRequester(List practitioner) { - for (ImmunizationPractitionerComponent p : practitioner) { - if (hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "OP")) - return p.getActor(); - } - return null; - } - - private boolean hasConcept(org.hl7.fhir.dstu3.model.CodeableConcept cc, String system, String code) { - for (org.hl7.fhir.dstu3.model.Coding c : cc.getCoding()) { - if (system.equals(c.getSystem()) && code.equals(c.getCode())) - return true; - } - return false; - } - - private boolean hasConcept(org.hl7.fhir.instance.model.CodeableConcept cc, String system, String code) { - for (org.hl7.fhir.instance.model.Coding c : cc.getCoding()) { - if (system.equals(c.getSystem()) && code.equals(c.getCode())) - return true; - } - return false; - } - - public org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent convertImmunizationExplanationComponent(org.hl7.fhir.instance.model.Immunization.ImmunizationExplanationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReasonNotGiven()) - tgt.addReasonNotGiven(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Immunization.ImmunizationExplanationComponent convertImmunizationExplanationComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Immunization.ImmunizationExplanationComponent tgt = new org.hl7.fhir.instance.model.Immunization.ImmunizationExplanationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotGiven()) - tgt.addReasonNotGiven(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent convertImmunizationReactionComponent(org.hl7.fhir.instance.model.Immunization.ImmunizationReactionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent(); - copyElement(src, tgt); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDetail(convertReference(src.getDetail())); - tgt.setReported(src.getReported()); - return tgt; - } - - public org.hl7.fhir.instance.model.Immunization.ImmunizationReactionComponent convertImmunizationReactionComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Immunization.ImmunizationReactionComponent tgt = new org.hl7.fhir.instance.model.Immunization.ImmunizationReactionComponent(); - copyElement(src, tgt); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDetail(convertReference(src.getDetail())); - tgt.setReported(src.getReported()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent(); - copyElement(src, tgt); - tgt.setDoseSequence(src.getDoseSequence()); - tgt.setDescription(src.getDescription()); - tgt.setAuthority(convertReference(src.getAuthority())); - tgt.setSeries(src.getSeries()); - tgt.setSeriesDoses(src.getSeriesDoses()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getTargetDisease()) - tgt.addTargetDisease(convertCodeableConcept(t)); - tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus())); - tgt.setDoseStatusReason(convertCodeableConcept(src.getDoseStatusReason())); - return tgt; - } - - public org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent(); - copyElement(src, tgt); - tgt.setDoseSequence(src.getDoseSequence()); - tgt.setDescription(src.getDescription()); - tgt.setAuthority(convertReference(src.getAuthority())); - tgt.setSeries(src.getSeries()); - tgt.setSeriesDoses(src.getSeriesDoses()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTargetDisease()) - tgt.addTargetDisease(convertCodeableConcept(t)); - tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus())); - tgt.setDoseStatusReason(convertCodeableConcept(src.getDoseStatusReason())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImmunizationRecommendation convertImmunizationRecommendation(org.hl7.fhir.instance.model.ImmunizationRecommendation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImmunizationRecommendation tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - for (org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent t : src.getRecommendation()) - tgt.addRecommendation(convertImmunizationRecommendationRecommendationComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ImmunizationRecommendation convertImmunizationRecommendation(org.hl7.fhir.dstu3.model.ImmunizationRecommendation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ImmunizationRecommendation tgt = new org.hl7.fhir.instance.model.ImmunizationRecommendation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - for (org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent t : src.getRecommendation()) - tgt.addRecommendation(convertImmunizationRecommendationRecommendationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent convertImmunizationRecommendationRecommendationComponent(org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent(); - copyElement(src, tgt); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); - tgt.setDoseNumber(src.getDoseNumber()); - tgt.setForecastStatus(convertCodeableConcept(src.getForecastStatus())); - for (org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent t : src.getDateCriterion()) - tgt.addDateCriterion(convertImmunizationRecommendationRecommendationDateCriterionComponent(t)); - tgt.setProtocol(convertImmunizationRecommendationRecommendationProtocolComponent(src.getProtocol())); - for (org.hl7.fhir.instance.model.Reference t : src.getSupportingImmunization()) - tgt.addSupportingImmunization(convertReference(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getSupportingPatientInformation()) - tgt.addSupportingPatientInformation(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent convertImmunizationRecommendationRecommendationComponent(org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent tgt = new org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent(); - copyElement(src, tgt); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); - tgt.setDoseNumber(src.getDoseNumber()); - tgt.setForecastStatus(convertCodeableConcept(src.getForecastStatus())); - for (org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent t : src.getDateCriterion()) - tgt.addDateCriterion(convertImmunizationRecommendationRecommendationDateCriterionComponent(t)); - tgt.setProtocol(convertImmunizationRecommendationRecommendationProtocolComponent(src.getProtocol())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingImmunization()) - tgt.addSupportingImmunization(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingPatientInformation()) - tgt.addSupportingPatientInformation(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent convertImmunizationRecommendationRecommendationDateCriterionComponent(org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent convertImmunizationRecommendationRecommendationDateCriterionComponent(org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent tgt = new org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent convertImmunizationRecommendationRecommendationProtocolComponent(org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent(); - copyElement(src, tgt); - tgt.setDoseSequence(src.getDoseSequence()); - tgt.setDescription(src.getDescription()); - tgt.setAuthority(convertReference(src.getAuthority())); - tgt.setSeries(src.getSeries()); - return tgt; - } - - public org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent convertImmunizationRecommendationRecommendationProtocolComponent(org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent tgt = new org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent(); - copyElement(src, tgt); - tgt.setDoseSequence(src.getDoseSequence()); - tgt.setDescription(src.getDescription()); - tgt.setAuthority(convertReference(src.getAuthority())); - tgt.setSeries(src.getSeries()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.instance.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setCopyright(src.getCopyright()); - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) - tgt.addDependency(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) - tgt.addPackage(convertImplementationGuidePackageComponent(t)); - for (org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); - for (org.hl7.fhir.instance.model.UriType t : src.getBinary()) - tgt.addBinary(t.getValue()); - tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); - return tgt; - } - - public org.hl7.fhir.instance.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu3.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ImplementationGuide tgt = new org.hl7.fhir.instance.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setCopyright(src.getCopyright()); - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) - tgt.addDependency(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) - tgt.addPackage(convertImplementationGuidePackageComponent(t)); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getBinary()) - tgt.addBinary(t.getValue()); - tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent(); - copyElement(src, tgt); - tgt.setType(convertGuideDependencyType(src.getType())); - tgt.setUri(src.getUri()); - return tgt; - } - - public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideDependencyComponent(); - copyElement(src, tgt); - tgt.setType(convertGuideDependencyType(src.getType())); - tgt.setUri(src.getUri()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REFERENCE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.REFERENCE; - case INCLUSION: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.INCLUSION; - default: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.NULL; - } - } - - public org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REFERENCE: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.REFERENCE; - case INCLUSION: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.INCLUSION; - default: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) - tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) - tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); - copyElement(src, tgt); - tgt.setExample(src.getPurpose() == org.hl7.fhir.instance.model.ImplementationGuide.GuideResourcePurpose.EXAMPLE); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setAcronym(src.getAcronym()); - tgt.setSource(convertType(src.getSource())); - tgt.setExampleFor(convertReference(src.getExampleFor())); - return tgt; - } - - public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); - copyElement(src, tgt); - if (src.getExample()) - tgt.setPurpose(org.hl7.fhir.instance.model.ImplementationGuide.GuideResourcePurpose.EXAMPLE); - else - tgt.setPurpose(org.hl7.fhir.instance.model.ImplementationGuide.GuideResourcePurpose.PROFILE); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setAcronym(src.getAcronym()); - tgt.setSource(convertType(src.getSource())); - tgt.setExampleFor(convertReference(src.getExampleFor())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent(); - copyElement(src, tgt); - tgt.setSource(src.getSource()); - tgt.setTitle(src.getName()); - tgt.setKind(convertGuidePageKind(src.getKind())); - for (org.hl7.fhir.instance.model.CodeType t : src.getType()) - tgt.addType(t.getValue()); - for (org.hl7.fhir.instance.model.StringType t : src.getPackage()) - tgt.addPackage(t.getValue()); - tgt.setFormat(src.getFormat()); - for (org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePageComponent(); - copyElement(src, tgt); - tgt.setSource(src.getSource()); - tgt.setName(src.getTitle()); - tgt.setKind(convertGuidePageKind(src.getKind())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getType()) - tgt.addType(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getPackage()) - tgt.addPackage(t.getValue()); - tgt.setFormat(src.getFormat()); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PAGE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.PAGE; - case EXAMPLE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.EXAMPLE; - case LIST: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.LIST; - case INCLUDE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.INCLUDE; - case DIRECTORY: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DIRECTORY; - case DICTIONARY: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DICTIONARY; - case TOC: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.TOC; - case RESOURCE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.RESOURCE; - default: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.NULL; - } - } - - public org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PAGE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.PAGE; - case EXAMPLE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.EXAMPLE; - case LIST: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.LIST; - case INCLUDE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.INCLUDE; - case DIRECTORY: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.DIRECTORY; - case DICTIONARY: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.DICTIONARY; - case TOC: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.TOC; - case RESOURCE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.RESOURCE; - default: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.NULL; - } - } - - - public org.hl7.fhir.dstu3.model.Location convertLocation(org.hl7.fhir.instance.model.Location src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Location tgt = new org.hl7.fhir.dstu3.model.Location(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertLocationStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setMode(convertLocationMode(src.getMode())); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); - tgt.setPosition(convertLocationPositionComponent(src.getPosition())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.instance.model.Location convertLocation(org.hl7.fhir.dstu3.model.Location src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Location tgt = new org.hl7.fhir.instance.model.Location(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertLocationStatus(src.getStatus())); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - tgt.setMode(convertLocationMode(src.getMode())); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); - tgt.setPosition(convertLocationPositionComponent(src.getPosition())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setPartOf(convertReference(src.getPartOf())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.instance.model.Location.LocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.Location.LocationStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.dstu3.model.Location.LocationStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.dstu3.model.Location.LocationStatus.INACTIVE; - default: return org.hl7.fhir.dstu3.model.Location.LocationStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu3.model.Location.LocationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.instance.model.Location.LocationStatus.ACTIVE; - case SUSPENDED: return org.hl7.fhir.instance.model.Location.LocationStatus.SUSPENDED; - case INACTIVE: return org.hl7.fhir.instance.model.Location.LocationStatus.INACTIVE; - default: return org.hl7.fhir.instance.model.Location.LocationStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Location.LocationMode convertLocationMode(org.hl7.fhir.instance.model.Location.LocationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu3.model.Location.LocationMode.INSTANCE; - case KIND: return org.hl7.fhir.dstu3.model.Location.LocationMode.KIND; - default: return org.hl7.fhir.dstu3.model.Location.LocationMode.NULL; - } - } - - public org.hl7.fhir.instance.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu3.model.Location.LocationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.instance.model.Location.LocationMode.INSTANCE; - case KIND: return org.hl7.fhir.instance.model.Location.LocationMode.KIND; - default: return org.hl7.fhir.instance.model.Location.LocationMode.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.instance.model.Location.LocationPositionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu3.model.Location.LocationPositionComponent(); - copyElement(src, tgt); - tgt.setLongitude(src.getLongitude()); - tgt.setLatitude(src.getLatitude()); - tgt.setAltitude(src.getAltitude()); - return tgt; - } - - public org.hl7.fhir.instance.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu3.model.Location.LocationPositionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.instance.model.Location.LocationPositionComponent(); - copyElement(src, tgt); - tgt.setLongitude(src.getLongitude()); - tgt.setLatitude(src.getLatitude()); - tgt.setAltitude(src.getAltitude()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Media convertMedia(org.hl7.fhir.instance.model.Media src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Media tgt = new org.hl7.fhir.dstu3.model.Media(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setType(convertDigitalMediaType(src.getType())); - tgt.setSubtype(convertCodeableConcept(src.getSubtype())); - tgt.setView(convertCodeableConcept(src.getView())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setOperator(convertReference(src.getOperator())); - tgt.getDevice().setDisplay(src.getDeviceName()); - tgt.setHeight(src.getHeight()); - tgt.setWidth(src.getWidth()); - tgt.setFrames(src.getFrames()); - tgt.setDuration(src.getDuration()); - tgt.setContent(convertAttachment(src.getContent())); - return tgt; - } - - public org.hl7.fhir.instance.model.Media convertMedia(org.hl7.fhir.dstu3.model.Media src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Media tgt = new org.hl7.fhir.instance.model.Media(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setType(convertDigitalMediaType(src.getType())); - tgt.setSubtype(convertCodeableConcept(src.getSubtype())); - tgt.setView(convertCodeableConcept(src.getView())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setOperator(convertReference(src.getOperator())); - tgt.setDeviceName(src.getDevice().getDisplay()); - tgt.setHeight(src.getHeight()); - tgt.setWidth(src.getWidth()); - tgt.setFrames(src.getFrames()); - tgt.setDuration(src.getDuration()); - tgt.setContent(convertAttachment(src.getContent())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.instance.model.Media.DigitalMediaType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHOTO: return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.PHOTO; - case VIDEO: return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.VIDEO; - case AUDIO: return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.AUDIO; - default: return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.NULL; - } - } - - public org.hl7.fhir.instance.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.dstu3.model.Media.DigitalMediaType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHOTO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.PHOTO; - case VIDEO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.VIDEO; - case AUDIO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.AUDIO; - default: return org.hl7.fhir.instance.model.Media.DigitalMediaType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Medication convertMedication(org.hl7.fhir.instance.model.Medication src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Medication tgt = new org.hl7.fhir.dstu3.model.Medication(); - copyDomainResource(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setIsBrand(src.getIsBrand()); - tgt.setManufacturer(convertReference(src.getManufacturer())); -// tgt.setProduct(convertMedicationProductComponent(src.getProduct())); - tgt.setPackage(convertMedicationPackageComponent(src.getPackage())); - return tgt; - } - - public org.hl7.fhir.instance.model.Medication convertMedication(org.hl7.fhir.dstu3.model.Medication src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Medication tgt = new org.hl7.fhir.instance.model.Medication(); - copyDomainResource(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setIsBrand(src.getIsBrand()); - tgt.setManufacturer(convertReference(src.getManufacturer())); -// tgt.setProduct(convertMedicationProductComponent(src.getProduct())); - tgt.setPackage(convertMedicationPackageComponent(src.getPackage())); - return tgt; - } - -// public org.hl7.fhir.dstu3.model.Medication.MedicationProductComponent convertMedicationProductComponent(org.hl7.fhir.instance.model.Medication.MedicationProductComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.Medication.MedicationProductComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationProductComponent(); -// copyElement(src, tgt); -// tgt.setForm(convertCodeableConcept(src.getForm())); -// for (org.hl7.fhir.instance.model.Medication.MedicationProductIngredientComponent t : src.getIngredient()) -// tgt.addIngredient(convertMedicationProductIngredientComponent(t)); -// for (org.hl7.fhir.instance.model.Medication.MedicationProductBatchComponent t : src.getBatch()) -// tgt.addBatch(convertMedicationProductBatchComponent(t)); -// return tgt; -// } - -// public org.hl7.fhir.instance.model.Medication.MedicationProductComponent convertMedicationProductComponent(org.hl7.fhir.dstu3.model.Medication.MedicationProductComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.Medication.MedicationProductComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationProductComponent(); -// copyElement(src, tgt); -// tgt.setForm(convertCodeableConcept(src.getForm())); -// for (org.hl7.fhir.dstu3.model.Medication.MedicationProductIngredientComponent t : src.getIngredient()) -// tgt.addIngredient(convertMedicationProductIngredientComponent(t)); -// for (org.hl7.fhir.dstu3.model.Medication.MedicationProductBatchComponent t : src.getBatch()) -// tgt.addBatch(convertMedicationProductBatchComponent(t)); -// return tgt; -// } - -// public org.hl7.fhir.dstu3.model.Medication.MedicationProductIngredientComponent convertMedicationProductIngredientComponent(org.hl7.fhir.instance.model.Medication.MedicationProductIngredientComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.Medication.MedicationProductIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationProductIngredientComponent(); -// copyElement(src, tgt); -// tgt.setItem(convertType(src.getItem())); -// tgt.setAmount(convertRatio(src.getAmount())); -// return tgt; -// } - -// public org.hl7.fhir.instance.model.Medication.MedicationProductIngredientComponent convertMedicationProductIngredientComponent(org.hl7.fhir.dstu3.model.Medication.MedicationProductIngredientComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.Medication.MedicationProductIngredientComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationProductIngredientComponent(); -// copyElement(src, tgt); -// if (src.hasItemReference()) -// tgt.setItem((org.hl7.fhir.instance.model.Reference) convertType(src.getItem())); -// tgt.setAmount(convertRatio(src.getAmount())); -// return tgt; -// } - -// public org.hl7.fhir.dstu3.model.Medication.MedicationProductBatchComponent convertMedicationProductBatchComponent(org.hl7.fhir.instance.model.Medication.MedicationProductBatchComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.Medication.MedicationProductBatchComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationProductBatchComponent(); -// copyElement(src, tgt); -// tgt.setLotNumber(src.getLotNumber()); -// tgt.setExpirationDate(src.getExpirationDate()); -// return tgt; -// } - -// public org.hl7.fhir.instance.model.Medication.MedicationProductBatchComponent convertMedicationProductBatchComponent(org.hl7.fhir.dstu3.model.Medication.MedicationProductBatchComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.Medication.MedicationProductBatchComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationProductBatchComponent(); -// copyElement(src, tgt); -// tgt.setLotNumber(src.getLotNumber()); -// tgt.setExpirationDate(src.getExpirationDate()); -// return tgt; -// } - - public org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.instance.model.Medication.MedicationPackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent(); - copyElement(src, tgt); - tgt.setContainer(convertCodeableConcept(src.getContainer())); - for (org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent t : src.getContent()) - tgt.addContent(convertMedicationPackageContentComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationPackageComponent(); - copyElement(src, tgt); - tgt.setContainer(convertCodeableConcept(src.getContainer())); - for (org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent t : src.getContent()) - tgt.addContent(convertMedicationPackageContentComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent(); - copyElement(src, tgt); - tgt.setItem(convertType(src.getItem())); - tgt.setAmount(convertSimpleQuantity(src.getAmount())); - return tgt; - } - - public org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent(); - copyElement(src, tgt); - if (src.hasItemReference()) - tgt.setItem((org.hl7.fhir.instance.model.Reference) convertType(src.getItem())); - tgt.setAmount(convertSimpleQuantity(src.getAmount())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.instance.model.MedicationDispense src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.MedicationDispense tgt = new org.hl7.fhir.dstu3.model.MedicationDispense(); - copyDomainResource(src, tgt); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setSubject(convertReference(src.getPatient())); -// tgt.setDispenser(convertReference(src.getDispenser())); - for (org.hl7.fhir.instance.model.Reference t : src.getAuthorizingPrescription()) - tgt.addAuthorizingPrescription(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); - tgt.setWhenPrepared(src.getWhenPrepared()); - tgt.setWhenHandedOver(src.getWhenHandedOver()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.instance.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - if (src.hasNote()) - tgt.addNote().setText(src.getNote()); - for (org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); - tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); - return tgt; - } - - public org.hl7.fhir.instance.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu3.model.MedicationDispense src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MedicationDispense tgt = new org.hl7.fhir.instance.model.MedicationDispense(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); - tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setPatient(convertReference(src.getSubject())); -// tgt.setDispenser(convertReference(src.getDispenser())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthorizingPrescription()) - tgt.addAuthorizingPrescription(convertReference(t)); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); - tgt.setWhenPrepared(src.getWhenPrepared()); - tgt.setWhenHandedOver(src.getWhenHandedOver()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.setNote(t.getText()); - for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction()) - tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); - tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ONHOLD; - case COMPLETED: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR; - case STOPPED: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.STOPPED; - default: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS; - case ONHOLD: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.ONHOLD; - case COMPLETED: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR; - case STOPPED: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.STOPPED; - default: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Dosage convertMedicationDispenseDosageInstructionComponent(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setDose(convertType(src.getDose())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent convertMedicationDispenseDosageInstructionComponent(Dosage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent tgt = new org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setSite(convertType(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setDose(convertType(src.getDose())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); - copyElement(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getResponsibleParty()) - tgt.addResponsibleParty(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); - copyElement(src, tgt); - tgt.setType(convertCodeableConcept(src.getType())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) - tgt.addReason(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getResponsibleParty()) - tgt.addResponsibleParty(convertReference(t)); - return tgt; - } - -// public org.hl7.fhir.dstu3.model.MedicationOrder convertMedicationOrder(org.hl7.fhir.instance.model.MedicationOrder src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.MedicationOrder tgt = new org.hl7.fhir.dstu3.model.MedicationOrder(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setStatus(convertMedicationOrderStatus(src.getStatus())); -// tgt.setMedication(convertType(src.getMedication())); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateWritten()) -// tgt.setDateWritten(src.getDateWritten()); -// tgt.setPrescriber(convertReference(src.getPrescriber())); -// if (src.hasReasonCodeableConcept()) -// tgt.addReasonCode(convertCodeableConcept(src.getReasonCodeableConcept())); -// if (src.hasReasonReference()) -// tgt.addReasonReference(convertReference(src.getReasonReference())); -//// tgt.setDateEnded(src.getDateEnded()); -//// tgt.setReasonEnded(convertCodeableConcept(src.getReasonEnded())); -// if (src.hasNote()) -// tgt.addNote().setText(src.getNote()); -// for (org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent t : src.getDosageInstruction()) -// tgt.addDosageInstruction(convertMedicationOrderDosageInstructionComponent(t)); -// tgt.setDispenseRequest(convertMedicationOrderDispenseRequestComponent(src.getDispenseRequest())); -// tgt.setSubstitution(convertMedicationOrderSubstitutionComponent(src.getSubstitution())); -// tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); -// return tgt; -// } -// -// public org.hl7.fhir.instance.model.MedicationOrder convertMedicationOrder(org.hl7.fhir.dstu3.model.MedicationOrder src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.MedicationOrder tgt = new org.hl7.fhir.instance.model.MedicationOrder(); -// copyDomainResource(src, tgt); -// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) -// tgt.addIdentifier(convertIdentifier(t)); -// tgt.setStatus(convertMedicationOrderStatus(src.getStatus())); -// tgt.setMedication(convertType(src.getMedication())); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setEncounter(convertReference(src.getEncounter())); -// if (src.hasDateWritten()) -// tgt.setDateWritten(src.getDateWritten()); -// tgt.setPrescriber(convertReference(src.getPrescriber())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) -// tgt.setReason(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) -// tgt.setReason(convertReference(t)); -//// tgt.setDateEnded(src.getDateEnded()); -//// tgt.setReasonEnded(convertCodeableConcept(src.getReasonEnded())); -// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) -// tgt.setNote(t.getText()); -// for (org.hl7.fhir.dstu3.model.DosageInstruction t : src.getDosageInstruction()) -// tgt.addDosageInstruction(convertMedicationOrderDosageInstructionComponent(t)); -// tgt.setDispenseRequest(convertMedicationOrderDispenseRequestComponent(src.getDispenseRequest())); -// tgt.setSubstitution(convertMedicationOrderSubstitutionComponent(src.getSubstitution())); -// tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus convertMedicationOrderStatus(org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.ACTIVE; -// case ONHOLD: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.ONHOLD; -// case COMPLETED: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.COMPLETED; -// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.ENTEREDINERROR; -// case STOPPED: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.STOPPED; -// case DRAFT: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.DRAFT; -// default: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.NULL; -// } -// } -// -// public org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus convertMedicationOrderStatus(org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus src) throws FHIRException { -// if (src == null) -// return null; -// switch (src) { -// case ACTIVE: return org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus.ACTIVE; -// case ONHOLD: return org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus.ONHOLD; -// case COMPLETED: return org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus.COMPLETED; -// case ENTEREDINERROR: return org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus.ENTEREDINERROR; -// case STOPPED: return org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus.STOPPED; -// case DRAFT: return org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus.DRAFT; -// default: return org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus.NULL; -// } -// } - - public org.hl7.fhir.dstu3.model.Dosage convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setDose(convertType(src.getDose())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.dstu3.model.Dosage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent tgt = new org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent(); - copyElement(src, tgt); - tgt.setText(src.getText()); -// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setSite(convertType(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setDose(convertType(src.getDose())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - -// public org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderDispenseRequestComponent convertMedicationOrderDispenseRequestComponent(org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDispenseRequestComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderDispenseRequestComponent tgt = new org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderDispenseRequestComponent(); -// copyElement(src, tgt); -//// tgt.setMedication(convertType(src.getMedication())); -// tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); -// tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); -// return tgt; -// } -// -// public org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDispenseRequestComponent convertMedicationOrderDispenseRequestComponent(org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderDispenseRequestComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDispenseRequestComponent tgt = new org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDispenseRequestComponent(); -// copyElement(src, tgt); -//// tgt.setMedication(convertType(src.getMedication())); -// tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); -// tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); -// return tgt; -// } -// -// public org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderSubstitutionComponent convertMedicationOrderSubstitutionComponent(org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderSubstitutionComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderSubstitutionComponent(); -// copyElement(src, tgt); -//// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setReason(convertCodeableConcept(src.getReason())); -// return tgt; -// } -// -// public org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderSubstitutionComponent convertMedicationOrderSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderSubstitutionComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderSubstitutionComponent tgt = new org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderSubstitutionComponent(); -// copyElement(src, tgt); -//// tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setReason(convertCodeableConcept(src.getReason())); -// return tgt; -// } - - public org.hl7.fhir.dstu3.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.instance.model.MedicationStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.MedicationStatement tgt = new org.hl7.fhir.dstu3.model.MedicationStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setSubject(convertReference(src.getPatient())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setInformationSource(convertReference(src.getInformationSource())); - for (org.hl7.fhir.instance.model.Reference t : src.getSupportingInformation()) - tgt.addDerivedFrom(convertReference(t)); - if (src.hasDateAsserted()) - tgt.setDateAsserted(src.getDateAsserted()); -// tgt.getNotTakenElement().setValueAsString(src.getWasNotTaken() ? "Y" : "N"); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReasonNotTaken()) - tgt.addReasonNotTaken(convertCodeableConcept(t)); -// tgt.setReasonForUse(convertType(src.getReasonForUse())); - if (src.hasNote()) - tgt.addNote().setText(src.getNote()); - for (org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent t : src.getDosage()) - tgt.addDosage(convertMedicationStatementDosageComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.dstu3.model.MedicationStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MedicationStatement tgt = new org.hl7.fhir.instance.model.MedicationStatement(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); - tgt.setMedication(convertType(src.getMedication())); - tgt.setPatient(convertReference(src.getSubject())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setInformationSource(convertReference(src.getInformationSource())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getDerivedFrom()) - tgt.addSupportingInformation(convertReference(t)); - if (src.hasDateAsserted()) - tgt.setDateAsserted(src.getDateAsserted()); -// tgt.setWasNotTaken("Y".equals(src.getNotTakenElement().getValueAsString())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotTaken()) - tgt.addReasonNotTaken(convertCodeableConcept(t)); -// tgt.setReasonForUse(convertType(src.getReasonForUse())); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.setNote(t.getText()); - for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) - tgt.addDosage(convertMedicationStatementDosageComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.INTENDED; - default: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; - case INTENDED: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.INTENDED; - default: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Dosage convertMedicationStatementDosageComponent(org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); - copyElement(src, tgt); - tgt.setText(src.getText()); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - if (src.hasSiteCodeableConcept()) - tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); -// tgt.setQuantity(convertType(src.getQuantity())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent convertMedicationStatementDosageComponent(org.hl7.fhir.dstu3.model.Dosage src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent tgt = new org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent(); - copyElement(src, tgt); - tgt.setText(src.getText()); - tgt.setTiming(convertTiming(src.getTiming())); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setSite(convertType(src.getSite())); - tgt.setRoute(convertCodeableConcept(src.getRoute())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); -// tgt.setQuantity(convertType(src.getQuantity())); - tgt.setRate(convertType(src.getRate())); - tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MessageHeader convertMessageHeader(org.hl7.fhir.instance.model.MessageHeader src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.MessageHeader tgt = new org.hl7.fhir.dstu3.model.MessageHeader(); - copyDomainResource(src, tgt); - tgt.setTimestamp(src.getTimestamp()); - tgt.setEvent(convertCoding(src.getEvent())); - tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); - tgt.setSource(convertMessageSourceComponent(src.getSource())); - for (org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) - tgt.addDestination(convertMessageDestinationComponent(t)); - tgt.setEnterer(convertReference(src.getEnterer())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setReceiver(convertReference(src.getReceiver())); - tgt.setResponsible(convertReference(src.getResponsible())); - tgt.setReason(convertCodeableConcept(src.getReason())); - for (org.hl7.fhir.instance.model.Reference t : src.getData()) - tgt.addFocus(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu3.model.MessageHeader src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MessageHeader tgt = new org.hl7.fhir.instance.model.MessageHeader(); - copyDomainResource(src, tgt); - tgt.setTimestamp(src.getTimestamp()); - tgt.setEvent(convertCoding(src.getEvent())); - tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); - tgt.setSource(convertMessageSourceComponent(src.getSource())); - for (org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) - tgt.addDestination(convertMessageDestinationComponent(t)); - tgt.setEnterer(convertReference(src.getEnterer())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setReceiver(convertReference(src.getReceiver())); - tgt.setResponsible(convertReference(src.getResponsible())); - tgt.setReason(convertCodeableConcept(src.getReason())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getFocus()) - tgt.addData(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setCode(convertResponseType(src.getCode())); - tgt.setDetails(convertReference(src.getDetails())); - return tgt; - } - - public org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setCode(convertResponseType(src.getCode())); - tgt.setDetails(convertReference(src.getDetails())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.instance.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OK: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.OK; - case TRANSIENTERROR: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.TRANSIENTERROR; - case FATALERROR: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.FATALERROR; - default: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.NULL; - } - } - - public org.hl7.fhir.instance.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu3.model.MessageHeader.ResponseType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OK: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.OK; - case TRANSIENTERROR: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.TRANSIENTERROR; - case FATALERROR: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.FATALERROR; - default: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setSoftware(src.getSoftware()); - tgt.setVersion(src.getVersion()); - tgt.setContact(convertContactPoint(src.getContact())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setSoftware(src.getSoftware()); - tgt.setVersion(src.getVersion()); - tgt.setContact(convertContactPoint(src.getContact())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setEndpoint(src.getEndpoint()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.NamingSystem convertNamingSystem(org.hl7.fhir.instance.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - tgt.setReplacedBy(convertReference(src.getReplacedBy())); - return tgt; - } - - public org.hl7.fhir.instance.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu3.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.NamingSystem tgt = new org.hl7.fhir.instance.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - tgt.setReplacedBy(convertReference(src.getReplacedBy())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.instance.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL; - } - } - - public org.hl7.fhir.instance.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - public org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Observation convertObservation(org.hl7.fhir.instance.model.Observation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Observation tgt = new org.hl7.fhir.dstu3.model.Observation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertObservationStatus(src.getStatus())); - tgt.addCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); - for (org.hl7.fhir.instance.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - tgt.setInterpretation(convertCodeableConcept(src.getInterpretation())); - tgt.setComment(src.getComments()); - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setSpecimen(convertReference(src.getSpecimen())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - for (org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent t : src.getRelated()) - tgt.addRelated(convertObservationRelatedComponent(t)); - for (org.hl7.fhir.instance.model.Observation.ObservationComponentComponent t : src.getComponent()) - tgt.addComponent(convertObservationComponentComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Observation convertObservation(org.hl7.fhir.dstu3.model.Observation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Observation tgt = new org.hl7.fhir.instance.model.Observation(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertObservationStatus(src.getStatus())); - for (org.hl7.fhir.dstu3.model.CodeableConcept c : src.getCategory()) - tgt.setCategory(convertCodeableConcept(c)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setEffective(convertType(src.getEffective())); - tgt.setIssued(src.getIssued()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) - tgt.addPerformer(convertReference(t)); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - tgt.setInterpretation(convertCodeableConcept(src.getInterpretation())); - tgt.setComments(src.getComment()); - tgt.setBodySite(convertCodeableConcept(src.getBodySite())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - tgt.setSpecimen(convertReference(src.getSpecimen())); - tgt.setDevice(convertReference(src.getDevice())); - for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - for (org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent t : src.getRelated()) - tgt.addRelated(convertObservationRelatedComponent(t)); - for (org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent t : src.getComponent()) - tgt.addComponent(convertObservationComponentComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.instance.model.Observation.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.AMENDED; - case CANCELLED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu3.model.Observation.ObservationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REGISTERED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.REGISTERED; - case PRELIMINARY: return org.hl7.fhir.instance.model.Observation.ObservationStatus.PRELIMINARY; - case FINAL: return org.hl7.fhir.instance.model.Observation.ObservationStatus.FINAL; - case AMENDED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.AMENDED; - case CANCELLED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.CANCELLED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.Observation.ObservationStatus.ENTEREDINERROR; - case UNKNOWN: return org.hl7.fhir.instance.model.Observation.ObservationStatus.UNKNOWN; - default: return org.hl7.fhir.instance.model.Observation.ObservationStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - tgt.setType(convertCodeableConcept(src.getMeaning())); - tgt.setAge(convertRange(src.getAge())); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept c : src.getMeaning()) - tgt.setMeaning(convertCodeableConcept(src.getType())); - tgt.setAge(convertRange(src.getAge())); - tgt.setText(src.getText()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent(); - copyElement(src, tgt); - tgt.setType(convertObservationRelationshipType(src.getType())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent(); - copyElement(src, tgt); - tgt.setType(convertObservationRelationshipType(src.getType())); - tgt.setTarget(convertReference(src.getTarget())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.instance.model.Observation.ObservationRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HASMEMBER: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER; - case DERIVEDFROM: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM; - case SEQUELTO: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.SEQUELTO; - case REPLACES: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.REPLACES; - case QUALIFIEDBY: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.QUALIFIEDBY; - case INTERFEREDBY: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.INTERFEREDBY; - default: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.NULL; - } - } - - public org.hl7.fhir.instance.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HASMEMBER: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.HASMEMBER; - case DERIVEDFROM: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.DERIVEDFROM; - case SEQUELTO: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.SEQUELTO; - case REPLACES: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.REPLACES; - case QUALIFIEDBY: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.QUALIFIEDBY; - case INTERFEREDBY: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.INTERFEREDBY; - default: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.instance.model.Observation.ObservationComponentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - for (org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationComponentComponent(); - copyElement(src, tgt); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setValue(convertType(src.getValue())); - tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); - for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) - tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.instance.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition tgt = new org.hl7.fhir.dstu3.model.OperationDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setPurpose(src.getRequirements()); - if (src.hasIdempotent()) - tgt.setIdempotent(src.getIdempotent()); - tgt.setCode(src.getCode()); - tgt.setComment(src.getNotes()); - tgt.setBase(convertReference(src.getBase())); - tgt.setSystem(src.getSystem()); - for (org.hl7.fhir.instance.model.CodeType t : src.getType()) - tgt.addResource(t.getValue()); - tgt.setType(tgt.hasResource()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu3.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.OperationDefinition tgt = new org.hl7.fhir.instance.model.OperationDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - tgt.setDescription(src.getDescription()); - tgt.setRequirements(src.getPurpose()); - tgt.setIdempotent(src.getIdempotent()); - tgt.setCode(src.getCode()); - tgt.setNotes(src.getComment()); - if (src.hasBase()) - tgt.setBase(convertReference(src.getBase())); - tgt.setSystem(src.getSystem()); - if (src.getType()) - for (org.hl7.fhir.dstu3.model.CodeType t : src.getResource()) - tgt.addType(t.getValue()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.instance.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.NULL; - } - } - - public org.hl7.fhir.instance.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - tgt.setDocumentation(src.getDocumentation()); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - tgt.setDocumentation(src.getDocumentation()); - if (src.hasSearchType()) { - tgt.setType(src.getSearchType().toCode()); - tgt.setType("string"); - } else - tgt.setType(src.getType()); - if (src.hasProfile()) - tgt.setProfile(convertReference(src.getProfile())); - if (src.hasBinding()) - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.NULL; - } - } - - public org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.NULL; - } - } - - public org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.instance.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.OperationOutcome tgt = new org.hl7.fhir.instance.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.instance.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - return tgt; - } - - public org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL; - } - } - - public org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.NULL; - } - } - - public org.hl7.fhir.dstu3.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.instance.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL; - } - } - - public org.hl7.fhir.instance.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NULL; - } - } - - - public org.hl7.fhir.dstu3.model.Organization convertOrganization(org.hl7.fhir.instance.model.Organization src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Organization tgt = new org.hl7.fhir.dstu3.model.Organization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - tgt.addType(convertCodeableConcept(src.getType())); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.instance.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.instance.model.Organization.OrganizationContactComponent t : src.getContact()) - tgt.addContact(convertOrganizationContactComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Organization convertOrganization(org.hl7.fhir.dstu3.model.Organization src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Organization tgt = new org.hl7.fhir.instance.model.Organization(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - tgt.setType(convertCodeableConcept(src.getTypeFirstRep())); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPartOf(convertReference(src.getPartOf())); - for (org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent t : src.getContact()) - tgt.addContact(convertOrganizationContactComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.instance.model.Organization.OrganizationContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent(); - copyElement(src, tgt); - tgt.setPurpose(convertCodeableConcept(src.getPurpose())); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - return tgt; - } - - public org.hl7.fhir.instance.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.instance.model.Organization.OrganizationContactComponent(); - copyElement(src, tgt); - tgt.setPurpose(convertCodeableConcept(src.getPurpose())); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - return tgt; - } - - - public org.hl7.fhir.dstu3.model.Patient convertPatient(org.hl7.fhir.instance.model.Patient src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Patient tgt = new org.hl7.fhir.dstu3.model.Patient(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.instance.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - tgt.setDeceased(convertType(src.getDeceased())); - for (org.hl7.fhir.instance.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); - tgt.setMultipleBirth(convertType(src.getMultipleBirth())); - for (org.hl7.fhir.instance.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.instance.model.Patient.ContactComponent t : src.getContact()) - tgt.addContact(convertContactComponent(t)); - tgt.setAnimal(convertAnimalComponent(src.getAnimal())); - for (org.hl7.fhir.instance.model.Patient.PatientCommunicationComponent t : src.getCommunication()) - tgt.addCommunication(convertPatientCommunicationComponent(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getCareProvider()) - tgt.addGeneralPractitioner(convertReference(t)); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.instance.model.Patient.PatientLinkComponent t : src.getLink()) - tgt.addLink(convertPatientLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Patient convertPatient(org.hl7.fhir.dstu3.model.Patient src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Patient tgt = new org.hl7.fhir.instance.model.Patient(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - tgt.setDeceased(convertType(src.getDeceased())); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); - tgt.setMultipleBirth(convertType(src.getMultipleBirth())); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - for (org.hl7.fhir.dstu3.model.Patient.ContactComponent t : src.getContact()) - tgt.addContact(convertContactComponent(t)); - tgt.setAnimal(convertAnimalComponent(src.getAnimal())); - for (org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent t : src.getCommunication()) - tgt.addCommunication(convertPatientCommunicationComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getGeneralPractitioner()) - tgt.addCareProvider(convertReference(t)); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - for (org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent t : src.getLink()) - tgt.addLink(convertPatientLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.instance.model.Patient.ContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu3.model.Patient.ContactComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRelationship()) - tgt.addRelationship(convertCodeableConcept(t)); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu3.model.Patient.ContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Patient.ContactComponent tgt = new org.hl7.fhir.instance.model.Patient.ContactComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRelationship()) - tgt.addRelationship(convertCodeableConcept(t)); - tgt.setName(convertHumanName(src.getName())); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setAddress(convertAddress(src.getAddress())); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setOrganization(convertReference(src.getOrganization())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.instance.model.Patient.AnimalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu3.model.Patient.AnimalComponent(); - copyElement(src, tgt); - tgt.setSpecies(convertCodeableConcept(src.getSpecies())); - tgt.setBreed(convertCodeableConcept(src.getBreed())); - tgt.setGenderStatus(convertCodeableConcept(src.getGenderStatus())); - return tgt; - } - - public org.hl7.fhir.instance.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.dstu3.model.Patient.AnimalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Patient.AnimalComponent tgt = new org.hl7.fhir.instance.model.Patient.AnimalComponent(); - copyElement(src, tgt); - tgt.setSpecies(convertCodeableConcept(src.getSpecies())); - tgt.setBreed(convertCodeableConcept(src.getBreed())); - tgt.setGenderStatus(convertCodeableConcept(src.getGenderStatus())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.instance.model.Patient.PatientCommunicationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent(); - copyElement(src, tgt); - tgt.setLanguage(convertCodeableConcept(src.getLanguage())); - tgt.setPreferred(src.getPreferred()); - return tgt; - } - - public org.hl7.fhir.instance.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.instance.model.Patient.PatientCommunicationComponent(); - copyElement(src, tgt); - tgt.setLanguage(convertCodeableConcept(src.getLanguage())); - tgt.setPreferred(src.getPreferred()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.instance.model.Patient.PatientLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent(); - copyElement(src, tgt); - tgt.setOther(convertReference(src.getOther())); - tgt.setType(convertLinkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.instance.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.instance.model.Patient.PatientLinkComponent(); - copyElement(src, tgt); - tgt.setOther(convertReference(src.getOther())); - tgt.setType(convertLinkType(src.getType())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Patient.LinkType convertLinkType(org.hl7.fhir.instance.model.Patient.LinkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACE: return org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACEDBY; - case REFER: return org.hl7.fhir.dstu3.model.Patient.LinkType.REFER; - case SEEALSO: return org.hl7.fhir.dstu3.model.Patient.LinkType.SEEALSO; - default: return org.hl7.fhir.dstu3.model.Patient.LinkType.NULL; - } - } - - public org.hl7.fhir.instance.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu3.model.Patient.LinkType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REPLACEDBY: return org.hl7.fhir.instance.model.Patient.LinkType.REPLACE; - case REPLACES: return org.hl7.fhir.instance.model.Patient.LinkType.REPLACE; - case REFER: return org.hl7.fhir.instance.model.Patient.LinkType.REFER; - case SEEALSO: return org.hl7.fhir.instance.model.Patient.LinkType.SEEALSO; - default: return org.hl7.fhir.instance.model.Patient.LinkType.NULL; - } - } - - - public org.hl7.fhir.dstu3.model.Person convertPerson(org.hl7.fhir.instance.model.Person src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Person tgt = new org.hl7.fhir.dstu3.model.Person(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.instance.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.instance.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPhoto(convertAttachment(src.getPhoto())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.instance.model.Person.PersonLinkComponent t : src.getLink()) - tgt.addLink(convertPersonLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Person convertPerson(org.hl7.fhir.dstu3.model.Person src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Person tgt = new org.hl7.fhir.instance.model.Person(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) - tgt.addName(convertHumanName(t)); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setPhoto(convertAttachment(src.getPhoto())); - tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu3.model.Person.PersonLinkComponent t : src.getLink()) - tgt.addLink(convertPersonLinkComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.instance.model.Person.PersonLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu3.model.Person.PersonLinkComponent(); - copyElement(src, tgt); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); - return tgt; - } - - public org.hl7.fhir.instance.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu3.model.Person.PersonLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.instance.model.Person.PersonLinkComponent(); - copyElement(src, tgt); - tgt.setTarget(convertReference(src.getTarget())); - tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LEVEL1: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL1; - case LEVEL2: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL2; - case LEVEL3: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL3; - case LEVEL4: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL4; - default: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.NULL; - } - } - - public org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LEVEL1: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL1; - case LEVEL2: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL2; - case LEVEL3: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL3; - case LEVEL4: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL4; - default: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Practitioner convertPractitioner(org.hl7.fhir.instance.model.Practitioner src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Practitioner tgt = new org.hl7.fhir.dstu3.model.Practitioner(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - if (src.hasName()) - tgt.addName(convertHumanName(src.getName())); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.instance.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.instance.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); -// for (org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent t : src.getPractitionerRole()) -// tgt.addRole(convertPractitionerPractitionerRoleComponent(t)); - for (org.hl7.fhir.instance.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) - tgt.addQualification(convertPractitionerQualificationComponent(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCommunication()) - tgt.addCommunication(convertCodeableConcept(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Practitioner convertPractitioner(org.hl7.fhir.dstu3.model.Practitioner src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Practitioner tgt = new org.hl7.fhir.instance.model.Practitioner(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setActive(src.getActive()); - for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) - tgt.setName(convertHumanName(t)); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); -// for (org.hl7.fhir.dstu3.model.Practitioner.PractitionerRoleComponent t : src.getRole()) -// tgt.addPractitionerRole(convertPractitionerPractitionerRoleComponent(t)); - for (org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) - tgt.addQualification(convertPractitionerQualificationComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCommunication()) - tgt.addCommunication(convertCodeableConcept(t)); - return tgt; - } - -// public org.hl7.fhir.dstu3.model.Practitioner.PractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.dstu3.model.Practitioner.PractitionerRoleComponent tgt = new org.hl7.fhir.dstu3.model.Practitioner.PractitionerRoleComponent(); -// copyElement(src, tgt); -// tgt.setOrganization(convertReference(src.getManagingOrganization())); -// tgt.setCode(convertCodeableConcept(src.getRole())); -// for (org.hl7.fhir.instance.model.CodeableConcept t : src.getSpecialty()) -// tgt.addSpecialty(convertCodeableConcept(t)); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.instance.model.Reference t : src.getLocation()) -// tgt.addLocation(convertReference(t)); -// for (org.hl7.fhir.instance.model.Reference t : src.getHealthcareService()) -// tgt.addHealthcareService(convertReference(t)); -// return tgt; -// } - -// public org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.dstu3.model.Practitioner.PractitionerRoleComponent src) throws FHIRException { -// if (src == null || src.isEmpty()) -// return null; -// org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent tgt = new org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent(); -// copyElement(src, tgt); -// tgt.setManagingOrganization(convertReference(src.getOrganization())); -// tgt.setRole(convertCodeableConcept(src.getCode())); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) -// tgt.addSpecialty(convertCodeableConcept(t)); -// tgt.setPeriod(convertPeriod(src.getPeriod())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) -// tgt.addLocation(convertReference(t)); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getHealthcareService()) -// tgt.addHealthcareService(convertReference(t)); -// return tgt; -// } - - public org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.instance.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIssuer(convertReference(src.getIssuer())); - return tgt; - } - - public org.hl7.fhir.instance.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.instance.model.Practitioner.PractitionerQualificationComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setIssuer(convertReference(src.getIssuer())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Procedure convertProcedure(org.hl7.fhir.instance.model.Procedure src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Procedure tgt = new org.hl7.fhir.dstu3.model.Procedure(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setStatus(convertProcedureStatus(src.getStatus())); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setNotDone(src.getNotPerformed()); -// for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReasonNotPerformed()) - if (src.hasReasonNotPerformed()) - tgt.setNotDoneReason(convertCodeableConcept(src.getReasonNotPerformed().get(0))); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - if (src.hasReasonCodeableConcept()) - tgt.addReasonCode(convertCodeableConcept(src.getReasonCodeableConcept())); - for (org.hl7.fhir.instance.model.Procedure.ProcedurePerformerComponent t : src.getPerformer()) - tgt.addPerformer(convertProcedurePerformerComponent(t)); - tgt.setPerformed(convertType(src.getPerformed())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - for (org.hl7.fhir.instance.model.Reference t : src.getReport()) - tgt.addReport(convertReference(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getComplication()) - tgt.addComplication(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getFollowUp()) - tgt.addFollowUp(convertCodeableConcept(t)); - tgt.addBasedOn(convertReference(src.getRequest())); -// for (org.hl7.fhir.instance.model.Annotation t : src.getNotes()) -// tgt.addNotes(convertAnnotation(t)); - for (org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent t : src.getFocalDevice()) - tgt.addFocalDevice(convertProcedureFocalDeviceComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Procedure convertProcedure(org.hl7.fhir.dstu3.model.Procedure src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Procedure tgt = new org.hl7.fhir.instance.model.Procedure(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setStatus(convertProcedureStatus(src.getStatus())); - tgt.setCategory(convertCodeableConcept(src.getCategory())); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setNotPerformed(src.getNotDone()); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotPerformed()) - tgt.addReasonNotPerformed(convertCodeableConcept(src.getNotDoneReason())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - tgt.setReason(convertType(src.getReasonCodeFirstRep())); - for (org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent t : src.getPerformer()) - tgt.addPerformer(convertProcedurePerformerComponent(t)); - tgt.setPerformed(convertType(src.getPerformed())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setLocation(convertReference(src.getLocation())); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReport()) - tgt.addReport(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getComplication()) - tgt.addComplication(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getFollowUp()) - tgt.addFollowUp(convertCodeableConcept(t)); - tgt.setRequest(convertReference(src.getBasedOnFirstRep())); -// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNotes()) -// tgt.addNotes(convertAnnotation(t)); - for (org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent t : src.getFocalDevice()) - tgt.addFocalDevice(convertProcedureFocalDeviceComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.instance.model.Procedure.ProcedureStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.INPROGRESS; - case ABORTED: return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ABORTED; - case COMPLETED: return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.INPROGRESS; - case ABORTED: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.ABORTED; - case COMPLETED: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.ENTEREDINERROR; - default: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.instance.model.Procedure.ProcedurePerformerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent tgt = new org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent(); - copyElement(src, tgt); - tgt.setActor(convertReference(src.getActor())); - tgt.setRole(convertCodeableConcept(src.getRole())); - return tgt; - } - - public org.hl7.fhir.instance.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Procedure.ProcedurePerformerComponent tgt = new org.hl7.fhir.instance.model.Procedure.ProcedurePerformerComponent(); - copyElement(src, tgt); - tgt.setActor(convertReference(src.getActor())); - tgt.setRole(convertCodeableConcept(src.getRole())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent(); - copyElement(src, tgt); - tgt.setAction(convertCodeableConcept(src.getAction())); - tgt.setManipulated(convertReference(src.getManipulated())); - return tgt; - } - - public org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent(); - copyElement(src, tgt); - tgt.setAction(convertCodeableConcept(src.getAction())); - tgt.setManipulated(convertReference(src.getManipulated())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ProcedureRequest convertProcedureRequest(org.hl7.fhir.instance.model.ProcedureRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ProcedureRequest tgt = new org.hl7.fhir.dstu3.model.ProcedureRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - if (src.hasReasonCodeableConcept()) - tgt.addReasonCode(convertCodeableConcept(src.getReasonCodeableConcept())); - tgt.setOccurrence(convertType(src.getScheduled())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setPerformer(convertReference(src.getPerformer())); - tgt.setStatus(convertProcedureRequestStatus(src.getStatus())); -// for (org.hl7.fhir.instance.model.Annotation t : src.getNotes()) -// tgt.addNotes(convertAnnotation(t)); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setAuthoredOn(src.getOrderedOn()); -// tgt.setOrderer(convertReference(src.getOrderer())); - tgt.setPriority(convertProcedureRequestPriority(src.getPriority())); - return tgt; - } - - public org.hl7.fhir.instance.model.ProcedureRequest convertProcedureRequest(org.hl7.fhir.dstu3.model.ProcedureRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ProcedureRequest tgt = new org.hl7.fhir.instance.model.ProcedureRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setCode(convertCodeableConcept(src.getCode())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) - tgt.addBodySite(convertCodeableConcept(t)); - tgt.setReason(convertType(src.getReasonCodeFirstRep())); - tgt.setScheduled(convertType(src.getOccurrence())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setPerformer(convertReference(src.getPerformer())); - tgt.setStatus(convertProcedureRequestStatus(src.getStatus())); -// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNotes()) -// tgt.addNotes(convertAnnotation(t)); - tgt.setAsNeeded(convertType(src.getAsNeeded())); - tgt.setOrderedOn(src.getAuthoredOn()); -// tgt.setOrderer(convertReference(src.getOrderer())); - tgt.setPriority(convertProcedureRequestPriority(src.getPriority())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus convertProcedureRequestStatus(org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PROPOSED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; - case DRAFT: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; - case REQUESTED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; - case RECEIVED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; - case ACCEPTED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; - case INPROGRESS: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.SUSPENDED; -// case REJECTED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.REJECTED; - case ABORTED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus convertProcedureRequestStatus(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { -// case PROPOSED: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.PROPOSED; - case DRAFT: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; -// case REQUESTED: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.REQUESTED; -// case RECEIVED: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.RECEIVED; -// case ACCEPTED: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.ACCEPTED; - case ACTIVE: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.COMPLETED; - case SUSPENDED: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.SUSPENDED; -// case REJECTED: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.REJECTED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.ABORTED; - default: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ROUTINE: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; - case URGENT: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.URGENT; - case STAT: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.STAT; - case ASAP: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ASAP; - default: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.NULL; - } - } - - public org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ROUTINE: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; - case URGENT: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.URGENT; - case STAT: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.STAT; - case ASAP: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.ASAP; - default: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.NULL; - } - } - - - public org.hl7.fhir.dstu3.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.instance.model.ProcessRequest.ActionList src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CANCEL: return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.CANCEL; - case POLL: return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.POLL; - case REPROCESS: return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.REPROCESS; - case STATUS: return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.STATUS; - default: return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.NULL; - } - } - - public org.hl7.fhir.instance.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.dstu3.model.ProcessRequest.ActionList src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CANCEL: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.CANCEL; - case POLL: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.POLL; - case REPROCESS: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.REPROCESS; - case STATUS: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.STATUS; - default: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent(); - copyElement(src, tgt); - tgt.setSequenceLinkId(src.getSequenceLinkId()); - return tgt; - } - - public org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent(); - copyElement(src, tgt); - tgt.setSequenceLinkId(src.getSequenceLinkId()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Provenance convertProvenance(org.hl7.fhir.instance.model.Provenance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Provenance tgt = new org.hl7.fhir.dstu3.model.Provenance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Reference t : src.getTarget()) - tgt.addTarget(convertReference(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setRecorded(src.getRecorded()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason()) - for (org.hl7.fhir.instance.model.Coding tc : t.getCoding()) - tgt.addReason(convertCoding(tc)); - for (org.hl7.fhir.instance.model.Coding t : src.getActivity().getCoding()) - tgt.setActivity(convertCoding(t)); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.instance.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - for (org.hl7.fhir.instance.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) - tgt.addAgent(convertProvenanceAgentComponent(t)); - for (org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) - tgt.addEntity(convertProvenanceEntityComponent(t)); - for (org.hl7.fhir.instance.model.Signature t : src.getSignature()) - tgt.addSignature(convertSignature(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Provenance convertProvenance(org.hl7.fhir.dstu3.model.Provenance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Provenance tgt = new org.hl7.fhir.instance.model.Provenance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Reference t : src.getTarget()) - tgt.addTarget(convertReference(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setRecorded(src.getRecorded()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getReason()) - tgt.addReason().addCoding(convertCoding(t)); - tgt.setActivity(new org.hl7.fhir.instance.model.CodeableConcept().addCoding(convertCoding(src.getActivity()))); - tgt.setLocation(convertReference(src.getLocation())); - for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) - tgt.addPolicy(t.getValue()); - for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) - tgt.addAgent(convertProvenanceAgentComponent(t)); - for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) - tgt.addEntity(convertProvenanceEntityComponent(t)); - for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) - tgt.addSignature(convertSignature(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.instance.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent(); - copyElement(src, tgt); -// tgt.setRole(convertCoding(src.getRole())); - tgt.setWho(convertReference(src.getActor())); - return tgt; - } - - public org.hl7.fhir.instance.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.instance.model.Provenance.ProvenanceAgentComponent(); - copyElement(src, tgt); -// tgt.setRole(convertCoding(src.getRole())); - if (src.hasWhoReference()) - tgt.setActor(convertReference(src.getWhoReference())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent(); - copyElement(src, tgt); - tgt.setRole(convertProvenanceEntityRole(src.getRole())); - if (src.hasReference()) - tgt.setWhat(new org.hl7.fhir.dstu3.model.Reference().setReference(src.getReference())); - tgt.addAgent(convertProvenanceAgentComponent(src.getAgent())); - return tgt; - } - - public org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent(); - copyElement(src, tgt); - tgt.setRole(convertProvenanceEntityRole(src.getRole())); - if (src.hasWhatReference() && src.getWhatReference().hasReference()) - tgt.setReference(src.getWhatReference().getReference()); - for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) - tgt.setAgent(convertProvenanceAgentComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.instance.model.Provenance.ProvenanceEntityRole src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DERIVATION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.DERIVATION; - case REVISION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REVISION; - case QUOTATION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.QUOTATION; - case SOURCE: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.SOURCE; - default: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.NULL; - } - } - - public org.hl7.fhir.instance.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DERIVATION: return org.hl7.fhir.instance.model.Provenance.ProvenanceEntityRole.DERIVATION; - case REVISION: return org.hl7.fhir.instance.model.Provenance.ProvenanceEntityRole.REVISION; - case QUOTATION: return org.hl7.fhir.instance.model.Provenance.ProvenanceEntityRole.QUOTATION; - case SOURCE: return org.hl7.fhir.instance.model.Provenance.ProvenanceEntityRole.SOURCE; - default: return org.hl7.fhir.instance.model.Provenance.ProvenanceEntityRole.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Questionnaire convertQuestionnaire(org.hl7.fhir.instance.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Questionnaire tgt = new org.hl7.fhir.dstu3.model.Questionnaire(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - org.hl7.fhir.instance.model.Questionnaire.GroupComponent root = src.getGroup(); - tgt.setTitle(root.getTitle()); - for (org.hl7.fhir.instance.model.Coding t : root.getConcept()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.instance.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - tgt.addItem(convertQuestionnaireGroupComponent(root)); - return tgt; - } - - public org.hl7.fhir.instance.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu3.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Questionnaire tgt = new org.hl7.fhir.instance.model.Questionnaire(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - org.hl7.fhir.instance.model.Questionnaire.GroupComponent root = tgt.getGroup(); - root.setTitle(src.getTitle()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) { - root.addConcept(convertCoding(t)); - } - for (org.hl7.fhir.dstu3.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - if (t.getType() == org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP) - root.addGroup(convertQuestionnaireGroupComponent(t)); - else - root.addQuestion(convertQuestionnaireQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.DRAFT; - case PUBLISHED: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.PUBLISHED; - case RETIRED: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.RETIRED; - default: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.DRAFT; - case PUBLISHED: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.PUBLISHED; - case RETIRED: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.RETIRED; - default: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.instance.model.Questionnaire.QuestionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.instance.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireQuestionType(src.getType())); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - tgt.setOptions(convertReference(src.getOptions())); - for (org.hl7.fhir.instance.model.Coding t : src.getOption()) - tgt.addOption().setValue(convertCoding(t)); - for (org.hl7.fhir.instance.model.Questionnaire.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireGroupComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireGroupComponent(org.hl7.fhir.instance.model.Questionnaire.GroupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.instance.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - for (org.hl7.fhir.instance.model.Questionnaire.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireGroupComponent(t)); - for (org.hl7.fhir.instance.model.Questionnaire.QuestionComponent t : src.getQuestion()) - tgt.addItem(convertQuestionnaireQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Questionnaire.GroupComponent convertQuestionnaireGroupComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Questionnaire.GroupComponent tgt = new org.hl7.fhir.instance.model.Questionnaire.GroupComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - if (t.getType() == org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP) - tgt.addGroup(convertQuestionnaireGroupComponent(t)); - else - tgt.addQuestion(convertQuestionnaireQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Questionnaire.QuestionComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Questionnaire.QuestionComponent tgt = new org.hl7.fhir.instance.model.Questionnaire.QuestionComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireItemType(src.getType())); - tgt.setRequired(src.getRequired()); - tgt.setRepeats(src.getRepeats()); - tgt.setOptions(convertReference(src.getOptions())); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) - if (t.hasValueCoding()) - try { - tgt.addOption(convertCoding(t.getValueCoding())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addGroup(convertQuestionnaireGroupComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType convertQuestionnaireQuestionType(org.hl7.fhir.instance.model.Questionnaire.AnswerFormat src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BOOLEAN: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; - case INSTANT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL; - } - } - - public org.hl7.fhir.instance.model.Questionnaire.AnswerFormat convertQuestionnaireItemType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BOOLEAN: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.BOOLEAN; - case DECIMAL: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DECIMAL; - case INTEGER: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.INTEGER; - case DATE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DATE; - case DATETIME: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DATETIME; - case TIME: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.TIME; - case STRING: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.STRING; - case TEXT: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.TEXT; - case URL: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.URL; - case CHOICE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.CHOICE; - case OPENCHOICE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.REFERENCE; - case QUANTITY: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.QUANTITY; - default: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.NULL; - } - } - - public org.hl7.fhir.dstu3.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.instance.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaire(convertReference(src.getQuestionnaire())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - tgt.setContext(convertReference(src.getEncounter())); - if (src.hasGroup()) - tgt.addItem(convertQuestionnaireResponseGroupComponent(src.getGroup())); - return tgt; - } - - public org.hl7.fhir.instance.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.QuestionnaireResponse tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaire(convertReference(src.getQuestionnaire())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setAuthor(convertReference(src.getAuthor())); - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getContext())); - - if (src.getItem().size() != 1) - throw new FHIRException("multiple root items not supported"); // though we could define a placeholder group? - - tgt.setGroup(convertQuestionnaireItemToGroup(src.getItem().get(0))); - return tgt; - } - - - public org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseGroupComponent(org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); - for (org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent t : src.getQuestion()) - tgt.addItem(convertQuestionnaireResponseQuestionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseQuestionComponent(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); - for (org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent convertQuestionnaireItemToGroup(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - if (t.hasAnswer()) - tgt.addQuestion(convertQuestionnaireItemToQuestion(t)); - else - tgt.addGroup(convertQuestionnaireItemToGroup(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent convertQuestionnaireItemToQuestion(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent(); - copyElement(src, tgt); - tgt.setLinkId(src.getLinkId()); - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) - tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addGroup(convertQuestionnaireItemToGroup(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ReferralRequest convertReferralRequest(org.hl7.fhir.instance.model.ReferralRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ReferralRequest tgt = new org.hl7.fhir.dstu3.model.ReferralRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertReferralStatus(src.getStatus())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setPriority(convertReferralPriorityCode(src.getPriority())); - tgt.setSubject(convertReference(src.getPatient())); - tgt.setOccurrence(convertPeriod(src.getFulfillmentTime())); - tgt.getRequester().setAgent(convertReference(src.getRequester())); - tgt.setSpecialty(convertCodeableConcept(src.getSpecialty())); - for (org.hl7.fhir.instance.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - tgt.addReasonCode(convertCodeableConcept(src.getReason())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getServiceRequested()) - tgt.addServiceRequested(convertCodeableConcept(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getSupportingInformation()) - tgt.addSupportingInfo(convertReference(t)); - return tgt; - } - - private ReferralPriority convertReferralPriorityCode(CodeableConcept priority) { - for (org.hl7.fhir.instance.model.Coding c : priority.getCoding()) { - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.ROUTINE; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.URGENT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.STAT; - if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) - return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.ASAP; - } - return null; - } - - public org.hl7.fhir.instance.model.ReferralRequest convertReferralRequest(org.hl7.fhir.dstu3.model.ReferralRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ReferralRequest tgt = new org.hl7.fhir.instance.model.ReferralRequest(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setStatus(convertReferralStatus(src.getStatus())); - tgt.setType(convertCodeableConcept(src.getType())); - tgt.setPriority(convertReferralPriorityCode(src.getPriority())); - tgt.setPatient(convertReference(src.getSubject())); - tgt.setFulfillmentTime(convertPeriod(src.getOccurrencePeriod())); - tgt.setRequester(convertReference(src.getRequester().getAgent())); - tgt.setSpecialty(convertCodeableConcept(src.getSpecialty())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) - tgt.addRecipient(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept cc : src.getReasonCode()) - tgt.setReason(convertCodeableConcept(cc)); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceRequested()) - tgt.addServiceRequested(convertCodeableConcept(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInfo()) - tgt.addSupportingInformation(convertReference(t)); - return tgt; - } - - private org.hl7.fhir.instance.model.CodeableConcept convertReferralPriorityCode(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority priority) { - org.hl7.fhir.instance.model.CodeableConcept cc = new org.hl7.fhir.instance.model.CodeableConcept(); - switch (priority) { - case ROUTINE: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); break; - case URGENT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); break; - case STAT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); break; - case ASAP: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); break; - default: return null; - } - return cc; - } - - - public org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus convertReferralStatus(org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.DRAFT; - case REQUESTED: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ACTIVE; - case CANCELLED: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.CANCELLED; - case ACCEPTED: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ACTIVE; - case REJECTED: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ENTEREDINERROR; - case COMPLETED: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.COMPLETED; - default: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus convertReferralStatus(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus.ACTIVE; - case CANCELLED: return org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus.CANCELLED; - case COMPLETED: return org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus.COMPLETED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus.REJECTED; - default: return org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.instance.model.RelatedPerson src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.RelatedPerson tgt = new org.hl7.fhir.dstu3.model.RelatedPerson(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); - tgt.addName(convertHumanName(src.getName())); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.instance.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - for (org.hl7.fhir.instance.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.instance.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.RelatedPerson tgt = new org.hl7.fhir.instance.model.RelatedPerson(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setRelationship(convertCodeableConcept(src.getRelationship())); - if (!src.getName().isEmpty()) - tgt.setName(convertHumanName(src.getName().get(0))); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - tgt.setGender(convertAdministrativeGender(src.getGender())); - tgt.setBirthDate(src.getBirthDate()); - for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) - tgt.addAddress(convertAddress(t)); - for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) - tgt.addPhoto(convertAttachment(t)); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.instance.model.RiskAssessment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.RiskAssessment tgt = new org.hl7.fhir.dstu3.model.RiskAssessment(); - copyDomainResource(src, tgt); - tgt.setSubject(convertReference(src.getSubject())); -// tgt.setDate(src.getDate()); - tgt.setCondition(convertReference(src.getCondition())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setPerformer(convertReference(src.getPerformer())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - for (org.hl7.fhir.instance.model.Reference t : src.getBasis()) - tgt.addBasis(convertReference(t)); - for (org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) - tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); - tgt.setMitigation(src.getMitigation()); - return tgt; - } - - public org.hl7.fhir.instance.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu3.model.RiskAssessment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.RiskAssessment tgt = new org.hl7.fhir.instance.model.RiskAssessment(); - copyDomainResource(src, tgt); - tgt.setSubject(convertReference(src.getSubject())); -// tgt.setDateElement(src.getOccurrenceDateTimeType()); - tgt.setCondition(convertReference(src.getCondition())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setPerformer(convertReference(src.getPerformer())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setMethod(convertCodeableConcept(src.getMethod())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getBasis()) - tgt.addBasis(convertReference(t)); - for (org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) - tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); - tgt.setMitigation(src.getMitigation()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent(); - copyElement(src, tgt); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setProbability(convertType(src.getProbability())); - tgt.setRelativeRisk(src.getRelativeRisk()); - tgt.setWhen(convertType(src.getWhen())); - tgt.setRationale(src.getRationale()); - return tgt; - } - - public org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent(); - copyElement(src, tgt); - tgt.setOutcome(convertCodeableConcept(src.getOutcome())); - tgt.setProbability(convertType(src.getProbability())); - tgt.setRelativeRisk(src.getRelativeRisk()); - tgt.setWhen(convertType(src.getWhen())); - tgt.setRationale(src.getRationale()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Schedule convertSchedule(org.hl7.fhir.instance.model.Schedule src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Schedule tgt = new org.hl7.fhir.dstu3.model.Schedule(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) - tgt.addServiceType(convertCodeableConcept(t)); - tgt.addActor(convertReference(src.getActor())); - tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.instance.model.Schedule convertSchedule(org.hl7.fhir.dstu3.model.Schedule src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Schedule tgt = new org.hl7.fhir.instance.model.Schedule(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) - tgt.addType(convertCodeableConcept(t)); - tgt.setActor(convertReference(src.getActorFirstRep())); - tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.SearchParameter convertSearchParameter(org.hl7.fhir.instance.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SearchParameter tgt = new org.hl7.fhir.dstu3.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCode(src.getCode()); - tgt.addBase(src.getBase()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.instance.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - public org.hl7.fhir.instance.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu3.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.SearchParameter tgt = new org.hl7.fhir.instance.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getBase()) - tgt.setBase(t.asStringValue()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.instance.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NULL; - } - } - - public org.hl7.fhir.instance.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Slot convertSlot(org.hl7.fhir.instance.model.Slot src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Slot tgt = new org.hl7.fhir.dstu3.model.Slot(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasType()) - tgt.addServiceType(convertCodeableConcept(src.getType())); - tgt.setSchedule(convertReference(src.getSchedule())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setOverbooked(src.getOverbooked()); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.instance.model.Slot convertSlot(org.hl7.fhir.dstu3.model.Slot src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Slot tgt = new org.hl7.fhir.instance.model.Slot(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) - tgt.setType(convertCodeableConcept(t)); - tgt.setSchedule(convertReference(src.getSchedule())); - tgt.setStart(src.getStart()); - tgt.setEnd(src.getEnd()); - tgt.setOverbooked(src.getOverbooked()); - tgt.setComment(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.instance.model.Slot.SlotStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BUSY: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSY; - case FREE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.FREE; - case BUSYUNAVAILABLE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYUNAVAILABLE; - case BUSYTENTATIVE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYTENTATIVE; - default: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu3.model.Slot.SlotStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case BUSY: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSY; - case FREE: return org.hl7.fhir.instance.model.Slot.SlotStatus.FREE; - case BUSYUNAVAILABLE: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSYUNAVAILABLE; - case BUSYTENTATIVE: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSYTENTATIVE; - default: return org.hl7.fhir.instance.model.Slot.SlotStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.instance.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setTitle(src.getDisplay()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.instance.model.Coding t : src.getCode()) - tgt.addKeyword(convertCoding(t)); - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind(), tgt.getId())); - tgt.setAbstract(src.getAbstract()); - tgt.setContextType(convertExtensionContext(src.getContextType())); - for (org.hl7.fhir.instance.model.StringType t : src.getContext()) - tgt.addContext(t.getValue()); - if (src.hasConstrainedType()) - tgt.setType(src.getConstrainedType()); - else if (src.getSnapshot().hasElement()) - tgt.setType(src.getSnapshot().getElement().get(0).getPath()); - else if (src.getDifferential().hasElement() && !src.getDifferential().getElement().get(0).getPath().contains(".")) - tgt.setType(src.getDifferential().getElement().get(0).getPath()); - else - tgt.setType(src.getDifferential().getElement().get(0).getPath().substring(0, src.getDifferential().getElement().get(0).getPath().indexOf("."))); - tgt.setBaseDefinition(src.getBase()); - tgt.setDerivation(src.hasConstrainedType() ? org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT : org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - if (tgt.hasSnapshot()) - tgt.getSnapshot().getElementFirstRep().getType().clear(); - if (tgt.hasDifferential()) - tgt.getDifferential().getElementFirstRep().getType().clear(); - if (tgt.getKind() == StructureDefinitionKind.PRIMITIVETYPE && !tgt.getType().equals(tgt.getId())) { - tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); - tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/"+tgt.getType()); -// for (ElementDefinition ed : tgt.getSnapshot().getElement()) { -// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); -// } -// for (ElementDefinition ed : tgt.getDifferential().getElement()) { -// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); -// } - tgt.setType(tgt.getId()); - } - return tgt; - } - - public org.hl7.fhir.instance.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.StructureDefinition tgt = new org.hl7.fhir.instance.model.StructureDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setDisplay(src.getTitle()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) - tgt.addCode(convertCoding(t)); - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind())); - tgt.setAbstract(src.getAbstract()); - tgt.setContextType(convertExtensionContext(src.getContextType())); - for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) - tgt.addContext(t.getValue()); - tgt.setConstrainedType(src.getType()); - tgt.setBase(src.getBaseDefinition()); - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - if (tgt.hasBase()) { - if (tgt.hasDifferential()) - tgt.getDifferential().getElement().get(0).addType().setCode(tail(tgt.getBase())); - if (tgt.hasSnapshot()) - tgt.getSnapshot().getElement().get(0).addType().setCode(tail(tgt.getBase())); - } - return tgt; - } - - private String tail(String base) { - return base.substring(base.lastIndexOf("/")+1); - } - - public org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind src, String dtName) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DATATYPE: - if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown")) - return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; - else - return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; - case RESOURCE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL; - } - } - - public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRIMITIVETYPE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case COMPLEXTYPE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case RESOURCE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.NULL; - } - } - - public org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; - case DATATYPE: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; - case EXTENSION: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; - } - } - - public org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.RESOURCE; - case DATATYPE: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.DATATYPE; - case EXTENSION: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComment(src.getComments()); - return tgt; - } - - public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - tgt.setUri(src.getUri()); - tgt.setName(src.getName()); - tgt.setComments(src.getComment()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - List slicePaths = new ArrayList(); - for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) { - if (t.hasSlicing()) - slicePaths.add(t.getPath()); - tgt.addElement(convertElementDefinition(t, slicePaths)); - } - return tgt; - } - - public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - List slicePaths = new ArrayList(); - for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) { - if (t.hasSlicing()) - slicePaths.add(t.getPath()); - tgt.addElement(convertElementDefinition(t, slicePaths)); - } - return tgt; - } - - public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Subscription convertSubscription(org.hl7.fhir.instance.model.Subscription src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Subscription tgt = new org.hl7.fhir.dstu3.model.Subscription(); - copyDomainResource(src, tgt); - tgt.setCriteria(src.getCriteria()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - tgt.setReason(src.getReason()); - tgt.setStatus(convertSubscriptionStatus(src.getStatus())); - tgt.setError(src.getError()); - tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.instance.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Subscription convertSubscription(org.hl7.fhir.dstu3.model.Subscription src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Subscription tgt = new org.hl7.fhir.instance.model.Subscription(); - copyDomainResource(src, tgt); - tgt.setCriteria(src.getCriteria()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) - tgt.addContact(convertContactPoint(t)); - tgt.setReason(src.getReason()); - tgt.setStatus(convertSubscriptionStatus(src.getStatus())); - tgt.setError(src.getError()); - tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); - tgt.setEnd(src.getEnd()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.instance.model.Subscription.SubscriptionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUESTED: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.REQUESTED; - case ACTIVE: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ACTIVE; - case ERROR: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ERROR; - case OFF: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.OFF; - default: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUESTED: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.REQUESTED; - case ACTIVE: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.ACTIVE; - case ERROR: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.ERROR; - case OFF: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.OFF; - default: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent(); - copyElement(src, tgt); - tgt.setType(convertSubscriptionChannelType(src.getType())); - tgt.setEndpoint(src.getEndpoint()); - tgt.setPayload(src.getPayload()); - tgt.addHeader(src.getHeader()); - return tgt; - } - - public org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent(); - copyElement(src, tgt); - tgt.setType(convertSubscriptionChannelType(src.getType())); - tgt.setEndpoint(src.getEndpoint()); - tgt.setPayload(src.getPayload()); - if (src.hasHeader()) - tgt.setHeaderElement(convertString(src.getHeader().get(0))); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESTHOOK: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.RESTHOOK; - case WEBSOCKET: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.WEBSOCKET; - case EMAIL: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.EMAIL; - case SMS: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.SMS; - case MESSAGE: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.MESSAGE; - default: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.NULL; - } - } - - public org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESTHOOK: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.RESTHOOK; - case WEBSOCKET: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.WEBSOCKET; - case EMAIL: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.EMAIL; - case SMS: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.SMS; - case MESSAGE: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.MESSAGE; - default: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.Substance convertSubstance(org.hl7.fhir.instance.model.Substance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Substance tgt = new org.hl7.fhir.dstu3.model.Substance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent t : src.getInstance()) - tgt.addInstance(convertSubstanceInstanceComponent(t)); - for (org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertSubstanceIngredientComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.Substance convertSubstance(org.hl7.fhir.dstu3.model.Substance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Substance tgt = new org.hl7.fhir.instance.model.Substance(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) - tgt.addCategory(convertCodeableConcept(t)); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent t : src.getInstance()) - tgt.addInstance(convertSubstanceInstanceComponent(t)); - for (org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) - tgt.addIngredient(convertSubstanceIngredientComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setExpiry(src.getExpiry()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - return tgt; - } - - public org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent(); - copyElement(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setExpiry(src.getExpiry()); - tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent(); - copyElement(src, tgt); - tgt.setQuantity(convertRatio(src.getQuantity())); - tgt.setSubstance(convertReference(src.getSubstance())); - return tgt; - } - - public org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent(); - copyElement(src, tgt); - tgt.setQuantity(convertRatio(src.getQuantity())); -// tgt.setSubstance(convertReference(src.getSubstance())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.instance.model.SupplyDelivery src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SupplyDelivery tgt = new org.hl7.fhir.dstu3.model.SupplyDelivery(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); - tgt.setSupplier(convertReference(src.getSupplier())); -// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); -// tgt.setTime(src.getTime()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.instance.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu3.model.SupplyDelivery src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.SupplyDelivery tgt = new org.hl7.fhir.instance.model.SupplyDelivery(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setType(convertCodeableConcept(src.getType())); -// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); -// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); - tgt.setSupplier(convertReference(src.getSupplier())); -// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); -// tgt.setTime(src.getTime()); - tgt.setDestination(convertReference(src.getDestination())); - for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) - tgt.addReceiver(convertReference(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; - case ABANDONED: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; - default: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; - case ABANDONED: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; - default: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.instance.model.SupplyRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SupplyRequest tgt = new org.hl7.fhir.dstu3.model.SupplyRequest(); - copyDomainResource(src, tgt); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); -// tgt.setKind(convertCodeableConcept(src.getKind())); -// tgt.getOrderedItem().setItem(convertReference(src.getOrderedItem())); -// for (org.hl7.fhir.instance.model.Reference t : src.getSupplier()) -// tgt.addSupplier(convertReference(t)); -// tgt.setReason(convertType(src.getReason())); -// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); - return tgt; - } - - public org.hl7.fhir.instance.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.dstu3.model.SupplyRequest src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.SupplyRequest tgt = new org.hl7.fhir.instance.model.SupplyRequest(); -// copyDomainResource(src, tgt); -// tgt.setPatient(convertReference(src.getPatient())); -// tgt.setSource(convertReference(src.getSource())); -// if (src.hasDate()) -// tgt.setDate(src.getDate()); -// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); -// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); -// tgt.setKind(convertCodeableConcept(src.getKind())); -// tgt.setOrderedItem(convertReference(src.getOrderedItem().getItemReference())); -// for (org.hl7.fhir.dstu3.model.Reference t : src.getSupplier()) -// tgt.addSupplier(convertReference(t)); -// tgt.setReason(convertType(src.getReason())); -// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUESTED: return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.ACTIVE; - case COMPLETED: return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.COMPLETED; - case FAILED: return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.CANCELLED; - case CANCELLED: return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.CANCELLED; - default: return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ACTIVE: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.REQUESTED; - case COMPLETED: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.COMPLETED; - case CANCELLED: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.CANCELLED; - default: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.TestScript convertTestScript(org.hl7.fhir.instance.model.TestScript src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript tgt = new org.hl7.fhir.dstu3.model.TestScript(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent t : src.getContact()) - tgt.addContact(convertTestScriptContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.instance.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript convertTestScript(org.hl7.fhir.dstu3.model.TestScript src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript tgt = new org.hl7.fhir.instance.model.TestScript(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertTestScriptContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setDescription(src.getDescription()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - tgt.setRequired(src.getRequired()); - tgt.setValidated(src.getValidated()); - tgt.setDescription(src.getDescription()); - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.instance.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - tgt.setCapabilities(convertReference(src.getConformance())); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - tgt.setRequired(src.getRequired()); - tgt.setValidated(src.getValidated()); - tgt.setDescription(src.getDescription()); - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.dstu3.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - tgt.setConformance(convertReference(src.getCapabilities())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - tgt.setAutocreate(src.getAutocreate()); - tgt.setAutodelete(src.getAutodelete()); - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - tgt.setAutocreate(src.getAutocreate()); - tgt.setAutodelete(src.getAutodelete()); - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setHeaderField(src.getHeaderField()); - tgt.setPath(src.getPath()); - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setHeaderField(src.getHeaderField()); - tgt.setPath(src.getPath()); - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setResource(src.getResource()); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setAccept(convertContentType(src.getAccept())); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setDestination(src.getDestination()); - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - tgt.setParams(src.getParams()); - for (org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - tgt.setResponseId(src.getResponseId()); - tgt.setSourceId(src.getSourceId()); - tgt.setTargetId(src.getTargetId()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - tgt.setResource(src.getResource()); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setAccept(convertContentType(src.getAccept())); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setDestination(src.getDestination()); - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - tgt.setParams(src.getParams()); - for (org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - tgt.setResponseId(src.getResponseId()); - tgt.setSourceId(src.getSourceId()); - tgt.setTargetId(src.getTargetId()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.ContentType convertContentType(org.hl7.fhir.instance.model.TestScript.ContentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XML: return org.hl7.fhir.dstu3.model.TestScript.ContentType.XML; - case JSON: return org.hl7.fhir.dstu3.model.TestScript.ContentType.JSON; - default: return org.hl7.fhir.dstu3.model.TestScript.ContentType.NULL; - } - } - - public org.hl7.fhir.instance.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu3.model.TestScript.ContentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XML: return org.hl7.fhir.instance.model.TestScript.ContentType.XML; - case JSON: return org.hl7.fhir.instance.model.TestScript.ContentType.JSON; - default: return org.hl7.fhir.instance.model.TestScript.ContentType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - tgt.setField(src.getField()); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - tgt.setField(src.getField()); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent(); - copyElement(src, tgt); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - tgt.setCompareToSourceId(src.getCompareToSourceId()); - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setHeaderField(src.getHeaderField()); - tgt.setMinimumId(src.getMinimumId()); - tgt.setNavigationLinks(src.getNavigationLinks()); - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - tgt.setPath(src.getPath()); - tgt.setResource(src.getResource()); - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - tgt.setResponseCode(src.getResponseCode()); - tgt.setSourceId(src.getSourceId()); - tgt.setValidateProfileId(src.getValidateProfileId()); - tgt.setValue(src.getValue()); - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent(); - copyElement(src, tgt); - tgt.setLabel(src.getLabel()); - tgt.setDescription(src.getDescription()); - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - tgt.setCompareToSourceId(src.getCompareToSourceId()); - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - tgt.setContentType(convertContentType(src.getContentType())); - tgt.setHeaderField(src.getHeaderField()); - tgt.setMinimumId(src.getMinimumId()); - tgt.setNavigationLinks(src.getNavigationLinks()); - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - tgt.setPath(src.getPath()); - tgt.setResource(src.getResource()); - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - tgt.setResponseCode(src.getResponseCode()); - tgt.setSourceId(src.getSourceId()); - tgt.setValidateProfileId(src.getValidateProfileId()); - tgt.setValue(src.getValue()); - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.instance.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.NULL; - } - } - - public org.hl7.fhir.instance.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.instance.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTCONTAINS; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NULL; - } - } - - public org.hl7.fhir.instance.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTCONTAINS; - default: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NULL; - } - } - - public org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NULL; - } - } - - public org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NULL; - } - } - - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.TestScript.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestScript.TestActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getUrl()); - tgt.setVersion(src.getVersion()); - tgt.setCaseSensitive(src.getCaseSensitive()); - - for (ConceptDefinitionComponent cc : src.getConcept()) - tgt.addConcept(convertCodeSystemConcept(src, cc)); - return tgt; - } - -public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent convertCodeSystemConcept(CodeSystem cs, ConceptDefinitionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent(); - copyElement(src, tgt); - tgt.setAbstract(CodeSystemUtilities.isNotSelectable(cs, src)); - tgt.setCode(src.getCode()); - tgt.setDefinition(src.getDefinition()); - tgt.setDisplay(src.getDisplay()); - - for (ConceptDefinitionComponent cc : src.getConcept()) - tgt.addConcept(convertCodeSystemConcept(cs, cc)); - for (ConceptDefinitionDesignationComponent cc : src.getDesignation()) - tgt.addDesignation(convertCodeSystemDesignation(cc)); - return tgt; - } - -public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent convertCodeSystemDesignation(ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - tgt.setUse(convertCoding(src.getUse())); - tgt.setLanguage(src.getLanguage()); - tgt.setValue(src.getValue()); - - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.instance.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet tgt = new org.hl7.fhir.dstu3.model.ValueSet(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - tgt.setImmutable(src.getImmutable()); - tgt.setPurpose(src.getRequirements()); - tgt.setCopyright(src.getCopyright()); - tgt.setExtensible(src.getExtensible()); - if (src.hasCompose()) { - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - tgt.getCompose().setLockedDate(src.getLockedDate()); - } - if (src.hasCodeSystem() && advisor != null) { - org.hl7.fhir.dstu3.model.CodeSystem tgtcs = new org.hl7.fhir.dstu3.model.CodeSystem(); - copyDomainResource(src, tgtcs); - tgtcs.setUrl(src.getCodeSystem().getSystem()); - tgtcs.setIdentifier(convertIdentifier(src.getIdentifier())); - tgtcs.setVersion(src.getCodeSystem().getVersion()); - tgtcs.setName(src.getName()+" Code System"); - tgtcs.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgtcs.setExperimental(src.getExperimental()); - tgtcs.setPublisher(src.getPublisher()); - for (org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent t : src.getContact()) - tgtcs.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgtcs.setDate(src.getDate()); - tgtcs.setDescription(src.getDescription()); - for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgtcs.addJurisdiction(convertCodeableConcept(t)); - else - tgtcs.addUseContext(convertCodeableConceptToUsageContext(t)); - tgtcs.setPurpose(src.getRequirements()); - tgtcs.setCopyright(src.getCopyright()); - tgtcs.setContent(CodeSystemContentMode.COMPLETE); - tgtcs.setCaseSensitive(src.getCodeSystem().getCaseSensitive()); - for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent cs : src.getCodeSystem().getConcept()) - processConcept(tgtcs.getConcept(), cs, tgtcs); - advisor.handleCodeSystem(tgtcs, tgt); - tgt.setUserData("r2-cs", tgtcs); - tgt.getCompose().addInclude().setSystem(tgtcs.getUrl()); - } - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - private void processConcept(List concepts, org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException { - org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent(); - concepts.add(ct); - ct.setCode(cs.getCode()); - ct.setDisplay(cs.getDisplay()); - ct.setDefinition(cs.getDefinition()); - if (cs.getAbstract()) - CodeSystemUtilities.setNotSelectable(tgtcs, ct); - for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { - org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent(); - cst.setLanguage(csd.getLanguage()); - cst.setUse(convertCoding(csd.getUse())); - cst.setValue(csd.getValue()); - } - - for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept()) - processConcept(ct.getConcept(), csc, tgtcs); - } - - private void processConcept(List concepts, ConceptDefinitionComponent cs, CodeSystem srcCS) throws FHIRException { - org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent ct = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent(); - concepts.add(ct); - ct.setCode(cs.getCode()); - ct.setDisplay(cs.getDisplay()); - ct.setDefinition(cs.getDefinition()); - if (CodeSystemUtilities.isNotSelectable(srcCS, cs)) - ct.setAbstract(true); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { - org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent(); - cst.setLanguage(csd.getLanguage()); - cst.setUse(convertCoding(csd.getUse())); - cst.setValue(csd.getValue()); - } - - for (ConceptDefinitionComponent csc : cs.getConcept()) - processConcept(ct.getConcept(), csc, srcCS); - } - - public org.hl7.fhir.instance.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet tgt = new org.hl7.fhir.instance.model.ValueSet(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier i : src.getIdentifier()) - tgt.setIdentifier(convertIdentifier(i)); - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setLockedDate(src.getCompose().getLockedDate()); - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - tgt.setImmutable(src.getImmutable()); - tgt.setRequirements(src.getPurpose()); - tgt.setCopyright(src.getCopyright()); - tgt.setExtensible(src.getExtensible()); - org.hl7.fhir.dstu3.model.CodeSystem srcCS = (CodeSystem) src.getUserData("r2-cs"); - if (srcCS == null) - srcCS = advisor.getCodeSystem(src); - if (srcCS != null) { - tgt.getCodeSystem().setSystem(srcCS.getUrl()); - tgt.getCodeSystem().setVersion(srcCS.getVersion()); - tgt.getCodeSystem().setCaseSensitive(srcCS.getCaseSensitive()); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent cs : srcCS.getConcept()) - processConcept(tgt.getCodeSystem().getConcept(), cs, srcCS); - - } - tgt.setCompose(convertValueSetComposeComponent(src.getCompose(), srcCS == null ? null : srcCS.getUrl())); - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - private static boolean isJurisdiction(CodeableConcept t) { - 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 org.hl7.fhir.dstu3.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.instance.model.UriType t : src.getImport()) - tgt.addInclude().addValueSet(t.getValue()); - for (org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent t : src.getInclude()) - tgt.addInclude(convertConceptSetComponent(t)); - for (org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent src, String noSystem) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getInclude()) { - for (org.hl7.fhir.dstu3.model.UriType ti : t.getValueSet()) - tgt.addImport(ti.getValue()); - if (noSystem == null || !t.getSystem().equals(noSystem)) - tgt.addInclude(convertConceptSetComponent(t)); - } - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.instance.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NULL; - } - } - - public org.hl7.fhir.instance.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - tgt.setTotal(src.getTotal()); - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - tgt.setTotal(src.getTotal()); - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setAbstract(src.getAbstract()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - tgt.setAbstract(src.getAbstract()); - tgt.setVersion(src.getVersion()); - tgt.setCode(src.getCode()); - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public org.hl7.fhir.dstu3.model.ListResource convertList(org.hl7.fhir.instance.model.List_ src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ListResource tgt = new org.hl7.fhir.dstu3.model.ListResource(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setStatus(convertListStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - tgt.setMode(convertListMode(src.getMode())); - if (src.hasNote()) - tgt.addNote(new org.hl7.fhir.dstu3.model.Annotation().setText(src.getNote())); - for (org.hl7.fhir.instance.model.List_.ListEntryComponent t : src.getEntry()) - tgt.addEntry(convertListEntry(t)); - return tgt; - } - - - public org.hl7.fhir.dstu3.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.instance.model.List_.ListStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.CURRENT; - case RETIRED: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.RETIRED; - case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.ENTEREDINERROR; - default: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ListResource.ListMode convertListMode(org.hl7.fhir.instance.model.List_.ListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.dstu3.model.ListResource.ListMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.dstu3.model.ListResource.ListMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.dstu3.model.ListResource.ListMode.CHANGES; - default: return org.hl7.fhir.dstu3.model.ListResource.ListMode.NULL; - } - } - - public org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent convertListEntry(org.hl7.fhir.instance.model.List_.ListEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent(); - copyBackboneElement(src, tgt); - tgt.setFlag(convertCodeableConcept(src.getFlag())); - tgt.setDeleted(src.getDeleted()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setItem(convertReference(src.getItem())); - return tgt; - } - - public org.hl7.fhir.instance.model.List_ convertList(org.hl7.fhir.dstu3.model.ListResource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.List_ tgt = new org.hl7.fhir.instance.model.List_(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setTitle(src.getTitle()); - tgt.setCode(convertCodeableConcept(src.getCode())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setSource(convertReference(src.getSource())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setStatus(convertListStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); - tgt.setMode(convertListMode(src.getMode())); - for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) - tgt.setNote(t.getText()); - for (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent t : src.getEntry()) - tgt.addEntry(convertListEntry(t)); - return tgt; - } - - - public org.hl7.fhir.instance.model.List_.ListStatus convertListStatus(org.hl7.fhir.dstu3.model.ListResource.ListStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CURRENT: return org.hl7.fhir.instance.model.List_.ListStatus.CURRENT; - case RETIRED: return org.hl7.fhir.instance.model.List_.ListStatus.RETIRED; - case ENTEREDINERROR: return org.hl7.fhir.instance.model.List_.ListStatus.ENTEREDINERROR; - default: return org.hl7.fhir.instance.model.List_.ListStatus.NULL; - } - } - - public org.hl7.fhir.instance.model.List_.ListMode convertListMode(org.hl7.fhir.dstu3.model.ListResource.ListMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case WORKING: return org.hl7.fhir.instance.model.List_.ListMode.WORKING; - case SNAPSHOT: return org.hl7.fhir.instance.model.List_.ListMode.SNAPSHOT; - case CHANGES: return org.hl7.fhir.instance.model.List_.ListMode.CHANGES; - default: return org.hl7.fhir.instance.model.List_.ListMode.NULL; - } - } - - public org.hl7.fhir.instance.model.List_.ListEntryComponent convertListEntry(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.instance.model.List_.ListEntryComponent tgt = new org.hl7.fhir.instance.model.List_.ListEntryComponent(); - copyBackboneElement(src, tgt); - tgt.setFlag(convertCodeableConcept(src.getFlag())); - tgt.setDeleted(src.getDeleted()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - tgt.setItem(convertReference(src.getItem())); - return tgt; - } - - - - public org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.instance.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.instance.model.Parameters) - return convertParameters((org.hl7.fhir.instance.model.Parameters) src); - if (src instanceof org.hl7.fhir.instance.model.Account) - return convertAccount((org.hl7.fhir.instance.model.Account) src); - if (src instanceof org.hl7.fhir.instance.model.Appointment) - return convertAppointment((org.hl7.fhir.instance.model.Appointment) src); - if (src instanceof org.hl7.fhir.instance.model.AppointmentResponse) - return convertAppointmentResponse((org.hl7.fhir.instance.model.AppointmentResponse) src); - if (src instanceof org.hl7.fhir.instance.model.AuditEvent) - return convertAuditEvent((org.hl7.fhir.instance.model.AuditEvent) src); - if (src instanceof org.hl7.fhir.instance.model.Basic) - return convertBasic((org.hl7.fhir.instance.model.Basic) src); - if (src instanceof org.hl7.fhir.instance.model.Binary) - return convertBinary((org.hl7.fhir.instance.model.Binary) src); - if (src instanceof org.hl7.fhir.instance.model.Bundle) - return convertBundle((org.hl7.fhir.instance.model.Bundle) src); - if (src instanceof org.hl7.fhir.instance.model.CarePlan) - return convertCarePlan((org.hl7.fhir.instance.model.CarePlan) src); - if (src instanceof org.hl7.fhir.instance.model.ClinicalImpression) - return convertClinicalImpression((org.hl7.fhir.instance.model.ClinicalImpression) src); - if (src instanceof org.hl7.fhir.instance.model.Communication) - return convertCommunication((org.hl7.fhir.instance.model.Communication) src); - if (src instanceof org.hl7.fhir.instance.model.CommunicationRequest) - return convertCommunicationRequest((org.hl7.fhir.instance.model.CommunicationRequest) src); - if (src instanceof org.hl7.fhir.instance.model.Composition) - return convertComposition((org.hl7.fhir.instance.model.Composition) src); - if (src instanceof org.hl7.fhir.instance.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.instance.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.instance.model.Condition) - return convertCondition((org.hl7.fhir.instance.model.Condition) src); - if (src instanceof org.hl7.fhir.instance.model.Conformance) - return convertConformance((org.hl7.fhir.instance.model.Conformance) src); - if (src instanceof org.hl7.fhir.instance.model.Contract) - return convertContract((org.hl7.fhir.instance.model.Contract) src); - if (src instanceof org.hl7.fhir.instance.model.DataElement) - return convertDataElement((org.hl7.fhir.instance.model.DataElement) src); - if (src instanceof org.hl7.fhir.instance.model.DetectedIssue) - return convertDetectedIssue((org.hl7.fhir.instance.model.DetectedIssue) src); - if (src instanceof org.hl7.fhir.instance.model.Device) - return convertDevice((org.hl7.fhir.instance.model.Device) src); - if (src instanceof org.hl7.fhir.instance.model.DeviceComponent) - return convertDeviceComponent((org.hl7.fhir.instance.model.DeviceComponent) src); - if (src instanceof org.hl7.fhir.instance.model.DeviceMetric) - return convertDeviceMetric((org.hl7.fhir.instance.model.DeviceMetric) src); - if (src instanceof org.hl7.fhir.instance.model.DeviceUseStatement) - return convertDeviceUseStatement((org.hl7.fhir.instance.model.DeviceUseStatement) src); - if (src instanceof org.hl7.fhir.instance.model.DiagnosticReport) - return convertDiagnosticReport((org.hl7.fhir.instance.model.DiagnosticReport) src); - if (src instanceof org.hl7.fhir.instance.model.DocumentManifest) - return convertDocumentManifest((org.hl7.fhir.instance.model.DocumentManifest) src); - if (src instanceof org.hl7.fhir.instance.model.DocumentReference) - return convertDocumentReference((org.hl7.fhir.instance.model.DocumentReference) src); - if (src instanceof org.hl7.fhir.instance.model.Encounter) - return convertEncounter((org.hl7.fhir.instance.model.Encounter) src); - if (src instanceof org.hl7.fhir.instance.model.EnrollmentRequest) - return convertEnrollmentRequest((org.hl7.fhir.instance.model.EnrollmentRequest) src); - if (src instanceof org.hl7.fhir.instance.model.EnrollmentResponse) - return convertEnrollmentResponse((org.hl7.fhir.instance.model.EnrollmentResponse) src); - if (src instanceof org.hl7.fhir.instance.model.EpisodeOfCare) - return convertEpisodeOfCare((org.hl7.fhir.instance.model.EpisodeOfCare) src); - if (src instanceof org.hl7.fhir.instance.model.FamilyMemberHistory) - return convertFamilyMemberHistory((org.hl7.fhir.instance.model.FamilyMemberHistory) src); - if (src instanceof org.hl7.fhir.instance.model.Flag) - return convertFlag((org.hl7.fhir.instance.model.Flag) src); - if (src instanceof org.hl7.fhir.instance.model.Group) - return convertGroup((org.hl7.fhir.instance.model.Group) src); - if (src instanceof org.hl7.fhir.instance.model.HealthcareService) - return convertHealthcareService((org.hl7.fhir.instance.model.HealthcareService) src); - if (src instanceof org.hl7.fhir.instance.model.ImagingStudy) - return convertImagingStudy((org.hl7.fhir.instance.model.ImagingStudy) src); - if (src instanceof org.hl7.fhir.instance.model.Immunization) - return convertImmunization((org.hl7.fhir.instance.model.Immunization) src); - if (src instanceof org.hl7.fhir.instance.model.ImmunizationRecommendation) - return convertImmunizationRecommendation((org.hl7.fhir.instance.model.ImmunizationRecommendation) src); - if (src instanceof org.hl7.fhir.instance.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.instance.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.instance.model.List_) - return convertList((org.hl7.fhir.instance.model.List_) src); - if (src instanceof org.hl7.fhir.instance.model.Location) - return convertLocation((org.hl7.fhir.instance.model.Location) src); - if (src instanceof org.hl7.fhir.instance.model.Media) - return convertMedia((org.hl7.fhir.instance.model.Media) src); - if (src instanceof org.hl7.fhir.instance.model.Medication) - return convertMedication((org.hl7.fhir.instance.model.Medication) src); - if (src instanceof org.hl7.fhir.instance.model.MedicationDispense) - return convertMedicationDispense((org.hl7.fhir.instance.model.MedicationDispense) src); -// if (src instanceof org.hl7.fhir.instance.model.MedicationOrder) -// return convertMedicationOrder((org.hl7.fhir.instance.model.MedicationOrder) src); - if (src instanceof org.hl7.fhir.instance.model.MedicationStatement) - return convertMedicationStatement((org.hl7.fhir.instance.model.MedicationStatement) src); - if (src instanceof org.hl7.fhir.instance.model.MessageHeader) - return convertMessageHeader((org.hl7.fhir.instance.model.MessageHeader) src); - if (src instanceof org.hl7.fhir.instance.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.instance.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.instance.model.Observation) - return convertObservation((org.hl7.fhir.instance.model.Observation) src); - if (src instanceof org.hl7.fhir.instance.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.instance.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.instance.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.instance.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.instance.model.Organization) - return convertOrganization((org.hl7.fhir.instance.model.Organization) src); - if (src instanceof org.hl7.fhir.instance.model.Patient) - return convertPatient((org.hl7.fhir.instance.model.Patient) src); - if (src instanceof org.hl7.fhir.instance.model.Person) - return convertPerson((org.hl7.fhir.instance.model.Person) src); - if (src instanceof org.hl7.fhir.instance.model.Practitioner) - return convertPractitioner((org.hl7.fhir.instance.model.Practitioner) src); - if (src instanceof org.hl7.fhir.instance.model.Procedure) - return convertProcedure((org.hl7.fhir.instance.model.Procedure) src); - if (src instanceof org.hl7.fhir.instance.model.ProcedureRequest) - return convertProcedureRequest((org.hl7.fhir.instance.model.ProcedureRequest) src); - if (src instanceof org.hl7.fhir.instance.model.Provenance) - return convertProvenance((org.hl7.fhir.instance.model.Provenance) src); - if (src instanceof org.hl7.fhir.instance.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.instance.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.instance.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.instance.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.instance.model.ReferralRequest) - return convertReferralRequest((org.hl7.fhir.instance.model.ReferralRequest) src); - if (src instanceof org.hl7.fhir.instance.model.RelatedPerson) - return convertRelatedPerson((org.hl7.fhir.instance.model.RelatedPerson) src); - if (src instanceof org.hl7.fhir.instance.model.RiskAssessment) - return convertRiskAssessment((org.hl7.fhir.instance.model.RiskAssessment) src); - if (src instanceof org.hl7.fhir.instance.model.Schedule) - return convertSchedule((org.hl7.fhir.instance.model.Schedule) src); - if (src instanceof org.hl7.fhir.instance.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.instance.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.instance.model.Slot) - return convertSlot((org.hl7.fhir.instance.model.Slot) src); - if (src instanceof org.hl7.fhir.instance.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.instance.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.instance.model.Subscription) - return convertSubscription((org.hl7.fhir.instance.model.Subscription) src); - if (src instanceof org.hl7.fhir.instance.model.Substance) - return convertSubstance((org.hl7.fhir.instance.model.Substance) src); - if (src instanceof org.hl7.fhir.instance.model.SupplyDelivery) - return convertSupplyDelivery((org.hl7.fhir.instance.model.SupplyDelivery) src); - if (src instanceof org.hl7.fhir.instance.model.SupplyRequest) - return convertSupplyRequest((org.hl7.fhir.instance.model.SupplyRequest) src); - if (src instanceof org.hl7.fhir.instance.model.TestScript) - return convertTestScript((org.hl7.fhir.instance.model.TestScript) src); - if (src instanceof org.hl7.fhir.instance.model.ValueSet) - return convertValueSet((org.hl7.fhir.instance.model.ValueSet) src); - throw new Error("Unknown resource "+src.getClass()); - } - - public org.hl7.fhir.instance.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu3.model.Parameters) - return convertParameters((org.hl7.fhir.dstu3.model.Parameters) src); - if (src instanceof org.hl7.fhir.dstu3.model.Appointment) - return convertAppointment((org.hl7.fhir.dstu3.model.Appointment) src); - if (src instanceof org.hl7.fhir.dstu3.model.AppointmentResponse) - return convertAppointmentResponse((org.hl7.fhir.dstu3.model.AppointmentResponse) src); - if (src instanceof org.hl7.fhir.dstu3.model.AuditEvent) - return convertAuditEvent((org.hl7.fhir.dstu3.model.AuditEvent) src); - if (src instanceof org.hl7.fhir.dstu3.model.Basic) - return convertBasic((org.hl7.fhir.dstu3.model.Basic) src); - if (src instanceof org.hl7.fhir.dstu3.model.Binary) - return convertBinary((org.hl7.fhir.dstu3.model.Binary) src); - if (src instanceof org.hl7.fhir.dstu3.model.Bundle) - return convertBundle((org.hl7.fhir.dstu3.model.Bundle) src); - if (src instanceof org.hl7.fhir.dstu3.model.CarePlan) - return convertCarePlan((org.hl7.fhir.dstu3.model.CarePlan) src); - if (src instanceof org.hl7.fhir.dstu3.model.ClinicalImpression) - return convertClinicalImpression((org.hl7.fhir.dstu3.model.ClinicalImpression) src); - if (src instanceof org.hl7.fhir.dstu3.model.Communication) - return convertCommunication((org.hl7.fhir.dstu3.model.Communication) src); - if (src instanceof org.hl7.fhir.dstu3.model.CommunicationRequest) - return convertCommunicationRequest((org.hl7.fhir.dstu3.model.CommunicationRequest) src); - if (src instanceof org.hl7.fhir.dstu3.model.Composition) - return convertComposition((org.hl7.fhir.dstu3.model.Composition) src); - if (src instanceof org.hl7.fhir.dstu3.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.dstu3.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.dstu3.model.Condition) - return convertCondition((org.hl7.fhir.dstu3.model.Condition) src); - if (src instanceof org.hl7.fhir.dstu3.model.CapabilityStatement) - return convertConformance((org.hl7.fhir.dstu3.model.CapabilityStatement) src); - if (src instanceof org.hl7.fhir.dstu3.model.Contract) - return convertContract((org.hl7.fhir.dstu3.model.Contract) src); - if (src instanceof org.hl7.fhir.dstu3.model.DataElement) - return convertDataElement((org.hl7.fhir.dstu3.model.DataElement) src); - if (src instanceof org.hl7.fhir.dstu3.model.DetectedIssue) - return convertDetectedIssue((org.hl7.fhir.dstu3.model.DetectedIssue) src); - if (src instanceof org.hl7.fhir.dstu3.model.Device) - return convertDevice((org.hl7.fhir.dstu3.model.Device) src); - if (src instanceof org.hl7.fhir.dstu3.model.DeviceComponent) - return convertDeviceComponent((org.hl7.fhir.dstu3.model.DeviceComponent) src); - if (src instanceof org.hl7.fhir.dstu3.model.DeviceMetric) - return convertDeviceMetric((org.hl7.fhir.dstu3.model.DeviceMetric) src); - if (src instanceof org.hl7.fhir.dstu3.model.DeviceUseStatement) - return convertDeviceUseStatement((org.hl7.fhir.dstu3.model.DeviceUseStatement) src); - if (src instanceof org.hl7.fhir.dstu3.model.DiagnosticReport) - return convertDiagnosticReport((org.hl7.fhir.dstu3.model.DiagnosticReport) src); - if (src instanceof org.hl7.fhir.dstu3.model.DocumentManifest) - return convertDocumentManifest((org.hl7.fhir.dstu3.model.DocumentManifest) src); - if (src instanceof org.hl7.fhir.dstu3.model.DocumentReference) - return convertDocumentReference((org.hl7.fhir.dstu3.model.DocumentReference) src); - if (src instanceof org.hl7.fhir.dstu3.model.Encounter) - return convertEncounter((org.hl7.fhir.dstu3.model.Encounter) src); - if (src instanceof org.hl7.fhir.dstu3.model.EnrollmentRequest) - return convertEnrollmentRequest((org.hl7.fhir.dstu3.model.EnrollmentRequest) src); - if (src instanceof org.hl7.fhir.dstu3.model.EnrollmentResponse) - return convertEnrollmentResponse((org.hl7.fhir.dstu3.model.EnrollmentResponse) src); - if (src instanceof org.hl7.fhir.dstu3.model.EpisodeOfCare) - return convertEpisodeOfCare((org.hl7.fhir.dstu3.model.EpisodeOfCare) src); - if (src instanceof org.hl7.fhir.dstu3.model.FamilyMemberHistory) - return convertFamilyMemberHistory((org.hl7.fhir.dstu3.model.FamilyMemberHistory) src); - if (src instanceof org.hl7.fhir.dstu3.model.Flag) - return convertFlag((org.hl7.fhir.dstu3.model.Flag) src); - if (src instanceof org.hl7.fhir.dstu3.model.Group) - return convertGroup((org.hl7.fhir.dstu3.model.Group) src); - if (src instanceof org.hl7.fhir.dstu3.model.HealthcareService) - return convertHealthcareService((org.hl7.fhir.dstu3.model.HealthcareService) src); - if (src instanceof org.hl7.fhir.dstu3.model.ImagingStudy) - return convertImagingStudy((org.hl7.fhir.dstu3.model.ImagingStudy) src); - if (src instanceof org.hl7.fhir.dstu3.model.Immunization) - return convertImmunization((org.hl7.fhir.dstu3.model.Immunization) src); - if (src instanceof org.hl7.fhir.dstu3.model.ImmunizationRecommendation) - return convertImmunizationRecommendation((org.hl7.fhir.dstu3.model.ImmunizationRecommendation) src); - if (src instanceof org.hl7.fhir.dstu3.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.dstu3.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.dstu3.model.ListResource) - return convertList((org.hl7.fhir.dstu3.model.ListResource) src); - if (src instanceof org.hl7.fhir.dstu3.model.Location) - return convertLocation((org.hl7.fhir.dstu3.model.Location) src); - if (src instanceof org.hl7.fhir.dstu3.model.Media) - return convertMedia((org.hl7.fhir.dstu3.model.Media) src); - if (src instanceof org.hl7.fhir.dstu3.model.Medication) - return convertMedication((org.hl7.fhir.dstu3.model.Medication) src); - if (src instanceof org.hl7.fhir.dstu3.model.MedicationDispense) - return convertMedicationDispense((org.hl7.fhir.dstu3.model.MedicationDispense) src); -// if (src instanceof org.hl7.fhir.dstu3.model.MedicationOrder) -// return convertMedicationOrder((org.hl7.fhir.dstu3.model.MedicationOrder) src); - if (src instanceof org.hl7.fhir.dstu3.model.MedicationStatement) - return convertMedicationStatement((org.hl7.fhir.dstu3.model.MedicationStatement) src); - if (src instanceof org.hl7.fhir.dstu3.model.MessageHeader) - return convertMessageHeader((org.hl7.fhir.dstu3.model.MessageHeader) src); - if (src instanceof org.hl7.fhir.dstu3.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.dstu3.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.dstu3.model.Observation) - return convertObservation((org.hl7.fhir.dstu3.model.Observation) src); - if (src instanceof org.hl7.fhir.dstu3.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.dstu3.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.dstu3.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.dstu3.model.Organization) - return convertOrganization((org.hl7.fhir.dstu3.model.Organization) src); - if (src instanceof org.hl7.fhir.dstu3.model.Patient) - return convertPatient((org.hl7.fhir.dstu3.model.Patient) src); - if (src instanceof org.hl7.fhir.dstu3.model.Person) - return convertPerson((org.hl7.fhir.dstu3.model.Person) src); - if (src instanceof org.hl7.fhir.dstu3.model.Practitioner) - return convertPractitioner((org.hl7.fhir.dstu3.model.Practitioner) src); - if (src instanceof org.hl7.fhir.dstu3.model.Procedure) - return convertProcedure((org.hl7.fhir.dstu3.model.Procedure) src); - if (src instanceof org.hl7.fhir.dstu3.model.ProcedureRequest) - return convertProcedureRequest((org.hl7.fhir.dstu3.model.ProcedureRequest) src); - if (src instanceof org.hl7.fhir.dstu3.model.Provenance) - return convertProvenance((org.hl7.fhir.dstu3.model.Provenance) src); - if (src instanceof org.hl7.fhir.dstu3.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.dstu3.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.dstu3.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.dstu3.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.dstu3.model.ReferralRequest) - return convertReferralRequest((org.hl7.fhir.dstu3.model.ReferralRequest) src); - if (src instanceof org.hl7.fhir.dstu3.model.RelatedPerson) - return convertRelatedPerson((org.hl7.fhir.dstu3.model.RelatedPerson) src); - if (src instanceof org.hl7.fhir.dstu3.model.RiskAssessment) - return convertRiskAssessment((org.hl7.fhir.dstu3.model.RiskAssessment) src); - if (src instanceof org.hl7.fhir.dstu3.model.Schedule) - return convertSchedule((org.hl7.fhir.dstu3.model.Schedule) src); - if (src instanceof org.hl7.fhir.dstu3.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.dstu3.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.dstu3.model.Slot) - return convertSlot((org.hl7.fhir.dstu3.model.Slot) src); - if (src instanceof org.hl7.fhir.dstu3.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.dstu3.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.Subscription) - return convertSubscription((org.hl7.fhir.dstu3.model.Subscription) src); - if (src instanceof org.hl7.fhir.dstu3.model.Substance) - return convertSubstance((org.hl7.fhir.dstu3.model.Substance) src); - if (src instanceof org.hl7.fhir.dstu3.model.SupplyDelivery) - return convertSupplyDelivery((org.hl7.fhir.dstu3.model.SupplyDelivery) src); - if (src instanceof org.hl7.fhir.dstu3.model.SupplyRequest) - return convertSupplyRequest((org.hl7.fhir.dstu3.model.SupplyRequest) src); - if (src instanceof org.hl7.fhir.dstu3.model.TestScript) - return convertTestScript((org.hl7.fhir.dstu3.model.TestScript) src); - if (src instanceof org.hl7.fhir.dstu3.model.ValueSet) - return convertValueSet((org.hl7.fhir.dstu3.model.ValueSet) src); - throw new Error("Unknown resource "+src.fhirType()); - } - -} + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.codec.binary.Base64; +import org.hl7.fhir.instance.model.CodeableConcept; +import org.hl7.fhir.instance.model.Reference; +import org.hl7.fhir.dstu2.utils.ToolingExtensions; +import org.hl7.fhir.dstu3.conformance.ProfileUtilities; +import org.hl7.fhir.dstu3.model.Annotation; +import org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction; +import org.hl7.fhir.dstu3.model.CodeSystem; +import org.hl7.fhir.dstu3.model.Coding; +import org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode; +import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent; +import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent; +import org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority; +import org.hl7.fhir.dstu3.model.ConceptMap; +import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent; +import org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent; +import org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus; +import org.hl7.fhir.dstu3.model.Dosage; +import org.hl7.fhir.dstu3.model.ElementDefinition; +import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; +import org.hl7.fhir.dstu3.model.Enumeration; +import org.hl7.fhir.dstu3.model.Immunization.ImmunizationPractitionerComponent; +import org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority; +import org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind; +import org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.dstu3.model.Timing.EventTiming; +import org.hl7.fhir.dstu3.model.UriType; +import org.hl7.fhir.dstu3.terminologies.CodeSystemUtilities; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.utilities.Utilities; + +/* + 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 Thu, Apr 7, 2016 02:14+1000 for FHIR v1.4.0 + + +public class VersionConvertor_10_20 { + + public VersionConvertorAdvisor advisor; + + public VersionConvertor_10_20(VersionConvertorAdvisor advisor) { + super(); + this.advisor = advisor; + } + + public void copyElement(org.hl7.fhir.instance.model.Element src, org.hl7.fhir.dstu3.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.instance.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + public void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.instance.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + public void copyElement(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.instance.model.Element tgt) throws FHIRException { + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + public void copyBackboneElement(org.hl7.fhir.instance.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + public void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.instance.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + public org.hl7.fhir.dstu3.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.instance.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu3.model.Base64BinaryType tgt = new org.hl7.fhir.dstu3.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu3.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.instance.model.Base64BinaryType tgt = new org.hl7.fhir.instance.model.Base64BinaryType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.BooleanType convertBoolean(org.hl7.fhir.instance.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu3.model.BooleanType tgt = new org.hl7.fhir.dstu3.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.BooleanType convertBoolean(org.hl7.fhir.dstu3.model.BooleanType src) throws FHIRException { + org.hl7.fhir.instance.model.BooleanType tgt = new org.hl7.fhir.instance.model.BooleanType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CodeType convertCode(org.hl7.fhir.instance.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.CodeType convertCode(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException { + org.hl7.fhir.instance.model.CodeType tgt = new org.hl7.fhir.instance.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.UriType convertCodeToUri(org.hl7.fhir.instance.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.CodeType convertUriToCode(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { + org.hl7.fhir.instance.model.CodeType tgt = new org.hl7.fhir.instance.model.CodeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.instance.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DateType convertDate(org.hl7.fhir.instance.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { + org.hl7.fhir.instance.model.DateType tgt = new org.hl7.fhir.instance.model.DateType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.instance.model.DateType tgt = new org.hl7.fhir.instance.model.DateType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DateTimeType convertDateTime(org.hl7.fhir.instance.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.DateTimeType convertDateTime(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.instance.model.DateTimeType tgt = new org.hl7.fhir.instance.model.DateTimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DecimalType convertDecimal(org.hl7.fhir.instance.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.DecimalType convertDecimal(org.hl7.fhir.dstu3.model.DecimalType src) throws FHIRException { + org.hl7.fhir.instance.model.DecimalType tgt = new org.hl7.fhir.instance.model.DecimalType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.IdType convertId(org.hl7.fhir.instance.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu3.model.IdType tgt = new org.hl7.fhir.dstu3.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.IdType convertId(org.hl7.fhir.dstu3.model.IdType src) throws FHIRException { + org.hl7.fhir.instance.model.IdType tgt = new org.hl7.fhir.instance.model.IdType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.InstantType convertInstant(org.hl7.fhir.instance.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu3.model.InstantType tgt = new org.hl7.fhir.dstu3.model.InstantType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.InstantType convertInstant(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException { + org.hl7.fhir.instance.model.InstantType tgt = new org.hl7.fhir.instance.model.InstantType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.IntegerType convertInteger(org.hl7.fhir.instance.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu3.model.IntegerType tgt = new org.hl7.fhir.dstu3.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.IntegerType convertInteger(org.hl7.fhir.dstu3.model.IntegerType src) throws FHIRException { + org.hl7.fhir.instance.model.IntegerType tgt = new org.hl7.fhir.instance.model.IntegerType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.MarkdownType convertMarkdown(org.hl7.fhir.instance.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu3.model.MarkdownType tgt = new org.hl7.fhir.dstu3.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu3.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.instance.model.MarkdownType tgt = new org.hl7.fhir.instance.model.MarkdownType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.OidType convertOid(org.hl7.fhir.instance.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu3.model.OidType tgt = new org.hl7.fhir.dstu3.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.OidType convertOid(org.hl7.fhir.dstu3.model.OidType src) throws FHIRException { + org.hl7.fhir.instance.model.OidType tgt = new org.hl7.fhir.instance.model.OidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.PositiveIntType convertPositiveInt(org.hl7.fhir.instance.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu3.model.PositiveIntType tgt = new org.hl7.fhir.dstu3.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu3.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.instance.model.PositiveIntType tgt = new org.hl7.fhir.instance.model.PositiveIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.StringType convertString(org.hl7.fhir.instance.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.StringType convertString(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException { + org.hl7.fhir.instance.model.StringType tgt = new org.hl7.fhir.instance.model.StringType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.instance.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.TimeType tgt = new org.hl7.fhir.dstu3.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { + org.hl7.fhir.instance.model.TimeType tgt = new org.hl7.fhir.instance.model.TimeType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.instance.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UnsignedIntType tgt = new org.hl7.fhir.dstu3.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu3.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.instance.model.UnsignedIntType tgt = new org.hl7.fhir.instance.model.UnsignedIntType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.UriType convertUri(org.hl7.fhir.instance.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.UriType convertUri(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { + org.hl7.fhir.instance.model.UriType tgt = new org.hl7.fhir.instance.model.UriType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.UuidType convertUuid(org.hl7.fhir.instance.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UuidType tgt = new org.hl7.fhir.dstu3.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.instance.model.UuidType convertUuid(org.hl7.fhir.dstu3.model.UuidType src) throws FHIRException { + org.hl7.fhir.instance.model.UuidType tgt = new org.hl7.fhir.instance.model.UuidType(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Extension convertExtension(org.hl7.fhir.instance.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Extension tgt = new org.hl7.fhir.dstu3.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public org.hl7.fhir.instance.model.Extension convertExtension(org.hl7.fhir.dstu3.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Extension tgt = new org.hl7.fhir.instance.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.instance.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + public org.hl7.fhir.instance.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Narrative tgt = new org.hl7.fhir.instance.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.instance.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GENERATED: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EMPTY; + default: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GENERATED: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.EMPTY; + default: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Annotation convertAnnotation(org.hl7.fhir.instance.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Annotation tgt = new org.hl7.fhir.dstu3.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.instance.model.Annotation convertAnnotation(org.hl7.fhir.dstu3.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Annotation tgt = new org.hl7.fhir.instance.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Attachment convertAttachment(org.hl7.fhir.instance.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Attachment tgt = new org.hl7.fhir.dstu3.model.Attachment(); + copyElement(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setLanguage(src.getLanguage()); + tgt.setData(src.getData()); + tgt.setUrl(src.getUrl()); + tgt.setSize(src.getSize()); + tgt.setHash(src.getHash()); + tgt.setTitle(src.getTitle()); + tgt.setCreation(src.getCreation()); + return tgt; + } + + public org.hl7.fhir.instance.model.Attachment convertAttachment(org.hl7.fhir.dstu3.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Attachment tgt = new org.hl7.fhir.instance.model.Attachment(); + copyElement(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setLanguage(src.getLanguage()); + tgt.setData(src.getData()); + tgt.setUrl(src.getUrl()); + tgt.setSize(src.getSize()); + tgt.setHash(src.getHash()); + tgt.setTitle(src.getTitle()); + tgt.setCreation(src.getCreation()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.instance.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeableConcept tgt = new org.hl7.fhir.dstu3.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.Coding t : src.getCoding()) + tgt.addCoding(convertCoding(t)); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.instance.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.CodeableConcept tgt = new org.hl7.fhir.instance.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCoding()) + tgt.addCoding(convertCoding(t)); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.instance.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public org.hl7.fhir.instance.model.Coding convertCoding(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Coding tgt = new org.hl7.fhir.instance.model.Coding(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + + + public org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.instance.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setSystem(src.getSystem()); + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public org.hl7.fhir.instance.model.Identifier convertIdentifier(org.hl7.fhir.dstu3.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Identifier tgt = new org.hl7.fhir.instance.model.Identifier(); + copyElement(src, tgt); + if (src.hasUse()) + tgt.setUse(convertIdentifierUse(src.getUse())); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + if (src.hasAssigner()) + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.instance.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.SECONDARY; + default: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.NULL; + } + } + + public org.hl7.fhir.instance.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.SECONDARY; + default: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Period convertPeriod(org.hl7.fhir.instance.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Period tgt = new org.hl7.fhir.dstu3.model.Period(); + copyElement(src, tgt); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + return tgt; + } + + public org.hl7.fhir.instance.model.Period convertPeriod(org.hl7.fhir.dstu3.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Period tgt = new org.hl7.fhir.instance.model.Period(); + copyElement(src, tgt); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Quantity convertQuantity(org.hl7.fhir.instance.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Quantity tgt = new org.hl7.fhir.dstu3.model.Quantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.instance.model.Quantity convertQuantity(org.hl7.fhir.dstu3.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Quantity tgt = new org.hl7.fhir.instance.model.Quantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.instance.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LESS_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_THAN; + default: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.NULL; + } + } + + public org.hl7.fhir.instance.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LESS_THAN: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.GREATER_THAN; + default: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Range convertRange(org.hl7.fhir.instance.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Range tgt = new org.hl7.fhir.dstu3.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public org.hl7.fhir.instance.model.Range convertRange(org.hl7.fhir.dstu3.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Range tgt = new org.hl7.fhir.instance.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Ratio convertRatio(org.hl7.fhir.instance.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Ratio tgt = new org.hl7.fhir.dstu3.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public org.hl7.fhir.instance.model.Ratio convertRatio(org.hl7.fhir.dstu3.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Ratio tgt = new org.hl7.fhir.instance.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.instance.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); + copyElement(src, tgt); + tgt.setReference(src.getReference()); + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public org.hl7.fhir.instance.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Reference tgt = new org.hl7.fhir.instance.model.Reference(); + copyElement(src, tgt); + tgt.setReference(src.getReference()); + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.SampledData convertSampledData(org.hl7.fhir.instance.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SampledData tgt = new org.hl7.fhir.dstu3.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + tgt.setFactor(src.getFactor()); + tgt.setLowerLimit(src.getLowerLimit()); + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public org.hl7.fhir.instance.model.SampledData convertSampledData(org.hl7.fhir.dstu3.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.SampledData tgt = new org.hl7.fhir.instance.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + tgt.setFactor(src.getFactor()); + tgt.setLowerLimit(src.getLowerLimit()); + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Signature convertSignature(org.hl7.fhir.instance.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Signature tgt = new org.hl7.fhir.dstu3.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + tgt.setContentType(src.getContentType()); + tgt.setBlob(src.getBlob()); + return tgt; + } + + public org.hl7.fhir.instance.model.Signature convertSignature(org.hl7.fhir.dstu3.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Signature tgt = new org.hl7.fhir.instance.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + tgt.setContentType(src.getContentType()); + tgt.setBlob(src.getBlob()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Address convertAddress(org.hl7.fhir.instance.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Address tgt = new org.hl7.fhir.dstu3.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + tgt.setText(src.getText()); + for (org.hl7.fhir.instance.model.StringType t : src.getLine()) + tgt.addLine(t.getValue()); + tgt.setCity(src.getCity()); + tgt.setDistrict(src.getDistrict()); + tgt.setState(src.getState()); + tgt.setPostalCode(src.getPostalCode()); + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.Address convertAddress(org.hl7.fhir.dstu3.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Address tgt = new org.hl7.fhir.instance.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getLine()) + tgt.addLine(t.getValue()); + tgt.setCity(src.getCity()); + tgt.setDistrict(src.getDistrict()); + tgt.setState(src.getState()); + tgt.setPostalCode(src.getPostalCode()); + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Address.AddressUse convertAddressUse(org.hl7.fhir.instance.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.dstu3.model.Address.AddressUse.HOME; + case WORK: return org.hl7.fhir.dstu3.model.Address.AddressUse.WORK; + case TEMP: return org.hl7.fhir.dstu3.model.Address.AddressUse.TEMP; + case OLD: return org.hl7.fhir.dstu3.model.Address.AddressUse.OLD; + default: return org.hl7.fhir.dstu3.model.Address.AddressUse.NULL; + } + } + + public org.hl7.fhir.instance.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu3.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.instance.model.Address.AddressUse.HOME; + case WORK: return org.hl7.fhir.instance.model.Address.AddressUse.WORK; + case TEMP: return org.hl7.fhir.instance.model.Address.AddressUse.TEMP; + case OLD: return org.hl7.fhir.instance.model.Address.AddressUse.OLD; + default: return org.hl7.fhir.instance.model.Address.AddressUse.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Address.AddressType convertAddressType(org.hl7.fhir.instance.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POSTAL: return org.hl7.fhir.dstu3.model.Address.AddressType.POSTAL; + case PHYSICAL: return org.hl7.fhir.dstu3.model.Address.AddressType.PHYSICAL; + case BOTH: return org.hl7.fhir.dstu3.model.Address.AddressType.BOTH; + default: return org.hl7.fhir.dstu3.model.Address.AddressType.NULL; + } + } + + public org.hl7.fhir.instance.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu3.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POSTAL: return org.hl7.fhir.instance.model.Address.AddressType.POSTAL; + case PHYSICAL: return org.hl7.fhir.instance.model.Address.AddressType.PHYSICAL; + case BOTH: return org.hl7.fhir.instance.model.Address.AddressType.BOTH; + default: return org.hl7.fhir.instance.model.Address.AddressType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ContactPoint convertContactPoint(org.hl7.fhir.instance.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactPoint tgt = new org.hl7.fhir.dstu3.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu3.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ContactPoint tgt = new org.hl7.fhir.instance.model.ContactPoint(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(convertContactPointSystem(src.getSystem())); + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + tgt.setRank(src.getRank()); + if (src.hasPeriod()) + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHONE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.OTHER; + default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL; + } + } + + public org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHONE: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.OTHER; + case URL: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.OTHER; + default: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.instance.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME; + case WORK: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK; + case TEMP: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP; + case OLD: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE; + default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL; + } + } + + public org.hl7.fhir.instance.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.HOME; + case WORK: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.WORK; + case TEMP: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.TEMP; + case OLD: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.MOBILE; + default: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ElementDefinition convertElementDefinition(org.hl7.fhir.instance.model.ElementDefinition src, List slicePaths) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition tgt = new org.hl7.fhir.dstu3.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.instance.model.Enumeration t : src.getRepresentation()) + tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); + if (src.hasName()) { + if (slicePaths.contains(src.getPath())) + tgt.setSliceName(src.getName()); + tgt.setId(src.getName()); + } + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.instance.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.instance.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasNameReference()) + tgt.setContentReference("#"+src.getNameReference()); + for (org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent t : src.getType()) + tgt.addType(convertElementDefinitionTypeComponent(t)); + if (src.hasDefaultValue()) + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + if (src.hasFixed()) + tgt.setFixed(convertType(src.getFixed())); + if (src.hasPattern()) + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); + if (src.hasMinValue()) + tgt.setMinValue(convertType(src.getMinValue())); + if (src.hasMaxValue()) + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.instance.model.IdType t : src.getCondition()) + tgt.addCondition(t.getValue()); + for (org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) + tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ElementDefinition tgt = new org.hl7.fhir.instance.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getRepresentation()) + tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); + if (src.hasSliceName()) + tgt.setName(src.getSliceName()); + else + tgt.setName(src.getId()); + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + tgt.setShort(src.getShort()); + tgt.setDefinition(src.getDefinition()); + tgt.setComments(src.getComment()); + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setNameReference(src.getContentReference().substring(1)); + for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) + tgt.addType(convertElementDefinitionTypeComponent(t)); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExampleFirstRep().getValue())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu3.model.IdType t : src.getCondition()) + tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) + tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + tgt.setMustSupport(src.getMustSupport()); + tgt.setIsModifier(src.getIsModifier()); + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XMLATTR: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR; + default: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XMLATTR: return org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation.XMLATTR; + default: return org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.StringType t : src.getDiscriminator()) + tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue())); + tgt.setDescription(src.getDescription()); + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) + tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); + tgt.setDescription(src.getDescription()); + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.instance.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLOSED: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPENATEND; + default: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.NULL; + } + } + + public org.hl7.fhir.instance.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLOSED: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.OPENATEND; + default: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCodeElement(convertCodeToUri(src.getCodeElement())); + for (org.hl7.fhir.instance.model.UriType t : src.getProfile()) + if (src.hasCode() && "Reference".equals(src.getCode())) + tgt.setTargetProfile(t.getValueAsString()); + else + tgt.setProfile(t.getValue()); + for (org.hl7.fhir.instance.model.Enumeration t : src.getAggregation()) + tgt.addAggregation(convertAggregationMode(t.getValue())); + return tgt; + } + + public org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCodeElement(convertUriToCode(src.getCodeElement())); + if (src.hasCode() && "Reference".equals(src.getCode())) { + if (src.hasTargetProfile()) + tgt.addProfile(src.getTargetProfile()); + } else if (src.hasProfile()) + tgt.addProfile(src.getProfile()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getAggregation()) + tgt.addAggregation(convertAggregationMode(t.getValue())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.instance.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONTAINED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.BUNDLED; + default: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.NULL; + } + } + + public org.hl7.fhir.instance.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONTAINED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.BUNDLED; + default: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); + tgt.setXpath(src.getXpath()); + return tgt; + } + + public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + ToolingExtensions.addStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); + tgt.setXpath(src.getXpath()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ERROR: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.WARNING; + default: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ERROR: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.WARNING; + default: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setDescription(src.getDescription()); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setDescription(src.getDescription()); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.instance.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXAMPLE; + default: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.NULL; + } + } + + public org.hl7.fhir.instance.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.EXAMPLE; + default: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.instance.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + tgt.setText(src.getText()); + for (org.hl7.fhir.instance.model.StringType t : src.getFamily()) + tgt.setFamily(t.getValue()); + for (org.hl7.fhir.instance.model.StringType t : src.getGiven()) + tgt.addGiven(t.getValue()); + for (org.hl7.fhir.instance.model.StringType t : src.getPrefix()) + tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.instance.model.StringType t : src.getSuffix()) + tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.HumanName convertHumanName(org.hl7.fhir.dstu3.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.HumanName tgt = new org.hl7.fhir.instance.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.addFamily(src.getFamily()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getGiven()) + tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getPrefix()) + tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSuffix()) + tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.HumanName.NameUse convertNameUse(org.hl7.fhir.instance.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.USUAL; + case OFFICIAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OFFICIAL; + case TEMP: return org.hl7.fhir.dstu3.model.HumanName.NameUse.TEMP; + case NICKNAME: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: return org.hl7.fhir.dstu3.model.HumanName.NameUse.ANONYMOUS; + case OLD: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OLD; + case MAIDEN: return org.hl7.fhir.dstu3.model.HumanName.NameUse.MAIDEN; + default: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NULL; + } + } + + public org.hl7.fhir.instance.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu3.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.instance.model.HumanName.NameUse.USUAL; + case OFFICIAL: return org.hl7.fhir.instance.model.HumanName.NameUse.OFFICIAL; + case TEMP: return org.hl7.fhir.instance.model.HumanName.NameUse.TEMP; + case NICKNAME: return org.hl7.fhir.instance.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: return org.hl7.fhir.instance.model.HumanName.NameUse.ANONYMOUS; + case OLD: return org.hl7.fhir.instance.model.HumanName.NameUse.OLD; + case MAIDEN: return org.hl7.fhir.instance.model.HumanName.NameUse.MAIDEN; + default: return org.hl7.fhir.instance.model.HumanName.NameUse.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.instance.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); + copyElement(src, tgt); + tgt.setVersionId(src.getVersionId()); + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.instance.model.UriType t : src.getProfile()) + tgt.addProfile(t.getValue()); + for (org.hl7.fhir.instance.model.Coding t : src.getSecurity()) + tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.instance.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Meta convertMeta(org.hl7.fhir.dstu3.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Meta tgt = new org.hl7.fhir.instance.model.Meta(); + copyElement(src, tgt); + tgt.setVersionId(src.getVersionId()); + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) + tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurity()) + tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Timing convertTiming(org.hl7.fhir.instance.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Timing tgt = new org.hl7.fhir.dstu3.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.DateTimeType t : src.getEvent()) + tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public org.hl7.fhir.instance.model.Timing convertTiming(org.hl7.fhir.dstu3.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Timing tgt = new org.hl7.fhir.instance.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.DateTimeType t : src.getEvent()) + tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.instance.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + tgt.setCount(src.getCount()); + tgt.setDuration(src.getDuration()); + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnits())); + tgt.setFrequency(src.getFrequency()); + tgt.setFrequencyMax(src.getFrequencyMax()); + tgt.setPeriod(src.getPeriod()); + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnits())); + tgt.addWhen(convertEventTiming(src.getWhen())); + return tgt; + } + + public org.hl7.fhir.instance.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.instance.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + tgt.setCount(src.getCount()); + tgt.setDuration(src.getDuration()); + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnits(convertUnitsOfTime(src.getDurationUnit())); + tgt.setFrequency(src.getFrequency()); + tgt.setFrequencyMax(src.getFrequencyMax()); + tgt.setPeriod(src.getPeriod()); + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnits(convertUnitsOfTime(src.getPeriodUnit())); + for (Enumeration t : src.getWhen()) + tgt.setWhen(convertEventTiming(t.getValue())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.instance.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case S: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.S; + case MIN: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MIN; + case H: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.H; + case D: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.D; + case WK: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.WK; + case MO: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MO; + case A: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.A; + default: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.NULL; + } + } + + public org.hl7.fhir.instance.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case S: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.S; + case MIN: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.MIN; + case H: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.H; + case D: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.D; + case WK: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.WK; + case MO: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.MO; + case A: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.A; + default: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.instance.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HS: return org.hl7.fhir.dstu3.model.Timing.EventTiming.HS; + case WAKE: return org.hl7.fhir.dstu3.model.Timing.EventTiming.WAKE; + case C: return org.hl7.fhir.dstu3.model.Timing.EventTiming.C; + case CM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CM; + case CD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CD; + case CV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CV; + case AC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.AC; + case ACM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACM; + case ACD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACD; + case ACV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACV; + case PC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PC; + case PCM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCM; + case PCD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCD; + case PCV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCV; + default: return org.hl7.fhir.dstu3.model.Timing.EventTiming.NULL; + } + } + + public org.hl7.fhir.instance.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu3.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HS: return org.hl7.fhir.instance.model.Timing.EventTiming.HS; + case WAKE: return org.hl7.fhir.instance.model.Timing.EventTiming.WAKE; + case C: return org.hl7.fhir.instance.model.Timing.EventTiming.C; + case CM: return org.hl7.fhir.instance.model.Timing.EventTiming.CM; + case CD: return org.hl7.fhir.instance.model.Timing.EventTiming.CD; + case CV: return org.hl7.fhir.instance.model.Timing.EventTiming.CV; + case AC: return org.hl7.fhir.instance.model.Timing.EventTiming.AC; + case ACM: return org.hl7.fhir.instance.model.Timing.EventTiming.ACM; + case ACD: return org.hl7.fhir.instance.model.Timing.EventTiming.ACD; + case ACV: return org.hl7.fhir.instance.model.Timing.EventTiming.ACV; + case PC: return org.hl7.fhir.instance.model.Timing.EventTiming.PC; + case PCM: return org.hl7.fhir.instance.model.Timing.EventTiming.PCM; + case PCD: return org.hl7.fhir.instance.model.Timing.EventTiming.PCD; + case PCV: return org.hl7.fhir.instance.model.Timing.EventTiming.PCV; + default: return org.hl7.fhir.instance.model.Timing.EventTiming.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Age convertAge(org.hl7.fhir.instance.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Age tgt = new org.hl7.fhir.dstu3.model.Age(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.instance.model.Age convertAge(org.hl7.fhir.dstu3.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Age tgt = new org.hl7.fhir.instance.model.Age(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Count convertCount(org.hl7.fhir.instance.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Count tgt = new org.hl7.fhir.dstu3.model.Count(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.instance.model.Count convertCount(org.hl7.fhir.dstu3.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Count tgt = new org.hl7.fhir.instance.model.Count(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Distance convertDistance(org.hl7.fhir.instance.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Distance tgt = new org.hl7.fhir.dstu3.model.Distance(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.instance.model.Distance convertDistance(org.hl7.fhir.dstu3.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Distance tgt = new org.hl7.fhir.instance.model.Distance(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Duration convertDuration(org.hl7.fhir.instance.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Duration tgt = new org.hl7.fhir.dstu3.model.Duration(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.instance.model.Duration convertDuration(org.hl7.fhir.dstu3.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Duration tgt = new org.hl7.fhir.instance.model.Duration(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Money convertMoney(org.hl7.fhir.instance.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Money tgt = new org.hl7.fhir.dstu3.model.Money(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.instance.model.Money convertMoney(org.hl7.fhir.dstu3.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Money tgt = new org.hl7.fhir.instance.model.Money(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.instance.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SimpleQuantity tgt = new org.hl7.fhir.dstu3.model.SimpleQuantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.instance.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.SimpleQuantity tgt = new org.hl7.fhir.instance.model.SimpleQuantity(); + copyElement(src, tgt); + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + tgt.setUnit(src.getUnit()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Type convertType(org.hl7.fhir.instance.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.instance.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.instance.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.instance.model.BooleanType) + return convertBoolean((org.hl7.fhir.instance.model.BooleanType) src); + if (src instanceof org.hl7.fhir.instance.model.CodeType) + return convertCode((org.hl7.fhir.instance.model.CodeType) src); + if (src instanceof org.hl7.fhir.instance.model.DateType) + return convertDate((org.hl7.fhir.instance.model.DateType) src); + if (src instanceof org.hl7.fhir.instance.model.DateTimeType) + return convertDateTime((org.hl7.fhir.instance.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.instance.model.DecimalType) + return convertDecimal((org.hl7.fhir.instance.model.DecimalType) src); + if (src instanceof org.hl7.fhir.instance.model.IdType) + return convertId((org.hl7.fhir.instance.model.IdType) src); + if (src instanceof org.hl7.fhir.instance.model.InstantType) + return convertInstant((org.hl7.fhir.instance.model.InstantType) src); + if (src instanceof org.hl7.fhir.instance.model.IntegerType) + return convertInteger((org.hl7.fhir.instance.model.IntegerType) src); + if (src instanceof org.hl7.fhir.instance.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.instance.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.instance.model.OidType) + return convertOid((org.hl7.fhir.instance.model.OidType) src); + if (src instanceof org.hl7.fhir.instance.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.instance.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.instance.model.StringType) + return convertString((org.hl7.fhir.instance.model.StringType) src); + if (src instanceof org.hl7.fhir.instance.model.TimeType) + return convertTime((org.hl7.fhir.instance.model.TimeType) src); + if (src instanceof org.hl7.fhir.instance.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.instance.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.instance.model.UriType) + return convertUri((org.hl7.fhir.instance.model.UriType) src); + if (src instanceof org.hl7.fhir.instance.model.UuidType) + return convertUuid((org.hl7.fhir.instance.model.UuidType) src); + if (src instanceof org.hl7.fhir.instance.model.Extension) + return convertExtension((org.hl7.fhir.instance.model.Extension) src); + if (src instanceof org.hl7.fhir.instance.model.Narrative) + return convertNarrative((org.hl7.fhir.instance.model.Narrative) src); + if (src instanceof org.hl7.fhir.instance.model.Annotation) + return convertAnnotation((org.hl7.fhir.instance.model.Annotation) src); + if (src instanceof org.hl7.fhir.instance.model.Attachment) + return convertAttachment((org.hl7.fhir.instance.model.Attachment) src); + if (src instanceof org.hl7.fhir.instance.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.instance.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.instance.model.Coding) + return convertCoding((org.hl7.fhir.instance.model.Coding) src); + if (src instanceof org.hl7.fhir.instance.model.Identifier) + return convertIdentifier((org.hl7.fhir.instance.model.Identifier) src); + if (src instanceof org.hl7.fhir.instance.model.Period) + return convertPeriod((org.hl7.fhir.instance.model.Period) src); + if (src instanceof org.hl7.fhir.instance.model.Quantity) + return convertQuantity((org.hl7.fhir.instance.model.Quantity) src); + if (src instanceof org.hl7.fhir.instance.model.Range) + return convertRange((org.hl7.fhir.instance.model.Range) src); + if (src instanceof org.hl7.fhir.instance.model.Ratio) + return convertRatio((org.hl7.fhir.instance.model.Ratio) src); + if (src instanceof org.hl7.fhir.instance.model.Reference) + return convertReference((org.hl7.fhir.instance.model.Reference) src); + if (src instanceof org.hl7.fhir.instance.model.SampledData) + return convertSampledData((org.hl7.fhir.instance.model.SampledData) src); + if (src instanceof org.hl7.fhir.instance.model.Signature) + return convertSignature((org.hl7.fhir.instance.model.Signature) src); + if (src instanceof org.hl7.fhir.instance.model.Address) + return convertAddress((org.hl7.fhir.instance.model.Address) src); + if (src instanceof org.hl7.fhir.instance.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.instance.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.instance.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.instance.model.ElementDefinition) src, new ArrayList()); + if (src instanceof org.hl7.fhir.instance.model.HumanName) + return convertHumanName((org.hl7.fhir.instance.model.HumanName) src); + if (src instanceof org.hl7.fhir.instance.model.Meta) + return convertMeta((org.hl7.fhir.instance.model.Meta) src); + if (src instanceof org.hl7.fhir.instance.model.Timing) + return convertTiming((org.hl7.fhir.instance.model.Timing) src); + if (src instanceof org.hl7.fhir.instance.model.Age) + return convertAge((org.hl7.fhir.instance.model.Age) src); + if (src instanceof org.hl7.fhir.instance.model.Count) + return convertCount((org.hl7.fhir.instance.model.Count) src); + if (src instanceof org.hl7.fhir.instance.model.Distance) + return convertDistance((org.hl7.fhir.instance.model.Distance) src); + if (src instanceof org.hl7.fhir.instance.model.Duration) + return convertDuration((org.hl7.fhir.instance.model.Duration) src); + if (src instanceof org.hl7.fhir.instance.model.Money) + return convertMoney((org.hl7.fhir.instance.model.Money) src); + if (src instanceof org.hl7.fhir.instance.model.SimpleQuantity) + return convertSimpleQuantity((org.hl7.fhir.instance.model.SimpleQuantity) src); + throw new Error("Unknown type "+src.getClass()); + } + + public org.hl7.fhir.instance.model.Type convertType(org.hl7.fhir.dstu3.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu3.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu3.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu3.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeType) + return convertCode((org.hl7.fhir.dstu3.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DateType) + return convertDate((org.hl7.fhir.dstu3.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu3.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu3.model.IdType) + return convertId((org.hl7.fhir.dstu3.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu3.model.InstantType) + return convertInstant((org.hl7.fhir.dstu3.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu3.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu3.model.OidType) + return convertOid((org.hl7.fhir.dstu3.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu3.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.StringType) + return convertString((org.hl7.fhir.dstu3.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu3.model.TimeType) + return convertTime((org.hl7.fhir.dstu3.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UriType) + return convertUri((org.hl7.fhir.dstu3.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UuidType) + return convertUuid((org.hl7.fhir.dstu3.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu3.model.Extension) + return convertExtension((org.hl7.fhir.dstu3.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu3.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu3.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu3.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu3.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu3.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu3.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu3.model.Coding) + return convertCoding((org.hl7.fhir.dstu3.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu3.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu3.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu3.model.Period) + return convertPeriod((org.hl7.fhir.dstu3.model.Period) src); + if (src instanceof org.hl7.fhir.dstu3.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu3.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu3.model.Range) + return convertRange((org.hl7.fhir.dstu3.model.Range) src); + if (src instanceof org.hl7.fhir.dstu3.model.Ratio) + return convertRatio((org.hl7.fhir.dstu3.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu3.model.Reference) + return convertReference((org.hl7.fhir.dstu3.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu3.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu3.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu3.model.Signature) + return convertSignature((org.hl7.fhir.dstu3.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu3.model.Address) + return convertAddress((org.hl7.fhir.dstu3.model.Address) src); + if (src instanceof org.hl7.fhir.dstu3.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu3.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu3.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.dstu3.model.ElementDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu3.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu3.model.Meta) + return convertMeta((org.hl7.fhir.dstu3.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu3.model.Timing) + return convertTiming((org.hl7.fhir.dstu3.model.Timing) src); + if (src instanceof org.hl7.fhir.dstu3.model.Age) + return convertAge((org.hl7.fhir.dstu3.model.Age) src); + if (src instanceof org.hl7.fhir.dstu3.model.Count) + return convertCount((org.hl7.fhir.dstu3.model.Count) src); + if (src instanceof org.hl7.fhir.dstu3.model.Distance) + return convertDistance((org.hl7.fhir.dstu3.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu3.model.Duration) + return convertDuration((org.hl7.fhir.dstu3.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu3.model.Money) + return convertMoney((org.hl7.fhir.dstu3.model.Money) src); + if (src instanceof org.hl7.fhir.dstu3.model.SimpleQuantity) + return convertSimpleQuantity((org.hl7.fhir.dstu3.model.SimpleQuantity) src); + throw new Error("Unknown type "+src.fhirType()); + } + + public void copyDomainResource(org.hl7.fhir.instance.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.instance.model.Resource t : src.getContained()) + tgt.addContained(convertResource(t)); + for (org.hl7.fhir.instance.model.Extension t : src.getExtension()) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.instance.model.Extension t : src.getModifierExtension()) + tgt.addModifierExtension(convertExtension(t)); + } + public void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.instance.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.dstu3.model.Resource t : src.getContained()) + tgt.getContained().add(convertResource(t)); + for (org.hl7.fhir.dstu3.model.Extension t : src.getExtension()) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension()) + tgt.addModifierExtension(convertExtension(t)); + } + + public org.hl7.fhir.dstu3.model.Parameters convertParameters(org.hl7.fhir.instance.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Parameters tgt = new org.hl7.fhir.dstu3.model.Parameters(); + copyResource(src, tgt); + for (org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent t : src.getParameter()) + tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Parameters convertParameters(org.hl7.fhir.dstu3.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Parameters tgt = new org.hl7.fhir.instance.model.Parameters(); + copyResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getParameter()) + tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + tgt.setResource(convertResource(src.getResource())); + for (org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent t : src.getPart()) + tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + tgt.setResource(convertResource(src.getResource())); + for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getPart()) + tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public void copyResource(org.hl7.fhir.instance.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException { + tgt.setId(src.getId()); + tgt.setMeta(convertMeta(src.getMeta())); + tgt.setImplicitRules(src.getImplicitRules()); + tgt.setLanguage(src.getLanguage()); + } + public void copyResource(org.hl7.fhir.dstu3.model.Resource src, org.hl7.fhir.instance.model.Resource tgt) throws FHIRException { + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + public org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.instance.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MALE: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.UNKNOWN; + default: return org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.NULL; + } + } + + public org.hl7.fhir.instance.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MALE: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.MALE; + case FEMALE: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.FEMALE; + case OTHER: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.OTHER; + case UNKNOWN: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.UNKNOWN; + default: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.instance.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NUMBER: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER; + case DATE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.DATE; + case STRING: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.STRING; + case TOKEN: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.QUANTITY; + case URI: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI; + default: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL; + } + } + + public org.hl7.fhir.instance.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NUMBER: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.NUMBER; + case DATE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.DATE; + case STRING: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.STRING; + case TOKEN: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.QUANTITY; + case URI: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.URI; + default: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Account convertAccount(org.hl7.fhir.instance.model.Account src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Account tgt = new org.hl7.fhir.dstu3.model.Account(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasType()) + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setStatus(convertAccountStatus(src.getStatus())); + tgt.setActive(convertPeriod(src.getActivePeriod())); + tgt.setBalance(convertMoney(src.getBalance())); +// tgt.setCoveragePeriod(convertPeriod(src.getCoveragePeriod())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setOwner(convertReference(src.getOwner())); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public org.hl7.fhir.instance.model.Account convertAccount(org.hl7.fhir.dstu3.model.Account src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Account tgt = new org.hl7.fhir.instance.model.Account(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setName(src.getName()); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setStatus(convertAccountStatus(src.getStatus())); + tgt.setActivePeriod(convertPeriod(src.getActive())); + tgt.setBalance(convertMoney(src.getBalance())); +// tgt.setCoveragePeriod(convertPeriod(src.getCoveragePeriod())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setOwner(convertReference(src.getOwner())); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Account.AccountStatus convertAccountStatus(org.hl7.fhir.instance.model.Account.AccountStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu3.model.Account.AccountStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.dstu3.model.Account.AccountStatus.INACTIVE; + default: return org.hl7.fhir.dstu3.model.Account.AccountStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Account.AccountStatus convertAccountStatus(org.hl7.fhir.dstu3.model.Account.AccountStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.instance.model.Account.AccountStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.instance.model.Account.AccountStatus.INACTIVE; + default: return org.hl7.fhir.instance.model.Account.AccountStatus.NULL; + } + } + + + public org.hl7.fhir.dstu3.model.Appointment convertAppointment(org.hl7.fhir.instance.model.Appointment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Appointment tgt = new org.hl7.fhir.dstu3.model.Appointment(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + if (src.hasType()) + tgt.addServiceType(convertCodeableConcept(src.getType())); +// tgt.setReason(convertCodeableConcept(src.getReason())); + tgt.setPriority(src.getPriority()); + tgt.setDescription(src.getDescription()); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.instance.model.Reference t : src.getSlot()) + tgt.addSlot(convertReference(t)); + tgt.setComment(src.getComment()); + for (org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertAppointmentParticipantComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Appointment convertAppointment(org.hl7.fhir.dstu3.model.Appointment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Appointment tgt = new org.hl7.fhir.instance.model.Appointment(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertAppointmentStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) + tgt.setType(convertCodeableConcept(t)); +// tgt.setReason(convertCodeableConcept(src.getReason())); + tgt.setPriority(src.getPriority()); + tgt.setDescription(src.getDescription()); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setMinutesDuration(src.getMinutesDuration()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSlot()) + tgt.addSlot(convertReference(t)); + tgt.setComment(src.getComment()); + for (org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertAppointmentParticipantComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.instance.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NOSHOW; + default: return org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.dstu3.model.Appointment.AppointmentStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.PROPOSED; + case PENDING: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.PENDING; + case BOOKED: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.BOOKED; + case ARRIVED: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.ARRIVED; + case FULFILLED: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.FULFILLED; + case CANCELLED: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.CANCELLED; + case NOSHOW: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.NOSHOW; + default: return org.hl7.fhir.instance.model.Appointment.AppointmentStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setActor(convertReference(src.getActor())); + tgt.setRequired(convertParticipantRequired(src.getRequired())); + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + public org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.dstu3.model.Appointment.AppointmentParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setActor(convertReference(src.getActor())); + tgt.setRequired(convertParticipantRequired(src.getRequired())); + tgt.setStatus(convertParticipationStatus(src.getStatus())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.instance.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: return org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired.NULL; + } + } + + public org.hl7.fhir.instance.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.dstu3.model.Appointment.ParticipantRequired src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.REQUIRED; + case OPTIONAL: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.OPTIONAL; + case INFORMATIONONLY: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.INFORMATIONONLY; + default: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.instance.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NEEDSACTION; + default: return org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.NEEDSACTION; + default: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.instance.model.AppointmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.AppointmentResponse tgt = new org.hl7.fhir.dstu3.model.AppointmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setAppointment(convertReference(src.getAppointment())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getParticipantType()) + tgt.addParticipantType(convertCodeableConcept(t)); + tgt.setActor(convertReference(src.getActor())); + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + tgt.setComment(src.getComment()); + return tgt; + } + + private org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus src) { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case INPROCESS: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case COMPLETED: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case NEEDSACTION: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: return org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NULL; + } + } + + private org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus src) { + if (src == null) + return null; + switch (src) { + case ACCEPTED: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.ACCEPTED; + case DECLINED: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.DECLINED; + case TENTATIVE: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.TENTATIVE; + case NEEDSACTION: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.NEEDSACTION; + default: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu3.model.AppointmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.AppointmentResponse tgt = new org.hl7.fhir.instance.model.AppointmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setAppointment(convertReference(src.getAppointment())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getParticipantType()) + tgt.addParticipantType(convertCodeableConcept(t)); + tgt.setActor(convertReference(src.getActor())); + tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus())); + tgt.setComment(src.getComment()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.AuditEvent convertAuditEvent(org.hl7.fhir.instance.model.AuditEvent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.AuditEvent tgt = new org.hl7.fhir.dstu3.model.AuditEvent(); + copyDomainResource(src, tgt); + if (src.hasEvent()) { + tgt.setType(convertCoding(src.getEvent().getType())); + for (org.hl7.fhir.instance.model.Coding t : src.getEvent().getSubtype()) + tgt.addSubtype(convertCoding(t)); + tgt.setAction(convertAuditEventAction(src.getEvent().getAction())); + tgt.setRecorded(src.getEvent().getDateTime()); + tgt.setOutcome(convertAuditEventOutcome(src.getEvent().getOutcome())); + tgt.setOutcomeDesc(src.getEvent().getOutcomeDesc()); + for (org.hl7.fhir.instance.model.Coding t : src.getEvent().getPurposeOfEvent()) + tgt.addPurposeOfEvent().addCoding(convertCoding(t)); + } + for (org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantComponent t : src.getParticipant()) + tgt.addAgent(convertAuditEventAgentComponent(t)); + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent t : src.getObject()) + tgt.addEntity(convertAuditEventEntityComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.AuditEvent convertAuditEvent(org.hl7.fhir.dstu3.model.AuditEvent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.AuditEvent tgt = new org.hl7.fhir.instance.model.AuditEvent(); + copyDomainResource(src, tgt); + tgt.getEvent().setType(convertCoding(src.getType())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSubtype()) + tgt.getEvent().addSubtype(convertCoding(t)); + tgt.getEvent().setAction(convertAuditEventAction(src.getAction())); + tgt.getEvent().setDateTime(src.getRecorded()); + tgt.getEvent().setOutcome(convertAuditEventOutcome(src.getOutcome())); + tgt.getEvent().setOutcomeDesc(src.getOutcomeDesc()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfEvent()) + for (org.hl7.fhir.dstu3.model.Coding cc : t.getCoding()) + tgt.getEvent().addPurposeOfEvent(convertCoding(cc)); + for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent t : src.getAgent()) + tgt.addParticipant(convertAuditEventAgentComponent(t)); + tgt.setSource(convertAuditEventSourceComponent(src.getSource())); + for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent t : src.getEntity()) + tgt.addObject(convertAuditEventEntityComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.instance.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case C: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.C; + case R: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.R; + case U: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.U; + case D: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.D; + case E: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.E; + default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction.NULL; + } + } + + public org.hl7.fhir.instance.model.AuditEvent.AuditEventAction convertAuditEventAction(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case C: return org.hl7.fhir.instance.model.AuditEvent.AuditEventAction.C; + case R: return org.hl7.fhir.instance.model.AuditEvent.AuditEventAction.R; + case U: return org.hl7.fhir.instance.model.AuditEvent.AuditEventAction.U; + case D: return org.hl7.fhir.instance.model.AuditEvent.AuditEventAction.D; + case E: return org.hl7.fhir.instance.model.AuditEvent.AuditEventAction.E; + default: return org.hl7.fhir.instance.model.AuditEvent.AuditEventAction.NULL; + } + } + + public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _0: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._0; + case _4: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._4; + case _8: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._8; + case _12: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome._12; + default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome.NULL; + } + } + + public org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventOutcome src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _0: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._0; + case _4: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._4; + case _8: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._8; + case _12: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._12; + default: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome.NULL; + } + } + + public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + tgt.setReference(convertReference(src.getReference())); + tgt.setUserId(convertIdentifier(src.getUserId())); + tgt.setAltId(src.getAltId()); + tgt.setName(src.getName()); + tgt.setRequestor(src.getRequestor()); + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.instance.model.UriType t : src.getPolicy()) + tgt.addPolicy(t.getValue()); + tgt.setMedia(convertCoding(src.getMedia())); + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.instance.model.Coding t : src.getPurposeOfUse()) + tgt.addPurposeOfUse().addCoding(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantComponent convertAuditEventAgentComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + tgt.setReference(convertReference(src.getReference())); + tgt.setUserId(convertIdentifier(src.getUserId())); + tgt.setAltId(src.getAltId()); + tgt.setName(src.getName()); + tgt.setRequestor(src.getRequestor()); + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) + tgt.addPolicy(t.getValue()); + tgt.setMedia(convertCoding(src.getMedia())); + tgt.setNetwork(convertAuditEventAgentNetworkComponent(src.getNetwork())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getPurposeOfUse()) + for (org.hl7.fhir.dstu3.model.Coding cc : t.getCoding()) + tgt.addPurposeOfUse(convertCoding(cc)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent(); + copyElement(src, tgt); + tgt.setAddress(src.getAddress()); + tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); + return tgt; + } + + public org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkComponent convertAuditEventAgentNetworkComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkComponent(); + copyElement(src, tgt); + tgt.setAddress(src.getAddress()); + tgt.setType(convertAuditEventParticipantNetworkType(src.getType())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _1: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._1; + case _2: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._2; + case _3: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._3; + case _4: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._4; + case _5: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType._5; + default: return org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType.NULL; + } + } + + public org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventAgentNetworkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case _1: return org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType._1; + case _2: return org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType._2; + case _3: return org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType._3; + case _4: return org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType._4; + case _5: return org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType._5; + default: return org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent(); + copyElement(src, tgt); + tgt.setSite(src.getSite()); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.instance.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.AuditEvent.AuditEventSourceComponent convertAuditEventSourceComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.AuditEvent.AuditEventSourceComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventSourceComponent(); + copyElement(src, tgt); + tgt.setSite(src.getSite()); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setReference(convertReference(src.getReference())); + tgt.setType(convertCoding(src.getType())); + tgt.setRole(convertCoding(src.getRole())); + tgt.setLifecycle(convertCoding(src.getLifecycle())); + for (org.hl7.fhir.instance.model.Coding t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCoding(t)); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent t : src.getDetail()) + tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent convertAuditEventEntityComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setReference(convertReference(src.getReference())); + tgt.setType(convertCoding(src.getType())); + tgt.setRole(convertCoding(src.getRole())); + tgt.setLifecycle(convertCoding(src.getLifecycle())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCoding(t)); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setQuery(src.getQuery()); + for (org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail()) + tgt.addDetail(convertAuditEventEntityDetailComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.dstu3.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Basic convertBasic(org.hl7.fhir.instance.model.Basic src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Basic tgt = new org.hl7.fhir.dstu3.model.Basic(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setCreated(src.getCreated()); + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + public org.hl7.fhir.instance.model.Basic convertBasic(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Basic tgt = new org.hl7.fhir.instance.model.Basic(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setCreated(src.getCreated()); + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.instance.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary(); + copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + public org.hl7.fhir.instance.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Binary tgt = new org.hl7.fhir.instance.model.Binary(); + copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Bundle convertBundle(org.hl7.fhir.instance.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle tgt = new org.hl7.fhir.dstu3.model.Bundle(); + copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.instance.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.instance.model.Bundle.BundleEntryComponent t : src.getEntry()) + tgt.addEntry(convertBundleEntryComponent(t)); + tgt.setSignature(convertSignature(src.getSignature())); + return tgt; + } + + public org.hl7.fhir.instance.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Bundle tgt = new org.hl7.fhir.instance.model.Bundle(); + copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent t : src.getEntry()) + tgt.addEntry(convertBundleEntryComponent(t)); + if (src.hasSignature()) + tgt.setSignature(convertSignature(src.getSignature())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Bundle.BundleType convertBundleType(org.hl7.fhir.instance.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENT: return org.hl7.fhir.dstu3.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: return org.hl7.fhir.dstu3.model.Bundle.BundleType.HISTORY; + case SEARCHSET: return org.hl7.fhir.dstu3.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.COLLECTION; + default: return org.hl7.fhir.dstu3.model.Bundle.BundleType.NULL; + } + } + + public org.hl7.fhir.instance.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu3.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENT: return org.hl7.fhir.instance.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: return org.hl7.fhir.instance.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: return org.hl7.fhir.instance.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: return org.hl7.fhir.instance.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: return org.hl7.fhir.instance.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: return org.hl7.fhir.instance.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: return org.hl7.fhir.instance.model.Bundle.BundleType.HISTORY; + case SEARCHSET: return org.hl7.fhir.instance.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: return org.hl7.fhir.instance.model.Bundle.BundleType.COLLECTION; + default: return org.hl7.fhir.instance.model.Bundle.BundleType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.instance.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent(); + copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public org.hl7.fhir.instance.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleLinkComponent(); + copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.instance.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + tgt.setFullUrl(src.getFullUrl()); + tgt.setResource(convertResource(src.getResource())); + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public org.hl7.fhir.instance.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (advisor.ignoreEntry(src)) + return null; + + org.hl7.fhir.instance.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntryComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + tgt.setFullUrl(src.getFullUrl()); + org.hl7.fhir.instance.model.Resource res = advisor.convert(src.getResource()); + if (res == null) + res = convertResource(src.getResource()); + tgt.setResource(res); + if (src.hasSearch()) + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + if (src.hasRequest()) + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + if (src.hasResponse()) + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent(); + copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + tgt.setScore(src.getScore()); + return tgt; + } + + public org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent(); + copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + tgt.setScore(src.getScore()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.instance.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MATCH: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.OUTCOME; + default: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.NULL; + } + } + + public org.hl7.fhir.instance.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MATCH: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.OUTCOME; + default: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent(); + copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + tgt.setIfNoneMatch(src.getIfNoneMatch()); + tgt.setIfModifiedSince(src.getIfModifiedSince()); + tgt.setIfMatch(src.getIfMatch()); + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent(); + copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + tgt.setIfNoneMatch(src.getIfNoneMatch()); + tgt.setIfModifiedSince(src.getIfModifiedSince()); + tgt.setIfMatch(src.getIfMatch()); + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.instance.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GET: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.GET; + case POST: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.POST; + case PUT: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.PUT; + case DELETE: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE; + default: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.NULL; + } + } + + public org.hl7.fhir.instance.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GET: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.GET; + case POST: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.POST; + case PUT: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.PUT; + case DELETE: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.DELETE; + default: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.instance.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent(); + copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + tgt.setLocation(src.getLocation()); + tgt.setEtag(src.getEtag()); + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public org.hl7.fhir.instance.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntryResponseComponent(); + copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + tgt.setLocation(src.getLocation()); + tgt.setEtag(src.getEtag()); + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CarePlan convertCarePlan(org.hl7.fhir.instance.model.CarePlan src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CarePlan tgt = new org.hl7.fhir.dstu3.model.CarePlan(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + tgt.setContext(convertReference(src.getContext())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.instance.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); +// tgt.setModified(src.getModified()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.Reference t : src.getAddresses()) + tgt.addAddresses(convertReference(t)); +// for (org.hl7.fhir.instance.model.Reference t : src.getSupport()) +// tgt.addSupport(convertReference(t)); +// for (org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent t : src.getRelatedPlan()) +// tgt.addRelatedPlan(convertCarePlanRelatedPlanComponent(t)); +// for (org.hl7.fhir.instance.model.CarePlan.CarePlanParticipantComponent t : src.getParticipant()) +// tgt.addParticipant(convertCarePlanParticipantComponent(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getGoal()) + tgt.addGoal(convertReference(t)); + for (org.hl7.fhir.instance.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) + tgt.addActivity(convertCarePlanActivityComponent(t)); +// tgt.setNote(convertAnnotation(src.getNote())); + return tgt; + } + + public org.hl7.fhir.instance.model.CarePlan convertCarePlan(org.hl7.fhir.dstu3.model.CarePlan src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.CarePlan tgt = new org.hl7.fhir.instance.model.CarePlan(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setStatus(convertCarePlanStatus(src.getStatus())); + tgt.setContext(convertReference(src.getContext())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); +// tgt.setModified(src.getModified()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAddresses()) + tgt.addAddresses(convertReference(t)); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getSupport()) +// tgt.addSupport(convertReference(t)); +// for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent t : src.getRelatedPlan()) +// tgt.addRelatedPlan(convertCarePlanRelatedPlanComponent(t)); +// for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanParticipantComponent t : src.getParticipant()) +// tgt.addParticipant(convertCarePlanParticipantComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) + tgt.addGoal(convertReference(t)); + for (org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent t : src.getActivity()) + tgt.addActivity(convertCarePlanActivityComponent(t)); +// tgt.setNote(convertAnnotation(src.getNote())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.instance.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT; + case DRAFT: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.CANCELLED; + default: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { +// case PROPOSED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.PROPOSED; + case DRAFT: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.CANCELLED; + default: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.NULL; + } + } + +// public org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent(); +// copyElement(src, tgt); +// tgt.setCode(convertCarePlanRelationship(src.getCode())); +// tgt.setPlan(convertReference(src.getPlan())); +// return tgt; +// } + +// public org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent(); +// copyElement(src, tgt); +// tgt.setCode(convertCarePlanRelationship(src.getCode())); +// tgt.setPlan(convertReference(src.getPlan())); +// return tgt; +// } + +// public org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case INCLUDES: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship.INCLUDES; +// case REPLACES: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship.REPLACES; +// case FULFILLS: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship.FULFILLS; +// default: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship.NULL; +// } +// } + +// public org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.dstu3.model.CarePlan.CarePlanRelationship src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case INCLUDES: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.INCLUDES; +// case REPLACES: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.REPLACES; +// case FULFILLS: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.FULFILLS; +// default: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.NULL; +// } +// } + +// public org.hl7.fhir.dstu3.model.CarePlan.CarePlanParticipantComponent convertCarePlanParticipantComponent(org.hl7.fhir.instance.model.CarePlan.CarePlanParticipantComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.CarePlan.CarePlanParticipantComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanParticipantComponent(); +// copyElement(src, tgt); +// tgt.setRole(convertCodeableConcept(src.getRole())); +// tgt.setMember(convertReference(src.getMember())); +// return tgt; +// } +// +// public org.hl7.fhir.instance.model.CarePlan.CarePlanParticipantComponent convertCarePlanParticipantComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanParticipantComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.CarePlan.CarePlanParticipantComponent tgt = new org.hl7.fhir.instance.model.CarePlan.CarePlanParticipantComponent(); +// copyElement(src, tgt); +// tgt.setRole(convertCodeableConcept(src.getRole())); +// tgt.setMember(convertReference(src.getMember())); +// return tgt; +// } +// + public org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.instance.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent(); + copyElement(src, tgt); +// for (org.hl7.fhir.instance.model.Reference t : src.getActionResulting()) +// tgt.addActionResulting(convertReference(t)); + for (org.hl7.fhir.instance.model.Annotation t : src.getProgress()) + tgt.addProgress(convertAnnotation(t)); + tgt.setReference(convertReference(src.getReference())); + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + return tgt; + } + + public org.hl7.fhir.instance.model.CarePlan.CarePlanActivityComponent convertCarePlanActivityComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.CarePlan.CarePlanActivityComponent tgt = new org.hl7.fhir.instance.model.CarePlan.CarePlanActivityComponent(); + copyElement(src, tgt); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getActionResulting()) +// tgt.addActionResulting(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getProgress()) + tgt.addProgress(convertAnnotation(t)); + tgt.setReference(convertReference(src.getReference())); + tgt.setDetail(convertCarePlanActivityDetailComponent(src.getDetail())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.instance.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent(); + copyElement(src, tgt); + tgt.setCategory(convertCodeableConcept(src.getCategory())); + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getGoal()) + tgt.addGoal(convertReference(t)); + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); +// tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + tgt.setProhibited(src.getProhibited()); + tgt.setScheduled(convertType(src.getScheduled())); + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.instance.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + tgt.setProduct(convertType(src.getProduct())); + tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public org.hl7.fhir.instance.model.CarePlan.CarePlanActivityDetailComponent convertCarePlanActivityDetailComponent(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityDetailComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.CarePlan.CarePlanActivityDetailComponent tgt = new org.hl7.fhir.instance.model.CarePlan.CarePlanActivityDetailComponent(); + copyElement(src, tgt); + tgt.setCategory(convertCodeableConcept(src.getCategory())); + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) + tgt.addReasonCode(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) + tgt.addReasonReference(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getGoal()) + tgt.addGoal(convertReference(t)); + tgt.setStatus(convertCarePlanActivityStatus(src.getStatus())); +// tgt.setStatusReason(convertCodeableConcept(src.getStatusReason())); + tgt.setProhibited(src.getProhibited()); + tgt.setScheduled(convertType(src.getScheduled())); + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + tgt.setProduct(convertType(src.getProduct())); + tgt.setDailyAmount(convertSimpleQuantity(src.getDailyAmount())); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSTARTED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case SCHEDULED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case INPROGRESS: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case ONHOLD: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case COMPLETED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.CANCELLED; + default: return org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus convertCarePlanActivityStatus(org.hl7.fhir.dstu3.model.CarePlan.CarePlanActivityStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSTARTED: return org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus.NOTSTARTED; + case SCHEDULED: return org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus.SCHEDULED; + case INPROGRESS: return org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus.INPROGRESS; + case ONHOLD: return org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus.ONHOLD; + case COMPLETED: return org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus.CANCELLED; + default: return org.hl7.fhir.instance.model.CarePlan.CarePlanActivityStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.instance.model.ClinicalImpression src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ClinicalImpression tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression(); + copyDomainResource(src, tgt); + tgt.setSubject(convertReference(src.getPatient())); + tgt.setAssessor(convertReference(src.getAssessor())); + tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + tgt.setPrevious(convertReference(src.getPrevious())); + for (org.hl7.fhir.instance.model.Reference t : src.getProblem()) + tgt.addProblem(convertReference(t)); +// for (org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent t : src.getInvestigations()) +// tgt.addInvestigations(convertClinicalImpressionInvestigationsComponent(t)); + tgt.addProtocol(src.getProtocol()); + tgt.setSummary(src.getSummary()); + for (org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) + tgt.addFinding(convertClinicalImpressionFindingComponent(t)); + if (src.hasPrognosis()) + tgt.addPrognosisCodeableConcept ().setText(src.getPrognosis()); +// for (org.hl7.fhir.instance.model.Reference t : src.getPlan()) +// tgt.addPlan(convertReference(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getAction()) + tgt.addAction(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.dstu3.model.ClinicalImpression src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ClinicalImpression tgt = new org.hl7.fhir.instance.model.ClinicalImpression(); + copyDomainResource(src, tgt); + tgt.setPatient(convertReference(src.getSubject())); + tgt.setAssessor(convertReference(src.getAssessor())); + tgt.setStatus(convertClinicalImpressionStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + tgt.setPrevious(convertReference(src.getPrevious())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProblem()) + tgt.addProblem(convertReference(t)); +// for (org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent t : src.getInvestigations()) +// tgt.addInvestigations(convertClinicalImpressionInvestigationsComponent(t)); + for (UriType t : src.getProtocol()) + tgt.setProtocol(t.asStringValue()); + tgt.setSummary(src.getSummary()); + for (org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent t : src.getFinding()) + tgt.addFinding(convertClinicalImpressionFindingComponent(t)); + tgt.setPrognosis(src.getPrognosisCodeableConceptFirstRep().getText()); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getPlan()) +// tgt.addPlan(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAction()) + tgt.addAction(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.DRAFT; + case COMPLETED: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionStatus.NULL; + } + } + +// public org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); +// copyElement(src, tgt); +// tgt.setCode(convertCodeableConcept(src.getCode())); +// for (org.hl7.fhir.instance.model.Reference t : src.getItem()) +// tgt.addItem(convertReference(t)); +// return tgt; +// } +// +// public org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent(); +// copyElement(src, tgt); +// tgt.setCode(convertCodeableConcept(src.getCode())); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getItem()) +// tgt.addItem(convertReference(t)); +// return tgt; +// } + + public org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent(); + copyElement(src, tgt); + tgt.setItem(convertCodeableConcept(src.getItem())); +// tgt.setCause(src.getCause()); + return tgt; + } + + public org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.dstu3.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent(); + copyElement(src, tgt); + if (src.hasItemCodeableConcept()) + try { + tgt.setItem(convertCodeableConcept(src.getItemCodeableConcept())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + } +// tgt.setCause(src.getCause()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Communication convertCommunication(org.hl7.fhir.instance.model.Communication src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Communication tgt = new org.hl7.fhir.dstu3.model.Communication(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.addCategory(convertCodeableConcept(src.getCategory())); + tgt.setSender(convertReference(src.getSender())); + for (org.hl7.fhir.instance.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + for (org.hl7.fhir.instance.model.Communication.CommunicationPayloadComponent t : src.getPayload()) + tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getMedium()) + tgt.addMedium(convertCodeableConcept(t)); + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + tgt.setContext(convertReference(src.getEncounter())); + tgt.setSent(src.getSent()); + tgt.setReceived(src.getReceived()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason()) + tgt.addReasonCode(convertCodeableConcept(t)); + tgt.setSubject(convertReference(src.getSubject())); + return tgt; + } + + public org.hl7.fhir.instance.model.Communication convertCommunication(org.hl7.fhir.dstu3.model.Communication src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Communication tgt = new org.hl7.fhir.instance.model.Communication(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setSender(convertReference(src.getSender())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent t : src.getPayload()) + tgt.addPayload(convertCommunicationPayloadComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getMedium()) + tgt.addMedium(convertCodeableConcept(t)); + tgt.setStatus(convertCommunicationStatus(src.getStatus())); + tgt.setEncounter(convertReference(src.getContext())); + tgt.setSent(src.getSent()); + tgt.setReceived(src.getReceived()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) + tgt.addReason(convertCodeableConcept(t)); + tgt.setSubject(convertReference(src.getSubject())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.instance.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.COMPLETED; + case SUSPENDED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.SUSPENDED; + case REJECTED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ENTEREDINERROR; + case FAILED: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.ABORTED; + default: return org.hl7.fhir.dstu3.model.Communication.CommunicationStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.dstu3.model.Communication.CommunicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.COMPLETED; + case SUSPENDED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.SUSPENDED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.REJECTED; + case ABORTED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.FAILED; + default: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.instance.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.instance.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.dstu3.model.Communication.CommunicationPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Communication.CommunicationPayloadComponent tgt = new org.hl7.fhir.instance.model.Communication.CommunicationPayloadComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.instance.model.CommunicationRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CommunicationRequest tgt = new org.hl7.fhir.dstu3.model.CommunicationRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.addCategory(convertCodeableConcept(src.getCategory())); + tgt.setSender(convertReference(src.getSender())); + for (org.hl7.fhir.instance.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + for (org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) + tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getMedium()) + tgt.addMedium(convertCodeableConcept(t)); + tgt.getRequester().setAgent(convertReference(src.getRequester())); + tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); + tgt.setContext(convertReference(src.getEncounter())); + tgt.setOccurrence(convertType(src.getScheduled())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason()) + tgt.addReasonCode(convertCodeableConcept(t)); + tgt.setAuthoredOn(src.getRequestedOn()); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setPriority(convertPriorityCode(src.getPriority())); + return tgt; + } + + private org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority convertPriorityCode(org.hl7.fhir.instance.model.CodeableConcept priority) { + for (org.hl7.fhir.instance.model.Coding c : priority.getCoding()) { + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.ROUTINE; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.URGENT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.STAT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority.ASAP; + } + return null; + } + + public org.hl7.fhir.instance.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.dstu3.model.CommunicationRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.CommunicationRequest tgt = new org.hl7.fhir.instance.model.CommunicationRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCategory(convertCodeableConcept(src.getCategoryFirstRep())); + tgt.setSender(convertReference(src.getSender())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + for (org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent t : src.getPayload()) + tgt.addPayload(convertCommunicationRequestPayloadComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getMedium()) + tgt.addMedium(convertCodeableConcept(t)); + tgt.setRequester(convertReference(src.getRequester().getAgent())); + tgt.setStatus(convertCommunicationRequestStatus(src.getStatus())); + tgt.setEncounter(convertReference(src.getContext())); + tgt.setScheduled(convertType(src.getOccurrence())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) + tgt.addReason(convertCodeableConcept(t)); + tgt.setRequestedOn(src.getAuthoredOn()); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setPriority(convertPriorityCode(src.getPriority())); + return tgt; + } + + private org.hl7.fhir.instance.model.CodeableConcept convertPriorityCode(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationPriority priority) { + org.hl7.fhir.instance.model.CodeableConcept cc = new org.hl7.fhir.instance.model.CodeableConcept(); + switch (priority) { + case ROUTINE: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); break; + case URGENT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); break; + case STAT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); break; + case ASAP: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); break; + default: return null; + } + return cc; + } + + public org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.DRAFT; + case PLANNED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case REQUESTED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case RECEIVED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case ACCEPTED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case INPROGRESS: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; + case SUSPENDED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED; + case REJECTED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.ENTEREDINERROR; +// case FAILED: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.FAILED; + default: return org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.PROPOSED; +// case PLANNED: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.PLANNED; +// case REQUESTED: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.REQUESTED; +// case RECEIVED: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.RECEIVED; +// case ACCEPTED: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.ACCEPTED; + case ACTIVE: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.COMPLETED; + case SUSPENDED: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.SUSPENDED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.REJECTED; +// case FAILED: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.FAILED; + default: return org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.dstu3.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Composition convertComposition(org.hl7.fhir.instance.model.Composition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Composition tgt = new org.hl7.fhir.dstu3.model.Composition(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setClass_(convertCodeableConcept(src.getClass_())); + tgt.setTitle(src.getTitle()); + tgt.setStatus(convertCompositionStatus(src.getStatus())); + try { + tgt.setConfidentiality(org.hl7.fhir.dstu3.model.Composition.DocumentConfidentiality.fromCode(src.getConfidentiality())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.instance.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + for (org.hl7.fhir.instance.model.Composition.CompositionAttesterComponent t : src.getAttester()) + tgt.addAttester(convertCompositionAttesterComponent(t)); + tgt.setCustodian(convertReference(src.getCustodian())); + for (org.hl7.fhir.instance.model.Composition.CompositionEventComponent t : src.getEvent()) + tgt.addEvent(convertCompositionEventComponent(t)); + tgt.setEncounter(convertReference(src.getEncounter())); + for (org.hl7.fhir.instance.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Composition convertComposition(org.hl7.fhir.dstu3.model.Composition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Composition tgt = new org.hl7.fhir.instance.model.Composition(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setClass_(convertCodeableConcept(src.getClass_())); + tgt.setTitle(src.getTitle()); + tgt.setStatus(convertCompositionStatus(src.getStatus())); + tgt.setConfidentiality(src.getConfidentiality().toCode()); + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent t : src.getAttester()) + tgt.addAttester(convertCompositionAttesterComponent(t)); + tgt.setCustodian(convertReference(src.getCustodian())); + for (org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent t : src.getEvent()) + tgt.addEvent(convertCompositionEventComponent(t)); + tgt.setEncounter(convertReference(src.getEncounter())); + for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.instance.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRELIMINARY: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.FINAL; + case AMENDED: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.Composition.CompositionStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.dstu3.model.Composition.CompositionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRELIMINARY: return org.hl7.fhir.instance.model.Composition.CompositionStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.instance.model.Composition.CompositionStatus.FINAL; + case AMENDED: return org.hl7.fhir.instance.model.Composition.CompositionStatus.AMENDED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.Composition.CompositionStatus.ENTEREDINERROR; + default: return org.hl7.fhir.instance.model.Composition.CompositionStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.instance.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.Enumeration t : src.getMode()) + tgt.addMode(convertCompositionAttestationMode(t.getValue())); + tgt.setTime(src.getTime()); + tgt.setParty(convertReference(src.getParty())); + return tgt; + } + + public org.hl7.fhir.instance.model.Composition.CompositionAttesterComponent convertCompositionAttesterComponent(org.hl7.fhir.dstu3.model.Composition.CompositionAttesterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Composition.CompositionAttesterComponent tgt = new org.hl7.fhir.instance.model.Composition.CompositionAttesterComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getMode()) + tgt.addMode(convertCompositionAttestationMode(t.getValue())); + tgt.setTime(src.getTime()); + tgt.setParty(convertReference(src.getParty())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.instance.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSONAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.OFFICIAL; + default: return org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode.NULL; + } + } + + public org.hl7.fhir.instance.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.dstu3.model.Composition.CompositionAttestationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSONAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.PERSONAL; + case PROFESSIONAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.PROFESSIONAL; + case LEGAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.LEGAL; + case OFFICIAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.OFFICIAL; + default: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.instance.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.instance.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.dstu3.model.Composition.CompositionEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Composition.CompositionEventComponent tgt = new org.hl7.fhir.instance.model.Composition.CompositionEventComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCode()) + tgt.addCode(convertCodeableConcept(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.instance.model.Composition.SectionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Composition.SectionComponent tgt = new org.hl7.fhir.dstu3.model.Composition.SectionComponent(); + copyElement(src, tgt); + tgt.setTitle(src.getTitle()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setText(convertNarrative(src.getText())); + try { + tgt.setMode(org.hl7.fhir.dstu3.model.Composition.SectionMode.fromCode(src.getMode())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.instance.model.Reference t : src.getEntry()) + tgt.addEntry(convertReference(t)); + tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.instance.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.dstu3.model.Composition.SectionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Composition.SectionComponent tgt = new org.hl7.fhir.instance.model.Composition.SectionComponent(); + copyElement(src, tgt); + tgt.setTitle(src.getTitle()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setText(convertNarrative(src.getText())); + tgt.setMode(src.getMode().toCode()); + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEntry()) + tgt.addEntry(convertReference(t)); + tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason())); + for (org.hl7.fhir.dstu3.model.Composition.SectionComponent t : src.getSection()) + tgt.addSection(convertSectionComponent(t)); + return tgt; + } + + private class SourceElementComponentWrapper { + public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { + super(); + this.source = source; + this.target = target; + this.comp = comp; + } + private String source; + private String target; + private org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent comp; + + } + + public org.hl7.fhir.dstu3.model.ConceptMap convertConceptMap(org.hl7.fhir.instance.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ConceptMap tgt = new org.hl7.fhir.dstu3.model.ConceptMap(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) + tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setSource(convertType(src.getSource())); + tgt.setTarget(convertType(src.getTarget())); + for (org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent t : src.getElement()) { + List ws = convertSourceElementComponent(t); + for (SourceElementComponentWrapper w : ws) + getGroup(tgt, w.source, w.target).addElement(w.comp); + } + return tgt; + } + + public org.hl7.fhir.dstu3.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.instance.model.CodeableConcept t) throws FHIRException { + org.hl7.fhir.dstu3.model.UsageContext result = new org.hl7.fhir.dstu3.model.UsageContext(); + // todo: set type.. + result.setValue(convertCodeableConcept(t)); + return result; + } + + + private ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { + for (ConceptMapGroupComponent grp : map.getGroup()) { + if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) + return grp; + } + ConceptMapGroupComponent grp = map.addGroup(); + grp.setSource(srcs); + grp.setTarget(tgts); + return grp; + } + + + public org.hl7.fhir.instance.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu3.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ConceptMap tgt = new org.hl7.fhir.instance.model.ConceptMap(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setSource(convertType(src.getSource())); + tgt.setTarget(convertType(src.getTarget())); + for (org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) + for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : g.getElement()) + tgt.addElement(convertSourceElementComponent(t, g)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; + default: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.RETIRED; + default: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.instance.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.ConceptMapContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public List convertSourceElementComponent(org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent src) throws FHIRException { + List res = new ArrayList(); + if (src == null || src.isEmpty()) + return res; + for (org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent t : src.getTarget()) { + org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.addTarget(convertTargetElementComponent(t)); + res.add(new SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem())); + } + return res; + } + + public org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent(); + copyElement(src, tgt); + tgt.setCodeSystem(g.getSource()); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent t : src.getTarget()) + tgt.addTarget(convertTargetElementComponent(t, g)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + tgt.setComment(src.getComments()); + for (org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) + tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent t : src.getProduct()) + tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent(); + copyElement(src, tgt); + tgt.setCodeSystem(g.getTarget()); + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + tgt.setComments(src.getComment()); + for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) + tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getProduct()) + tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUIVALENT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUIVALENT: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: return org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent(); + copyElement(src, tgt); + tgt.setProperty(src.getElement()); + tgt.setSystem(src.getCodeSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent(); + copyElement(src, tgt); + tgt.setElement(src.getProperty()); + tgt.setCodeSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Condition convertCondition(org.hl7.fhir.instance.model.Condition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Condition tgt = new org.hl7.fhir.dstu3.model.Condition(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getPatient())); + tgt.setContext(convertReference(src.getEncounter())); + tgt.setAsserter(convertReference(src.getAsserter())); + if (src.hasDateRecorded()) + tgt.setAssertedDate(src.getDateRecorded()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.addCategory(convertCodeableConcept(src.getCategory())); + try { + tgt.setClinicalStatus(org.hl7.fhir.dstu3.model.Condition.ConditionClinicalStatus.fromCode(src.getClinicalStatus())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + tgt.setSeverity(convertCodeableConcept(src.getSeverity())); + tgt.setOnset(convertType(src.getOnset())); + tgt.setAbatement(convertType(src.getAbatement())); + tgt.setStage(convertConditionStageComponent(src.getStage())); + for (org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) + tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); +// tgt.setNotes(src.getNotes()); + return tgt; + } + + public org.hl7.fhir.instance.model.Condition convertCondition(org.hl7.fhir.dstu3.model.Condition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Condition tgt = new org.hl7.fhir.instance.model.Condition(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setPatient(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getContext())); + tgt.setAsserter(convertReference(src.getAsserter())); + if (src.hasAssertedDate()) + tgt.setDateRecorded(src.getAssertedDate()); + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) + tgt.setCategory(convertCodeableConcept(t)); + tgt.setClinicalStatus(src.getClinicalStatus().toCode()); + tgt.setVerificationStatus(convertConditionVerificationStatus(src.getVerificationStatus())); + tgt.setSeverity(convertCodeableConcept(src.getSeverity())); + tgt.setOnset(convertType(src.getOnset())); + tgt.setAbatement(convertType(src.getAbatement())); + tgt.setStage(convertConditionStageComponent(src.getStage())); + for (org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent t : src.getEvidence()) + tgt.addEvidence(convertConditionEvidenceComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); +// tgt.setNotes(src.getNotes()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROVISIONAL: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.PROVISIONAL; + case DIFFERENTIAL: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; + case CONFIRMED: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.CONFIRMED; + case REFUTED: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.REFUTED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.UNKNOWN; + default: return org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.dstu3.model.Condition.ConditionVerificationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROVISIONAL: return org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus.PROVISIONAL; + case DIFFERENTIAL: return org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus.DIFFERENTIAL; + case CONFIRMED: return org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus.CONFIRMED; + case REFUTED: return org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus.REFUTED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus.UNKNOWN; + default: return org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.instance.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent(); + copyElement(src, tgt); + tgt.setSummary(convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.instance.model.Reference t : src.getAssessment()) + tgt.addAssessment(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.dstu3.model.Condition.ConditionStageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.instance.model.Condition.ConditionStageComponent(); + copyElement(src, tgt); + tgt.setSummary(convertCodeableConcept(src.getSummary())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAssessment()) + tgt.addAssessment(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent(); + copyElement(src, tgt); + tgt.addCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.instance.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.dstu3.model.Condition.ConditionEvidenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept cc : src.getCode()) + tgt.setCode(convertCodeableConcept(cc)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDetail()) + tgt.addDetail(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement convertConformance(org.hl7.fhir.instance.model.Conformance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.Conformance.ConformanceContactComponent t : src.getContact()) + tgt.addContact(convertConformanceContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + tgt.setFhirVersion(src.getFhirVersion()); + tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + for (org.hl7.fhir.instance.model.CodeType t : src.getFormat()) + tgt.addFormat(t.getValue()); + for (org.hl7.fhir.instance.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent t : src.getRest()) + tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.instance.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) + tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) + tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance convertConformance(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance tgt = new org.hl7.fhir.instance.model.Conformance(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertConformanceContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + if (src.hasImplementation()) + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + tgt.setFhirVersion(src.getFhirVersion()); + tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getFormat()) + tgt.addFormat(t.getValue()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) + tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) + tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) + tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.NULL; + } + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.instance.model.Conformance.UnknownContentCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NO: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NO; + case EXTENSIONS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; + case ELEMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.ELEMENTS; + case BOTH: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.BOTH; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NO: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.NO; + case EXTENSIONS: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.EXTENSIONS; + case ELEMENTS: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.ELEMENTS; + case BOTH: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.BOTH; + default: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.instance.model.Conformance.ConformanceContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setVersion(src.getVersion()); + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setVersion(src.getVersion()); + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.instance.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceImplementationComponent(); + copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent(); + copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) + tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertSystemInteractionComponent(t)); + if (src.getTransactionMode() == org.hl7.fhir.instance.model.Conformance.TransactionMode.BATCH || src.getTransactionMode() == org.hl7.fhir.instance.model.Conformance.TransactionMode.BOTH) + tgt.addInteraction().setCode(SystemRestfulInteraction.BATCH); + for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) + tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.instance.model.UriType t : src.getCompartment()) + tgt.addCompartment(t.getValue()); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent(); + copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) + tgt.addResource(convertConformanceRestResourceComponent(t)); + boolean batch = false; + boolean transaction = false; + for (org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) { + if (t.getCode().equals(SystemRestfulInteraction.BATCH)) + batch = true; + else + tgt.addInteraction(convertSystemInteractionComponent(t)); + if (t.getCode().equals(SystemRestfulInteraction.TRANSACTION)) + transaction = true; + } + if (batch) + tgt.setTransactionMode(transaction ? org.hl7.fhir.instance.model.Conformance.TransactionMode.BOTH : org.hl7.fhir.instance.model.Conformance.TransactionMode.BATCH); + else + tgt.setTransactionMode(transaction ? org.hl7.fhir.instance.model.Conformance.TransactionMode.TRANSACTION : org.hl7.fhir.instance.model.Conformance.TransactionMode.NOTSUPPORTED); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation()) + tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getCompartment()) + tgt.addCompartment(t.getValue()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLIENT: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLIENT: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.CLIENT; + case SERVER: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.SERVER; + default: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.NULL; + } + } + + + public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + copyElement(src, tgt); + tgt.setCors(src.getCors()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getService()) + tgt.addService(convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent t : src.getCertificate()) + tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent(); + copyElement(src, tgt); + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getService()) + tgt.addService(convertCodeableConcept(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent t : src.getCertificate()) + tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setBlob(src.getBlob()); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setBlob(src.getBlob()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(convertReference(src.getProfile())); + for (org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + tgt.setReadHistory(src.getReadHistory()); + tgt.setUpdateCreate(src.getUpdateCreate()); + tgt.setConditionalCreate(src.getConditionalCreate()); + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.instance.model.StringType t : src.getSearchInclude()) + tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.instance.model.StringType t : src.getSearchRevInclude()) + tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(convertReference(src.getProfile())); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + tgt.setReadHistory(src.getReadHistory()); + tgt.setUpdateCreate(src.getUpdateCreate()); + tgt.setConditionalCreate(src.getConditionalCreate()); + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchInclude()) + tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchRevInclude()) + tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOVERSION: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOVERSION: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.NOVERSION; + case VERSIONED: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; + default: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.NULL; + } + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.MULTIPLE; + default: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case READ: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case DELETE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case READ: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.READ; + case VREAD: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.VREAD; + case UPDATE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.UPDATE; + case DELETE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; + default: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.NULL; + } + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(src.getDefinition()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(src.getDefinition()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRANSACTION: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRANSACTION: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; + default: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.NULL; + } + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(convertReference(src.getDefinition())); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(convertReference(src.getDefinition())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.instance.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) + tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + tgt.setReliableCache(src.getReliableCache()); + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) + tgt.addEvent(convertConformanceMessagingEventComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceMessagingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) + tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + tgt.setReliableCache(src.getReliableCache()); + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent t : src.getEvent()) + tgt.addEvent(convertConformanceMessagingEventComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + copyElement(src, tgt); + tgt.setProtocol(convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEndpointComponent(); + copyElement(src, tgt); + tgt.setProtocol(convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent(); + copyElement(src, tgt); + tgt.setCode(convertCoding(src.getCode())); + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + tgt.setMode(convertConformanceEventMode(src.getMode())); + tgt.setFocus(src.getFocus()); + tgt.setRequest(convertReference(src.getRequest())); + tgt.setResponse(convertReference(src.getResponse())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEventComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceMessagingEventComponent(); + copyElement(src, tgt); + tgt.setCode(convertCoding(src.getCode())); + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + tgt.setMode(convertConformanceEventMode(src.getMode())); + tgt.setFocus(src.getFocus()); + tgt.setRequest(convertReference(src.getRequest())); + tgt.setResponse(convertReference(src.getResponse())); + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONSEQUENCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NOTIFICATION; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONSEQUENCE: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.NOTIFICATION; + default: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.NULL; + } + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.instance.model.Conformance.ConformanceEventMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SENDER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SENDER: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.SENDER; + case RECEIVER: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.RECEIVER; + default: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.NULL; + } + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfile(convertReference(src.getProfile())); + return tgt; + } + + public org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent(); + copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfile(convertReference(src.getProfile())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.instance.model.Conformance.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRODUCER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.CONSUMER; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.NULL; + } + } + + public org.hl7.fhir.instance.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRODUCER: return org.hl7.fhir.instance.model.Conformance.DocumentMode.PRODUCER; + case CONSUMER: return org.hl7.fhir.instance.model.Conformance.DocumentMode.CONSUMER; + default: return org.hl7.fhir.instance.model.Conformance.DocumentMode.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Contract convertContract(org.hl7.fhir.instance.model.Contract src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract tgt = new org.hl7.fhir.dstu3.model.Contract(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setIssued(src.getIssued()); + tgt.setApplies(convertPeriod(src.getApplies())); + for (org.hl7.fhir.instance.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getAuthority()) + tgt.addAuthority(convertReference(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getDomain()) + tgt.addDomain(convertReference(t)); + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getSubType()) + tgt.addSubType(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getAction()) + tgt.addAction(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getActionReason()) + tgt.addActionReason(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.Contract.ActorComponent t : src.getActor()) + tgt.addAgent(convertAgentComponent(t)); + for (org.hl7.fhir.instance.model.Contract.SignatoryComponent t : src.getSigner()) + tgt.addSigner(convertSignatoryComponent(t)); + for (org.hl7.fhir.instance.model.Contract.ValuedItemComponent t : src.getValuedItem()) + tgt.addValuedItem(convertValuedItemComponent(t)); + for (org.hl7.fhir.instance.model.Contract.TermComponent t : src.getTerm()) + tgt.addTerm(convertTermComponent(t)); + tgt.setBinding(convertType(src.getBinding())); + for (org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) + tgt.addFriendly(convertFriendlyLanguageComponent(t)); + for (org.hl7.fhir.instance.model.Contract.LegalLanguageComponent t : src.getLegal()) + tgt.addLegal(convertLegalLanguageComponent(t)); + for (org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent t : src.getRule()) + tgt.addRule(convertComputableLanguageComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract convertContract(org.hl7.fhir.dstu3.model.Contract src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract tgt = new org.hl7.fhir.instance.model.Contract(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setIssued(src.getIssued()); + tgt.setApplies(convertPeriod(src.getApplies())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSubject()) + tgt.addSubject(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthority()) + tgt.addAuthority(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDomain()) + tgt.addDomain(convertReference(t)); + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSubType()) + tgt.addSubType(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) + tgt.addAction(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getActionReason()) + tgt.addActionReason(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Contract.AgentComponent t : src.getAgent()) + tgt.addActor(convertAgentComponent(t)); + for (org.hl7.fhir.dstu3.model.Contract.SignatoryComponent t : src.getSigner()) + tgt.addSigner(convertSignatoryComponent(t)); + for (org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent t : src.getValuedItem()) + tgt.addValuedItem(convertValuedItemComponent(t)); + for (org.hl7.fhir.dstu3.model.Contract.TermComponent t : src.getTerm()) + tgt.addTerm(convertTermComponent(t)); + tgt.setBinding(convertType(src.getBinding())); + for (org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent t : src.getFriendly()) + tgt.addFriendly(convertFriendlyLanguageComponent(t)); + for (org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent t : src.getLegal()) + tgt.addLegal(convertLegalLanguageComponent(t)); + for (org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent t : src.getRule()) + tgt.addRule(convertComputableLanguageComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.instance.model.Contract.ActorComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.AgentComponent tgt = new org.hl7.fhir.dstu3.model.Contract.AgentComponent(); + copyElement(src, tgt); + tgt.setActor(convertReference(src.getEntity())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.ActorComponent convertAgentComponent(org.hl7.fhir.dstu3.model.Contract.AgentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.ActorComponent tgt = new org.hl7.fhir.instance.model.Contract.ActorComponent(); + copyElement(src, tgt); + tgt.setEntity(convertReference(src.getActor())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.instance.model.Contract.SignatoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.dstu3.model.Contract.SignatoryComponent(); + copyElement(src, tgt); + tgt.setType(convertCoding(src.getType())); + tgt.setParty(convertReference(src.getParty())); + if (src.hasSignature()) + tgt.addSignature(new org.hl7.fhir.dstu3.model.Signature().setBlob(src.getSignature().getBytes())); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.dstu3.model.Contract.SignatoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.instance.model.Contract.SignatoryComponent(); + copyElement(src, tgt); + tgt.setType(convertCoding(src.getType())); + tgt.setParty(convertReference(src.getParty())); + for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) + tgt.setSignature(Base64.encodeBase64String(t.getBlob())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.instance.model.Contract.ValuedItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent(); + copyElement(src, tgt); + tgt.setEntity(convertType(src.getEntity())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setEffectiveTime(src.getEffectiveTime()); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + tgt.setFactor(src.getFactor()); + tgt.setPoints(src.getPoints()); + tgt.setNet(convertMoney(src.getNet())); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.dstu3.model.Contract.ValuedItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.instance.model.Contract.ValuedItemComponent(); + copyElement(src, tgt); + tgt.setEntity(convertType(src.getEntity())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setEffectiveTime(src.getEffectiveTime()); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + tgt.setFactor(src.getFactor()); + tgt.setPoints(src.getPoints()); + tgt.setNet(convertMoney(src.getNet())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.instance.model.Contract.TermComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.TermComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setIssued(src.getIssued()); + tgt.setApplies(convertPeriod(src.getApplies())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setSubType(convertCodeableConcept(src.getSubType())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getAction()) + tgt.addAction(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getActionReason()) + tgt.addActionReason(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.Contract.TermActorComponent t : src.getActor()) + tgt.addAgent(convertTermAgentComponent(t)); + tgt.setText(src.getText()); + for (org.hl7.fhir.instance.model.Contract.TermValuedItemComponent t : src.getValuedItem()) + tgt.addValuedItem(convertTermValuedItemComponent(t)); + for (org.hl7.fhir.instance.model.Contract.TermComponent t : src.getGroup()) + tgt.addGroup(convertTermComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.dstu3.model.Contract.TermComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.TermComponent tgt = new org.hl7.fhir.instance.model.Contract.TermComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setIssued(src.getIssued()); + tgt.setApplies(convertPeriod(src.getApplies())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setSubType(convertCodeableConcept(src.getSubType())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction()) + tgt.addAction(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getActionReason()) + tgt.addActionReason(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Contract.TermAgentComponent t : src.getAgent()) + tgt.addActor(convertTermAgentComponent(t)); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent t : src.getValuedItem()) + tgt.addValuedItem(convertTermValuedItemComponent(t)); + for (org.hl7.fhir.dstu3.model.Contract.TermComponent t : src.getGroup()) + tgt.addGroup(convertTermComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Contract.TermAgentComponent convertTermAgentComponent(org.hl7.fhir.instance.model.Contract.TermActorComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.TermAgentComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermAgentComponent(); + copyElement(src, tgt); + tgt.setActor(convertReference(src.getEntity())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.TermActorComponent convertTermAgentComponent(org.hl7.fhir.dstu3.model.Contract.TermAgentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.TermActorComponent tgt = new org.hl7.fhir.instance.model.Contract.TermActorComponent(); + copyElement(src, tgt); + tgt.setEntity(convertReference(src.getActor())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRole()) + tgt.addRole(convertCodeableConcept(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.instance.model.Contract.TermValuedItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent(); + copyElement(src, tgt); + tgt.setEntity(convertType(src.getEntity())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setEffectiveTime(src.getEffectiveTime()); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + tgt.setFactor(src.getFactor()); + tgt.setPoints(src.getPoints()); + tgt.setNet(convertMoney(src.getNet())); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.dstu3.model.Contract.TermValuedItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.instance.model.Contract.TermValuedItemComponent(); + copyElement(src, tgt); + tgt.setEntity(convertType(src.getEntity())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setEffectiveTime(src.getEffectiveTime()); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setUnitPrice(convertMoney(src.getUnitPrice())); + tgt.setFactor(src.getFactor()); + tgt.setPoints(src.getPoints()); + tgt.setNet(convertMoney(src.getNet())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.dstu3.model.Contract.FriendlyLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.instance.model.Contract.LegalLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.dstu3.model.Contract.LegalLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.LegalLanguageComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + public org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.dstu3.model.Contract.ComputableLanguageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent(); + copyElement(src, tgt); + tgt.setContent(convertType(src.getContent())); + return tgt; + } + + + public org.hl7.fhir.dstu3.model.DataElement convertDataElement(org.hl7.fhir.instance.model.DataElement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DataElement tgt = new org.hl7.fhir.dstu3.model.DataElement(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.DataElement.DataElementContactComponent t : src.getContact()) + tgt.addContact(convertDataElementContactComponent(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setCopyright(src.getCopyright()); + tgt.setStringency(convertDataElementStringency(src.getStringency())); + for (org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent t : src.getMapping()) + tgt.addMapping(convertDataElementMappingComponent(t)); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.addElement(convertElementDefinition(t, slicePaths)); + } + return tgt; + } + + public org.hl7.fhir.instance.model.DataElement convertDataElement(org.hl7.fhir.dstu3.model.DataElement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DataElement tgt = new org.hl7.fhir.instance.model.DataElement(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertDataElementContactComponent(t)); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setCopyright(src.getCopyright()); + tgt.setStringency(convertDataElementStringency(src.getStringency())); + for (org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent t : src.getMapping()) + tgt.addMapping(convertDataElementMappingComponent(t)); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.instance.model.DataElement.DataElementStringency src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPARABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.COMPARABLE; + case FULLYSPECIFIED: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FULLYSPECIFIED; + case EQUIVALENT: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.EQUIVALENT; + case CONVERTABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.CONVERTABLE; + case SCALEABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.SCALEABLE; + case FLEXIBLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FLEXIBLE; + default: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.NULL; + } + } + + public org.hl7.fhir.instance.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPARABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.COMPARABLE; + case FULLYSPECIFIED: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.FULLYSPECIFIED; + case EQUIVALENT: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.EQUIVALENT; + case CONVERTABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.CONVERTABLE; + case SCALEABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.SCALEABLE; + case FLEXIBLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.FLEXIBLE; + default: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.instance.model.DataElement.DataElementContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.instance.model.DataElement.DataElementContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComment(src.getComments()); + return tgt; + } + + public org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComments(src.getComment()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.instance.model.DetectedIssue src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DetectedIssue tgt = new org.hl7.fhir.dstu3.model.DetectedIssue(); + copyDomainResource(src, tgt); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setCategory(convertCodeableConcept(src.getCategory())); + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + for (org.hl7.fhir.instance.model.Reference t : src.getImplicated()) + tgt.addImplicated(convertReference(t)); + tgt.setDetail(src.getDetail()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setReference(src.getReference()); + for (org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) + tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.dstu3.model.DetectedIssue src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DetectedIssue tgt = new org.hl7.fhir.instance.model.DetectedIssue(); + copyDomainResource(src, tgt); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setCategory(convertCodeableConcept(src.getCategory())); + tgt.setSeverity(convertDetectedIssueSeverity(src.getSeverity())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getImplicated()) + tgt.addImplicated(convertReference(t)); + tgt.setDetail(src.getDetail()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setReference(src.getReference()); + for (org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent t : src.getMitigation()) + tgt.addMitigation(convertDetectedIssueMitigationComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HIGH: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: return org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } + + public org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HIGH: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.HIGH; + case MODERATE: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.MODERATE; + case LOW: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.LOW; + default: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.NULL; + } + } + + public org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent(); + copyElement(src, tgt); + tgt.setAction(convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + public org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.dstu3.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueMitigationComponent tgt = new org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueMitigationComponent(); + copyElement(src, tgt); + tgt.setAction(convertCodeableConcept(src.getAction())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setAuthor(convertReference(src.getAuthor())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Device convertDevice(org.hl7.fhir.instance.model.Device src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Device tgt = new org.hl7.fhir.dstu3.model.Device(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setUdi((new org.hl7.fhir.dstu3.model.Device.DeviceUdiComponent()).setDeviceIdentifier(src.getUdi())); + tgt.setStatus(convertDeviceStatus(src.getStatus())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setLotNumber(src.getLotNumber()); + tgt.setManufacturer(src.getManufacturer()); + tgt.setManufactureDate(src.getManufactureDate()); + tgt.setExpirationDate(src.getExpiry()); + tgt.setModel(src.getModel()); + tgt.setVersion(src.getVersion()); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setOwner(convertReference(src.getOwner())); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + tgt.setLocation(convertReference(src.getLocation())); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.instance.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Device convertDevice(org.hl7.fhir.dstu3.model.Device src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Device tgt = new org.hl7.fhir.instance.model.Device(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasUdi()) + tgt.setUdi(src.getUdi().getDeviceIdentifier()); + tgt.setStatus(convertDeviceStatus(src.getStatus())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setLotNumber(src.getLotNumber()); + tgt.setManufacturer(src.getManufacturer()); + tgt.setManufactureDate(src.getManufactureDate()); + tgt.setExpiry(src.getExpirationDate()); + tgt.setModel(src.getModel()); + tgt.setVersion(src.getVersion()); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setOwner(convertReference(src.getOwner())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + tgt.setLocation(convertReference(src.getLocation())); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus convertDeviceStatus(org.hl7.fhir.instance.model.Device.DeviceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case AVAILABLE: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ACTIVE; + case NOTAVAILABLE: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Device.DeviceStatus convertDeviceStatus(org.hl7.fhir.dstu3.model.Device.FHIRDeviceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.instance.model.Device.DeviceStatus.AVAILABLE; + case INACTIVE: return org.hl7.fhir.instance.model.Device.DeviceStatus.NOTAVAILABLE; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.Device.DeviceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.instance.model.Device.DeviceStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.instance.model.DeviceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DeviceComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent(); + copyDomainResource(src, tgt); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setLastSystemChange(src.getLastSystemChange()); + tgt.setSource(convertReference(src.getSource())); + tgt.setParent(convertReference(src.getParent())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getOperationalStatus()) + tgt.addOperationalStatus(convertCodeableConcept(t)); + tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); + tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); + for (org.hl7.fhir.instance.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) + tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); + tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); + return tgt; + } + + public org.hl7.fhir.instance.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.dstu3.model.DeviceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DeviceComponent tgt = new org.hl7.fhir.instance.model.DeviceComponent(); + copyDomainResource(src, tgt); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setLastSystemChange(src.getLastSystemChange()); + tgt.setSource(convertReference(src.getSource())); + tgt.setParent(convertReference(src.getParent())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getOperationalStatus()) + tgt.addOperationalStatus(convertCodeableConcept(t)); + tgt.setParameterGroup(convertCodeableConcept(src.getParameterGroup())); + tgt.setMeasurementPrinciple(convertMeasmntPrinciple(src.getMeasurementPrinciple())); + for (org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent t : src.getProductionSpecification()) + tgt.addProductionSpecification(convertDeviceComponentProductionSpecificationComponent(t)); + tgt.setLanguageCode(convertCodeableConcept(src.getLanguageCode())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OTHER: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OTHER; + case CHEMICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; + case ELECTRICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; + case IMPEDANCE: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; + case NUCLEAR: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; + case OPTICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.OPTICAL; + case THERMAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.THERMAL; + case BIOLOGICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; + case MECHANICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; + case ACOUSTICAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; + case MANUAL: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.MANUAL; + default: return org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple.NULL; + } + } + + public org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.dstu3.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OTHER: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.OTHER; + case CHEMICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.CHEMICAL; + case ELECTRICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL; + case IMPEDANCE: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE; + case NUCLEAR: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.NUCLEAR; + case OPTICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.OPTICAL; + case THERMAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.THERMAL; + case BIOLOGICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL; + case MECHANICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.MECHANICAL; + case ACOUSTICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL; + case MANUAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.MANUAL; + default: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.NULL; + } + } + + public org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.instance.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); + copyElement(src, tgt); + tgt.setSpecType(convertCodeableConcept(src.getSpecType())); + tgt.setComponentId(convertIdentifier(src.getComponentId())); + tgt.setProductionSpec(src.getProductionSpec()); + return tgt; + } + + public org.hl7.fhir.instance.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.dstu3.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DeviceComponent.DeviceComponentProductionSpecificationComponent tgt = new org.hl7.fhir.instance.model.DeviceComponent.DeviceComponentProductionSpecificationComponent(); + copyElement(src, tgt); + tgt.setSpecType(convertCodeableConcept(src.getSpecType())); + tgt.setComponentId(convertIdentifier(src.getComponentId())); + tgt.setProductionSpec(src.getProductionSpec()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.instance.model.DeviceMetric src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DeviceMetric tgt = new org.hl7.fhir.dstu3.model.DeviceMetric(); + copyDomainResource(src, tgt); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setUnit(convertCodeableConcept(src.getUnit())); + tgt.setSource(convertReference(src.getSource())); + tgt.setParent(convertReference(src.getParent())); + tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); + tgt.setColor(convertDeviceMetricColor(src.getColor())); + tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); + tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); + for (org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) + tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.DeviceMetric convertDeviceMetric(org.hl7.fhir.dstu3.model.DeviceMetric src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DeviceMetric tgt = new org.hl7.fhir.instance.model.DeviceMetric(); + copyDomainResource(src, tgt); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setUnit(convertCodeableConcept(src.getUnit())); + tgt.setSource(convertReference(src.getSource())); + tgt.setParent(convertReference(src.getParent())); + tgt.setOperationalStatus(convertDeviceMetricOperationalStatus(src.getOperationalStatus())); + tgt.setColor(convertDeviceMetricColor(src.getColor())); + tgt.setCategory(convertDeviceMetricCategory(src.getCategory())); + tgt.setMeasurementPeriod(convertTiming(src.getMeasurementPeriod())); + for (org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent t : src.getCalibration()) + tgt.addCalibration(convertDeviceMetricCalibrationComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ON: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + case OFF: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + case STANDBY: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ON: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.ON; + case OFF: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.OFF; + case STANDBY: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY; + default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BLACK: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLACK; + case RED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.RED; + case GREEN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.GREEN; + case YELLOW: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.YELLOW; + case BLUE: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.BLUE; + case MAGENTA: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.MAGENTA; + case CYAN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.CYAN; + case WHITE: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.WHITE; + default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor.NULL; + } + } + + public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor convertDeviceMetricColor(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricColor src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BLACK: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.BLACK; + case RED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.RED; + case GREEN: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.GREEN; + case YELLOW: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.YELLOW; + case BLUE: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.BLUE; + case MAGENTA: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.MAGENTA; + case CYAN: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.CYAN; + case WHITE: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.WHITE; + default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricColor.NULL; + } + } + + public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MEASUREMENT: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + case SETTING: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.SETTING; + case CALCULATION: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory.NULL; + } + } + + public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MEASUREMENT: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT; + case SETTING: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.SETTING; + case CALCULATION: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.CALCULATION; + case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED; + default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.NULL; + } + } + + public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent(); + copyElement(src, tgt); + tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + tgt.setTime(src.getTime()); + return tgt; + } + + public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent(); + copyElement(src, tgt); + tgt.setType(convertDeviceMetricCalibrationType(src.getType())); + tgt.setState(convertDeviceMetricCalibrationState(src.getState())); + tgt.setTime(src.getTime()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + case OFFSET: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + case GAIN: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + case TWOPOINT: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType.NULL; + } + } + + public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED; + case OFFSET: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET; + case GAIN: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.GAIN; + case TWOPOINT: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT; + default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTCALIBRATED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + case CALIBRATIONREQUIRED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + case CALIBRATED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + case UNSPECIFIED: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + default: return org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + } + } + + public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.dstu3.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTCALIBRATED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED; + case CALIBRATIONREQUIRED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED; + case CALIBRATED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED; + case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED; + default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.NULL; + } + } + + public org.hl7.fhir.dstu3.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.instance.model.DeviceUseStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DeviceUseStatement tgt = new org.hl7.fhir.dstu3.model.DeviceUseStatement(); + copyDomainResource(src, tgt); + if (src.hasBodySiteCodeableConcept()) + tgt.setBodySite(convertCodeableConcept(src.getBodySiteCodeableConcept())); + tgt.setWhenUsed(convertPeriod(src.getWhenUsed())); + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getIndication()) + tgt.addIndication(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.StringType t : src.getNotes()) + tgt.addNote().setText(t.getValue()); + tgt.setRecordedOn(src.getRecordedOn()); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setTiming(convertType(src.getTiming())); + return tgt; + } + + public org.hl7.fhir.instance.model.DeviceUseStatement convertDeviceUseStatement(org.hl7.fhir.dstu3.model.DeviceUseStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DeviceUseStatement tgt = new org.hl7.fhir.instance.model.DeviceUseStatement(); + copyDomainResource(src, tgt); + tgt.setBodySite(convertType(src.getBodySite())); + tgt.setWhenUsed(convertPeriod(src.getWhenUsed())); + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getIndication()) + tgt.addIndication(convertCodeableConcept(t)); + for (Annotation t : src.getNote()) + tgt.addNotes(t.getText()); + tgt.setRecordedOn(src.getRecordedOn()); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setTiming(convertType(src.getTiming())); + return tgt; + } + +// public org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus convertDiagnosticOrderStatus(org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus src) throws FHIRException { +// if (src ==/* null || src.isEmpty()*/) +// return null; +// switch (src) { +// case PROPOSED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.PROPOSED; +// case DRAFT: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.DRAFT; +// case PLANNED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.PLANNED; +// case REQUESTED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.REQUESTED; +// case RECEIVED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.RECEIVED; +// case ACCEPTED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.ACCEPTED; +// case INPROGRESS: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.INPROGRESS; +// case REVIEW: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.REVIEW; +// case COMPLETED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.COMPLETED; +// case CANCELLED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.CANCELLED; +// case SUSPENDED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.SUSPENDED; +// case REJECTED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.REJECTED; +// case FAILED: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.FAILED; +// default: return org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus.NULL; +// } +// } +// +// public org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus convertDiagnosticOrderStatus(org.hl7.fhir.dstu3.model.DiagnosticRequest.DiagnosticRequestStatus src) throws FHIRException { +// if (src ==/* null || src.isEmpty()*/) +// return null; +// switch (src) { +// case PROPOSED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.PROPOSED; +// case DRAFT: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.DRAFT; +// case PLANNED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.PLANNED; +// case REQUESTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REQUESTED; +// case RECEIVED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.RECEIVED; +// case ACCEPTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.ACCEPTED; +// case INPROGRESS: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.INPROGRESS; +// case REVIEW: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REVIEW; +// case COMPLETED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.COMPLETED; +// case CANCELLED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.CANCELLED; +// case SUSPENDED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.SUSPENDED; +// case REJECTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REJECTED; +// case FAILED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.FAILED; +// default: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.NULL; +// } +// } + + + public org.hl7.fhir.dstu3.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.instance.model.DiagnosticReport src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DiagnosticReport tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + tgt.setCategory(convertCodeableConcept(src.getCategory())); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setContext(convertReference(src.getEncounter())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); +// tgt.setPerformer(convertReference(src.getPerformer())); +// for (org.hl7.fhir.instance.model.Reference t : src.getRequest()) +// tgt.addRequest(convertReference(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getSpecimen()) + tgt.addSpecimen(convertReference(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getResult()) + tgt.addResult(convertReference(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getImagingStudy()) + tgt.addImagingStudy(convertReference(t)); + for (org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) + tgt.addImage(convertDiagnosticReportImageComponent(t)); + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCodedDiagnosis()) + tgt.addCodedDiagnosis(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.Attachment t : src.getPresentedForm()) + tgt.addPresentedForm(convertAttachment(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.dstu3.model.DiagnosticReport src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DiagnosticReport tgt = new org.hl7.fhir.instance.model.DiagnosticReport(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertDiagnosticReportStatus(src.getStatus())); + tgt.setCategory(convertCodeableConcept(src.getCategory())); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getContext())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); +// tgt.setPerformer(convertReference(src.getPerformer())); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getRequest()) +// tgt.addRequest(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSpecimen()) + tgt.addSpecimen(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getResult()) + tgt.addResult(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getImagingStudy()) + tgt.addImagingStudy(convertReference(t)); + for (org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent t : src.getImage()) + tgt.addImage(convertDiagnosticReportImageComponent(t)); + tgt.setConclusion(src.getConclusion()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCodedDiagnosis()) + tgt.addCodedDiagnosis(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPresentedForm()) + tgt.addPresentedForm(convertAttachment(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case FINAL: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case CORRECTED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.REGISTERED; + case PARTIAL: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.PARTIAL; + case FINAL: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.FINAL; + case CORRECTED: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.CORRECTED; + case APPENDED: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.APPENDED; + case CANCELLED: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.ENTEREDINERROR; + default: return org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent(); + copyElement(src, tgt); + tgt.setComment(src.getComment()); + tgt.setLink(convertReference(src.getLink())); + return tgt; + } + + public org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.dstu3.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent(); + copyElement(src, tgt); + tgt.setComment(src.getComment()); + tgt.setLink(convertReference(src.getLink())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.instance.model.DocumentManifest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentManifest tgt = new org.hl7.fhir.dstu3.model.DocumentManifest(); + copyDomainResource(src, tgt); + tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.instance.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.instance.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + tgt.setCreated(src.getCreated()); + tgt.setSource(src.getSource()); + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) + tgt.addContent(convertDocumentManifestContentComponent(t)); + for (org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) + tgt.addRelated(convertDocumentManifestRelatedComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.dstu3.model.DocumentManifest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DocumentManifest tgt = new org.hl7.fhir.instance.model.DocumentManifest(); + copyDomainResource(src, tgt); + tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + tgt.setCreated(src.getCreated()); + tgt.setSource(src.getSource()); + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent t : src.getContent()) + tgt.addContent(convertDocumentManifestContentComponent(t)); + for (org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent t : src.getRelated()) + tgt.addRelated(convertDocumentManifestRelatedComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.CURRENT; + case SUPERSEDED: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.SUPERSEDED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR; + default: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent(); + copyElement(src, tgt); + tgt.setP(convertType(src.getP())); + return tgt; + } + + public org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestContentComponent convertDocumentManifestContentComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestContentComponent tgt = new org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestContentComponent(); + copyElement(src, tgt); + tgt.setP(convertType(src.getP())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + public org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.dstu3.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestRelatedComponent tgt = new org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestRelatedComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DocumentReference convertDocumentReference(org.hl7.fhir.instance.model.DocumentReference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentReference tgt = new org.hl7.fhir.dstu3.model.DocumentReference(); + copyDomainResource(src, tgt); + tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setClass_(convertCodeableConcept(src.getClass_())); + for (org.hl7.fhir.instance.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + tgt.setCustodian(convertReference(src.getCustodian())); + tgt.setAuthenticator(convertReference(src.getAuthenticator())); + tgt.setCreated(src.getCreated()); + tgt.setIndexed(src.getIndexed()); + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + tgt.setDocStatus(convertDocStatus(src.getDocStatus())); + for (org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) + tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) + tgt.addContent(convertDocumentReferenceContentComponent(t)); + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + private ReferredDocumentStatus convertDocStatus(CodeableConcept cc) { + if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "preliminary")) + return ReferredDocumentStatus.PRELIMINARY; + if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "final")) + return ReferredDocumentStatus.FINAL; + if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "amended")) + return ReferredDocumentStatus.AMENDED; + if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "entered-in-error")) + return ReferredDocumentStatus.ENTEREDINERROR; + + return null; + } + + private CodeableConcept convertDocStatus(ReferredDocumentStatus docStatus) { + CodeableConcept cc = new CodeableConcept (); + switch (docStatus) { + case AMENDED: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("amended"); break; + case ENTEREDINERROR: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("entered-in-error"); break; + case FINAL: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("final"); break; + case PRELIMINARY: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("preliminary"); break; + default: return null; + } + return cc; + } + + public org.hl7.fhir.instance.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu3.model.DocumentReference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DocumentReference tgt = new org.hl7.fhir.instance.model.DocumentReference(); + copyDomainResource(src, tgt); + tgt.setMasterIdentifier(convertIdentifier(src.getMasterIdentifier())); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setClass_(convertCodeableConcept(src.getClass_())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor()) + tgt.addAuthor(convertReference(t)); + tgt.setCustodian(convertReference(src.getCustodian())); + tgt.setAuthenticator(convertReference(src.getAuthenticator())); + tgt.setCreated(src.getCreated()); + tgt.setIndexed(src.getIndexed()); + tgt.setStatus(convertDocumentReferenceStatus(src.getStatus())); + tgt.setDocStatus(convertDocStatus(src.getDocStatus())); + for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo()) + tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSecurityLabel()) + tgt.addSecurityLabel(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent()) + tgt.addContent(convertDocumentReferenceContentComponent(t)); + tgt.setContext(convertDocumentReferenceContextComponent(src.getContext())); + return tgt; + } + + + public org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent(); + copyElement(src, tgt); + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + tgt.setTarget(convertReference(src.getTarget())); + return tgt; + } + + public org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent(); + copyElement(src, tgt); + tgt.setCode(convertDocumentRelationshipType(src.getCode())); + tgt.setTarget(convertReference(src.getTarget())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACES: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: return org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.NULL; + } + } + + public org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACES: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.REPLACES; + case TRANSFORMS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.TRANSFORMS; + case SIGNS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.SIGNS; + case APPENDS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.APPENDS; + default: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent(); + copyElement(src, tgt); + tgt.setAttachment(convertAttachment(src.getAttachment())); + for (org.hl7.fhir.instance.model.Coding t : src.getFormat()) + tgt.setFormat(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContentComponent(); + copyElement(src, tgt); + tgt.setAttachment(convertAttachment(src.getAttachment())); + tgt.addFormat(convertCoding(src.getFormat())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent(); + copyElement(src, tgt); + tgt.setEncounter(convertReference(src.getEncounter())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getEvent()) + tgt.addEvent(convertCodeableConcept(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); + tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); + tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) + tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextComponent(); + copyElement(src, tgt); + tgt.setEncounter(convertReference(src.getEncounter())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getEvent()) + tgt.addEvent(convertCodeableConcept(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setFacilityType(convertCodeableConcept(src.getFacilityType())); + tgt.setPracticeSetting(convertCodeableConcept(src.getPracticeSetting())); + tgt.setSourcePatientInfo(convertReference(src.getSourcePatientInfo())); + for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated()) + tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + public org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContextRelatedComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setRef(convertReference(src.getRef())); + return tgt; + } + + + public org.hl7.fhir.dstu3.model.Encounter convertEncounter(org.hl7.fhir.instance.model.Encounter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Encounter tgt = new org.hl7.fhir.dstu3.model.Encounter(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertEncounterState(src.getStatus())); +// for (org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent t : src.getStatusHistory()) +// tgt.addStatusHistory(convertEncounterStatusHistoryComponent(t)); + tgt.setClass_(convertEncounterClass(src.getClass_())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setPriority(convertCodeableConcept(src.getPriority())); + tgt.setSubject(convertReference(src.getPatient())); + for (org.hl7.fhir.instance.model.Reference t : src.getEpisodeOfCare()) + tgt.addEpisodeOfCare(convertReference(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getIncomingReferral()) + tgt.addIncomingReferral(convertReference(t)); + for (org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertEncounterParticipantComponent(t)); + tgt.setAppointment(convertReference(src.getAppointment())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setLength(convertDuration(src.getLength())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.instance.model.Encounter.EncounterLocationComponent t : src.getLocation()) + tgt.addLocation(convertEncounterLocationComponent(t)); + tgt.setServiceProvider(convertReference(src.getServiceProvider())); + tgt.setPartOf(convertReference(src.getPartOf())); + return tgt; + } + + public org.hl7.fhir.instance.model.Encounter convertEncounter(org.hl7.fhir.dstu3.model.Encounter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Encounter tgt = new org.hl7.fhir.instance.model.Encounter(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertEncounterState(src.getStatus())); +// for (org.hl7.fhir.dstu3.model.Encounter.EncounterStatusHistoryComponent t : src.getStatusHistory()) +// tgt.addStatusHistory(convertEncounterStatusHistoryComponent(t)); + tgt.setClass_(convertEncounterClass(src.getClass_())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setPriority(convertCodeableConcept(src.getPriority())); + tgt.setPatient(convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getEpisodeOfCare()) + tgt.addEpisodeOfCare(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getIncomingReferral()) + tgt.addIncomingReferral(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent t : src.getParticipant()) + tgt.addParticipant(convertEncounterParticipantComponent(t)); + tgt.setAppointment(convertReference(src.getAppointment())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setLength(convertDuration(src.getLength())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + tgt.setHospitalization(convertEncounterHospitalizationComponent(src.getHospitalization())); + for (org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent t : src.getLocation()) + tgt.addLocation(convertEncounterLocationComponent(t)); + tgt.setServiceProvider(convertReference(src.getServiceProvider())); + tgt.setPartOf(convertReference(src.getPartOf())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Encounter.EncounterStatus convertEncounterState(org.hl7.fhir.instance.model.Encounter.EncounterState src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.PLANNED; + case ARRIVED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ARRIVED; + case INPROGRESS: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.INPROGRESS; + case ONLEAVE: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.ONLEAVE; + case FINISHED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.FINISHED; + case CANCELLED: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.CANCELLED; + default: return org.hl7.fhir.dstu3.model.Encounter.EncounterStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Encounter.EncounterState convertEncounterState(org.hl7.fhir.dstu3.model.Encounter.EncounterStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.instance.model.Encounter.EncounterState.PLANNED; + case ARRIVED: return org.hl7.fhir.instance.model.Encounter.EncounterState.ARRIVED; + case INPROGRESS: return org.hl7.fhir.instance.model.Encounter.EncounterState.INPROGRESS; + case ONLEAVE: return org.hl7.fhir.instance.model.Encounter.EncounterState.ONLEAVE; + case FINISHED: return org.hl7.fhir.instance.model.Encounter.EncounterState.FINISHED; + case CANCELLED: return org.hl7.fhir.instance.model.Encounter.EncounterState.CANCELLED; + default: return org.hl7.fhir.instance.model.Encounter.EncounterState.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Coding convertEncounterClass(org.hl7.fhir.instance.model.Encounter.EncounterClass src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPATIENT: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("IMP"); + case OUTPATIENT: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("AMB"); + case AMBULATORY: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("AMB"); + case EMERGENCY: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("EMER"); + case HOME: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("HH"); + case FIELD: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("FLD"); + case DAYTIME: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("SS"); + case VIRTUAL: return new org.hl7.fhir.dstu3.model.Coding().setSystem("http://hl7.org/fhir/v3/ActCode").setCode("VR"); + default: return null; + } + } + + public org.hl7.fhir.instance.model.Encounter.EncounterClass convertEncounterClass(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src.getSystem().equals("http://hl7.org/fhir/v3/ActCode")) { + if (src.getCode().equals("IMP")) return org.hl7.fhir.instance.model.Encounter.EncounterClass.INPATIENT; + if (src.getCode().equals("AMB")) return org.hl7.fhir.instance.model.Encounter.EncounterClass.AMBULATORY; + if (src.getCode().equals("EMER")) return org.hl7.fhir.instance.model.Encounter.EncounterClass.EMERGENCY; + if (src.getCode().equals("HH")) return org.hl7.fhir.instance.model.Encounter.EncounterClass.HOME; + if (src.getCode().equals("FLD")) return org.hl7.fhir.instance.model.Encounter.EncounterClass.FIELD; + if (src.getCode().equals("")) return org.hl7.fhir.instance.model.Encounter.EncounterClass.DAYTIME; + if (src.getCode().equals("VR")) return org.hl7.fhir.instance.model.Encounter.EncounterClass.VIRTUAL; + } + return org.hl7.fhir.instance.model.Encounter.EncounterClass.NULL; + } + +// public org.hl7.fhir.dstu3.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterStatusHistoryComponent(); +// copyElement(src, tgt); +// tgt.setStatus(convertEncounterState(src.getStatus())); +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// return tgt; +// } + +// public org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent(); +// copyElement(src, tgt); +// tgt.setStatus(convertEncounterState(src.getStatus())); +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// return tgt; +// } + + public org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setIndividual(convertReference(src.getIndividual())); + return tgt; + } + + public org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterParticipantComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setIndividual(convertReference(src.getIndividual())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.instance.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent(); + copyElement(src, tgt); + tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); + tgt.setOrigin(convertReference(src.getOrigin())); + tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); + tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getDietPreference()) + tgt.addDietPreference(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getSpecialCourtesy()) + tgt.addSpecialCourtesy(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getSpecialArrangement()) + tgt.addSpecialArrangement(convertCodeableConcept(t)); + tgt.setDestination(convertReference(src.getDestination())); + tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public org.hl7.fhir.instance.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Encounter.EncounterHospitalizationComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterHospitalizationComponent(); + copyElement(src, tgt); + tgt.setPreAdmissionIdentifier(convertIdentifier(src.getPreAdmissionIdentifier())); + tgt.setOrigin(convertReference(src.getOrigin())); + tgt.setAdmitSource(convertCodeableConcept(src.getAdmitSource())); + tgt.setReAdmission(convertCodeableConcept(src.getReAdmission())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getDietPreference()) + tgt.addDietPreference(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialCourtesy()) + tgt.addSpecialCourtesy(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialArrangement()) + tgt.addSpecialArrangement(convertCodeableConcept(t)); + tgt.setDestination(convertReference(src.getDestination())); + tgt.setDischargeDisposition(convertCodeableConcept(src.getDischargeDisposition())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.instance.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent(); + copyElement(src, tgt); + tgt.setLocation(convertReference(src.getLocation())); + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.Encounter.EncounterLocationComponent convertEncounterLocationComponent(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Encounter.EncounterLocationComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterLocationComponent(); + copyElement(src, tgt); + tgt.setLocation(convertReference(src.getLocation())); + tgt.setStatus(convertEncounterLocationStatus(src.getStatus())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.instance.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.COMPLETED; + default: return org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Encounter.EncounterLocationStatus convertEncounterLocationStatus(org.hl7.fhir.dstu3.model.Encounter.EncounterLocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.instance.model.Encounter.EncounterLocationStatus.PLANNED; + case ACTIVE: return org.hl7.fhir.instance.model.Encounter.EncounterLocationStatus.ACTIVE; + case RESERVED: return org.hl7.fhir.instance.model.Encounter.EncounterLocationStatus.RESERVED; + case COMPLETED: return org.hl7.fhir.instance.model.Encounter.EncounterLocationStatus.COMPLETED; + default: return org.hl7.fhir.instance.model.Encounter.EncounterLocationStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.instance.model.EnrollmentRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.EnrollmentRequest tgt = new org.hl7.fhir.dstu3.model.EnrollmentRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCreated(src.getCreated()); +// tgt.setTarget(convertReference(src.getTarget())); + tgt.setProvider(convertReference(src.getProvider())); + tgt.setOrganization(convertReference(src.getOrganization())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setCoverage(convertReference(src.getCoverage())); +// tgt.setRelationship(convertCoding(src.getRelationship())); + return tgt; + } + + public org.hl7.fhir.instance.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.dstu3.model.EnrollmentRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.EnrollmentRequest tgt = new org.hl7.fhir.instance.model.EnrollmentRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCreated(src.getCreated()); +// tgt.setTarget(convertReference(src.getTarget())); +// tgt.setProvider(convertReference(src.getProvider())); +// tgt.setOrganization(convertReference(src.getOrganization())); +// tgt.setSubject(convertReference(src.getSubject())); + tgt.setCoverage(convertReference(src.getCoverage())); +// tgt.setRelationship(convertCoding(src.getRelationship())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.instance.model.EnrollmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.EnrollmentResponse tgt = new org.hl7.fhir.dstu3.model.EnrollmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setRequest(convertReference(src.getRequest())); +// tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); + tgt.setDisposition(src.getDisposition()); + tgt.setCreated(src.getCreated()); + tgt.setOrganization(convertReference(src.getOrganization())); + tgt.setRequestProvider(convertReference(src.getRequestProvider())); + tgt.setRequestOrganization(convertReference(src.getRequestOrganization())); + return tgt; + } + + public org.hl7.fhir.instance.model.EnrollmentResponse convertEnrollmentResponse(org.hl7.fhir.dstu3.model.EnrollmentResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.EnrollmentResponse tgt = new org.hl7.fhir.instance.model.EnrollmentResponse(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); +// tgt.setRequest(convertReference(src.getRequestReference())); +// tgt.setOutcome(convertRemittanceOutcome(src.getOutcome())); + tgt.setDisposition(src.getDisposition()); + tgt.setCreated(src.getCreated()); +// tgt.setOrganization(convertReference(src.getOrganizationReference())); +// tgt.setRequestProvider(convertReference(src.getRequestProviderReference())); +// tgt.setRequestOrganization(convertReference(src.getRequestOrganizationReference())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.instance.model.EpisodeOfCare src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.EpisodeOfCare tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) + tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.instance.model.Reference t : src.getReferralRequest()) + tgt.addReferralRequest(convertReference(t)); + tgt.setCareManager(convertReference(src.getCareManager())); + return tgt; + } + + public org.hl7.fhir.instance.model.EpisodeOfCare convertEpisodeOfCare(org.hl7.fhir.dstu3.model.EpisodeOfCare src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.EpisodeOfCare tgt = new org.hl7.fhir.instance.model.EpisodeOfCare(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent t : src.getStatusHistory()) + tgt.addStatusHistory(convertEpisodeOfCareStatusHistoryComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReferralRequest()) + tgt.addReferralRequest(convertReference(t)); + tgt.setCareManager(convertReference(src.getCareManager())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + default: return org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus convertEpisodeOfCareStatus(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PLANNED: return org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus.PLANNED; + case WAITLIST: return org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus.WAITLIST; + case ACTIVE: return org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus.ACTIVE; + case ONHOLD: return org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus.ONHOLD; + case FINISHED: return org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus.FINISHED; + case CANCELLED: return org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus.CANCELLED; + default: return org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + copyElement(src, tgt); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent convertEpisodeOfCareStatusHistoryComponent(org.hl7.fhir.dstu3.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent tgt = new org.hl7.fhir.instance.model.EpisodeOfCare.EpisodeOfCareStatusHistoryComponent(); + copyElement(src, tgt); + tgt.setStatus(convertEpisodeOfCareStatus(src.getStatus())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + + public org.hl7.fhir.dstu3.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.instance.model.FamilyMemberHistory src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.FamilyMemberHistory tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBorn(convertType(src.getBorn())); + tgt.setAge(convertType(src.getAge())); + tgt.setDeceased(convertType(src.getDeceased())); +// tgt.setNote(convertAnnotation(src.getNote())); + for (org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) + tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.dstu3.model.FamilyMemberHistory src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.FamilyMemberHistory tgt = new org.hl7.fhir.instance.model.FamilyMemberHistory(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setPatient(convertReference(src.getPatient())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setStatus(convertFamilyHistoryStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBorn(convertType(src.getBorn())); + tgt.setAge(convertType(src.getAge())); + tgt.setDeceased(convertType(src.getDeceased())); +// tgt.setNote(convertAnnotation(src.getNote())); + for (org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent t : src.getCondition()) + tgt.addCondition(convertFamilyMemberHistoryConditionComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PARTIAL: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: return org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PARTIAL: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL; + case COMPLETED: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR; + case HEALTHUNKNOWN: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN; + default: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + tgt.setOnset(convertType(src.getOnset())); +// tgt.setNote(convertAnnotation(src.getNote())); + return tgt; + } + + public org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.dstu3.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent tgt = new org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + tgt.setOnset(convertType(src.getOnset())); +// tgt.setNote(convertAnnotation(src.getNote())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Flag convertFlag(org.hl7.fhir.instance.model.Flag src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Flag tgt = new org.hl7.fhir.dstu3.model.Flag(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCategory(convertCodeableConcept(src.getCategory())); + tgt.setStatus(convertFlagStatus(src.getStatus())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public org.hl7.fhir.instance.model.Flag convertFlag(org.hl7.fhir.dstu3.model.Flag src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Flag tgt = new org.hl7.fhir.instance.model.Flag(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCategory(convertCodeableConcept(src.getCategory())); + tgt.setStatus(convertFlagStatus(src.getStatus())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.instance.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.Flag.FlagStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Flag.FlagStatus convertFlagStatus(org.hl7.fhir.dstu3.model.Flag.FlagStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.instance.model.Flag.FlagStatus.ACTIVE; + case INACTIVE: return org.hl7.fhir.instance.model.Flag.FlagStatus.INACTIVE; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.Flag.FlagStatus.ENTEREDINERROR; + default: return org.hl7.fhir.instance.model.Flag.FlagStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Group convertGroup(org.hl7.fhir.instance.model.Group src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Group tgt = new org.hl7.fhir.dstu3.model.Group(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setType(convertGroupType(src.getType())); + tgt.setActual(src.getActual()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setName(src.getName()); + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.instance.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) + tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.instance.model.Group.GroupMemberComponent t : src.getMember()) + tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Group convertGroup(org.hl7.fhir.dstu3.model.Group src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Group tgt = new org.hl7.fhir.instance.model.Group(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setType(convertGroupType(src.getType())); + tgt.setActual(src.getActual()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setName(src.getName()); + tgt.setQuantity(src.getQuantity()); + for (org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent t : src.getCharacteristic()) + tgt.addCharacteristic(convertGroupCharacteristicComponent(t)); + for (org.hl7.fhir.dstu3.model.Group.GroupMemberComponent t : src.getMember()) + tgt.addMember(convertGroupMemberComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Group.GroupType convertGroupType(org.hl7.fhir.instance.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSON: return org.hl7.fhir.dstu3.model.Group.GroupType.PERSON; + case ANIMAL: return org.hl7.fhir.dstu3.model.Group.GroupType.ANIMAL; + case PRACTITIONER: return org.hl7.fhir.dstu3.model.Group.GroupType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.dstu3.model.Group.GroupType.DEVICE; + case MEDICATION: return org.hl7.fhir.dstu3.model.Group.GroupType.MEDICATION; + case SUBSTANCE: return org.hl7.fhir.dstu3.model.Group.GroupType.SUBSTANCE; + default: return org.hl7.fhir.dstu3.model.Group.GroupType.NULL; + } + } + + public org.hl7.fhir.instance.model.Group.GroupType convertGroupType(org.hl7.fhir.dstu3.model.Group.GroupType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PERSON: return org.hl7.fhir.instance.model.Group.GroupType.PERSON; + case ANIMAL: return org.hl7.fhir.instance.model.Group.GroupType.ANIMAL; + case PRACTITIONER: return org.hl7.fhir.instance.model.Group.GroupType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.instance.model.Group.GroupType.DEVICE; + case MEDICATION: return org.hl7.fhir.instance.model.Group.GroupType.MEDICATION; + case SUBSTANCE: return org.hl7.fhir.instance.model.Group.GroupType.SUBSTANCE; + default: return org.hl7.fhir.instance.model.Group.GroupType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.instance.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setValue(convertType(src.getValue())); + tgt.setExclude(src.getExclude()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.dstu3.model.Group.GroupCharacteristicComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Group.GroupCharacteristicComponent tgt = new org.hl7.fhir.instance.model.Group.GroupCharacteristicComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setValue(convertType(src.getValue())); + tgt.setExclude(src.getExclude()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.instance.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.dstu3.model.Group.GroupMemberComponent(); + copyElement(src, tgt); + tgt.setEntity(convertReference(src.getEntity())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setInactive(src.getInactive()); + return tgt; + } + + public org.hl7.fhir.instance.model.Group.GroupMemberComponent convertGroupMemberComponent(org.hl7.fhir.dstu3.model.Group.GroupMemberComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Group.GroupMemberComponent tgt = new org.hl7.fhir.instance.model.Group.GroupMemberComponent(); + copyElement(src, tgt); + tgt.setEntity(convertReference(src.getEntity())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setInactive(src.getInactive()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.HealthcareService convertHealthcareService(org.hl7.fhir.instance.model.HealthcareService src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.HealthcareService tgt = new org.hl7.fhir.dstu3.model.HealthcareService(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setProvidedBy(convertReference(src.getProvidedBy())); +// tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategory())); + for (org.hl7.fhir.instance.model.HealthcareService.ServiceTypeComponent t : src.getServiceType()) { +// if (t.hasType()) +// tgt.addServiceType(convertCodeableConcept(t.getType())); + for (org.hl7.fhir.instance.model.CodeableConcept tj : t.getSpecialty()) + tgt.addSpecialty(convertCodeableConcept(tj)); + } + tgt.addLocation(convertReference(src.getLocation())); +// tgt.setServiceName(src.getServiceName()); + tgt.setComment(src.getComment()); + tgt.setExtraDetails(src.getExtraDetails()); + tgt.setPhoto(convertAttachment(src.getPhoto())); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getCoverageArea()) + tgt.addCoverageArea(convertReference(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getServiceProvisionCode()) + tgt.addServiceProvisionCode(convertCodeableConcept(t)); + tgt.setEligibility(convertCodeableConcept(src.getEligibility())); + tgt.setEligibilityNote(src.getEligibilityNote()); + for (org.hl7.fhir.instance.model.StringType t : src.getProgramName()) + tgt.addProgramName(t.getValue()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCharacteristic()) + tgt.addCharacteristic(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReferralMethod()) + tgt.addReferralMethod(convertCodeableConcept(t)); +// tgt.setPublicKey(src.getPublicKey()); + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) + tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) + tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + return tgt; + } + + public org.hl7.fhir.instance.model.HealthcareService convertHealthcareService(org.hl7.fhir.dstu3.model.HealthcareService src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.HealthcareService tgt = new org.hl7.fhir.instance.model.HealthcareService(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setProvidedBy(convertReference(src.getProvidedBy())); +// tgt.setServiceCategory(convertCodeableConcept(src.getServiceCategory())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) +// tgt.addServiceType().setType(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) { + if (!tgt.hasServiceType()) + tgt.addServiceType(); + tgt.getServiceType().get(0).addSpecialty(convertCodeableConcept(t)); + } + for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) + tgt.setLocation(convertReference(t)); +// tgt.setServiceName(src.getServiceName()); + tgt.setComment(src.getComment()); + tgt.setExtraDetails(src.getExtraDetails()); + tgt.setPhoto(convertAttachment(src.getPhoto())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getCoverageArea()) + tgt.addCoverageArea(convertReference(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceProvisionCode()) + tgt.addServiceProvisionCode(convertCodeableConcept(t)); + tgt.setEligibility(convertCodeableConcept(src.getEligibility())); + tgt.setEligibilityNote(src.getEligibilityNote()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getProgramName()) + tgt.addProgramName(t.getValue()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCharacteristic()) + tgt.addCharacteristic(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReferralMethod()) + tgt.addReferralMethod(convertCodeableConcept(t)); +// tgt.setPublicKey(src.getPublicKey()); + tgt.setAppointmentRequired(src.getAppointmentRequired()); + for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent t : src.getAvailableTime()) + tgt.addAvailableTime(convertHealthcareServiceAvailableTimeComponent(t)); + for (org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent t : src.getNotAvailable()) + tgt.addNotAvailable(convertHealthcareServiceNotAvailableComponent(t)); + tgt.setAvailabilityExceptions(src.getAvailabilityExceptions()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.Enumeration t : src.getDaysOfWeek()) + tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); + tgt.setAllDay(src.getAllDay()); + tgt.setAvailableStartTime(src.getAvailableStartTime()); + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceAvailableTimeComponent convertHealthcareServiceAvailableTimeComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceAvailableTimeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceAvailableTimeComponent tgt = new org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceAvailableTimeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getDaysOfWeek()) + tgt.addDaysOfWeek(convertDaysOfWeek(t.getValue())); + tgt.setAllDay(src.getAllDay()); + tgt.setAvailableStartTime(src.getAvailableStartTime()); + tgt.setAvailableEndTime(src.getAvailableEndTime()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.WED; + case THU: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.SUN; + default: return org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek.NULL; + } + } + + public org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.dstu3.model.HealthcareService.DaysOfWeek src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MON: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.MON; + case TUE: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.TUE; + case WED: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.WED; + case THU: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.THU; + case FRI: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.FRI; + case SAT: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.SAT; + case SUN: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.SUN; + default: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.NULL; + } + } + + public org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setDuring(convertPeriod(src.getDuring())); + return tgt; + } + + public org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.dstu3.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceNotAvailableComponent tgt = new org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceNotAvailableComponent(); + copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + tgt.setDuring(convertPeriod(src.getDuring())); + return tgt; + } + +// public org.hl7.fhir.dstu3.model.ImagingObjectSelection convertImagingObjectSelection(org.hl7.fhir.instance.model.ImagingObjectSelection src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.ImagingObjectSelection tgt = new org.hl7.fhir.dstu3.model.ImagingObjectSelection(); +// copyDomainResource(src, tgt); +// tgt.setUid(src.getUid()); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setAuthoringTime(src.getAuthoringTime()); +// tgt.setAuthor(convertReference(src.getAuthor())); +// tgt.setTitle(convertCodeableConcept(src.getTitle())); +// tgt.setDescription(src.getDescription()); +// for (org.hl7.fhir.instance.model.ImagingObjectSelection.StudyComponent t : src.getStudy()) +// tgt.addStudy(convertStudyComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.instance.model.ImagingObjectSelection convertImagingObjectSelection(org.hl7.fhir.dstu3.model.ImagingObjectSelection src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.ImagingObjectSelection tgt = new org.hl7.fhir.instance.model.ImagingObjectSelection(); +// copyDomainResource(src, tgt); +// tgt.setUid(src.getUid()); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setAuthoringTime(src.getAuthoringTime()); +// tgt.setAuthor(convertReference(src.getAuthor())); +// tgt.setTitle(convertCodeableConcept(src.getTitle())); +// tgt.setDescription(src.getDescription()); +// for (org.hl7.fhir.dstu3.model.ImagingObjectSelection.StudyComponent t : src.getStudy()) +// tgt.addStudy(convertStudyComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu3.model.ImagingObjectSelection.StudyComponent convertStudyComponent(org.hl7.fhir.instance.model.ImagingObjectSelection.StudyComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.ImagingObjectSelection.StudyComponent tgt = new org.hl7.fhir.dstu3.model.ImagingObjectSelection.StudyComponent(); +// copyElement(src, tgt); +// tgt.setUid(src.getUid()); +// tgt.setUrl(src.getUrl()); +// tgt.setImagingStudy(convertReference(src.getImagingStudy())); +// for (org.hl7.fhir.instance.model.ImagingObjectSelection.SeriesComponent t : src.getSeries()) +// tgt.addSeries(convertSeriesComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.instance.model.ImagingObjectSelection.StudyComponent convertStudyComponent(org.hl7.fhir.dstu3.model.ImagingObjectSelection.StudyComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.ImagingObjectSelection.StudyComponent tgt = new org.hl7.fhir.instance.model.ImagingObjectSelection.StudyComponent(); +// copyElement(src, tgt); +// tgt.setUid(src.getUid()); +// tgt.setUrl(src.getUrl()); +// tgt.setImagingStudy(convertReference(src.getImagingStudy())); +// for (org.hl7.fhir.dstu3.model.ImagingObjectSelection.SeriesComponent t : src.getSeries()) +// tgt.addSeries(convertSeriesComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu3.model.ImagingObjectSelection.SeriesComponent convertSeriesComponent(org.hl7.fhir.instance.model.ImagingObjectSelection.SeriesComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.ImagingObjectSelection.SeriesComponent tgt = new org.hl7.fhir.dstu3.model.ImagingObjectSelection.SeriesComponent(); +// copyElement(src, tgt); +// tgt.setUid(src.getUid()); +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.instance.model.ImagingObjectSelection.InstanceComponent t : src.getInstance()) +// tgt.addInstance(convertInstanceComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.instance.model.ImagingObjectSelection.SeriesComponent convertSeriesComponent(org.hl7.fhir.dstu3.model.ImagingObjectSelection.SeriesComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.ImagingObjectSelection.SeriesComponent tgt = new org.hl7.fhir.instance.model.ImagingObjectSelection.SeriesComponent(); +// copyElement(src, tgt); +// tgt.setUid(src.getUid()); +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.dstu3.model.ImagingObjectSelection.InstanceComponent t : src.getInstance()) +// tgt.addInstance(convertInstanceComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu3.model.ImagingObjectSelection.InstanceComponent convertInstanceComponent(org.hl7.fhir.instance.model.ImagingObjectSelection.InstanceComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.ImagingObjectSelection.InstanceComponent tgt = new org.hl7.fhir.dstu3.model.ImagingObjectSelection.InstanceComponent(); +// copyElement(src, tgt); +// tgt.setSopClass(src.getSopClass()); +// tgt.setUid(src.getUid()); +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.instance.model.ImagingObjectSelection.FramesComponent t : src.getFrames()) +// tgt.addFrame(convertFramesComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.instance.model.ImagingObjectSelection.InstanceComponent convertInstanceComponent(org.hl7.fhir.dstu3.model.ImagingObjectSelection.InstanceComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.ImagingObjectSelection.InstanceComponent tgt = new org.hl7.fhir.instance.model.ImagingObjectSelection.InstanceComponent(); +// copyElement(src, tgt); +// tgt.setSopClass(src.getSopClass()); +// tgt.setUid(src.getUid()); +// tgt.setUrl(src.getUrl()); +// for (org.hl7.fhir.dstu3.model.ImagingObjectSelection.FramesComponent t : src.getFrame()) +// tgt.addFrames(convertFramesComponent(t)); +// return tgt; +// } +// +// public org.hl7.fhir.dstu3.model.ImagingObjectSelection.FramesComponent convertFramesComponent(org.hl7.fhir.instance.model.ImagingObjectSelection.FramesComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.ImagingObjectSelection.FramesComponent tgt = new org.hl7.fhir.dstu3.model.ImagingObjectSelection.FramesComponent(); +// copyElement(src, tgt); +// for (org.hl7.fhir.instance.model.UnsignedIntType t : src.getFrameNumbers()) +// tgt.addNumber(t.getValue()); +// tgt.setUrl(src.getUrl()); +// return tgt; +// } +// +// public org.hl7.fhir.instance.model.ImagingObjectSelection.FramesComponent convertFramesComponent(org.hl7.fhir.dstu3.model.ImagingObjectSelection.FramesComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.ImagingObjectSelection.FramesComponent tgt = new org.hl7.fhir.instance.model.ImagingObjectSelection.FramesComponent(); +// copyElement(src, tgt); +// for (org.hl7.fhir.dstu3.model.UnsignedIntType t : src.getNumber()) +// tgt.addFrameNumbers(t.getValue()); +// tgt.setUrl(src.getUrl()); +// return tgt; +// } +// + public org.hl7.fhir.dstu3.model.ImagingStudy convertImagingStudy(org.hl7.fhir.instance.model.ImagingStudy src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImagingStudy tgt = new org.hl7.fhir.dstu3.model.ImagingStudy(); + copyDomainResource(src, tgt); + tgt.setUid(src.getUid()); + tgt.setAccession(convertIdentifier(src.getAccession())); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); + for (org.hl7.fhir.instance.model.Coding t : src.getModalityList()) + tgt.addModalityList(convertCoding(t)); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setStarted(src.getStarted()); + tgt.setReferrer(convertReference(src.getReferrer())); + tgt.addInterpreter(convertReference(src.getInterpreter())); + tgt.setNumberOfSeries(src.getNumberOfSeries()); + tgt.setNumberOfInstances(src.getNumberOfInstances()); + for (org.hl7.fhir.instance.model.Reference t : src.getProcedure()) + tgt.addProcedureReference(convertReference(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) + tgt.addSeries(convertImagingStudySeriesComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ImagingStudy convertImagingStudy(org.hl7.fhir.dstu3.model.ImagingStudy src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ImagingStudy tgt = new org.hl7.fhir.instance.model.ImagingStudy(); + copyDomainResource(src, tgt); + tgt.setUid(src.getUid()); + tgt.setAccession(convertIdentifier(src.getAccession())); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); + for (org.hl7.fhir.dstu3.model.Coding t : src.getModalityList()) + tgt.addModalityList(convertCoding(t)); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setStarted(src.getStarted()); + tgt.setReferrer(convertReference(src.getReferrer())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getInterpreter()) + tgt.setInterpreter(convertReference(t)); + tgt.setNumberOfSeries(src.getNumberOfSeries()); + tgt.setNumberOfInstances(src.getNumberOfInstances()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProcedureReference()) + tgt.addProcedure(convertReference(t)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent t : src.getSeries()) + tgt.addSeries(convertImagingStudySeriesComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ONLINE: return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.ONLINE; + case OFFLINE: return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.OFFLINE; + case NEARLINE: return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.NEARLINE; + case UNAVAILABLE: return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.UNAVAILABLE; + default: return org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability.NULL; + } + } + + public org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.dstu3.model.ImagingStudy.InstanceAvailability src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ONLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.ONLINE; + case OFFLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.OFFLINE; + case NEARLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.NEARLINE; + case UNAVAILABLE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.UNAVAILABLE; + default: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent(); + copyElement(src, tgt); + tgt.setUid(src.getUid()); + tgt.setNumber(src.getNumber()); + tgt.setModality(convertCoding(src.getModality())); + tgt.setDescription(src.getDescription()); + tgt.setNumberOfInstances(src.getNumberOfInstances()); + tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); + tgt.setBodySite(convertCoding(src.getBodySite())); + tgt.setLaterality(convertCoding(src.getLaterality())); + tgt.setStarted(src.getStarted()); + for (org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) + tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesComponent tgt = new org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesComponent(); + copyElement(src, tgt); + tgt.setUid(src.getUid()); + tgt.setNumber(src.getNumber()); + tgt.setModality(convertCoding(src.getModality())); + tgt.setDescription(src.getDescription()); + tgt.setNumberOfInstances(src.getNumberOfInstances()); + tgt.setAvailability(convertInstanceAvailability(src.getAvailability())); + tgt.setBodySite(convertCoding(src.getBodySite())); + tgt.setLaterality(convertCoding(src.getLaterality())); + tgt.setStarted(src.getStarted()); + for (org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent t : src.getInstance()) + tgt.addInstance(convertImagingStudySeriesInstanceComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); + copyElement(src, tgt); + tgt.setUid(src.getUid()); + tgt.setNumber(src.getNumber()); + tgt.setSopClass(src.getSopClass()); + tgt.setTitle(src.getTitle()); + return tgt; + } + + public org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesInstanceComponent convertImagingStudySeriesInstanceComponent(org.hl7.fhir.dstu3.model.ImagingStudy.ImagingStudySeriesInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesInstanceComponent tgt = new org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesInstanceComponent(); + copyElement(src, tgt); + tgt.setUid(src.getUid()); + tgt.setNumber(src.getNumber()); + tgt.setSopClass(src.getSopClass()); + tgt.setTitle(src.getTitle()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Immunization convertImmunization(org.hl7.fhir.instance.model.Immunization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Immunization tgt = new org.hl7.fhir.dstu3.model.Immunization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + try { + tgt.setStatus(org.hl7.fhir.dstu3.model.Immunization.ImmunizationStatus.fromCode(src.getStatus())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setNotGiven(src.getWasNotGiven()); + tgt.setPrimarySource(!src.getReported()); + if (src.hasPerformer()) + tgt.addPractitioner().setActor(convertReference(src.getPerformer())).setRole(new org.hl7.fhir.dstu3.model.CodeableConcept().addCoding(new Coding().setSystem("http://hl7.org/fhir/v2/0443").setCode("AP"))); + if (src.hasRequester()) + tgt.addPractitioner().setActor(convertReference(src.getRequester())).setRole(new org.hl7.fhir.dstu3.model.CodeableConcept().addCoding(new Coding().setSystem("http://hl7.org/fhir/v2/0443").setCode("OP"))); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setManufacturer(convertReference(src.getManufacturer())); + tgt.setLocation(convertReference(src.getLocation())); + tgt.setLotNumber(src.getLotNumber()); + tgt.setExpirationDate(src.getExpirationDate()); + tgt.setSite(convertCodeableConcept(src.getSite())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setDoseQuantity(convertSimpleQuantity(src.getDoseQuantity())); + for (org.hl7.fhir.instance.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + tgt.setExplanation(convertImmunizationExplanationComponent(src.getExplanation())); + for (org.hl7.fhir.instance.model.Immunization.ImmunizationReactionComponent t : src.getReaction()) + tgt.addReaction(convertImmunizationReactionComponent(t)); + for (org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent t : src.getVaccinationProtocol()) + tgt.addVaccinationProtocol(convertImmunizationVaccinationProtocolComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Immunization convertImmunization(org.hl7.fhir.dstu3.model.Immunization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Immunization tgt = new org.hl7.fhir.instance.model.Immunization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(src.getStatus().toCode()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setWasNotGiven(src.getNotGiven()); + tgt.setReported(!src.getPrimarySource()); + tgt.setPerformer(convertReference(getPerformer(src.getPractitioner()))); + tgt.setRequester(convertReference(getRequester(src.getPractitioner()))); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setManufacturer(convertReference(src.getManufacturer())); + tgt.setLocation(convertReference(src.getLocation())); + tgt.setLotNumber(src.getLotNumber()); + tgt.setExpirationDate(src.getExpirationDate()); + tgt.setSite(convertCodeableConcept(src.getSite())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setDoseQuantity(convertSimpleQuantity(src.getDoseQuantity())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.addNote(convertAnnotation(t)); + tgt.setExplanation(convertImmunizationExplanationComponent(src.getExplanation())); + for (org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent t : src.getReaction()) + tgt.addReaction(convertImmunizationReactionComponent(t)); + for (org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent t : src.getVaccinationProtocol()) + tgt.addVaccinationProtocol(convertImmunizationVaccinationProtocolComponent(t)); + return tgt; + } + + private org.hl7.fhir.dstu3.model.Reference getPerformer(List practitioner) { + for (ImmunizationPractitionerComponent p : practitioner) { + if (hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "AP")) + return p.getActor(); + } + return null; + } + + private org.hl7.fhir.dstu3.model.Reference getRequester(List practitioner) { + for (ImmunizationPractitionerComponent p : practitioner) { + if (hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "OP")) + return p.getActor(); + } + return null; + } + + private boolean hasConcept(org.hl7.fhir.dstu3.model.CodeableConcept cc, String system, String code) { + for (org.hl7.fhir.dstu3.model.Coding c : cc.getCoding()) { + if (system.equals(c.getSystem()) && code.equals(c.getCode())) + return true; + } + return false; + } + + private boolean hasConcept(org.hl7.fhir.instance.model.CodeableConcept cc, String system, String code) { + for (org.hl7.fhir.instance.model.Coding c : cc.getCoding()) { + if (system.equals(c.getSystem()) && code.equals(c.getCode())) + return true; + } + return false; + } + + public org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent convertImmunizationExplanationComponent(org.hl7.fhir.instance.model.Immunization.ImmunizationExplanationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReasonNotGiven()) + tgt.addReasonNotGiven(convertCodeableConcept(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Immunization.ImmunizationExplanationComponent convertImmunizationExplanationComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationExplanationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Immunization.ImmunizationExplanationComponent tgt = new org.hl7.fhir.instance.model.Immunization.ImmunizationExplanationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotGiven()) + tgt.addReasonNotGiven(convertCodeableConcept(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent convertImmunizationReactionComponent(org.hl7.fhir.instance.model.Immunization.ImmunizationReactionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent(); + copyElement(src, tgt); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDetail(convertReference(src.getDetail())); + tgt.setReported(src.getReported()); + return tgt; + } + + public org.hl7.fhir.instance.model.Immunization.ImmunizationReactionComponent convertImmunizationReactionComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationReactionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Immunization.ImmunizationReactionComponent tgt = new org.hl7.fhir.instance.model.Immunization.ImmunizationReactionComponent(); + copyElement(src, tgt); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDetail(convertReference(src.getDetail())); + tgt.setReported(src.getReported()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent(); + copyElement(src, tgt); + tgt.setDoseSequence(src.getDoseSequence()); + tgt.setDescription(src.getDescription()); + tgt.setAuthority(convertReference(src.getAuthority())); + tgt.setSeries(src.getSeries()); + tgt.setSeriesDoses(src.getSeriesDoses()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getTargetDisease()) + tgt.addTargetDisease(convertCodeableConcept(t)); + tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus())); + tgt.setDoseStatusReason(convertCodeableConcept(src.getDoseStatusReason())); + return tgt; + } + + public org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.dstu3.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent(); + copyElement(src, tgt); + tgt.setDoseSequence(src.getDoseSequence()); + tgt.setDescription(src.getDescription()); + tgt.setAuthority(convertReference(src.getAuthority())); + tgt.setSeries(src.getSeries()); + tgt.setSeriesDoses(src.getSeriesDoses()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getTargetDisease()) + tgt.addTargetDisease(convertCodeableConcept(t)); + tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus())); + tgt.setDoseStatusReason(convertCodeableConcept(src.getDoseStatusReason())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ImmunizationRecommendation convertImmunizationRecommendation(org.hl7.fhir.instance.model.ImmunizationRecommendation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImmunizationRecommendation tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setPatient(convertReference(src.getPatient())); + for (org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent t : src.getRecommendation()) + tgt.addRecommendation(convertImmunizationRecommendationRecommendationComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ImmunizationRecommendation convertImmunizationRecommendation(org.hl7.fhir.dstu3.model.ImmunizationRecommendation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ImmunizationRecommendation tgt = new org.hl7.fhir.instance.model.ImmunizationRecommendation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setPatient(convertReference(src.getPatient())); + for (org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent t : src.getRecommendation()) + tgt.addRecommendation(convertImmunizationRecommendationRecommendationComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent convertImmunizationRecommendationRecommendationComponent(org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent(); + copyElement(src, tgt); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); + tgt.setDoseNumber(src.getDoseNumber()); + tgt.setForecastStatus(convertCodeableConcept(src.getForecastStatus())); + for (org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent t : src.getDateCriterion()) + tgt.addDateCriterion(convertImmunizationRecommendationRecommendationDateCriterionComponent(t)); + tgt.setProtocol(convertImmunizationRecommendationRecommendationProtocolComponent(src.getProtocol())); + for (org.hl7.fhir.instance.model.Reference t : src.getSupportingImmunization()) + tgt.addSupportingImmunization(convertReference(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getSupportingPatientInformation()) + tgt.addSupportingPatientInformation(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent convertImmunizationRecommendationRecommendationComponent(org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent tgt = new org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent(); + copyElement(src, tgt); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setVaccineCode(convertCodeableConcept(src.getVaccineCode())); + tgt.setDoseNumber(src.getDoseNumber()); + tgt.setForecastStatus(convertCodeableConcept(src.getForecastStatus())); + for (org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent t : src.getDateCriterion()) + tgt.addDateCriterion(convertImmunizationRecommendationRecommendationDateCriterionComponent(t)); + tgt.setProtocol(convertImmunizationRecommendationRecommendationProtocolComponent(src.getProtocol())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingImmunization()) + tgt.addSupportingImmunization(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingPatientInformation()) + tgt.addSupportingPatientInformation(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent convertImmunizationRecommendationRecommendationDateCriterionComponent(org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent convertImmunizationRecommendationRecommendationDateCriterionComponent(org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent tgt = new org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent convertImmunizationRecommendationRecommendationProtocolComponent(org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent tgt = new org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent(); + copyElement(src, tgt); + tgt.setDoseSequence(src.getDoseSequence()); + tgt.setDescription(src.getDescription()); + tgt.setAuthority(convertReference(src.getAuthority())); + tgt.setSeries(src.getSeries()); + return tgt; + } + + public org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent convertImmunizationRecommendationRecommendationProtocolComponent(org.hl7.fhir.dstu3.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent tgt = new org.hl7.fhir.instance.model.ImmunizationRecommendation.ImmunizationRecommendationRecommendationProtocolComponent(); + copyElement(src, tgt); + tgt.setDoseSequence(src.getDoseSequence()); + tgt.setDescription(src.getDescription()); + tgt.setAuthority(convertReference(src.getAuthority())); + tgt.setSeries(src.getSeries()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.instance.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) + tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setCopyright(src.getCopyright()); + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) + tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) + tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) + tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + for (org.hl7.fhir.instance.model.UriType t : src.getBinary()) + tgt.addBinary(t.getValue()); + tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public org.hl7.fhir.instance.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu3.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ImplementationGuide tgt = new org.hl7.fhir.instance.model.ImplementationGuide(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setCopyright(src.getCopyright()); + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) + tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) + tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) + tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getBinary()) + tgt.addBinary(t.getValue()); + tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + copyElement(src, tgt); + tgt.setType(convertGuideDependencyType(src.getType())); + tgt.setUri(src.getUri()); + return tgt; + } + + public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + copyElement(src, tgt); + tgt.setType(convertGuideDependencyType(src.getType())); + tgt.setUri(src.getUri()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REFERENCE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.REFERENCE; + case INCLUSION: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.INCLUSION; + default: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.NULL; + } + } + + public org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REFERENCE: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.REFERENCE; + case INCLUSION: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.INCLUSION; + default: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) + tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) + tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + copyElement(src, tgt); + tgt.setExample(src.getPurpose() == org.hl7.fhir.instance.model.ImplementationGuide.GuideResourcePurpose.EXAMPLE); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setAcronym(src.getAcronym()); + tgt.setSource(convertType(src.getSource())); + tgt.setExampleFor(convertReference(src.getExampleFor())); + return tgt; + } + + public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + copyElement(src, tgt); + if (src.getExample()) + tgt.setPurpose(org.hl7.fhir.instance.model.ImplementationGuide.GuideResourcePurpose.EXAMPLE); + else + tgt.setPurpose(org.hl7.fhir.instance.model.ImplementationGuide.GuideResourcePurpose.PROFILE); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setAcronym(src.getAcronym()); + tgt.setSource(convertType(src.getSource())); + tgt.setExampleFor(convertReference(src.getExampleFor())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(convertReference(src.getProfile())); + return tgt; + } + + public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(convertReference(src.getProfile())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent(); + copyElement(src, tgt); + tgt.setSource(src.getSource()); + tgt.setTitle(src.getName()); + tgt.setKind(convertGuidePageKind(src.getKind())); + for (org.hl7.fhir.instance.model.CodeType t : src.getType()) + tgt.addType(t.getValue()); + for (org.hl7.fhir.instance.model.StringType t : src.getPackage()) + tgt.addPackage(t.getValue()); + tgt.setFormat(src.getFormat()); + for (org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) + tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePageComponent(); + copyElement(src, tgt); + tgt.setSource(src.getSource()); + tgt.setName(src.getTitle()); + tgt.setKind(convertGuidePageKind(src.getKind())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getType()) + tgt.addType(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getPackage()) + tgt.addPackage(t.getValue()); + tgt.setFormat(src.getFormat()); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) + tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PAGE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.PAGE; + case EXAMPLE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.EXAMPLE; + case LIST: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.LIST; + case INCLUDE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.INCLUDE; + case DIRECTORY: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DIRECTORY; + case DICTIONARY: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DICTIONARY; + case TOC: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.TOC; + case RESOURCE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.RESOURCE; + default: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.NULL; + } + } + + public org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PAGE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.PAGE; + case EXAMPLE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.EXAMPLE; + case LIST: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.LIST; + case INCLUDE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.INCLUDE; + case DIRECTORY: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.DIRECTORY; + case DICTIONARY: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.DICTIONARY; + case TOC: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.TOC; + case RESOURCE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.RESOURCE; + default: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.NULL; + } + } + + + public org.hl7.fhir.dstu3.model.Location convertLocation(org.hl7.fhir.instance.model.Location src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Location tgt = new org.hl7.fhir.dstu3.model.Location(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertLocationStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setMode(convertLocationMode(src.getMode())); + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + tgt.setPartOf(convertReference(src.getPartOf())); + return tgt; + } + + public org.hl7.fhir.instance.model.Location convertLocation(org.hl7.fhir.dstu3.model.Location src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Location tgt = new org.hl7.fhir.instance.model.Location(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertLocationStatus(src.getStatus())); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + tgt.setMode(convertLocationMode(src.getMode())); + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + tgt.setPhysicalType(convertCodeableConcept(src.getPhysicalType())); + tgt.setPosition(convertLocationPositionComponent(src.getPosition())); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + tgt.setPartOf(convertReference(src.getPartOf())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.instance.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu3.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.dstu3.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: return org.hl7.fhir.dstu3.model.Location.LocationStatus.INACTIVE; + default: return org.hl7.fhir.dstu3.model.Location.LocationStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.dstu3.model.Location.LocationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.instance.model.Location.LocationStatus.ACTIVE; + case SUSPENDED: return org.hl7.fhir.instance.model.Location.LocationStatus.SUSPENDED; + case INACTIVE: return org.hl7.fhir.instance.model.Location.LocationStatus.INACTIVE; + default: return org.hl7.fhir.instance.model.Location.LocationStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Location.LocationMode convertLocationMode(org.hl7.fhir.instance.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.dstu3.model.Location.LocationMode.INSTANCE; + case KIND: return org.hl7.fhir.dstu3.model.Location.LocationMode.KIND; + default: return org.hl7.fhir.dstu3.model.Location.LocationMode.NULL; + } + } + + public org.hl7.fhir.instance.model.Location.LocationMode convertLocationMode(org.hl7.fhir.dstu3.model.Location.LocationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.instance.model.Location.LocationMode.INSTANCE; + case KIND: return org.hl7.fhir.instance.model.Location.LocationMode.KIND; + default: return org.hl7.fhir.instance.model.Location.LocationMode.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.instance.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.dstu3.model.Location.LocationPositionComponent(); + copyElement(src, tgt); + tgt.setLongitude(src.getLongitude()); + tgt.setLatitude(src.getLatitude()); + tgt.setAltitude(src.getAltitude()); + return tgt; + } + + public org.hl7.fhir.instance.model.Location.LocationPositionComponent convertLocationPositionComponent(org.hl7.fhir.dstu3.model.Location.LocationPositionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Location.LocationPositionComponent tgt = new org.hl7.fhir.instance.model.Location.LocationPositionComponent(); + copyElement(src, tgt); + tgt.setLongitude(src.getLongitude()); + tgt.setLatitude(src.getLatitude()); + tgt.setAltitude(src.getAltitude()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Media convertMedia(org.hl7.fhir.instance.model.Media src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Media tgt = new org.hl7.fhir.dstu3.model.Media(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setType(convertDigitalMediaType(src.getType())); + tgt.setSubtype(convertCodeableConcept(src.getSubtype())); + tgt.setView(convertCodeableConcept(src.getView())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setOperator(convertReference(src.getOperator())); + tgt.getDevice().setDisplay(src.getDeviceName()); + tgt.setHeight(src.getHeight()); + tgt.setWidth(src.getWidth()); + tgt.setFrames(src.getFrames()); + tgt.setDuration(src.getDuration()); + tgt.setContent(convertAttachment(src.getContent())); + return tgt; + } + + public org.hl7.fhir.instance.model.Media convertMedia(org.hl7.fhir.dstu3.model.Media src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Media tgt = new org.hl7.fhir.instance.model.Media(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setType(convertDigitalMediaType(src.getType())); + tgt.setSubtype(convertCodeableConcept(src.getSubtype())); + tgt.setView(convertCodeableConcept(src.getView())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setOperator(convertReference(src.getOperator())); + tgt.setDeviceName(src.getDevice().getDisplay()); + tgt.setHeight(src.getHeight()); + tgt.setWidth(src.getWidth()); + tgt.setFrames(src.getFrames()); + tgt.setDuration(src.getDuration()); + tgt.setContent(convertAttachment(src.getContent())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.instance.model.Media.DigitalMediaType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHOTO: return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.PHOTO; + case VIDEO: return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.VIDEO; + case AUDIO: return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.AUDIO; + default: return org.hl7.fhir.dstu3.model.Media.DigitalMediaType.NULL; + } + } + + public org.hl7.fhir.instance.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.dstu3.model.Media.DigitalMediaType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHOTO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.PHOTO; + case VIDEO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.VIDEO; + case AUDIO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.AUDIO; + default: return org.hl7.fhir.instance.model.Media.DigitalMediaType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Medication convertMedication(org.hl7.fhir.instance.model.Medication src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Medication tgt = new org.hl7.fhir.dstu3.model.Medication(); + copyDomainResource(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setIsBrand(src.getIsBrand()); + tgt.setManufacturer(convertReference(src.getManufacturer())); +// tgt.setProduct(convertMedicationProductComponent(src.getProduct())); + tgt.setPackage(convertMedicationPackageComponent(src.getPackage())); + return tgt; + } + + public org.hl7.fhir.instance.model.Medication convertMedication(org.hl7.fhir.dstu3.model.Medication src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Medication tgt = new org.hl7.fhir.instance.model.Medication(); + copyDomainResource(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setIsBrand(src.getIsBrand()); + tgt.setManufacturer(convertReference(src.getManufacturer())); +// tgt.setProduct(convertMedicationProductComponent(src.getProduct())); + tgt.setPackage(convertMedicationPackageComponent(src.getPackage())); + return tgt; + } + +// public org.hl7.fhir.dstu3.model.Medication.MedicationProductComponent convertMedicationProductComponent(org.hl7.fhir.instance.model.Medication.MedicationProductComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.Medication.MedicationProductComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationProductComponent(); +// copyElement(src, tgt); +// tgt.setForm(convertCodeableConcept(src.getForm())); +// for (org.hl7.fhir.instance.model.Medication.MedicationProductIngredientComponent t : src.getIngredient()) +// tgt.addIngredient(convertMedicationProductIngredientComponent(t)); +// for (org.hl7.fhir.instance.model.Medication.MedicationProductBatchComponent t : src.getBatch()) +// tgt.addBatch(convertMedicationProductBatchComponent(t)); +// return tgt; +// } + +// public org.hl7.fhir.instance.model.Medication.MedicationProductComponent convertMedicationProductComponent(org.hl7.fhir.dstu3.model.Medication.MedicationProductComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.Medication.MedicationProductComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationProductComponent(); +// copyElement(src, tgt); +// tgt.setForm(convertCodeableConcept(src.getForm())); +// for (org.hl7.fhir.dstu3.model.Medication.MedicationProductIngredientComponent t : src.getIngredient()) +// tgt.addIngredient(convertMedicationProductIngredientComponent(t)); +// for (org.hl7.fhir.dstu3.model.Medication.MedicationProductBatchComponent t : src.getBatch()) +// tgt.addBatch(convertMedicationProductBatchComponent(t)); +// return tgt; +// } + +// public org.hl7.fhir.dstu3.model.Medication.MedicationProductIngredientComponent convertMedicationProductIngredientComponent(org.hl7.fhir.instance.model.Medication.MedicationProductIngredientComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.Medication.MedicationProductIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationProductIngredientComponent(); +// copyElement(src, tgt); +// tgt.setItem(convertType(src.getItem())); +// tgt.setAmount(convertRatio(src.getAmount())); +// return tgt; +// } + +// public org.hl7.fhir.instance.model.Medication.MedicationProductIngredientComponent convertMedicationProductIngredientComponent(org.hl7.fhir.dstu3.model.Medication.MedicationProductIngredientComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.Medication.MedicationProductIngredientComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationProductIngredientComponent(); +// copyElement(src, tgt); +// if (src.hasItemReference()) +// tgt.setItem((org.hl7.fhir.instance.model.Reference) convertType(src.getItem())); +// tgt.setAmount(convertRatio(src.getAmount())); +// return tgt; +// } + +// public org.hl7.fhir.dstu3.model.Medication.MedicationProductBatchComponent convertMedicationProductBatchComponent(org.hl7.fhir.instance.model.Medication.MedicationProductBatchComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.Medication.MedicationProductBatchComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationProductBatchComponent(); +// copyElement(src, tgt); +// tgt.setLotNumber(src.getLotNumber()); +// tgt.setExpirationDate(src.getExpirationDate()); +// return tgt; +// } + +// public org.hl7.fhir.instance.model.Medication.MedicationProductBatchComponent convertMedicationProductBatchComponent(org.hl7.fhir.dstu3.model.Medication.MedicationProductBatchComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.Medication.MedicationProductBatchComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationProductBatchComponent(); +// copyElement(src, tgt); +// tgt.setLotNumber(src.getLotNumber()); +// tgt.setExpirationDate(src.getExpirationDate()); +// return tgt; +// } + + public org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.instance.model.Medication.MedicationPackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent(); + copyElement(src, tgt); + tgt.setContainer(convertCodeableConcept(src.getContainer())); + for (org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent t : src.getContent()) + tgt.addContent(convertMedicationPackageContentComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.dstu3.model.Medication.MedicationPackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationPackageComponent(); + copyElement(src, tgt); + tgt.setContainer(convertCodeableConcept(src.getContainer())); + for (org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent t : src.getContent()) + tgt.addContent(convertMedicationPackageContentComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent(); + copyElement(src, tgt); + tgt.setItem(convertType(src.getItem())); + tgt.setAmount(convertSimpleQuantity(src.getAmount())); + return tgt; + } + + public org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.dstu3.model.Medication.MedicationPackageContentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent(); + copyElement(src, tgt); + if (src.hasItemReference()) + tgt.setItem((org.hl7.fhir.instance.model.Reference) convertType(src.getItem())); + tgt.setAmount(convertSimpleQuantity(src.getAmount())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.instance.model.MedicationDispense src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.MedicationDispense tgt = new org.hl7.fhir.dstu3.model.MedicationDispense(); + copyDomainResource(src, tgt); + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + tgt.setMedication(convertType(src.getMedication())); + tgt.setSubject(convertReference(src.getPatient())); +// tgt.setDispenser(convertReference(src.getDispenser())); + for (org.hl7.fhir.instance.model.Reference t : src.getAuthorizingPrescription()) + tgt.addAuthorizingPrescription(convertReference(t)); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); + tgt.setWhenPrepared(src.getWhenPrepared()); + tgt.setWhenHandedOver(src.getWhenHandedOver()); + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.instance.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + if (src.hasNote()) + tgt.addNote().setText(src.getNote()); + for (org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent t : src.getDosageInstruction()) + tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + return tgt; + } + + public org.hl7.fhir.instance.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.dstu3.model.MedicationDispense src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MedicationDispense tgt = new org.hl7.fhir.instance.model.MedicationDispense(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep())); + tgt.setStatus(convertMedicationDispenseStatus(src.getStatus())); + tgt.setMedication(convertType(src.getMedication())); + tgt.setPatient(convertReference(src.getSubject())); +// tgt.setDispenser(convertReference(src.getDispenser())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthorizingPrescription()) + tgt.addAuthorizingPrescription(convertReference(t)); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply())); + tgt.setWhenPrepared(src.getWhenPrepared()); + tgt.setWhenHandedOver(src.getWhenHandedOver()); + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.setNote(t.getText()); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosageInstruction()) + tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t)); + tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS; + case ONHOLD: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ONHOLD; + case COMPLETED: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR; + case STOPPED: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.STOPPED; + default: return org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS; + case ONHOLD: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.ONHOLD; + case COMPLETED: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR; + case STOPPED: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.STOPPED; + default: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Dosage convertMedicationDispenseDosageInstructionComponent(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); + copyElement(src, tgt); + tgt.setText(src.getText()); +// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setDose(convertType(src.getDose())); + tgt.setRate(convertType(src.getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent convertMedicationDispenseDosageInstructionComponent(Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent tgt = new org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent(); + copyElement(src, tgt); + tgt.setText(src.getText()); +// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + tgt.setSite(convertType(src.getSite())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setDose(convertType(src.getDose())); + tgt.setRate(convertType(src.getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + copyElement(src, tgt); + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getResponsibleParty()) + tgt.addResponsibleParty(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent(); + copyElement(src, tgt); + tgt.setType(convertCodeableConcept(src.getType())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReason()) + tgt.addReason(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getResponsibleParty()) + tgt.addResponsibleParty(convertReference(t)); + return tgt; + } + +// public org.hl7.fhir.dstu3.model.MedicationOrder convertMedicationOrder(org.hl7.fhir.instance.model.MedicationOrder src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.MedicationOrder tgt = new org.hl7.fhir.dstu3.model.MedicationOrder(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// tgt.setStatus(convertMedicationOrderStatus(src.getStatus())); +// tgt.setMedication(convertType(src.getMedication())); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setEncounter(convertReference(src.getEncounter())); +// if (src.hasDateWritten()) +// tgt.setDateWritten(src.getDateWritten()); +// tgt.setPrescriber(convertReference(src.getPrescriber())); +// if (src.hasReasonCodeableConcept()) +// tgt.addReasonCode(convertCodeableConcept(src.getReasonCodeableConcept())); +// if (src.hasReasonReference()) +// tgt.addReasonReference(convertReference(src.getReasonReference())); +//// tgt.setDateEnded(src.getDateEnded()); +//// tgt.setReasonEnded(convertCodeableConcept(src.getReasonEnded())); +// if (src.hasNote()) +// tgt.addNote().setText(src.getNote()); +// for (org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent t : src.getDosageInstruction()) +// tgt.addDosageInstruction(convertMedicationOrderDosageInstructionComponent(t)); +// tgt.setDispenseRequest(convertMedicationOrderDispenseRequestComponent(src.getDispenseRequest())); +// tgt.setSubstitution(convertMedicationOrderSubstitutionComponent(src.getSubstitution())); +// tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); +// return tgt; +// } +// +// public org.hl7.fhir.instance.model.MedicationOrder convertMedicationOrder(org.hl7.fhir.dstu3.model.MedicationOrder src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.MedicationOrder tgt = new org.hl7.fhir.instance.model.MedicationOrder(); +// copyDomainResource(src, tgt); +// for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) +// tgt.addIdentifier(convertIdentifier(t)); +// tgt.setStatus(convertMedicationOrderStatus(src.getStatus())); +// tgt.setMedication(convertType(src.getMedication())); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setEncounter(convertReference(src.getEncounter())); +// if (src.hasDateWritten()) +// tgt.setDateWritten(src.getDateWritten()); +// tgt.setPrescriber(convertReference(src.getPrescriber())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonCode()) +// tgt.setReason(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getReasonReference()) +// tgt.setReason(convertReference(t)); +//// tgt.setDateEnded(src.getDateEnded()); +//// tgt.setReasonEnded(convertCodeableConcept(src.getReasonEnded())); +// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) +// tgt.setNote(t.getText()); +// for (org.hl7.fhir.dstu3.model.DosageInstruction t : src.getDosageInstruction()) +// tgt.addDosageInstruction(convertMedicationOrderDosageInstructionComponent(t)); +// tgt.setDispenseRequest(convertMedicationOrderDispenseRequestComponent(src.getDispenseRequest())); +// tgt.setSubstitution(convertMedicationOrderSubstitutionComponent(src.getSubstitution())); +// tgt.setPriorPrescription(convertReference(src.getPriorPrescription())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus convertMedicationOrderStatus(org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case ACTIVE: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.ACTIVE; +// case ONHOLD: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.ONHOLD; +// case COMPLETED: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.COMPLETED; +// case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.ENTEREDINERROR; +// case STOPPED: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.STOPPED; +// case DRAFT: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.DRAFT; +// default: return org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus.NULL; +// } +// } +// +// public org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus convertMedicationOrderStatus(org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderStatus src) throws FHIRException { +// if (src == null) +// return null; +// switch (src) { +// case ACTIVE: return org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus.ACTIVE; +// case ONHOLD: return org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus.ONHOLD; +// case COMPLETED: return org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus.COMPLETED; +// case ENTEREDINERROR: return org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus.ENTEREDINERROR; +// case STOPPED: return org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus.STOPPED; +// case DRAFT: return org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus.DRAFT; +// default: return org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderStatus.NULL; +// } +// } + + public org.hl7.fhir.dstu3.model.Dosage convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); + copyElement(src, tgt); + tgt.setText(src.getText()); +// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setDose(convertType(src.getDose())); + tgt.setRate(convertType(src.getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.dstu3.model.Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent tgt = new org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent(); + copyElement(src, tgt); + tgt.setText(src.getText()); +// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions())); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + tgt.setSite(convertType(src.getSite())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setDose(convertType(src.getDose())); + tgt.setRate(convertType(src.getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + +// public org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderDispenseRequestComponent convertMedicationOrderDispenseRequestComponent(org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDispenseRequestComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderDispenseRequestComponent tgt = new org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderDispenseRequestComponent(); +// copyElement(src, tgt); +//// tgt.setMedication(convertType(src.getMedication())); +// tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); +// tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); +// return tgt; +// } +// +// public org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDispenseRequestComponent convertMedicationOrderDispenseRequestComponent(org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderDispenseRequestComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDispenseRequestComponent tgt = new org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDispenseRequestComponent(); +// copyElement(src, tgt); +//// tgt.setMedication(convertType(src.getMedication())); +// tgt.setValidityPeriod(convertPeriod(src.getValidityPeriod())); +// tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed()); +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// tgt.setExpectedSupplyDuration(convertDuration(src.getExpectedSupplyDuration())); +// return tgt; +// } +// +// public org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderSubstitutionComponent convertMedicationOrderSubstitutionComponent(org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderSubstitutionComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderSubstitutionComponent tgt = new org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderSubstitutionComponent(); +// copyElement(src, tgt); +//// tgt.setType(convertCodeableConcept(src.getType())); +// tgt.setReason(convertCodeableConcept(src.getReason())); +// return tgt; +// } +// +// public org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderSubstitutionComponent convertMedicationOrderSubstitutionComponent(org.hl7.fhir.dstu3.model.MedicationOrder.MedicationOrderSubstitutionComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderSubstitutionComponent tgt = new org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderSubstitutionComponent(); +// copyElement(src, tgt); +//// tgt.setType(convertCodeableConcept(src.getType())); +// tgt.setReason(convertCodeableConcept(src.getReason())); +// return tgt; +// } + + public org.hl7.fhir.dstu3.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.instance.model.MedicationStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.MedicationStatement tgt = new org.hl7.fhir.dstu3.model.MedicationStatement(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + tgt.setMedication(convertType(src.getMedication())); + tgt.setSubject(convertReference(src.getPatient())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setInformationSource(convertReference(src.getInformationSource())); + for (org.hl7.fhir.instance.model.Reference t : src.getSupportingInformation()) + tgt.addDerivedFrom(convertReference(t)); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); +// tgt.getNotTakenElement().setValueAsString(src.getWasNotTaken() ? "Y" : "N"); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReasonNotTaken()) + tgt.addReasonNotTaken(convertCodeableConcept(t)); +// tgt.setReasonForUse(convertType(src.getReasonForUse())); + if (src.hasNote()) + tgt.addNote().setText(src.getNote()); + for (org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent t : src.getDosage()) + tgt.addDosage(convertMedicationStatementDosageComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.dstu3.model.MedicationStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MedicationStatement tgt = new org.hl7.fhir.instance.model.MedicationStatement(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertMedicationStatementStatus(src.getStatus())); + tgt.setMedication(convertType(src.getMedication())); + tgt.setPatient(convertReference(src.getSubject())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setInformationSource(convertReference(src.getInformationSource())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getDerivedFrom()) + tgt.addSupportingInformation(convertReference(t)); + if (src.hasDateAsserted()) + tgt.setDateAsserted(src.getDateAsserted()); +// tgt.setWasNotTaken("Y".equals(src.getNotTakenElement().getValueAsString())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotTaken()) + tgt.addReasonNotTaken(convertCodeableConcept(t)); +// tgt.setReasonForUse(convertType(src.getReasonForUse())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.setNote(t.getText()); + for (org.hl7.fhir.dstu3.model.Dosage t : src.getDosage()) + tgt.addDosage(convertMedicationStatementDosageComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.INTENDED; + default: return org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.dstu3.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR; + case INTENDED: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.INTENDED; + default: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Dosage convertMedicationStatementDosageComponent(org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Dosage tgt = new org.hl7.fhir.dstu3.model.Dosage(); + copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + if (src.hasSiteCodeableConcept()) + tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); +// tgt.setQuantity(convertType(src.getQuantity())); + tgt.setRate(convertType(src.getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent convertMedicationStatementDosageComponent(org.hl7.fhir.dstu3.model.Dosage src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent tgt = new org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent(); + copyElement(src, tgt); + tgt.setText(src.getText()); + tgt.setTiming(convertTiming(src.getTiming())); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + tgt.setSite(convertType(src.getSite())); + tgt.setRoute(convertCodeableConcept(src.getRoute())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); +// tgt.setQuantity(convertType(src.getQuantity())); + tgt.setRate(convertType(src.getRate())); + tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.MessageHeader convertMessageHeader(org.hl7.fhir.instance.model.MessageHeader src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.MessageHeader tgt = new org.hl7.fhir.dstu3.model.MessageHeader(); + copyDomainResource(src, tgt); + tgt.setTimestamp(src.getTimestamp()); + tgt.setEvent(convertCoding(src.getEvent())); + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + tgt.setSource(convertMessageSourceComponent(src.getSource())); + for (org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) + tgt.addDestination(convertMessageDestinationComponent(t)); + tgt.setEnterer(convertReference(src.getEnterer())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setReceiver(convertReference(src.getReceiver())); + tgt.setResponsible(convertReference(src.getResponsible())); + tgt.setReason(convertCodeableConcept(src.getReason())); + for (org.hl7.fhir.instance.model.Reference t : src.getData()) + tgt.addFocus(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.MessageHeader convertMessageHeader(org.hl7.fhir.dstu3.model.MessageHeader src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MessageHeader tgt = new org.hl7.fhir.instance.model.MessageHeader(); + copyDomainResource(src, tgt); + tgt.setTimestamp(src.getTimestamp()); + tgt.setEvent(convertCoding(src.getEvent())); + tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse())); + tgt.setSource(convertMessageSourceComponent(src.getSource())); + for (org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent t : src.getDestination()) + tgt.addDestination(convertMessageDestinationComponent(t)); + tgt.setEnterer(convertReference(src.getEnterer())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setReceiver(convertReference(src.getReceiver())); + tgt.setResponsible(convertReference(src.getResponsible())); + tgt.setReason(convertCodeableConcept(src.getReason())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getFocus()) + tgt.addData(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setCode(convertResponseType(src.getCode())); + tgt.setDetails(convertReference(src.getDetails())); + return tgt; + } + + public org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setCode(convertResponseType(src.getCode())); + tgt.setDetails(convertReference(src.getDetails())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.instance.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OK: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.FATALERROR; + default: return org.hl7.fhir.dstu3.model.MessageHeader.ResponseType.NULL; + } + } + + public org.hl7.fhir.instance.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.dstu3.model.MessageHeader.ResponseType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OK: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.OK; + case TRANSIENTERROR: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.TRANSIENTERROR; + case FATALERROR: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.FATALERROR; + default: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setSoftware(src.getSoftware()); + tgt.setVersion(src.getVersion()); + tgt.setContact(convertContactPoint(src.getContact())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageSourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setSoftware(src.getSoftware()); + tgt.setVersion(src.getVersion()); + tgt.setContact(convertContactPoint(src.getContact())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setTarget(convertReference(src.getTarget())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.dstu3.model.MessageHeader.MessageDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setTarget(convertReference(src.getTarget())); + tgt.setEndpoint(src.getEndpoint()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.NamingSystem convertNamingSystem(org.hl7.fhir.instance.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem(); + copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) + tgt.addContact(convertNamingSystemContactComponent(t)); + tgt.setResponsible(src.getResponsible()); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) + tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + tgt.setReplacedBy(convertReference(src.getReplacedBy())); + return tgt; + } + + public org.hl7.fhir.instance.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu3.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.NamingSystem tgt = new org.hl7.fhir.instance.model.NamingSystem(); + copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertNamingSystemContactComponent(t)); + tgt.setResponsible(src.getResponsible()); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) + tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + tgt.setReplacedBy(convertReference(src.getReplacedBy())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.instance.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODESYSTEM: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT; + default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL; + } + } + + public org.hl7.fhir.instance.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODESYSTEM: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.ROOT; + default: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent(); + copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent(); + copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + public org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OID: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Observation convertObservation(org.hl7.fhir.instance.model.Observation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Observation tgt = new org.hl7.fhir.dstu3.model.Observation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertObservationStatus(src.getStatus())); + tgt.addCategory(convertCodeableConcept(src.getCategory())); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setContext(convertReference(src.getEncounter())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.instance.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + tgt.setValue(convertType(src.getValue())); + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + tgt.setInterpretation(convertCodeableConcept(src.getInterpretation())); + tgt.setComment(src.getComments()); + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setSpecimen(convertReference(src.getSpecimen())); + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent t : src.getRelated()) + tgt.addRelated(convertObservationRelatedComponent(t)); + for (org.hl7.fhir.instance.model.Observation.ObservationComponentComponent t : src.getComponent()) + tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Observation convertObservation(org.hl7.fhir.dstu3.model.Observation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Observation tgt = new org.hl7.fhir.instance.model.Observation(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertObservationStatus(src.getStatus())); + for (org.hl7.fhir.dstu3.model.CodeableConcept c : src.getCategory()) + tgt.setCategory(convertCodeableConcept(c)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getContext())); + tgt.setEffective(convertType(src.getEffective())); + tgt.setIssued(src.getIssued()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getPerformer()) + tgt.addPerformer(convertReference(t)); + tgt.setValue(convertType(src.getValue())); + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + tgt.setInterpretation(convertCodeableConcept(src.getInterpretation())); + tgt.setComments(src.getComment()); + tgt.setBodySite(convertCodeableConcept(src.getBodySite())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + tgt.setSpecimen(convertReference(src.getSpecimen())); + tgt.setDevice(convertReference(src.getDevice())); + for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + for (org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent t : src.getRelated()) + tgt.addRelated(convertObservationRelatedComponent(t)); + for (org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent t : src.getComponent()) + tgt.addComponent(convertObservationComponentComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.instance.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.FINAL; + case AMENDED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.AMENDED; + case CANCELLED: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.UNKNOWN; + default: return org.hl7.fhir.dstu3.model.Observation.ObservationStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.dstu3.model.Observation.ObservationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REGISTERED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.REGISTERED; + case PRELIMINARY: return org.hl7.fhir.instance.model.Observation.ObservationStatus.PRELIMINARY; + case FINAL: return org.hl7.fhir.instance.model.Observation.ObservationStatus.FINAL; + case AMENDED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.AMENDED; + case CANCELLED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.CANCELLED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.Observation.ObservationStatus.ENTEREDINERROR; + case UNKNOWN: return org.hl7.fhir.instance.model.Observation.ObservationStatus.UNKNOWN; + default: return org.hl7.fhir.instance.model.Observation.ObservationStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + tgt.setType(convertCodeableConcept(src.getMeaning())); + tgt.setAge(convertRange(src.getAge())); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept c : src.getMeaning()) + tgt.setMeaning(convertCodeableConcept(src.getType())); + tgt.setAge(convertRange(src.getAge())); + tgt.setText(src.getText()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent(); + copyElement(src, tgt); + tgt.setType(convertObservationRelationshipType(src.getType())); + tgt.setTarget(convertReference(src.getTarget())); + return tgt; + } + + public org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.dstu3.model.Observation.ObservationRelatedComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent(); + copyElement(src, tgt); + tgt.setType(convertObservationRelationshipType(src.getType())); + tgt.setTarget(convertReference(src.getTarget())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.instance.model.Observation.ObservationRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HASMEMBER: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.HASMEMBER; + case DERIVEDFROM: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.DERIVEDFROM; + case SEQUELTO: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.SEQUELTO; + case REPLACES: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.REPLACES; + case QUALIFIEDBY: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.QUALIFIEDBY; + case INTERFEREDBY: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.INTERFEREDBY; + default: return org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType.NULL; + } + } + + public org.hl7.fhir.instance.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.dstu3.model.Observation.ObservationRelationshipType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HASMEMBER: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.HASMEMBER; + case DERIVEDFROM: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.DERIVEDFROM; + case SEQUELTO: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.SEQUELTO; + case REPLACES: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.REPLACES; + case QUALIFIEDBY: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.QUALIFIEDBY; + case INTERFEREDBY: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.INTERFEREDBY; + default: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.instance.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setValue(convertType(src.getValue())); + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationComponentComponent(); + copyElement(src, tgt); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setValue(convertType(src.getValue())); + tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason())); + for (org.hl7.fhir.dstu3.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange()) + tgt.addReferenceRange(convertObservationReferenceRangeComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.instance.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition tgt = new org.hl7.fhir.dstu3.model.OperationDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) + tgt.addContact(convertOperationDefinitionContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setPurpose(src.getRequirements()); + if (src.hasIdempotent()) + tgt.setIdempotent(src.getIdempotent()); + tgt.setCode(src.getCode()); + tgt.setComment(src.getNotes()); + tgt.setBase(convertReference(src.getBase())); + tgt.setSystem(src.getSystem()); + for (org.hl7.fhir.instance.model.CodeType t : src.getType()) + tgt.addResource(t.getValue()); + tgt.setType(tgt.hasResource()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu3.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.OperationDefinition tgt = new org.hl7.fhir.instance.model.OperationDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertOperationDefinitionContactComponent(t)); + tgt.setDescription(src.getDescription()); + tgt.setRequirements(src.getPurpose()); + tgt.setIdempotent(src.getIdempotent()); + tgt.setCode(src.getCode()); + tgt.setNotes(src.getComment()); + if (src.hasBase()) + tgt.setBase(convertReference(src.getBase())); + tgt.setSystem(src.getSystem()); + if (src.getType()) + for (org.hl7.fhir.dstu3.model.CodeType t : src.getResource()) + tgt.addType(t.getValue()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.instance.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OPERATION: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.QUERY; + default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.NULL; + } + } + + public org.hl7.fhir.instance.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OPERATION: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.QUERY; + default: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + tgt.setDocumentation(src.getDocumentation()); + tgt.setType(src.getType()); + tgt.setProfile(convertReference(src.getProfile())); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) + tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + tgt.setDocumentation(src.getDocumentation()); + if (src.hasSearchType()) { + tgt.setType(src.getSearchType().toCode()); + tgt.setType("string"); + } else + tgt.setType(src.getType()); + if (src.hasProfile()) + tgt.setProfile(convertReference(src.getProfile())); + if (src.hasBinding()) + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) + tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.IN; + case OUT: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.OUT; + default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.NULL; + } + } + + public org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.IN; + case OUT: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.OUT; + default: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.NULL; + } + } + + public org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.instance.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) + tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.OperationOutcome tgt = new org.hl7.fhir.instance.model.OperationOutcome(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) + tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); + copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(convertCodeableConcept(src.getDetails())); + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.instance.model.StringType t : src.getLocation()) + tgt.addLocation(t.getValue()); + return tgt; + } + + public org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent(); + copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(convertCodeableConcept(src.getDetails())); + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getLocation()) + tgt.addLocation(t.getValue()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FATAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION; + default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL; + } + } + + public org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FATAL: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.INFORMATION; + default: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.NULL; + } + } + + public org.hl7.fhir.dstu3.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.instance.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL; + default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL; + } + } + + public org.hl7.fhir.instance.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INVALID: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INFORMATIONAL; + default: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NULL; + } + } + + + public org.hl7.fhir.dstu3.model.Organization convertOrganization(org.hl7.fhir.instance.model.Organization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Organization tgt = new org.hl7.fhir.dstu3.model.Organization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setActive(src.getActive()); + tgt.addType(convertCodeableConcept(src.getType())); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.instance.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setPartOf(convertReference(src.getPartOf())); + for (org.hl7.fhir.instance.model.Organization.OrganizationContactComponent t : src.getContact()) + tgt.addContact(convertOrganizationContactComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Organization convertOrganization(org.hl7.fhir.dstu3.model.Organization src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Organization tgt = new org.hl7.fhir.instance.model.Organization(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setActive(src.getActive()); + tgt.setType(convertCodeableConcept(src.getTypeFirstRep())); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setPartOf(convertReference(src.getPartOf())); + for (org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent t : src.getContact()) + tgt.addContact(convertOrganizationContactComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.instance.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent(); + copyElement(src, tgt); + tgt.setPurpose(convertCodeableConcept(src.getPurpose())); + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + return tgt; + } + + public org.hl7.fhir.instance.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.dstu3.model.Organization.OrganizationContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.instance.model.Organization.OrganizationContactComponent(); + copyElement(src, tgt); + tgt.setPurpose(convertCodeableConcept(src.getPurpose())); + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + return tgt; + } + + + public org.hl7.fhir.dstu3.model.Patient convertPatient(org.hl7.fhir.instance.model.Patient src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Patient tgt = new org.hl7.fhir.dstu3.model.Patient(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.instance.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + tgt.setDeceased(convertType(src.getDeceased())); + for (org.hl7.fhir.instance.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); + tgt.setMultipleBirth(convertType(src.getMultipleBirth())); + for (org.hl7.fhir.instance.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + for (org.hl7.fhir.instance.model.Patient.ContactComponent t : src.getContact()) + tgt.addContact(convertContactComponent(t)); + tgt.setAnimal(convertAnimalComponent(src.getAnimal())); + for (org.hl7.fhir.instance.model.Patient.PatientCommunicationComponent t : src.getCommunication()) + tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getCareProvider()) + tgt.addGeneralPractitioner(convertReference(t)); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.instance.model.Patient.PatientLinkComponent t : src.getLink()) + tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Patient convertPatient(org.hl7.fhir.dstu3.model.Patient src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Patient tgt = new org.hl7.fhir.instance.model.Patient(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + tgt.setDeceased(convertType(src.getDeceased())); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setMaritalStatus(convertCodeableConcept(src.getMaritalStatus())); + tgt.setMultipleBirth(convertType(src.getMultipleBirth())); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + for (org.hl7.fhir.dstu3.model.Patient.ContactComponent t : src.getContact()) + tgt.addContact(convertContactComponent(t)); + tgt.setAnimal(convertAnimalComponent(src.getAnimal())); + for (org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent t : src.getCommunication()) + tgt.addCommunication(convertPatientCommunicationComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getGeneralPractitioner()) + tgt.addCareProvider(convertReference(t)); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + for (org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent t : src.getLink()) + tgt.addLink(convertPatientLinkComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.instance.model.Patient.ContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Patient.ContactComponent tgt = new org.hl7.fhir.dstu3.model.Patient.ContactComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRelationship()) + tgt.addRelationship(convertCodeableConcept(t)); + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setOrganization(convertReference(src.getOrganization())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.dstu3.model.Patient.ContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Patient.ContactComponent tgt = new org.hl7.fhir.instance.model.Patient.ContactComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getRelationship()) + tgt.addRelationship(convertCodeableConcept(t)); + tgt.setName(convertHumanName(src.getName())); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setAddress(convertAddress(src.getAddress())); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setOrganization(convertReference(src.getOrganization())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.instance.model.Patient.AnimalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Patient.AnimalComponent tgt = new org.hl7.fhir.dstu3.model.Patient.AnimalComponent(); + copyElement(src, tgt); + tgt.setSpecies(convertCodeableConcept(src.getSpecies())); + tgt.setBreed(convertCodeableConcept(src.getBreed())); + tgt.setGenderStatus(convertCodeableConcept(src.getGenderStatus())); + return tgt; + } + + public org.hl7.fhir.instance.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.dstu3.model.Patient.AnimalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Patient.AnimalComponent tgt = new org.hl7.fhir.instance.model.Patient.AnimalComponent(); + copyElement(src, tgt); + tgt.setSpecies(convertCodeableConcept(src.getSpecies())); + tgt.setBreed(convertCodeableConcept(src.getBreed())); + tgt.setGenderStatus(convertCodeableConcept(src.getGenderStatus())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.instance.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent(); + copyElement(src, tgt); + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public org.hl7.fhir.instance.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.dstu3.model.Patient.PatientCommunicationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Patient.PatientCommunicationComponent tgt = new org.hl7.fhir.instance.model.Patient.PatientCommunicationComponent(); + copyElement(src, tgt); + tgt.setLanguage(convertCodeableConcept(src.getLanguage())); + tgt.setPreferred(src.getPreferred()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.instance.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent(); + copyElement(src, tgt); + tgt.setOther(convertReference(src.getOther())); + tgt.setType(convertLinkType(src.getType())); + return tgt; + } + + public org.hl7.fhir.instance.model.Patient.PatientLinkComponent convertPatientLinkComponent(org.hl7.fhir.dstu3.model.Patient.PatientLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Patient.PatientLinkComponent tgt = new org.hl7.fhir.instance.model.Patient.PatientLinkComponent(); + copyElement(src, tgt); + tgt.setOther(convertReference(src.getOther())); + tgt.setType(convertLinkType(src.getType())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Patient.LinkType convertLinkType(org.hl7.fhir.instance.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACE: return org.hl7.fhir.dstu3.model.Patient.LinkType.REPLACEDBY; + case REFER: return org.hl7.fhir.dstu3.model.Patient.LinkType.REFER; + case SEEALSO: return org.hl7.fhir.dstu3.model.Patient.LinkType.SEEALSO; + default: return org.hl7.fhir.dstu3.model.Patient.LinkType.NULL; + } + } + + public org.hl7.fhir.instance.model.Patient.LinkType convertLinkType(org.hl7.fhir.dstu3.model.Patient.LinkType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REPLACEDBY: return org.hl7.fhir.instance.model.Patient.LinkType.REPLACE; + case REPLACES: return org.hl7.fhir.instance.model.Patient.LinkType.REPLACE; + case REFER: return org.hl7.fhir.instance.model.Patient.LinkType.REFER; + case SEEALSO: return org.hl7.fhir.instance.model.Patient.LinkType.SEEALSO; + default: return org.hl7.fhir.instance.model.Patient.LinkType.NULL; + } + } + + + public org.hl7.fhir.dstu3.model.Person convertPerson(org.hl7.fhir.instance.model.Person src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Person tgt = new org.hl7.fhir.dstu3.model.Person(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.instance.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.instance.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setPhoto(convertAttachment(src.getPhoto())); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.instance.model.Person.PersonLinkComponent t : src.getLink()) + tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Person convertPerson(org.hl7.fhir.dstu3.model.Person src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Person tgt = new org.hl7.fhir.instance.model.Person(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) + tgt.addName(convertHumanName(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setPhoto(convertAttachment(src.getPhoto())); + tgt.setManagingOrganization(convertReference(src.getManagingOrganization())); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.Person.PersonLinkComponent t : src.getLink()) + tgt.addLink(convertPersonLinkComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.instance.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.dstu3.model.Person.PersonLinkComponent(); + copyElement(src, tgt); + tgt.setTarget(convertReference(src.getTarget())); + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } + + public org.hl7.fhir.instance.model.Person.PersonLinkComponent convertPersonLinkComponent(org.hl7.fhir.dstu3.model.Person.PersonLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Person.PersonLinkComponent tgt = new org.hl7.fhir.instance.model.Person.PersonLinkComponent(); + copyElement(src, tgt); + tgt.setTarget(convertReference(src.getTarget())); + tgt.setAssurance(convertIdentityAssuranceLevel(src.getAssurance())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LEVEL1: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.LEVEL4; + default: return org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel.NULL; + } + } + + public org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.dstu3.model.Person.IdentityAssuranceLevel src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LEVEL1: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL1; + case LEVEL2: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL2; + case LEVEL3: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL3; + case LEVEL4: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL4; + default: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Practitioner convertPractitioner(org.hl7.fhir.instance.model.Practitioner src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Practitioner tgt = new org.hl7.fhir.dstu3.model.Practitioner(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setActive(src.getActive()); + if (src.hasName()) + tgt.addName(convertHumanName(src.getName())); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.instance.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.instance.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); +// for (org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent t : src.getPractitionerRole()) +// tgt.addRole(convertPractitionerPractitionerRoleComponent(t)); + for (org.hl7.fhir.instance.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) + tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCommunication()) + tgt.addCommunication(convertCodeableConcept(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Practitioner convertPractitioner(org.hl7.fhir.dstu3.model.Practitioner src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Practitioner tgt = new org.hl7.fhir.instance.model.Practitioner(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setActive(src.getActive()); + for (org.hl7.fhir.dstu3.model.HumanName t : src.getName()) + tgt.setName(convertHumanName(t)); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); +// for (org.hl7.fhir.dstu3.model.Practitioner.PractitionerRoleComponent t : src.getRole()) +// tgt.addPractitionerRole(convertPractitionerPractitionerRoleComponent(t)); + for (org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent t : src.getQualification()) + tgt.addQualification(convertPractitionerQualificationComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCommunication()) + tgt.addCommunication(convertCodeableConcept(t)); + return tgt; + } + +// public org.hl7.fhir.dstu3.model.Practitioner.PractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.dstu3.model.Practitioner.PractitionerRoleComponent tgt = new org.hl7.fhir.dstu3.model.Practitioner.PractitionerRoleComponent(); +// copyElement(src, tgt); +// tgt.setOrganization(convertReference(src.getManagingOrganization())); +// tgt.setCode(convertCodeableConcept(src.getRole())); +// for (org.hl7.fhir.instance.model.CodeableConcept t : src.getSpecialty()) +// tgt.addSpecialty(convertCodeableConcept(t)); +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// for (org.hl7.fhir.instance.model.Reference t : src.getLocation()) +// tgt.addLocation(convertReference(t)); +// for (org.hl7.fhir.instance.model.Reference t : src.getHealthcareService()) +// tgt.addHealthcareService(convertReference(t)); +// return tgt; +// } + +// public org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.dstu3.model.Practitioner.PractitionerRoleComponent src) throws FHIRException { +// if (src == null || src.isEmpty()) +// return null; +// org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent tgt = new org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent(); +// copyElement(src, tgt); +// tgt.setManagingOrganization(convertReference(src.getOrganization())); +// tgt.setRole(convertCodeableConcept(src.getCode())); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSpecialty()) +// tgt.addSpecialty(convertCodeableConcept(t)); +// tgt.setPeriod(convertPeriod(src.getPeriod())); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getLocation()) +// tgt.addLocation(convertReference(t)); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getHealthcareService()) +// tgt.addHealthcareService(convertReference(t)); +// return tgt; +// } + + public org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.instance.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setIssuer(convertReference(src.getIssuer())); + return tgt; + } + + public org.hl7.fhir.instance.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.dstu3.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Practitioner.PractitionerQualificationComponent tgt = new org.hl7.fhir.instance.model.Practitioner.PractitionerQualificationComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setIssuer(convertReference(src.getIssuer())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Procedure convertProcedure(org.hl7.fhir.instance.model.Procedure src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Procedure tgt = new org.hl7.fhir.dstu3.model.Procedure(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setStatus(convertProcedureStatus(src.getStatus())); + tgt.setCategory(convertCodeableConcept(src.getCategory())); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setNotDone(src.getNotPerformed()); +// for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReasonNotPerformed()) + if (src.hasReasonNotPerformed()) + tgt.setNotDoneReason(convertCodeableConcept(src.getReasonNotPerformed().get(0))); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + if (src.hasReasonCodeableConcept()) + tgt.addReasonCode(convertCodeableConcept(src.getReasonCodeableConcept())); + for (org.hl7.fhir.instance.model.Procedure.ProcedurePerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertProcedurePerformerComponent(t)); + tgt.setPerformed(convertType(src.getPerformed())); + tgt.setContext(convertReference(src.getEncounter())); + tgt.setLocation(convertReference(src.getLocation())); + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + for (org.hl7.fhir.instance.model.Reference t : src.getReport()) + tgt.addReport(convertReference(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getComplication()) + tgt.addComplication(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getFollowUp()) + tgt.addFollowUp(convertCodeableConcept(t)); + tgt.addBasedOn(convertReference(src.getRequest())); +// for (org.hl7.fhir.instance.model.Annotation t : src.getNotes()) +// tgt.addNotes(convertAnnotation(t)); + for (org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent t : src.getFocalDevice()) + tgt.addFocalDevice(convertProcedureFocalDeviceComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Procedure convertProcedure(org.hl7.fhir.dstu3.model.Procedure src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Procedure tgt = new org.hl7.fhir.instance.model.Procedure(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setStatus(convertProcedureStatus(src.getStatus())); + tgt.setCategory(convertCodeableConcept(src.getCategory())); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setNotPerformed(src.getNotDone()); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getReasonNotPerformed()) + tgt.addReasonNotPerformed(convertCodeableConcept(src.getNotDoneReason())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + tgt.setReason(convertType(src.getReasonCodeFirstRep())); + for (org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent t : src.getPerformer()) + tgt.addPerformer(convertProcedurePerformerComponent(t)); + tgt.setPerformed(convertType(src.getPerformed())); + tgt.setEncounter(convertReference(src.getContext())); + tgt.setLocation(convertReference(src.getLocation())); + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReport()) + tgt.addReport(convertReference(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getComplication()) + tgt.addComplication(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getFollowUp()) + tgt.addFollowUp(convertCodeableConcept(t)); + tgt.setRequest(convertReference(src.getBasedOnFirstRep())); +// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNotes()) +// tgt.addNotes(convertAnnotation(t)); + for (org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent t : src.getFocalDevice()) + tgt.addFocalDevice(convertProcedureFocalDeviceComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.instance.model.Procedure.ProcedureStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.INPROGRESS; + case ABORTED: return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ABORTED; + case COMPLETED: return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.dstu3.model.Procedure.ProcedureStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.INPROGRESS; + case ABORTED: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.ABORTED; + case COMPLETED: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.ENTEREDINERROR; + default: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.instance.model.Procedure.ProcedurePerformerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent tgt = new org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent(); + copyElement(src, tgt); + tgt.setActor(convertReference(src.getActor())); + tgt.setRole(convertCodeableConcept(src.getRole())); + return tgt; + } + + public org.hl7.fhir.instance.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.dstu3.model.Procedure.ProcedurePerformerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Procedure.ProcedurePerformerComponent tgt = new org.hl7.fhir.instance.model.Procedure.ProcedurePerformerComponent(); + copyElement(src, tgt); + tgt.setActor(convertReference(src.getActor())); + tgt.setRole(convertCodeableConcept(src.getRole())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent(); + copyElement(src, tgt); + tgt.setAction(convertCodeableConcept(src.getAction())); + tgt.setManipulated(convertReference(src.getManipulated())); + return tgt; + } + + public org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.dstu3.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent(); + copyElement(src, tgt); + tgt.setAction(convertCodeableConcept(src.getAction())); + tgt.setManipulated(convertReference(src.getManipulated())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ProcedureRequest convertProcedureRequest(org.hl7.fhir.instance.model.ProcedureRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ProcedureRequest tgt = new org.hl7.fhir.dstu3.model.ProcedureRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + if (src.hasReasonCodeableConcept()) + tgt.addReasonCode(convertCodeableConcept(src.getReasonCodeableConcept())); + tgt.setOccurrence(convertType(src.getScheduled())); + tgt.setContext(convertReference(src.getEncounter())); + tgt.setPerformer(convertReference(src.getPerformer())); + tgt.setStatus(convertProcedureRequestStatus(src.getStatus())); +// for (org.hl7.fhir.instance.model.Annotation t : src.getNotes()) +// tgt.addNotes(convertAnnotation(t)); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + tgt.setAuthoredOn(src.getOrderedOn()); +// tgt.setOrderer(convertReference(src.getOrderer())); + tgt.setPriority(convertProcedureRequestPriority(src.getPriority())); + return tgt; + } + + public org.hl7.fhir.instance.model.ProcedureRequest convertProcedureRequest(org.hl7.fhir.dstu3.model.ProcedureRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ProcedureRequest tgt = new org.hl7.fhir.instance.model.ProcedureRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setCode(convertCodeableConcept(src.getCode())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getBodySite()) + tgt.addBodySite(convertCodeableConcept(t)); + tgt.setReason(convertType(src.getReasonCodeFirstRep())); + tgt.setScheduled(convertType(src.getOccurrence())); + tgt.setEncounter(convertReference(src.getContext())); + tgt.setPerformer(convertReference(src.getPerformer())); + tgt.setStatus(convertProcedureRequestStatus(src.getStatus())); +// for (org.hl7.fhir.dstu3.model.Annotation t : src.getNotes()) +// tgt.addNotes(convertAnnotation(t)); + tgt.setAsNeeded(convertType(src.getAsNeeded())); + tgt.setOrderedOn(src.getAuthoredOn()); +// tgt.setOrderer(convertReference(src.getOrderer())); + tgt.setPriority(convertProcedureRequestPriority(src.getPriority())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus convertProcedureRequestStatus(org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PROPOSED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; + case DRAFT: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; + case REQUESTED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; + case RECEIVED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; + case ACCEPTED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; + case INPROGRESS: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.COMPLETED; + case SUSPENDED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.SUSPENDED; +// case REJECTED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.REJECTED; + case ABORTED: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus convertProcedureRequestStatus(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { +// case PROPOSED: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.PROPOSED; + case DRAFT: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.DRAFT; +// case REQUESTED: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.REQUESTED; +// case RECEIVED: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.RECEIVED; +// case ACCEPTED: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.ACCEPTED; + case ACTIVE: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.COMPLETED; + case SUSPENDED: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.SUSPENDED; +// case REJECTED: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.REJECTED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.ABORTED; + default: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.URGENT; + case STAT: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.STAT; + case ASAP: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.ASAP; + default: return org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority.NULL; + } + } + + public org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.dstu3.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ROUTINE: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE; + case URGENT: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.URGENT; + case STAT: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.STAT; + case ASAP: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.ASAP; + default: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.NULL; + } + } + + + public org.hl7.fhir.dstu3.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.instance.model.ProcessRequest.ActionList src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CANCEL: return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.CANCEL; + case POLL: return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.POLL; + case REPROCESS: return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.REPROCESS; + case STATUS: return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.STATUS; + default: return org.hl7.fhir.dstu3.model.ProcessRequest.ActionList.NULL; + } + } + + public org.hl7.fhir.instance.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.dstu3.model.ProcessRequest.ActionList src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CANCEL: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.CANCEL; + case POLL: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.POLL; + case REPROCESS: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.REPROCESS; + case STATUS: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.STATUS; + default: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent(); + copyElement(src, tgt); + tgt.setSequenceLinkId(src.getSequenceLinkId()); + return tgt; + } + + public org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.dstu3.model.ProcessRequest.ItemsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent(); + copyElement(src, tgt); + tgt.setSequenceLinkId(src.getSequenceLinkId()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Provenance convertProvenance(org.hl7.fhir.instance.model.Provenance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Provenance tgt = new org.hl7.fhir.dstu3.model.Provenance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Reference t : src.getTarget()) + tgt.addTarget(convertReference(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setRecorded(src.getRecorded()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason()) + for (org.hl7.fhir.instance.model.Coding tc : t.getCoding()) + tgt.addReason(convertCoding(tc)); + for (org.hl7.fhir.instance.model.Coding t : src.getActivity().getCoding()) + tgt.setActivity(convertCoding(t)); + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.instance.model.UriType t : src.getPolicy()) + tgt.addPolicy(t.getValue()); + for (org.hl7.fhir.instance.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) + tgt.addAgent(convertProvenanceAgentComponent(t)); + for (org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) + tgt.addEntity(convertProvenanceEntityComponent(t)); + for (org.hl7.fhir.instance.model.Signature t : src.getSignature()) + tgt.addSignature(convertSignature(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Provenance convertProvenance(org.hl7.fhir.dstu3.model.Provenance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Provenance tgt = new org.hl7.fhir.instance.model.Provenance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Reference t : src.getTarget()) + tgt.addTarget(convertReference(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setRecorded(src.getRecorded()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getReason()) + tgt.addReason().addCoding(convertCoding(t)); + tgt.setActivity(new org.hl7.fhir.instance.model.CodeableConcept().addCoding(convertCoding(src.getActivity()))); + tgt.setLocation(convertReference(src.getLocation())); + for (org.hl7.fhir.dstu3.model.UriType t : src.getPolicy()) + tgt.addPolicy(t.getValue()); + for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) + tgt.addAgent(convertProvenanceAgentComponent(t)); + for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent t : src.getEntity()) + tgt.addEntity(convertProvenanceEntityComponent(t)); + for (org.hl7.fhir.dstu3.model.Signature t : src.getSignature()) + tgt.addSignature(convertSignature(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.instance.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent(); + copyElement(src, tgt); +// tgt.setRole(convertCoding(src.getRole())); + tgt.setWho(convertReference(src.getActor())); + return tgt; + } + + public org.hl7.fhir.instance.model.Provenance.ProvenanceAgentComponent convertProvenanceAgentComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Provenance.ProvenanceAgentComponent tgt = new org.hl7.fhir.instance.model.Provenance.ProvenanceAgentComponent(); + copyElement(src, tgt); +// tgt.setRole(convertCoding(src.getRole())); + if (src.hasWhoReference()) + tgt.setActor(convertReference(src.getWhoReference())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent(); + copyElement(src, tgt); + tgt.setRole(convertProvenanceEntityRole(src.getRole())); + if (src.hasReference()) + tgt.setWhat(new org.hl7.fhir.dstu3.model.Reference().setReference(src.getReference())); + tgt.addAgent(convertProvenanceAgentComponent(src.getAgent())); + return tgt; + } + + public org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent convertProvenanceEntityComponent(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent tgt = new org.hl7.fhir.instance.model.Provenance.ProvenanceEntityComponent(); + copyElement(src, tgt); + tgt.setRole(convertProvenanceEntityRole(src.getRole())); + if (src.hasWhatReference() && src.getWhatReference().hasReference()) + tgt.setReference(src.getWhatReference().getReference()); + for (org.hl7.fhir.dstu3.model.Provenance.ProvenanceAgentComponent t : src.getAgent()) + tgt.setAgent(convertProvenanceAgentComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.instance.model.Provenance.ProvenanceEntityRole src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DERIVATION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.DERIVATION; + case REVISION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.REVISION; + case QUOTATION: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.QUOTATION; + case SOURCE: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.SOURCE; + default: return org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole.NULL; + } + } + + public org.hl7.fhir.instance.model.Provenance.ProvenanceEntityRole convertProvenanceEntityRole(org.hl7.fhir.dstu3.model.Provenance.ProvenanceEntityRole src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DERIVATION: return org.hl7.fhir.instance.model.Provenance.ProvenanceEntityRole.DERIVATION; + case REVISION: return org.hl7.fhir.instance.model.Provenance.ProvenanceEntityRole.REVISION; + case QUOTATION: return org.hl7.fhir.instance.model.Provenance.ProvenanceEntityRole.QUOTATION; + case SOURCE: return org.hl7.fhir.instance.model.Provenance.ProvenanceEntityRole.SOURCE; + default: return org.hl7.fhir.instance.model.Provenance.ProvenanceEntityRole.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Questionnaire convertQuestionnaire(org.hl7.fhir.instance.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Questionnaire tgt = new org.hl7.fhir.dstu3.model.Questionnaire(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + org.hl7.fhir.instance.model.Questionnaire.GroupComponent root = src.getGroup(); + tgt.setTitle(root.getTitle()); + for (org.hl7.fhir.instance.model.Coding t : root.getConcept()) + tgt.addCode(convertCoding(t)); + for (org.hl7.fhir.instance.model.CodeType t : src.getSubjectType()) + tgt.addSubjectType(t.getValue()); + tgt.addItem(convertQuestionnaireGroupComponent(root)); + return tgt; + } + + public org.hl7.fhir.instance.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu3.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Questionnaire tgt = new org.hl7.fhir.instance.model.Questionnaire(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + org.hl7.fhir.instance.model.Questionnaire.GroupComponent root = tgt.getGroup(); + root.setTitle(src.getTitle()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) { + root.addConcept(convertCoding(t)); + } + for (org.hl7.fhir.dstu3.model.CodeType t : src.getSubjectType()) + tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + if (t.getType() == org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP) + root.addGroup(convertQuestionnaireGroupComponent(t)); + else + root.addQuestion(convertQuestionnaireQuestionComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.DRAFT; + case PUBLISHED: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.PUBLISHED; + case RETIRED: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.RETIRED; + default: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.DRAFT; + case PUBLISHED: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.PUBLISHED; + case RETIRED: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.RETIRED; + default: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.instance.model.Questionnaire.QuestionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.instance.model.Coding t : src.getConcept()) + tgt.addCode(convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireQuestionType(src.getType())); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + tgt.setOptions(convertReference(src.getOptions())); + for (org.hl7.fhir.instance.model.Coding t : src.getOption()) + tgt.addOption().setValue(convertCoding(t)); + for (org.hl7.fhir.instance.model.Questionnaire.GroupComponent t : src.getGroup()) + tgt.addItem(convertQuestionnaireGroupComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireGroupComponent(org.hl7.fhir.instance.model.Questionnaire.GroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.instance.model.Coding t : src.getConcept()) + tgt.addCode(convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + for (org.hl7.fhir.instance.model.Questionnaire.GroupComponent t : src.getGroup()) + tgt.addItem(convertQuestionnaireGroupComponent(t)); + for (org.hl7.fhir.instance.model.Questionnaire.QuestionComponent t : src.getQuestion()) + tgt.addItem(convertQuestionnaireQuestionComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Questionnaire.GroupComponent convertQuestionnaireGroupComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Questionnaire.GroupComponent tgt = new org.hl7.fhir.instance.model.Questionnaire.GroupComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) + tgt.addConcept(convertCoding(t)); + tgt.setText(src.getText()); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + if (t.getType() == org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP) + tgt.addGroup(convertQuestionnaireGroupComponent(t)); + else + tgt.addQuestion(convertQuestionnaireQuestionComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Questionnaire.QuestionComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Questionnaire.QuestionComponent tgt = new org.hl7.fhir.instance.model.Questionnaire.QuestionComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) + tgt.addConcept(convertCoding(t)); + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireItemType(src.getType())); + tgt.setRequired(src.getRequired()); + tgt.setRepeats(src.getRepeats()); + tgt.setOptions(convertReference(src.getOptions())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) + if (t.hasValueCoding()) + try { + tgt.addOption(convertCoding(t.getValueCoding())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addGroup(convertQuestionnaireGroupComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType convertQuestionnaireQuestionType(org.hl7.fhir.instance.model.Questionnaire.AnswerFormat src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BOOLEAN: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; + case INSTANT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + public org.hl7.fhir.instance.model.Questionnaire.AnswerFormat convertQuestionnaireItemType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BOOLEAN: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.BOOLEAN; + case DECIMAL: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DECIMAL; + case INTEGER: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.INTEGER; + case DATE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DATE; + case DATETIME: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DATETIME; + case TIME: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.TIME; + case STRING: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.STRING; + case TEXT: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.TEXT; + case URL: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.URL; + case CHOICE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.CHOICE; + case OPENCHOICE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.OPENCHOICE; + case ATTACHMENT: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.ATTACHMENT; + case REFERENCE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.REFERENCE; + case QUANTITY: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.QUANTITY; + default: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.NULL; + } + } + + public org.hl7.fhir.dstu3.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.instance.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaire(convertReference(src.getQuestionnaire())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setAuthored(src.getAuthored()); + tgt.setSource(convertReference(src.getSource())); + tgt.setContext(convertReference(src.getEncounter())); + if (src.hasGroup()) + tgt.addItem(convertQuestionnaireResponseGroupComponent(src.getGroup())); + return tgt; + } + + public org.hl7.fhir.instance.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.QuestionnaireResponse tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaire(convertReference(src.getQuestionnaire())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setAuthor(convertReference(src.getAuthor())); + tgt.setAuthored(src.getAuthored()); + tgt.setSource(convertReference(src.getSource())); + tgt.setEncounter(convertReference(src.getContext())); + + if (src.getItem().size() != 1) + throw new FHIRException("multiple root items not supported"); // though we could define a placeholder group? + + tgt.setGroup(convertQuestionnaireItemToGroup(src.getItem().get(0))); + return tgt; + } + + + public org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseGroupComponent(org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) + tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); + for (org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent t : src.getQuestion()) + tgt.addItem(convertQuestionnaireResponseQuestionComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseQuestionComponent(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent convertQuestionnaireItemToGroup(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + if (t.hasAnswer()) + tgt.addQuestion(convertQuestionnaireItemToQuestion(t)); + else + tgt.addGroup(convertQuestionnaireItemToGroup(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent convertQuestionnaireItemToQuestion(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent(); + copyElement(src, tgt); + tgt.setLinkId(src.getLinkId()); + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + copyElement(src, tgt); + tgt.setValue(convertType(src.getValue())); + for (org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent t : src.getGroup()) + tgt.addItem(convertQuestionnaireResponseGroupComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent(); + copyElement(src, tgt); + tgt.setValue(convertType(src.getValue())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addGroup(convertQuestionnaireItemToGroup(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ReferralRequest convertReferralRequest(org.hl7.fhir.instance.model.ReferralRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ReferralRequest tgt = new org.hl7.fhir.dstu3.model.ReferralRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertReferralStatus(src.getStatus())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setPriority(convertReferralPriorityCode(src.getPriority())); + tgt.setSubject(convertReference(src.getPatient())); + tgt.setOccurrence(convertPeriod(src.getFulfillmentTime())); + tgt.getRequester().setAgent(convertReference(src.getRequester())); + tgt.setSpecialty(convertCodeableConcept(src.getSpecialty())); + for (org.hl7.fhir.instance.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + tgt.addReasonCode(convertCodeableConcept(src.getReason())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getServiceRequested()) + tgt.addServiceRequested(convertCodeableConcept(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getSupportingInformation()) + tgt.addSupportingInfo(convertReference(t)); + return tgt; + } + + private ReferralPriority convertReferralPriorityCode(CodeableConcept priority) { + for (org.hl7.fhir.instance.model.Coding c : priority.getCoding()) { + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.ROUTINE; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.URGENT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.STAT; + if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode())) + return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority.ASAP; + } + return null; + } + + public org.hl7.fhir.instance.model.ReferralRequest convertReferralRequest(org.hl7.fhir.dstu3.model.ReferralRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ReferralRequest tgt = new org.hl7.fhir.instance.model.ReferralRequest(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setStatus(convertReferralStatus(src.getStatus())); + tgt.setType(convertCodeableConcept(src.getType())); + tgt.setPriority(convertReferralPriorityCode(src.getPriority())); + tgt.setPatient(convertReference(src.getSubject())); + tgt.setFulfillmentTime(convertPeriod(src.getOccurrencePeriod())); + tgt.setRequester(convertReference(src.getRequester().getAgent())); + tgt.setSpecialty(convertCodeableConcept(src.getSpecialty())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getRecipient()) + tgt.addRecipient(convertReference(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept cc : src.getReasonCode()) + tgt.setReason(convertCodeableConcept(cc)); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceRequested()) + tgt.addServiceRequested(convertCodeableConcept(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getSupportingInfo()) + tgt.addSupportingInformation(convertReference(t)); + return tgt; + } + + private org.hl7.fhir.instance.model.CodeableConcept convertReferralPriorityCode(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralPriority priority) { + org.hl7.fhir.instance.model.CodeableConcept cc = new org.hl7.fhir.instance.model.CodeableConcept(); + switch (priority) { + case ROUTINE: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); break; + case URGENT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); break; + case STAT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); break; + case ASAP: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); break; + default: return null; + } + return cc; + } + + + public org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus convertReferralStatus(org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.DRAFT; + case REQUESTED: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.CANCELLED; + case ACCEPTED: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ACTIVE; + case REJECTED: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.ENTEREDINERROR; + case COMPLETED: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.COMPLETED; + default: return org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus convertReferralStatus(org.hl7.fhir.dstu3.model.ReferralRequest.ReferralRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus.ACTIVE; + case CANCELLED: return org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus.CANCELLED; + case COMPLETED: return org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus.COMPLETED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus.REJECTED; + default: return org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.instance.model.RelatedPerson src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.RelatedPerson tgt = new org.hl7.fhir.dstu3.model.RelatedPerson(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); + tgt.addName(convertHumanName(src.getName())); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.instance.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + for (org.hl7.fhir.instance.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.instance.model.RelatedPerson convertRelatedPerson(org.hl7.fhir.dstu3.model.RelatedPerson src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.RelatedPerson tgt = new org.hl7.fhir.instance.model.RelatedPerson(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setRelationship(convertCodeableConcept(src.getRelationship())); + if (!src.getName().isEmpty()) + tgt.setName(convertHumanName(src.getName().get(0))); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + tgt.setGender(convertAdministrativeGender(src.getGender())); + tgt.setBirthDate(src.getBirthDate()); + for (org.hl7.fhir.dstu3.model.Address t : src.getAddress()) + tgt.addAddress(convertAddress(t)); + for (org.hl7.fhir.dstu3.model.Attachment t : src.getPhoto()) + tgt.addPhoto(convertAttachment(t)); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.instance.model.RiskAssessment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.RiskAssessment tgt = new org.hl7.fhir.dstu3.model.RiskAssessment(); + copyDomainResource(src, tgt); + tgt.setSubject(convertReference(src.getSubject())); +// tgt.setDate(src.getDate()); + tgt.setCondition(convertReference(src.getCondition())); + tgt.setContext(convertReference(src.getEncounter())); + tgt.setPerformer(convertReference(src.getPerformer())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + for (org.hl7.fhir.instance.model.Reference t : src.getBasis()) + tgt.addBasis(convertReference(t)); + for (org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) + tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + tgt.setMitigation(src.getMitigation()); + return tgt; + } + + public org.hl7.fhir.instance.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.dstu3.model.RiskAssessment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.RiskAssessment tgt = new org.hl7.fhir.instance.model.RiskAssessment(); + copyDomainResource(src, tgt); + tgt.setSubject(convertReference(src.getSubject())); +// tgt.setDateElement(src.getOccurrenceDateTimeType()); + tgt.setCondition(convertReference(src.getCondition())); + tgt.setEncounter(convertReference(src.getContext())); + tgt.setPerformer(convertReference(src.getPerformer())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setMethod(convertCodeableConcept(src.getMethod())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getBasis()) + tgt.addBasis(convertReference(t)); + for (org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction()) + tgt.addPrediction(convertRiskAssessmentPredictionComponent(t)); + tgt.setMitigation(src.getMitigation()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent(); + copyElement(src, tgt); + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + tgt.setProbability(convertType(src.getProbability())); + tgt.setRelativeRisk(src.getRelativeRisk()); + tgt.setWhen(convertType(src.getWhen())); + tgt.setRationale(src.getRationale()); + return tgt; + } + + public org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.dstu3.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent(); + copyElement(src, tgt); + tgt.setOutcome(convertCodeableConcept(src.getOutcome())); + tgt.setProbability(convertType(src.getProbability())); + tgt.setRelativeRisk(src.getRelativeRisk()); + tgt.setWhen(convertType(src.getWhen())); + tgt.setRationale(src.getRationale()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Schedule convertSchedule(org.hl7.fhir.instance.model.Schedule src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Schedule tgt = new org.hl7.fhir.dstu3.model.Schedule(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType()) + tgt.addServiceType(convertCodeableConcept(t)); + tgt.addActor(convertReference(src.getActor())); + tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); + tgt.setComment(src.getComment()); + return tgt; + } + + public org.hl7.fhir.instance.model.Schedule convertSchedule(org.hl7.fhir.dstu3.model.Schedule src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Schedule tgt = new org.hl7.fhir.instance.model.Schedule(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) + tgt.addType(convertCodeableConcept(t)); + tgt.setActor(convertReference(src.getActorFirstRep())); + tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon())); + tgt.setComment(src.getComment()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.SearchParameter convertSearchParameter(org.hl7.fhir.instance.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SearchParameter tgt = new org.hl7.fhir.dstu3.model.SearchParameter(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) + tgt.addContact(convertSearchParameterContactComponent(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCode(src.getCode()); + tgt.addBase(src.getBase()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION)); + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.instance.model.CodeType t : src.getTarget()) + tgt.addTarget(t.getValue()); + return tgt; + } + + public org.hl7.fhir.instance.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu3.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.SearchParameter tgt = new org.hl7.fhir.instance.model.SearchParameter(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertSearchParameterContactComponent(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getBase()) + tgt.setBase(t.asStringValue()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + org.hl7.fhir.dstu2.utils.ToolingExtensions.setStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression()); + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget()) + tgt.addTarget(t.getValue()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.instance.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NORMAL: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.OTHER; + default: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NULL; + } + } + + public org.hl7.fhir.instance.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NORMAL: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.OTHER; + default: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Slot convertSlot(org.hl7.fhir.instance.model.Slot src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Slot tgt = new org.hl7.fhir.dstu3.model.Slot(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasType()) + tgt.addServiceType(convertCodeableConcept(src.getType())); + tgt.setSchedule(convertReference(src.getSchedule())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setOverbooked(src.getOverbooked()); + tgt.setComment(src.getComment()); + return tgt; + } + + public org.hl7.fhir.instance.model.Slot convertSlot(org.hl7.fhir.dstu3.model.Slot src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Slot tgt = new org.hl7.fhir.instance.model.Slot(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getServiceType()) + tgt.setType(convertCodeableConcept(t)); + tgt.setSchedule(convertReference(src.getSchedule())); + tgt.setStart(src.getStart()); + tgt.setEnd(src.getEnd()); + tgt.setOverbooked(src.getOverbooked()); + tgt.setComment(src.getComment()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.instance.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BUSY: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSY; + case FREE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.BUSYTENTATIVE; + default: return org.hl7.fhir.dstu3.model.Slot.SlotStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.dstu3.model.Slot.SlotStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case BUSY: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSY; + case FREE: return org.hl7.fhir.instance.model.Slot.SlotStatus.FREE; + case BUSYUNAVAILABLE: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSYUNAVAILABLE; + case BUSYTENTATIVE: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSYTENTATIVE; + default: return org.hl7.fhir.instance.model.Slot.SlotStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.instance.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setTitle(src.getDisplay()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) + tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.instance.model.Coding t : src.getCode()) + tgt.addKeyword(convertCoding(t)); + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind(), tgt.getId())); + tgt.setAbstract(src.getAbstract()); + tgt.setContextType(convertExtensionContext(src.getContextType())); + for (org.hl7.fhir.instance.model.StringType t : src.getContext()) + tgt.addContext(t.getValue()); + if (src.hasConstrainedType()) + tgt.setType(src.getConstrainedType()); + else if (src.getSnapshot().hasElement()) + tgt.setType(src.getSnapshot().getElement().get(0).getPath()); + else if (src.getDifferential().hasElement() && !src.getDifferential().getElement().get(0).getPath().contains(".")) + tgt.setType(src.getDifferential().getElement().get(0).getPath()); + else + tgt.setType(src.getDifferential().getElement().get(0).getPath().substring(0, src.getDifferential().getElement().get(0).getPath().indexOf("."))); + tgt.setBaseDefinition(src.getBase()); + tgt.setDerivation(src.hasConstrainedType() ? org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT : org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION); + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + if (tgt.hasSnapshot()) + tgt.getSnapshot().getElementFirstRep().getType().clear(); + if (tgt.hasDifferential()) + tgt.getDifferential().getElementFirstRep().getType().clear(); + if (tgt.getKind() == StructureDefinitionKind.PRIMITIVETYPE && !tgt.getType().equals(tgt.getId())) { + tgt.setDerivation(TypeDerivationRule.SPECIALIZATION); + tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/"+tgt.getType()); +// for (ElementDefinition ed : tgt.getSnapshot().getElement()) { +// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); +// } +// for (ElementDefinition ed : tgt.getDifferential().getElement()) { +// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+".")); +// } + tgt.setType(tgt.getId()); + } + return tgt; + } + + public org.hl7.fhir.instance.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.StructureDefinition tgt = new org.hl7.fhir.instance.model.StructureDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setDisplay(src.getTitle()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) + tgt.addCode(convertCoding(t)); + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + tgt.setAbstract(src.getAbstract()); + tgt.setContextType(convertExtensionContext(src.getContextType())); + for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) + tgt.addContext(t.getValue()); + tgt.setConstrainedType(src.getType()); + tgt.setBase(src.getBaseDefinition()); + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + if (tgt.hasBase()) { + if (tgt.hasDifferential()) + tgt.getDifferential().getElement().get(0).addType().setCode(tail(tgt.getBase())); + if (tgt.hasSnapshot()) + tgt.getSnapshot().getElement().get(0).addType().setCode(tail(tgt.getBase())); + } + return tgt; + } + + private String tail(String base) { + return base.substring(base.lastIndexOf("/")+1); + } + + public org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind src, String dtName) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DATATYPE: + if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown")) + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE; + else + return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRIMITIVETYPE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case COMPLEXTYPE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case RESOURCE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + public org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESOURCE: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; + case DATATYPE: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; + case EXTENSION: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; + default: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; + } + } + + public org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESOURCE: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.RESOURCE; + case DATATYPE: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.DATATYPE; + case EXTENSION: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.EXTENSION; + default: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComment(src.getComments()); + return tgt; + } + + public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + tgt.setUri(src.getUri()); + tgt.setName(src.getName()); + tgt.setComments(src.getComment()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + copyElement(src, tgt); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.addElement(convertElementDefinition(t, slicePaths)); + } + return tgt; + } + + public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + copyElement(src, tgt); + List slicePaths = new ArrayList(); + for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) { + if (t.hasSlicing()) + slicePaths.add(t.getPath()); + tgt.addElement(convertElementDefinition(t, slicePaths)); + } + return tgt; + } + + public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Subscription convertSubscription(org.hl7.fhir.instance.model.Subscription src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Subscription tgt = new org.hl7.fhir.dstu3.model.Subscription(); + copyDomainResource(src, tgt); + tgt.setCriteria(src.getCriteria()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + tgt.setReason(src.getReason()); + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + tgt.setError(src.getError()); + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.instance.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Subscription convertSubscription(org.hl7.fhir.dstu3.model.Subscription src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Subscription tgt = new org.hl7.fhir.instance.model.Subscription(); + copyDomainResource(src, tgt); + tgt.setCriteria(src.getCriteria()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getContact()) + tgt.addContact(convertContactPoint(t)); + tgt.setReason(src.getReason()); + tgt.setStatus(convertSubscriptionStatus(src.getStatus())); + tgt.setError(src.getError()); + tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel())); + tgt.setEnd(src.getEnd()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.instance.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUESTED: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.ERROR; + case OFF: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.OFF; + default: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.dstu3.model.Subscription.SubscriptionStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUESTED: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.REQUESTED; + case ACTIVE: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.ACTIVE; + case ERROR: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.ERROR; + case OFF: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.OFF; + default: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent(); + copyElement(src, tgt); + tgt.setType(convertSubscriptionChannelType(src.getType())); + tgt.setEndpoint(src.getEndpoint()); + tgt.setPayload(src.getPayload()); + tgt.addHeader(src.getHeader()); + return tgt; + } + + public org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent(); + copyElement(src, tgt); + tgt.setType(convertSubscriptionChannelType(src.getType())); + tgt.setEndpoint(src.getEndpoint()); + tgt.setPayload(src.getPayload()); + if (src.hasHeader()) + tgt.setHeaderElement(convertString(src.getHeader().get(0))); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESTHOOK: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.MESSAGE; + default: return org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType.NULL; + } + } + + public org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.dstu3.model.Subscription.SubscriptionChannelType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESTHOOK: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.RESTHOOK; + case WEBSOCKET: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.WEBSOCKET; + case EMAIL: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.EMAIL; + case SMS: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.SMS; + case MESSAGE: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.MESSAGE; + default: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.Substance convertSubstance(org.hl7.fhir.instance.model.Substance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Substance tgt = new org.hl7.fhir.dstu3.model.Substance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent t : src.getInstance()) + tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.Substance convertSubstance(org.hl7.fhir.dstu3.model.Substance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Substance tgt = new org.hl7.fhir.instance.model.Substance(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory()) + tgt.addCategory(convertCodeableConcept(t)); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent t : src.getInstance()) + tgt.addInstance(convertSubstanceInstanceComponent(t)); + for (org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent t : src.getIngredient()) + tgt.addIngredient(convertSubstanceIngredientComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setExpiry(src.getExpiry()); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceInstanceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent(); + copyElement(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setExpiry(src.getExpiry()); + tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent(); + copyElement(src, tgt); + tgt.setQuantity(convertRatio(src.getQuantity())); + tgt.setSubstance(convertReference(src.getSubstance())); + return tgt; + } + + public org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.dstu3.model.Substance.SubstanceIngredientComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent(); + copyElement(src, tgt); + tgt.setQuantity(convertRatio(src.getQuantity())); +// tgt.setSubstance(convertReference(src.getSubstance())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.instance.model.SupplyDelivery src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SupplyDelivery tgt = new org.hl7.fhir.dstu3.model.SupplyDelivery(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setType(convertCodeableConcept(src.getType())); +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); + tgt.setSupplier(convertReference(src.getSupplier())); +// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); +// tgt.setTime(src.getTime()); + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.instance.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.dstu3.model.SupplyDelivery src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.SupplyDelivery tgt = new org.hl7.fhir.instance.model.SupplyDelivery(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus())); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setType(convertCodeableConcept(src.getType())); +// tgt.setQuantity(convertSimpleQuantity(src.getQuantity())); +// tgt.setSuppliedItem(convertReference(src.getSuppliedItem())); + tgt.setSupplier(convertReference(src.getSupplier())); +// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared())); +// tgt.setTime(src.getTime()); + tgt.setDestination(convertReference(src.getDestination())); + for (org.hl7.fhir.dstu3.model.Reference t : src.getReceiver()) + tgt.addReceiver(convertReference(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + default: return org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.dstu3.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED; + case ABANDONED: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED; + default: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.instance.model.SupplyRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SupplyRequest tgt = new org.hl7.fhir.dstu3.model.SupplyRequest(); + copyDomainResource(src, tgt); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setSource(convertReference(src.getSource())); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); +// tgt.setKind(convertCodeableConcept(src.getKind())); +// tgt.getOrderedItem().setItem(convertReference(src.getOrderedItem())); +// for (org.hl7.fhir.instance.model.Reference t : src.getSupplier()) +// tgt.addSupplier(convertReference(t)); +// tgt.setReason(convertType(src.getReason())); +// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); + return tgt; + } + + public org.hl7.fhir.instance.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.dstu3.model.SupplyRequest src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.SupplyRequest tgt = new org.hl7.fhir.instance.model.SupplyRequest(); +// copyDomainResource(src, tgt); +// tgt.setPatient(convertReference(src.getPatient())); +// tgt.setSource(convertReference(src.getSource())); +// if (src.hasDate()) +// tgt.setDate(src.getDate()); +// tgt.setIdentifier(convertIdentifier(src.getIdentifier())); +// tgt.setStatus(convertSupplyRequestStatus(src.getStatus())); +// tgt.setKind(convertCodeableConcept(src.getKind())); +// tgt.setOrderedItem(convertReference(src.getOrderedItem().getItemReference())); +// for (org.hl7.fhir.dstu3.model.Reference t : src.getSupplier()) +// tgt.addSupplier(convertReference(t)); +// tgt.setReason(convertType(src.getReason())); +// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUESTED: return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.ACTIVE; + case COMPLETED: return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.COMPLETED; + case FAILED: return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + case CANCELLED: return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + default: return org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.dstu3.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ACTIVE: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.REQUESTED; + case COMPLETED: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.COMPLETED; + case CANCELLED: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.CANCELLED; + default: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.TestScript convertTestScript(org.hl7.fhir.instance.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript tgt = new org.hl7.fhir.dstu3.model.TestScript(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent t : src.getContact()) + tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) + tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.instance.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent t : src.getVariable()) + tgt.addVariable(convertTestScriptVariableComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent t : src.getTest()) + tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript convertTestScript(org.hl7.fhir.dstu3.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript tgt = new org.hl7.fhir.instance.model.TestScript(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) + tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent t : src.getVariable()) + tgt.addVariable(convertTestScriptVariableComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent t : src.getTest()) + tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) + tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) + tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) + tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) + tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setDescription(src.getDescription()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent(); + copyElement(src, tgt); + tgt.setRequired(src.getRequired()); + tgt.setValidated(src.getValidated()); + tgt.setDescription(src.getDescription()); + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.instance.model.UriType t : src.getLink()) + tgt.addLink(t.getValue()); + tgt.setCapabilities(convertReference(src.getConformance())); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent(); + copyElement(src, tgt); + tgt.setRequired(src.getRequired()); + tgt.setValidated(src.getValidated()); + tgt.setDescription(src.getDescription()); + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getLink()) + tgt.addLink(t.getValue()); + tgt.setConformance(convertReference(src.getCapabilities())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent(); + copyElement(src, tgt); + tgt.setAutocreate(src.getAutocreate()); + tgt.setAutodelete(src.getAutodelete()); + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent(); + copyElement(src, tgt); + tgt.setAutocreate(src.getAutocreate()); + tgt.setAutodelete(src.getAutodelete()); + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setHeaderField(src.getHeaderField()); + tgt.setPath(src.getPath()); + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setHeaderField(src.getHeaderField()); + tgt.setPath(src.getPath()); + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent(); + copyElement(src, tgt); + tgt.setType(convertCoding(src.getType())); + tgt.setResource(src.getResource()); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setDestination(src.getDestination()); + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + tgt.setParams(src.getParams()); + for (org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) + tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + tgt.setResponseId(src.getResponseId()); + tgt.setSourceId(src.getSourceId()); + tgt.setTargetId(src.getTargetId()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent(); + copyElement(src, tgt); + tgt.setType(convertCoding(src.getType())); + tgt.setResource(src.getResource()); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setDestination(src.getDestination()); + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + tgt.setParams(src.getParams()); + for (org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) + tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + tgt.setResponseId(src.getResponseId()); + tgt.setSourceId(src.getSourceId()); + tgt.setTargetId(src.getTargetId()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.TestScript.ContentType convertContentType(org.hl7.fhir.instance.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XML: return org.hl7.fhir.dstu3.model.TestScript.ContentType.XML; + case JSON: return org.hl7.fhir.dstu3.model.TestScript.ContentType.JSON; + default: return org.hl7.fhir.dstu3.model.TestScript.ContentType.NULL; + } + } + + public org.hl7.fhir.instance.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu3.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XML: return org.hl7.fhir.instance.model.TestScript.ContentType.XML; + case JSON: return org.hl7.fhir.instance.model.TestScript.ContentType.JSON; + default: return org.hl7.fhir.instance.model.TestScript.ContentType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent(); + copyElement(src, tgt); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + tgt.setCompareToSourceId(src.getCompareToSourceId()); + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setHeaderField(src.getHeaderField()); + tgt.setMinimumId(src.getMinimumId()); + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + tgt.setPath(src.getPath()); + tgt.setResource(src.getResource()); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + tgt.setResponseCode(src.getResponseCode()); + tgt.setSourceId(src.getSourceId()); + tgt.setValidateProfileId(src.getValidateProfileId()); + tgt.setValue(src.getValue()); + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent(); + copyElement(src, tgt); + tgt.setLabel(src.getLabel()); + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + tgt.setCompareToSourceId(src.getCompareToSourceId()); + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + tgt.setHeaderField(src.getHeaderField()); + tgt.setMinimumId(src.getMinimumId()); + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + tgt.setPath(src.getPath()); + tgt.setResource(src.getResource()); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + tgt.setResponseCode(src.getResponseCode()); + tgt.setSourceId(src.getSourceId()); + tgt.setValidateProfileId(src.getValidateProfileId()); + tgt.setValue(src.getValue()); + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.instance.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESPONSE: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.REQUEST; + default: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.NULL; + } + } + + public org.hl7.fhir.instance.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESPONSE: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.REQUEST; + default: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.instance.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.IN; + case NOTIN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NULL; + } + } + + public org.hl7.fhir.instance.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUALS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.IN; + case NOTIN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NULL; + } + } + + public org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OKAY: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NULL; + } + } + + public org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OKAY: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NULL; + } + } + + + public org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.TestScript.TestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getUrl()); + tgt.setVersion(src.getVersion()); + tgt.setCaseSensitive(src.getCaseSensitive()); + + for (ConceptDefinitionComponent cc : src.getConcept()) + tgt.addConcept(convertCodeSystemConcept(src, cc)); + return tgt; + } + +public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent convertCodeSystemConcept(CodeSystem cs, ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent(); + copyElement(src, tgt); + tgt.setAbstract(CodeSystemUtilities.isNotSelectable(cs, src)); + tgt.setCode(src.getCode()); + tgt.setDefinition(src.getDefinition()); + tgt.setDisplay(src.getDisplay()); + + for (ConceptDefinitionComponent cc : src.getConcept()) + tgt.addConcept(convertCodeSystemConcept(cs, cc)); + for (ConceptDefinitionDesignationComponent cc : src.getDesignation()) + tgt.addDesignation(convertCodeSystemDesignation(cc)); + return tgt; + } + +public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent convertCodeSystemDesignation(ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + tgt.setUse(convertCoding(src.getUse())); + tgt.setLanguage(src.getLanguage()); + tgt.setValue(src.getValue()); + + return tgt; + } + + public org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.instance.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet tgt = new org.hl7.fhir.dstu3.model.ValueSet(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent t : src.getContact()) + tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + tgt.setImmutable(src.getImmutable()); + tgt.setPurpose(src.getRequirements()); + tgt.setCopyright(src.getCopyright()); + tgt.setExtensible(src.getExtensible()); + if (src.hasCompose()) { + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + tgt.getCompose().setLockedDate(src.getLockedDate()); + } + if (src.hasCodeSystem() && advisor != null) { + org.hl7.fhir.dstu3.model.CodeSystem tgtcs = new org.hl7.fhir.dstu3.model.CodeSystem(); + copyDomainResource(src, tgtcs); + tgtcs.setUrl(src.getCodeSystem().getSystem()); + tgtcs.setIdentifier(convertIdentifier(src.getIdentifier())); + tgtcs.setVersion(src.getCodeSystem().getVersion()); + tgtcs.setName(src.getName()+" Code System"); + tgtcs.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgtcs.setExperimental(src.getExperimental()); + tgtcs.setPublisher(src.getPublisher()); + for (org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent t : src.getContact()) + tgtcs.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgtcs.setDate(src.getDate()); + tgtcs.setDescription(src.getDescription()); + for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgtcs.addJurisdiction(convertCodeableConcept(t)); + else + tgtcs.addUseContext(convertCodeableConceptToUsageContext(t)); + tgtcs.setPurpose(src.getRequirements()); + tgtcs.setCopyright(src.getCopyright()); + tgtcs.setContent(CodeSystemContentMode.COMPLETE); + tgtcs.setCaseSensitive(src.getCodeSystem().getCaseSensitive()); + for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent cs : src.getCodeSystem().getConcept()) + processConcept(tgtcs.getConcept(), cs, tgtcs); + advisor.handleCodeSystem(tgtcs, tgt); + tgt.setUserData("r2-cs", tgtcs); + tgt.getCompose().addInclude().setSystem(tgtcs.getUrl()); + } + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + private void processConcept(List concepts, org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException { + org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent(); + concepts.add(ct); + ct.setCode(cs.getCode()); + ct.setDisplay(cs.getDisplay()); + ct.setDefinition(cs.getDefinition()); + if (cs.getAbstract()) + CodeSystemUtilities.setNotSelectable(tgtcs, ct); + for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { + org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent(); + cst.setLanguage(csd.getLanguage()); + cst.setUse(convertCoding(csd.getUse())); + cst.setValue(csd.getValue()); + } + + for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept()) + processConcept(ct.getConcept(), csc, tgtcs); + } + + private void processConcept(List concepts, ConceptDefinitionComponent cs, CodeSystem srcCS) throws FHIRException { + org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent ct = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent(); + concepts.add(ct); + ct.setCode(cs.getCode()); + ct.setDisplay(cs.getDisplay()); + ct.setDefinition(cs.getDefinition()); + if (CodeSystemUtilities.isNotSelectable(srcCS, cs)) + ct.setAbstract(true); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) { + org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent(); + cst.setLanguage(csd.getLanguage()); + cst.setUse(convertCoding(csd.getUse())); + cst.setValue(csd.getValue()); + } + + for (ConceptDefinitionComponent csc : cs.getConcept()) + processConcept(ct.getConcept(), csc, srcCS); + } + + public org.hl7.fhir.instance.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet tgt = new org.hl7.fhir.instance.model.ValueSet(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier i : src.getIdentifier()) + tgt.setIdentifier(convertIdentifier(i)); + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setLockedDate(src.getCompose().getLockedDate()); + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + tgt.setImmutable(src.getImmutable()); + tgt.setRequirements(src.getPurpose()); + tgt.setCopyright(src.getCopyright()); + tgt.setExtensible(src.getExtensible()); + org.hl7.fhir.dstu3.model.CodeSystem srcCS = (CodeSystem) src.getUserData("r2-cs"); + if (srcCS == null) + srcCS = advisor.getCodeSystem(src); + if (srcCS != null) { + tgt.getCodeSystem().setSystem(srcCS.getUrl()); + tgt.getCodeSystem().setVersion(srcCS.getVersion()); + tgt.getCodeSystem().setCaseSensitive(srcCS.getCaseSensitive()); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent cs : srcCS.getConcept()) + processConcept(tgt.getCodeSystem().getConcept(), cs, srcCS); + + } + tgt.setCompose(convertValueSetComposeComponent(src.getCompose(), srcCS == null ? null : srcCS.getUrl())); + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + private static boolean isJurisdiction(CodeableConcept t) { + 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 org.hl7.fhir.dstu3.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.instance.model.UriType t : src.getImport()) + tgt.addInclude().addValueSet(t.getValue()); + for (org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent t : src.getInclude()) + tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent t : src.getExclude()) + tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent src, String noSystem) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getInclude()) { + for (org.hl7.fhir.dstu3.model.UriType ti : t.getValueSet()) + tgt.addImport(ti.getValue()); + if (noSystem == null || !t.getSystem().equals(noSystem)) + tgt.addInclude(convertConceptSetComponent(t)); + } + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getExclude()) + tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) + tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) + tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) + tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) + tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent(); + copyElement(src, tgt); + tgt.setLanguage(src.getLanguage()); + tgt.setUse(convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + tgt.setLanguage(src.getLanguage()); + tgt.setUse(convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent(); + copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent(); + copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.instance.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISA; + case ISNOTA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.REGEX; + case IN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NOTIN; + default: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NULL; + } + } + + public org.hl7.fhir.instance.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.ISA; + case ISNOTA: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.REGEX; + case IN: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.NOTIN; + default: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + tgt.setTotal(src.getTotal()); + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + tgt.setTotal(src.getTotal()); + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setAbstract(src.getAbstract()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + tgt.setAbstract(src.getAbstract()); + tgt.setVersion(src.getVersion()); + tgt.setCode(src.getCode()); + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public org.hl7.fhir.dstu3.model.ListResource convertList(org.hl7.fhir.instance.model.List_ src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ListResource tgt = new org.hl7.fhir.dstu3.model.ListResource(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setTitle(src.getTitle()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setSource(convertReference(src.getSource())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + tgt.setMode(convertListMode(src.getMode())); + if (src.hasNote()) + tgt.addNote(new org.hl7.fhir.dstu3.model.Annotation().setText(src.getNote())); + for (org.hl7.fhir.instance.model.List_.ListEntryComponent t : src.getEntry()) + tgt.addEntry(convertListEntry(t)); + return tgt; + } + + + public org.hl7.fhir.dstu3.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.instance.model.List_.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.CURRENT; + case RETIRED: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.RETIRED; + case ENTEREDINERROR: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.ENTEREDINERROR; + default: return org.hl7.fhir.dstu3.model.ListResource.ListStatus.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ListResource.ListMode convertListMode(org.hl7.fhir.instance.model.List_.ListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WORKING: return org.hl7.fhir.dstu3.model.ListResource.ListMode.WORKING; + case SNAPSHOT: return org.hl7.fhir.dstu3.model.ListResource.ListMode.SNAPSHOT; + case CHANGES: return org.hl7.fhir.dstu3.model.ListResource.ListMode.CHANGES; + default: return org.hl7.fhir.dstu3.model.ListResource.ListMode.NULL; + } + } + + public org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent convertListEntry(org.hl7.fhir.instance.model.List_.ListEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent(); + copyBackboneElement(src, tgt); + tgt.setFlag(convertCodeableConcept(src.getFlag())); + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setItem(convertReference(src.getItem())); + return tgt; + } + + public org.hl7.fhir.instance.model.List_ convertList(org.hl7.fhir.dstu3.model.ListResource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.List_ tgt = new org.hl7.fhir.instance.model.List_(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setTitle(src.getTitle()); + tgt.setCode(convertCodeableConcept(src.getCode())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setSource(convertReference(src.getSource())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setStatus(convertListStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy())); + tgt.setMode(convertListMode(src.getMode())); + for (org.hl7.fhir.dstu3.model.Annotation t : src.getNote()) + tgt.setNote(t.getText()); + for (org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent t : src.getEntry()) + tgt.addEntry(convertListEntry(t)); + return tgt; + } + + + public org.hl7.fhir.instance.model.List_.ListStatus convertListStatus(org.hl7.fhir.dstu3.model.ListResource.ListStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CURRENT: return org.hl7.fhir.instance.model.List_.ListStatus.CURRENT; + case RETIRED: return org.hl7.fhir.instance.model.List_.ListStatus.RETIRED; + case ENTEREDINERROR: return org.hl7.fhir.instance.model.List_.ListStatus.ENTEREDINERROR; + default: return org.hl7.fhir.instance.model.List_.ListStatus.NULL; + } + } + + public org.hl7.fhir.instance.model.List_.ListMode convertListMode(org.hl7.fhir.dstu3.model.ListResource.ListMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case WORKING: return org.hl7.fhir.instance.model.List_.ListMode.WORKING; + case SNAPSHOT: return org.hl7.fhir.instance.model.List_.ListMode.SNAPSHOT; + case CHANGES: return org.hl7.fhir.instance.model.List_.ListMode.CHANGES; + default: return org.hl7.fhir.instance.model.List_.ListMode.NULL; + } + } + + public org.hl7.fhir.instance.model.List_.ListEntryComponent convertListEntry(org.hl7.fhir.dstu3.model.ListResource.ListEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.instance.model.List_.ListEntryComponent tgt = new org.hl7.fhir.instance.model.List_.ListEntryComponent(); + copyBackboneElement(src, tgt); + tgt.setFlag(convertCodeableConcept(src.getFlag())); + tgt.setDeleted(src.getDeleted()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + tgt.setItem(convertReference(src.getItem())); + return tgt; + } + + + + public org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.instance.model.Resource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.instance.model.Parameters) + return convertParameters((org.hl7.fhir.instance.model.Parameters) src); + if (src instanceof org.hl7.fhir.instance.model.Account) + return convertAccount((org.hl7.fhir.instance.model.Account) src); + if (src instanceof org.hl7.fhir.instance.model.Appointment) + return convertAppointment((org.hl7.fhir.instance.model.Appointment) src); + if (src instanceof org.hl7.fhir.instance.model.AppointmentResponse) + return convertAppointmentResponse((org.hl7.fhir.instance.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.instance.model.AuditEvent) + return convertAuditEvent((org.hl7.fhir.instance.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.instance.model.Basic) + return convertBasic((org.hl7.fhir.instance.model.Basic) src); + if (src instanceof org.hl7.fhir.instance.model.Binary) + return convertBinary((org.hl7.fhir.instance.model.Binary) src); + if (src instanceof org.hl7.fhir.instance.model.Bundle) + return convertBundle((org.hl7.fhir.instance.model.Bundle) src); + if (src instanceof org.hl7.fhir.instance.model.CarePlan) + return convertCarePlan((org.hl7.fhir.instance.model.CarePlan) src); + if (src instanceof org.hl7.fhir.instance.model.ClinicalImpression) + return convertClinicalImpression((org.hl7.fhir.instance.model.ClinicalImpression) src); + if (src instanceof org.hl7.fhir.instance.model.Communication) + return convertCommunication((org.hl7.fhir.instance.model.Communication) src); + if (src instanceof org.hl7.fhir.instance.model.CommunicationRequest) + return convertCommunicationRequest((org.hl7.fhir.instance.model.CommunicationRequest) src); + if (src instanceof org.hl7.fhir.instance.model.Composition) + return convertComposition((org.hl7.fhir.instance.model.Composition) src); + if (src instanceof org.hl7.fhir.instance.model.ConceptMap) + return convertConceptMap((org.hl7.fhir.instance.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.instance.model.Condition) + return convertCondition((org.hl7.fhir.instance.model.Condition) src); + if (src instanceof org.hl7.fhir.instance.model.Conformance) + return convertConformance((org.hl7.fhir.instance.model.Conformance) src); + if (src instanceof org.hl7.fhir.instance.model.Contract) + return convertContract((org.hl7.fhir.instance.model.Contract) src); + if (src instanceof org.hl7.fhir.instance.model.DataElement) + return convertDataElement((org.hl7.fhir.instance.model.DataElement) src); + if (src instanceof org.hl7.fhir.instance.model.DetectedIssue) + return convertDetectedIssue((org.hl7.fhir.instance.model.DetectedIssue) src); + if (src instanceof org.hl7.fhir.instance.model.Device) + return convertDevice((org.hl7.fhir.instance.model.Device) src); + if (src instanceof org.hl7.fhir.instance.model.DeviceComponent) + return convertDeviceComponent((org.hl7.fhir.instance.model.DeviceComponent) src); + if (src instanceof org.hl7.fhir.instance.model.DeviceMetric) + return convertDeviceMetric((org.hl7.fhir.instance.model.DeviceMetric) src); + if (src instanceof org.hl7.fhir.instance.model.DeviceUseStatement) + return convertDeviceUseStatement((org.hl7.fhir.instance.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.instance.model.DiagnosticReport) + return convertDiagnosticReport((org.hl7.fhir.instance.model.DiagnosticReport) src); + if (src instanceof org.hl7.fhir.instance.model.DocumentManifest) + return convertDocumentManifest((org.hl7.fhir.instance.model.DocumentManifest) src); + if (src instanceof org.hl7.fhir.instance.model.DocumentReference) + return convertDocumentReference((org.hl7.fhir.instance.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.instance.model.Encounter) + return convertEncounter((org.hl7.fhir.instance.model.Encounter) src); + if (src instanceof org.hl7.fhir.instance.model.EnrollmentRequest) + return convertEnrollmentRequest((org.hl7.fhir.instance.model.EnrollmentRequest) src); + if (src instanceof org.hl7.fhir.instance.model.EnrollmentResponse) + return convertEnrollmentResponse((org.hl7.fhir.instance.model.EnrollmentResponse) src); + if (src instanceof org.hl7.fhir.instance.model.EpisodeOfCare) + return convertEpisodeOfCare((org.hl7.fhir.instance.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.instance.model.FamilyMemberHistory) + return convertFamilyMemberHistory((org.hl7.fhir.instance.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.instance.model.Flag) + return convertFlag((org.hl7.fhir.instance.model.Flag) src); + if (src instanceof org.hl7.fhir.instance.model.Group) + return convertGroup((org.hl7.fhir.instance.model.Group) src); + if (src instanceof org.hl7.fhir.instance.model.HealthcareService) + return convertHealthcareService((org.hl7.fhir.instance.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.instance.model.ImagingStudy) + return convertImagingStudy((org.hl7.fhir.instance.model.ImagingStudy) src); + if (src instanceof org.hl7.fhir.instance.model.Immunization) + return convertImmunization((org.hl7.fhir.instance.model.Immunization) src); + if (src instanceof org.hl7.fhir.instance.model.ImmunizationRecommendation) + return convertImmunizationRecommendation((org.hl7.fhir.instance.model.ImmunizationRecommendation) src); + if (src instanceof org.hl7.fhir.instance.model.ImplementationGuide) + return convertImplementationGuide((org.hl7.fhir.instance.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.instance.model.List_) + return convertList((org.hl7.fhir.instance.model.List_) src); + if (src instanceof org.hl7.fhir.instance.model.Location) + return convertLocation((org.hl7.fhir.instance.model.Location) src); + if (src instanceof org.hl7.fhir.instance.model.Media) + return convertMedia((org.hl7.fhir.instance.model.Media) src); + if (src instanceof org.hl7.fhir.instance.model.Medication) + return convertMedication((org.hl7.fhir.instance.model.Medication) src); + if (src instanceof org.hl7.fhir.instance.model.MedicationDispense) + return convertMedicationDispense((org.hl7.fhir.instance.model.MedicationDispense) src); +// if (src instanceof org.hl7.fhir.instance.model.MedicationOrder) +// return convertMedicationOrder((org.hl7.fhir.instance.model.MedicationOrder) src); + if (src instanceof org.hl7.fhir.instance.model.MedicationStatement) + return convertMedicationStatement((org.hl7.fhir.instance.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.instance.model.MessageHeader) + return convertMessageHeader((org.hl7.fhir.instance.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.instance.model.NamingSystem) + return convertNamingSystem((org.hl7.fhir.instance.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.instance.model.Observation) + return convertObservation((org.hl7.fhir.instance.model.Observation) src); + if (src instanceof org.hl7.fhir.instance.model.OperationDefinition) + return convertOperationDefinition((org.hl7.fhir.instance.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.instance.model.OperationOutcome) + return convertOperationOutcome((org.hl7.fhir.instance.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.instance.model.Organization) + return convertOrganization((org.hl7.fhir.instance.model.Organization) src); + if (src instanceof org.hl7.fhir.instance.model.Patient) + return convertPatient((org.hl7.fhir.instance.model.Patient) src); + if (src instanceof org.hl7.fhir.instance.model.Person) + return convertPerson((org.hl7.fhir.instance.model.Person) src); + if (src instanceof org.hl7.fhir.instance.model.Practitioner) + return convertPractitioner((org.hl7.fhir.instance.model.Practitioner) src); + if (src instanceof org.hl7.fhir.instance.model.Procedure) + return convertProcedure((org.hl7.fhir.instance.model.Procedure) src); + if (src instanceof org.hl7.fhir.instance.model.ProcedureRequest) + return convertProcedureRequest((org.hl7.fhir.instance.model.ProcedureRequest) src); + if (src instanceof org.hl7.fhir.instance.model.Provenance) + return convertProvenance((org.hl7.fhir.instance.model.Provenance) src); + if (src instanceof org.hl7.fhir.instance.model.Questionnaire) + return convertQuestionnaire((org.hl7.fhir.instance.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.instance.model.QuestionnaireResponse) + return convertQuestionnaireResponse((org.hl7.fhir.instance.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.instance.model.ReferralRequest) + return convertReferralRequest((org.hl7.fhir.instance.model.ReferralRequest) src); + if (src instanceof org.hl7.fhir.instance.model.RelatedPerson) + return convertRelatedPerson((org.hl7.fhir.instance.model.RelatedPerson) src); + if (src instanceof org.hl7.fhir.instance.model.RiskAssessment) + return convertRiskAssessment((org.hl7.fhir.instance.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.instance.model.Schedule) + return convertSchedule((org.hl7.fhir.instance.model.Schedule) src); + if (src instanceof org.hl7.fhir.instance.model.SearchParameter) + return convertSearchParameter((org.hl7.fhir.instance.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.instance.model.Slot) + return convertSlot((org.hl7.fhir.instance.model.Slot) src); + if (src instanceof org.hl7.fhir.instance.model.StructureDefinition) + return convertStructureDefinition((org.hl7.fhir.instance.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.instance.model.Subscription) + return convertSubscription((org.hl7.fhir.instance.model.Subscription) src); + if (src instanceof org.hl7.fhir.instance.model.Substance) + return convertSubstance((org.hl7.fhir.instance.model.Substance) src); + if (src instanceof org.hl7.fhir.instance.model.SupplyDelivery) + return convertSupplyDelivery((org.hl7.fhir.instance.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.instance.model.SupplyRequest) + return convertSupplyRequest((org.hl7.fhir.instance.model.SupplyRequest) src); + if (src instanceof org.hl7.fhir.instance.model.TestScript) + return convertTestScript((org.hl7.fhir.instance.model.TestScript) src); + if (src instanceof org.hl7.fhir.instance.model.ValueSet) + return convertValueSet((org.hl7.fhir.instance.model.ValueSet) src); + throw new Error("Unknown resource "+src.getClass()); + } + + public org.hl7.fhir.instance.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu3.model.Parameters) + return convertParameters((org.hl7.fhir.dstu3.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu3.model.Appointment) + return convertAppointment((org.hl7.fhir.dstu3.model.Appointment) src); + if (src instanceof org.hl7.fhir.dstu3.model.AppointmentResponse) + return convertAppointmentResponse((org.hl7.fhir.dstu3.model.AppointmentResponse) src); + if (src instanceof org.hl7.fhir.dstu3.model.AuditEvent) + return convertAuditEvent((org.hl7.fhir.dstu3.model.AuditEvent) src); + if (src instanceof org.hl7.fhir.dstu3.model.Basic) + return convertBasic((org.hl7.fhir.dstu3.model.Basic) src); + if (src instanceof org.hl7.fhir.dstu3.model.Binary) + return convertBinary((org.hl7.fhir.dstu3.model.Binary) src); + if (src instanceof org.hl7.fhir.dstu3.model.Bundle) + return convertBundle((org.hl7.fhir.dstu3.model.Bundle) src); + if (src instanceof org.hl7.fhir.dstu3.model.CarePlan) + return convertCarePlan((org.hl7.fhir.dstu3.model.CarePlan) src); + if (src instanceof org.hl7.fhir.dstu3.model.ClinicalImpression) + return convertClinicalImpression((org.hl7.fhir.dstu3.model.ClinicalImpression) src); + if (src instanceof org.hl7.fhir.dstu3.model.Communication) + return convertCommunication((org.hl7.fhir.dstu3.model.Communication) src); + if (src instanceof org.hl7.fhir.dstu3.model.CommunicationRequest) + return convertCommunicationRequest((org.hl7.fhir.dstu3.model.CommunicationRequest) src); + if (src instanceof org.hl7.fhir.dstu3.model.Composition) + return convertComposition((org.hl7.fhir.dstu3.model.Composition) src); + if (src instanceof org.hl7.fhir.dstu3.model.ConceptMap) + return convertConceptMap((org.hl7.fhir.dstu3.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu3.model.Condition) + return convertCondition((org.hl7.fhir.dstu3.model.Condition) src); + if (src instanceof org.hl7.fhir.dstu3.model.CapabilityStatement) + return convertConformance((org.hl7.fhir.dstu3.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.Contract) + return convertContract((org.hl7.fhir.dstu3.model.Contract) src); + if (src instanceof org.hl7.fhir.dstu3.model.DataElement) + return convertDataElement((org.hl7.fhir.dstu3.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu3.model.DetectedIssue) + return convertDetectedIssue((org.hl7.fhir.dstu3.model.DetectedIssue) src); + if (src instanceof org.hl7.fhir.dstu3.model.Device) + return convertDevice((org.hl7.fhir.dstu3.model.Device) src); + if (src instanceof org.hl7.fhir.dstu3.model.DeviceComponent) + return convertDeviceComponent((org.hl7.fhir.dstu3.model.DeviceComponent) src); + if (src instanceof org.hl7.fhir.dstu3.model.DeviceMetric) + return convertDeviceMetric((org.hl7.fhir.dstu3.model.DeviceMetric) src); + if (src instanceof org.hl7.fhir.dstu3.model.DeviceUseStatement) + return convertDeviceUseStatement((org.hl7.fhir.dstu3.model.DeviceUseStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.DiagnosticReport) + return convertDiagnosticReport((org.hl7.fhir.dstu3.model.DiagnosticReport) src); + if (src instanceof org.hl7.fhir.dstu3.model.DocumentManifest) + return convertDocumentManifest((org.hl7.fhir.dstu3.model.DocumentManifest) src); + if (src instanceof org.hl7.fhir.dstu3.model.DocumentReference) + return convertDocumentReference((org.hl7.fhir.dstu3.model.DocumentReference) src); + if (src instanceof org.hl7.fhir.dstu3.model.Encounter) + return convertEncounter((org.hl7.fhir.dstu3.model.Encounter) src); + if (src instanceof org.hl7.fhir.dstu3.model.EnrollmentRequest) + return convertEnrollmentRequest((org.hl7.fhir.dstu3.model.EnrollmentRequest) src); + if (src instanceof org.hl7.fhir.dstu3.model.EnrollmentResponse) + return convertEnrollmentResponse((org.hl7.fhir.dstu3.model.EnrollmentResponse) src); + if (src instanceof org.hl7.fhir.dstu3.model.EpisodeOfCare) + return convertEpisodeOfCare((org.hl7.fhir.dstu3.model.EpisodeOfCare) src); + if (src instanceof org.hl7.fhir.dstu3.model.FamilyMemberHistory) + return convertFamilyMemberHistory((org.hl7.fhir.dstu3.model.FamilyMemberHistory) src); + if (src instanceof org.hl7.fhir.dstu3.model.Flag) + return convertFlag((org.hl7.fhir.dstu3.model.Flag) src); + if (src instanceof org.hl7.fhir.dstu3.model.Group) + return convertGroup((org.hl7.fhir.dstu3.model.Group) src); + if (src instanceof org.hl7.fhir.dstu3.model.HealthcareService) + return convertHealthcareService((org.hl7.fhir.dstu3.model.HealthcareService) src); + if (src instanceof org.hl7.fhir.dstu3.model.ImagingStudy) + return convertImagingStudy((org.hl7.fhir.dstu3.model.ImagingStudy) src); + if (src instanceof org.hl7.fhir.dstu3.model.Immunization) + return convertImmunization((org.hl7.fhir.dstu3.model.Immunization) src); + if (src instanceof org.hl7.fhir.dstu3.model.ImmunizationRecommendation) + return convertImmunizationRecommendation((org.hl7.fhir.dstu3.model.ImmunizationRecommendation) src); + if (src instanceof org.hl7.fhir.dstu3.model.ImplementationGuide) + return convertImplementationGuide((org.hl7.fhir.dstu3.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu3.model.ListResource) + return convertList((org.hl7.fhir.dstu3.model.ListResource) src); + if (src instanceof org.hl7.fhir.dstu3.model.Location) + return convertLocation((org.hl7.fhir.dstu3.model.Location) src); + if (src instanceof org.hl7.fhir.dstu3.model.Media) + return convertMedia((org.hl7.fhir.dstu3.model.Media) src); + if (src instanceof org.hl7.fhir.dstu3.model.Medication) + return convertMedication((org.hl7.fhir.dstu3.model.Medication) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationDispense) + return convertMedicationDispense((org.hl7.fhir.dstu3.model.MedicationDispense) src); +// if (src instanceof org.hl7.fhir.dstu3.model.MedicationOrder) +// return convertMedicationOrder((org.hl7.fhir.dstu3.model.MedicationOrder) src); + if (src instanceof org.hl7.fhir.dstu3.model.MedicationStatement) + return convertMedicationStatement((org.hl7.fhir.dstu3.model.MedicationStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.MessageHeader) + return convertMessageHeader((org.hl7.fhir.dstu3.model.MessageHeader) src); + if (src instanceof org.hl7.fhir.dstu3.model.NamingSystem) + return convertNamingSystem((org.hl7.fhir.dstu3.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.dstu3.model.Observation) + return convertObservation((org.hl7.fhir.dstu3.model.Observation) src); + if (src instanceof org.hl7.fhir.dstu3.model.OperationDefinition) + return convertOperationDefinition((org.hl7.fhir.dstu3.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.OperationOutcome) + return convertOperationOutcome((org.hl7.fhir.dstu3.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu3.model.Organization) + return convertOrganization((org.hl7.fhir.dstu3.model.Organization) src); + if (src instanceof org.hl7.fhir.dstu3.model.Patient) + return convertPatient((org.hl7.fhir.dstu3.model.Patient) src); + if (src instanceof org.hl7.fhir.dstu3.model.Person) + return convertPerson((org.hl7.fhir.dstu3.model.Person) src); + if (src instanceof org.hl7.fhir.dstu3.model.Practitioner) + return convertPractitioner((org.hl7.fhir.dstu3.model.Practitioner) src); + if (src instanceof org.hl7.fhir.dstu3.model.Procedure) + return convertProcedure((org.hl7.fhir.dstu3.model.Procedure) src); + if (src instanceof org.hl7.fhir.dstu3.model.ProcedureRequest) + return convertProcedureRequest((org.hl7.fhir.dstu3.model.ProcedureRequest) src); + if (src instanceof org.hl7.fhir.dstu3.model.Provenance) + return convertProvenance((org.hl7.fhir.dstu3.model.Provenance) src); + if (src instanceof org.hl7.fhir.dstu3.model.Questionnaire) + return convertQuestionnaire((org.hl7.fhir.dstu3.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu3.model.QuestionnaireResponse) + return convertQuestionnaireResponse((org.hl7.fhir.dstu3.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu3.model.ReferralRequest) + return convertReferralRequest((org.hl7.fhir.dstu3.model.ReferralRequest) src); + if (src instanceof org.hl7.fhir.dstu3.model.RelatedPerson) + return convertRelatedPerson((org.hl7.fhir.dstu3.model.RelatedPerson) src); + if (src instanceof org.hl7.fhir.dstu3.model.RiskAssessment) + return convertRiskAssessment((org.hl7.fhir.dstu3.model.RiskAssessment) src); + if (src instanceof org.hl7.fhir.dstu3.model.Schedule) + return convertSchedule((org.hl7.fhir.dstu3.model.Schedule) src); + if (src instanceof org.hl7.fhir.dstu3.model.SearchParameter) + return convertSearchParameter((org.hl7.fhir.dstu3.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu3.model.Slot) + return convertSlot((org.hl7.fhir.dstu3.model.Slot) src); + if (src instanceof org.hl7.fhir.dstu3.model.StructureDefinition) + return convertStructureDefinition((org.hl7.fhir.dstu3.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.Subscription) + return convertSubscription((org.hl7.fhir.dstu3.model.Subscription) src); + if (src instanceof org.hl7.fhir.dstu3.model.Substance) + return convertSubstance((org.hl7.fhir.dstu3.model.Substance) src); + if (src instanceof org.hl7.fhir.dstu3.model.SupplyDelivery) + return convertSupplyDelivery((org.hl7.fhir.dstu3.model.SupplyDelivery) src); + if (src instanceof org.hl7.fhir.dstu3.model.SupplyRequest) + return convertSupplyRequest((org.hl7.fhir.dstu3.model.SupplyRequest) src); + if (src instanceof org.hl7.fhir.dstu3.model.TestScript) + return convertTestScript((org.hl7.fhir.dstu3.model.TestScript) src); + if (src instanceof org.hl7.fhir.dstu3.model.ValueSet) + return convertValueSet((org.hl7.fhir.dstu3.model.ValueSet) src); + throw new Error("Unknown resource "+src.fhirType()); + } + +} diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_20.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_20.java index 04c73265d33..e22f00b8b49 100644 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_20.java +++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_20.java @@ -20,7230 +20,7230 @@ package org.hl7.fhir.convertors; * #L% */ - -/* - 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 Mon, Aug 15, 2016 19:58+1000 for FHIR v1.7.0 - -import java.util.ArrayList; -import java.util.List; - -import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent; -import org.hl7.fhir.dstu2016may.model.CodeableConcept; -import org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule; -import org.hl7.fhir.dstu3.conformance.ProfileUtilities; -import org.hl7.fhir.dstu3.model.CodeSystem; -import org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator; -import org.hl7.fhir.dstu3.model.ConceptMap; -import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent; -import org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent; -import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; -import org.hl7.fhir.dstu3.model.Enumeration; -import org.hl7.fhir.dstu3.model.Timing.EventTiming; -import org.hl7.fhir.exceptions.FHIRException; - -public class VersionConvertor_14_20 { - - private static void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.dstu3.model.Element tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); - } - } - - private static void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { - tgt.addExtension(convertExtension(e)); - } - } - - private static void copyBackboneElement(org.hl7.fhir.dstu2016may.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - private static void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.dstu2016may.model.BackboneElement tgt) throws FHIRException { - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { - tgt.addModifierExtension(convertExtension(e)); - } - } - - public static org.hl7.fhir.dstu3.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2016may.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.dstu3.model.Base64BinaryType tgt = new org.hl7.fhir.dstu3.model.Base64BinaryType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu3.model.Base64BinaryType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2016may.model.Base64BinaryType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.BooleanType convertBoolean(org.hl7.fhir.dstu2016may.model.BooleanType src) throws FHIRException { - org.hl7.fhir.dstu3.model.BooleanType tgt = new org.hl7.fhir.dstu3.model.BooleanType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.BooleanType convertBoolean(org.hl7.fhir.dstu3.model.BooleanType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.BooleanType tgt = new org.hl7.fhir.dstu2016may.model.BooleanType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeType convertCode(org.hl7.fhir.dstu2016may.model.CodeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeType convertCode(org.hl7.fhir.dstu3.model.CodeType 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.dstu3.model.DateType convertDate(org.hl7.fhir.dstu2016may.model.DateType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.DateType tgt = new org.hl7.fhir.dstu2016may.model.DateType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2016may.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DateTimeType convertDateTime(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.DateTimeType tgt = new org.hl7.fhir.dstu2016may.model.DateTimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DecimalType convertDecimal(org.hl7.fhir.dstu2016may.model.DecimalType src) throws FHIRException { - org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DecimalType convertDecimal(org.hl7.fhir.dstu3.model.DecimalType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.DecimalType tgt = new org.hl7.fhir.dstu2016may.model.DecimalType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.IdType convertId(org.hl7.fhir.dstu2016may.model.IdType src) throws FHIRException { - org.hl7.fhir.dstu3.model.IdType tgt = new org.hl7.fhir.dstu3.model.IdType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.IdType convertId(org.hl7.fhir.dstu3.model.IdType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.IdType tgt = new org.hl7.fhir.dstu2016may.model.IdType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.InstantType convertInstant(org.hl7.fhir.dstu2016may.model.InstantType src) throws FHIRException { - org.hl7.fhir.dstu3.model.InstantType tgt = new org.hl7.fhir.dstu3.model.InstantType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.InstantType convertInstant(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.InstantType tgt = new org.hl7.fhir.dstu2016may.model.InstantType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.IntegerType convertInteger(org.hl7.fhir.dstu2016may.model.IntegerType src) throws FHIRException { - org.hl7.fhir.dstu3.model.IntegerType tgt = new org.hl7.fhir.dstu3.model.IntegerType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.IntegerType convertInteger(org.hl7.fhir.dstu3.model.IntegerType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.IntegerType tgt = new org.hl7.fhir.dstu2016may.model.IntegerType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2016may.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.dstu3.model.MarkdownType tgt = new org.hl7.fhir.dstu3.model.MarkdownType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu3.model.MarkdownType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.MarkdownType tgt = new org.hl7.fhir.dstu2016may.model.MarkdownType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OidType convertOid(org.hl7.fhir.dstu2016may.model.OidType src) throws FHIRException { - org.hl7.fhir.dstu3.model.OidType tgt = new org.hl7.fhir.dstu3.model.OidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OidType convertOid(org.hl7.fhir.dstu3.model.OidType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.OidType tgt = new org.hl7.fhir.dstu2016may.model.OidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2016may.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.dstu3.model.PositiveIntType tgt = new org.hl7.fhir.dstu3.model.PositiveIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu3.model.PositiveIntType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.PositiveIntType tgt = new org.hl7.fhir.dstu2016may.model.PositiveIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StringType convertString(org.hl7.fhir.dstu2016may.model.StringType src) throws FHIRException { - org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StringType convertString(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.StringType tgt = new org.hl7.fhir.dstu2016may.model.StringType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.dstu2016may.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu3.model.TimeType tgt = new org.hl7.fhir.dstu3.model.TimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.TimeType tgt = new org.hl7.fhir.dstu2016may.model.TimeType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2016may.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UnsignedIntType tgt = new org.hl7.fhir.dstu3.model.UnsignedIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu3.model.UnsignedIntType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2016may.model.UnsignedIntType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.UriType convertUri(org.hl7.fhir.dstu2016may.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.UriType convertUri(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.UriType tgt = new org.hl7.fhir.dstu2016may.model.UriType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.UuidType convertUuid(org.hl7.fhir.dstu2016may.model.UuidType src) throws FHIRException { - org.hl7.fhir.dstu3.model.UuidType tgt = new org.hl7.fhir.dstu3.model.UuidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.UuidType convertUuid(org.hl7.fhir.dstu3.model.UuidType src) throws FHIRException { - org.hl7.fhir.dstu2016may.model.UuidType tgt = new org.hl7.fhir.dstu2016may.model.UuidType(); - if (src.hasValue()) - tgt.setValue(src.getValue()); - copyElement(src, tgt); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Extension convertExtension(org.hl7.fhir.dstu2016may.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Extension tgt = new org.hl7.fhir.dstu3.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Extension convertExtension(org.hl7.fhir.dstu3.model.Extension src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Extension tgt = new org.hl7.fhir.dstu2016may.model.Extension(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.dstu2016may.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Narrative tgt = new org.hl7.fhir.dstu2016may.model.Narrative(); - copyElement(src, tgt); - tgt.setStatus(convertNarrativeStatus(src.getStatus())); - tgt.setDiv(src.getDiv()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GENERATED: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.GENERATED; - case EXTENSIONS: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EXTENSIONS; - case ADDITIONAL: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.ADDITIONAL; - case EMPTY: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EMPTY; - default: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.Age convertAge(org.hl7.fhir.dstu2016may.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Age tgt = new org.hl7.fhir.dstu3.model.Age(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Age convertAge(org.hl7.fhir.dstu3.model.Age src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Age tgt = new org.hl7.fhir.dstu2016may.model.Age(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - - public static org.hl7.fhir.dstu3.model.Annotation convertAnnotation(org.hl7.fhir.dstu2016may.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Annotation tgt = new org.hl7.fhir.dstu3.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - if (src.hasTime()) - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Annotation convertAnnotation(org.hl7.fhir.dstu3.model.Annotation src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Annotation tgt = new org.hl7.fhir.dstu2016may.model.Annotation(); - copyElement(src, tgt); - tgt.setAuthor(convertType(src.getAuthor())); - if (src.hasTime()) - tgt.setTime(src.getTime()); - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Attachment convertAttachment(org.hl7.fhir.dstu2016may.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Attachment tgt = new org.hl7.fhir.dstu3.model.Attachment(); - copyElement(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasData()) - tgt.setData(src.getData()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasSize()) - tgt.setSize(src.getSize()); - if (src.hasHash()) - tgt.setHash(src.getHash()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCreation()) - tgt.setCreation(src.getCreation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Attachment convertAttachment(org.hl7.fhir.dstu3.model.Attachment src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Attachment tgt = new org.hl7.fhir.dstu2016may.model.Attachment(); - copyElement(src, tgt); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - if (src.hasData()) - tgt.setData(src.getData()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasSize()) - tgt.setSize(src.getSize()); - if (src.hasHash()) - tgt.setHash(src.getHash()); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - if (src.hasCreation()) - tgt.setCreation(src.getCreation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2016may.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeableConcept tgt = new org.hl7.fhir.dstu3.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeableConcept tgt = new org.hl7.fhir.dstu2016may.model.CodeableConcept(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCoding()) - tgt.addCoding(convertCoding(t)); - if (src.hasText()) - tgt.setText(src.getText()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.dstu2016may.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUserSelected()) - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Coding convertCoding(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Coding tgt = new org.hl7.fhir.dstu2016may.model.Coding(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasUserSelected()) - tgt.setUserSelected(src.getUserSelected()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Count convertCount(org.hl7.fhir.dstu2016may.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Count tgt = new org.hl7.fhir.dstu3.model.Count(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Count convertCount(org.hl7.fhir.dstu3.model.Count src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Count tgt = new org.hl7.fhir.dstu2016may.model.Count(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Distance convertDistance(org.hl7.fhir.dstu2016may.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Distance tgt = new org.hl7.fhir.dstu3.model.Distance(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Distance convertDistance(org.hl7.fhir.dstu3.model.Distance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Distance tgt = new org.hl7.fhir.dstu2016may.model.Distance(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Duration convertDuration(org.hl7.fhir.dstu2016may.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Duration tgt = new org.hl7.fhir.dstu3.model.Duration(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Duration convertDuration(org.hl7.fhir.dstu3.model.Duration src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Duration tgt = new org.hl7.fhir.dstu2016may.model.Duration(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Money convertMoney(org.hl7.fhir.dstu2016may.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Money tgt = new org.hl7.fhir.dstu3.model.Money(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Money convertMoney(org.hl7.fhir.dstu3.model.Money src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Money tgt = new org.hl7.fhir.dstu2016may.model.Money(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.dstu2016may.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); - copyElement(src, tgt); - tgt.setUse(convertIdentifierUse(src.getUse())); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Identifier convertIdentifier(org.hl7.fhir.dstu3.model.Identifier src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Identifier tgt = new org.hl7.fhir.dstu2016may.model.Identifier(); - copyElement(src, tgt); - tgt.setUse(convertIdentifierUse(src.getUse())); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - tgt.setAssigner(convertReference(src.getAssigner())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.TEMP; - case SECONDARY: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.SECONDARY; - default: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.NULL; - } - } - - - public static org.hl7.fhir.dstu3.model.Period convertPeriod(org.hl7.fhir.dstu2016may.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Period tgt = new org.hl7.fhir.dstu3.model.Period(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Period convertPeriod(org.hl7.fhir.dstu3.model.Period src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Period tgt = new org.hl7.fhir.dstu2016may.model.Period(); - copyElement(src, tgt); - if (src.hasStart()) - tgt.setStart(src.getStart()); - if (src.hasEnd()) - tgt.setEnd(src.getEnd()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Quantity convertQuantity(org.hl7.fhir.dstu2016may.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Quantity tgt = new org.hl7.fhir.dstu3.model.Quantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Quantity convertQuantity(org.hl7.fhir.dstu3.model.Quantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Quantity tgt = new org.hl7.fhir.dstu2016may.model.Quantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case LESS_THAN: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_THAN; - case LESS_OR_EQUAL: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_OR_EQUAL; - case GREATER_OR_EQUAL: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; - case GREATER_THAN: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_THAN; - default: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.Range convertRange(org.hl7.fhir.dstu2016may.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Range tgt = new org.hl7.fhir.dstu3.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Range convertRange(org.hl7.fhir.dstu3.model.Range src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Range tgt = new org.hl7.fhir.dstu2016may.model.Range(); - copyElement(src, tgt); - tgt.setLow(convertSimpleQuantity(src.getLow())); - tgt.setHigh(convertSimpleQuantity(src.getHigh())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Ratio convertRatio(org.hl7.fhir.dstu2016may.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Ratio tgt = new org.hl7.fhir.dstu3.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Ratio convertRatio(org.hl7.fhir.dstu3.model.Ratio src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Ratio tgt = new org.hl7.fhir.dstu2016may.model.Ratio(); - copyElement(src, tgt); - tgt.setNumerator(convertQuantity(src.getNumerator())); - tgt.setDenominator(convertQuantity(src.getDenominator())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.dstu2016may.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); - copyElement(src, tgt); - if (src.hasReference()) - tgt.setReference(src.getReference()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Reference tgt = new org.hl7.fhir.dstu2016may.model.Reference(); - copyElement(src, tgt); - if (src.hasReference()) - tgt.setReference(src.getReference()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SampledData convertSampledData(org.hl7.fhir.dstu2016may.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SampledData tgt = new org.hl7.fhir.dstu3.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - if (src.hasFactor()) - tgt.setFactor(src.getFactor()); - if (src.hasLowerLimit()) - tgt.setLowerLimit(src.getLowerLimit()); - if (src.hasUpperLimit()) - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SampledData convertSampledData(org.hl7.fhir.dstu3.model.SampledData src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SampledData tgt = new org.hl7.fhir.dstu2016may.model.SampledData(); - copyElement(src, tgt); - tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); - tgt.setPeriod(src.getPeriod()); - if (src.hasFactor()) - tgt.setFactor(src.getFactor()); - if (src.hasLowerLimit()) - tgt.setLowerLimit(src.getLowerLimit()); - if (src.hasUpperLimit()) - tgt.setUpperLimit(src.getUpperLimit()); - tgt.setDimensions(src.getDimensions()); - tgt.setData(src.getData()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Signature convertSignature(org.hl7.fhir.dstu2016may.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Signature tgt = new org.hl7.fhir.dstu3.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - tgt.setWho(convertType(src.getWho())); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasBlob()) - tgt.setBlob(src.getBlob()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Signature convertSignature(org.hl7.fhir.dstu3.model.Signature src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Signature tgt = new org.hl7.fhir.dstu2016may.model.Signature(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) - tgt.addType(convertCoding(t)); - tgt.setWhen(src.getWhen()); - tgt.setWho(convertType(src.getWho())); - if (src.hasContentType()) - tgt.setContentType(src.getContentType()); - if (src.hasBlob()) - tgt.setBlob(src.getBlob()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Address convertAddress(org.hl7.fhir.dstu2016may.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Address tgt = new org.hl7.fhir.dstu3.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - if (src.hasCity()) - tgt.setCity(src.getCity()); - if (src.hasDistrict()) - tgt.setDistrict(src.getDistrict()); - if (src.hasState()) - tgt.setState(src.getState()); - if (src.hasPostalCode()) - tgt.setPostalCode(src.getPostalCode()); - if (src.hasCountry()) - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Address convertAddress(org.hl7.fhir.dstu3.model.Address src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Address tgt = new org.hl7.fhir.dstu2016may.model.Address(); - copyElement(src, tgt); - tgt.setUse(convertAddressUse(src.getUse())); - tgt.setType(convertAddressType(src.getType())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getLine()) - tgt.addLine(t.getValue()); - if (src.hasCity()) - tgt.setCity(src.getCity()); - if (src.hasDistrict()) - tgt.setDistrict(src.getDistrict()); - if (src.hasState()) - tgt.setState(src.getState()); - if (src.hasPostalCode()) - tgt.setPostalCode(src.getPostalCode()); - if (src.hasCountry()) - tgt.setCountry(src.getCountry()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2016may.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu3.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.dstu3.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.dstu3.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.dstu3.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.dstu3.model.Address.AddressUse.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu3.model.Address.AddressUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.HOME; - case WORK: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.WORK; - case TEMP: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.TEMP; - case OLD: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.OLD; - default: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2016may.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.dstu3.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.dstu3.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.dstu3.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.dstu3.model.Address.AddressType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu3.model.Address.AddressType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case POSTAL: return org.hl7.fhir.dstu2016may.model.Address.AddressType.POSTAL; - case PHYSICAL: return org.hl7.fhir.dstu2016may.model.Address.AddressType.PHYSICAL; - case BOTH: return org.hl7.fhir.dstu2016may.model.Address.AddressType.BOTH; - default: return org.hl7.fhir.dstu2016may.model.Address.AddressType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactPoint tgt = new org.hl7.fhir.dstu3.model.ContactPoint(); - copyElement(src, tgt); - tgt.setSystem(convertContactPointSystem(src.getSystem())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu3.model.ContactPoint src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ContactPoint tgt = new org.hl7.fhir.dstu2016may.model.ContactPoint(); - copyElement(src, tgt); - tgt.setSystem(convertContactPointSystem(src.getSystem())); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setUse(convertContactPointUse(src.getUse())); - if (src.hasRank()) - tgt.setRank(src.getRank()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER; - case OTHER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.URL; - default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PHONE: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PHONE; - case FAX: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.FAX; - case EMAIL: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.EMAIL; - case PAGER: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PAGER; - case URL: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.OTHER; - default: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HOME: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.HOME; - case WORK: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.WORK; - case TEMP: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.TEMP; - case OLD: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.OLD; - case MOBILE: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.MOBILE; - default: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2016may.model.ElementDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition tgt = new org.hl7.fhir.dstu3.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getRepresentation()) - tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); - if (src.hasName()) - tgt.setSliceName(src.getName()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComments()) - tgt.setComment(src.getComments()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setContentReference(src.getContentReference()); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent t : src.getType()) - tgt.addType(convertTypeRefComponent(t)); - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - tgt.setFixed(convertType(src.getFixed())); - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); - tgt.setMinValue(convertType(src.getMinValue())); - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.dstu2016may.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getRepresentation()) - tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); - if (src.hasSliceName()) - tgt.setName(src.getSliceName()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addCode(convertCoding(t)); - if (src.hasSlicing()) - tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); - if (src.hasShort()) - tgt.setShort(src.getShort()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - if (src.hasComment()) - tgt.setComments(src.getComment()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) - tgt.addAlias(t.getValue()); - if (src.hasMin()) - tgt.setMin(src.getMin()); - if (src.hasMax()) - tgt.setMax(src.getMax()); - if (src.hasBase()) - tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); - if (src.hasContentReference()) - tgt.setContentReference(src.getContentReference()); - for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) - tgt.addType(convertTypeRefComponent(t)); - tgt.setDefaultValue(convertType(src.getDefaultValue())); - if (src.hasMeaningWhenMissing()) - tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); - tgt.setFixed(convertType(src.getFixed())); - tgt.setPattern(convertType(src.getPattern())); - if (src.hasExample()) - tgt.setExample(convertType(src.getExample().get(0).getValue())); - tgt.setMinValue(convertType(src.getMinValue())); - tgt.setMaxValue(convertType(src.getMaxValue())); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - for (org.hl7.fhir.dstu3.model.IdType t : src.getCondition()) - tgt.addCondition(t.getValue()); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) - tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); - if (src.hasMustSupport()) - tgt.setMustSupport(src.getMustSupport()); - if (src.hasIsModifier()) - tgt.setIsModifier(src.getIsModifier()); - if (src.hasIsSummary()) - tgt.setIsSummary(src.getIsSummary()); - if (src.hasBinding()) - tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertElementDefinitionMappingComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR; - case XMLTEXT: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLTEXT; - case TYPEATTR: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.TYPEATTR; - case CDATEXT: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.CDATEXT; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XMLATTR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLATTR; - case XMLTEXT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLTEXT; - case TYPEATTR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.TYPEATTR; - case CDATEXT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.CDATEXT; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getDiscriminator()) - tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOrdered()) - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent(); - copyElement(src, tgt); - for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) - tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasOrdered()) - tgt.setOrdered(src.getOrdered()); - tgt.setRules(convertSlicingRules(src.getRules())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLOSED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.CLOSED; - case OPEN: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPEN; - case OPENATEND: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPENATEND; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent(); - copyElement(src, tgt); - tgt.setPath(src.getPath()); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent convertTypeRefComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getProfile()) { - if (src.getCode().equals("Reference")) - tgt.setTargetProfile(t.getValueAsString()); - else - tgt.setProfile(t.getValueAsString()); - } - for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getAggregation()) - tgt.addAggregation(convertAggregationMode(t.getValue())); - tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent convertTypeRefComponent(org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasCode() && "Reference".equals(src.getCode())) - tgt.addProfile(src.getTargetProfile()); - else - tgt.addProfile(src.getProfile()); - for (org.hl7.fhir.dstu3.model.Enumeration t : src.getAggregation()) - tgt.addAggregation(convertAggregationMode(t.getValue())); - tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONTAINED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.CONTAINED; - case REFERENCED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.REFERENCED; - case BUNDLED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.BUNDLED; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EITHER: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.EITHER; - case INDEPENDENT: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; - case SPECIFIC: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EITHER: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.EITHER; - case INDEPENDENT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; - case SPECIFIC: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - tgt.setXpath(src.getXpath()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent(); - copyElement(src, tgt); - tgt.setKey(src.getKey()); - if (src.hasRequirements()) - tgt.setRequirements(src.getRequirements()); - tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); - tgt.setHuman(src.getHuman()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - tgt.setXpath(src.getXpath()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case ERROR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.WARNING; - default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REQUIRED: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.REQUIRED; - case EXTENSIBLE: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXTENSIBLE; - case PREFERRED: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.PREFERRED; - case EXAMPLE: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXAMPLE; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setMap(src.getMap()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.dstu2016may.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - if (src.hasText()) - tgt.setText(src.getText()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getFamily()) - tgt.setFamily(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.HumanName convertHumanName(org.hl7.fhir.dstu3.model.HumanName src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.HumanName tgt = new org.hl7.fhir.dstu2016may.model.HumanName(); - copyElement(src, tgt); - tgt.setUse(convertNameUse(src.getUse())); - if (src.hasText()) - tgt.setText(src.getText()); - if (src.hasFamily()) - tgt.addFamily(src.getFamily()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getGiven()) - tgt.addGiven(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getPrefix()) - tgt.addPrefix(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSuffix()) - tgt.addSuffix(t.getValue()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2016may.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu3.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.dstu3.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.dstu3.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu3.model.HumanName.NameUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case USUAL: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.USUAL; - case OFFICIAL: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OFFICIAL; - case TEMP: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.TEMP; - case NICKNAME: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NICKNAME; - case ANONYMOUS: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.ANONYMOUS; - case OLD: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OLD; - case MAIDEN: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.MAIDEN; - default: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.dstu2016may.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); - copyElement(src, tgt); - if (src.hasVersionId()) - tgt.setVersionId(src.getVersionId()); - if (src.hasLastUpdated()) - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Meta convertMeta(org.hl7.fhir.dstu3.model.Meta src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Meta tgt = new org.hl7.fhir.dstu2016may.model.Meta(); - copyElement(src, tgt); - if (src.hasVersionId()) - tgt.setVersionId(src.getVersionId()); - if (src.hasLastUpdated()) - tgt.setLastUpdated(src.getLastUpdated()); - for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) - tgt.addProfile(t.getValue()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurity()) - tgt.addSecurity(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) - tgt.addTag(convertCoding(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Timing convertTiming(org.hl7.fhir.dstu2016may.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Timing tgt = new org.hl7.fhir.dstu3.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Timing convertTiming(org.hl7.fhir.dstu3.model.Timing src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Timing tgt = new org.hl7.fhir.dstu2016may.model.Timing(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.DateTimeType t : src.getEvent()) - tgt.addEvent(t.getValue()); - tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); - tgt.setCode(convertCodeableConcept(src.getCode())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - if (src.hasCountMax()) - tgt.setCountMax(src.getCountMax()); - if (src.hasDuration()) - tgt.setDuration(src.getDuration()); - if (src.hasDurationMax()) - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); - if (src.hasFrequency()) - tgt.setFrequency(src.getFrequency()); - if (src.hasFrequencyMax()) - tgt.setFrequencyMax(src.getFrequencyMax()); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasPeriodMax()) - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); - tgt.addWhen(convertEventTiming(src.getWhen())); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent(); - copyElement(src, tgt); - tgt.setBounds(convertType(src.getBounds())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - if (src.hasCountMax()) - tgt.setCountMax(src.getCountMax()); - if (src.hasDuration()) - tgt.setDuration(src.getDuration()); - if (src.hasDurationMax()) - tgt.setDurationMax(src.getDurationMax()); - tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); - if (src.hasFrequency()) - tgt.setFrequency(src.getFrequency()); - if (src.hasFrequencyMax()) - tgt.setFrequencyMax(src.getFrequencyMax()); - if (src.hasPeriod()) - tgt.setPeriod(src.getPeriod()); - if (src.hasPeriodMax()) - tgt.setPeriodMax(src.getPeriodMax()); - tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); - for (Enumeration t : src.getWhen()) - tgt.setWhen(convertEventTiming(t.getValue())); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case S: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.S; - case MIN: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MIN; - case H: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.H; - case D: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.D; - case WK: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.WK; - case MO: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MO; - case A: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.A; - default: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2016may.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.dstu3.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.dstu3.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.dstu3.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.dstu3.model.Timing.EventTiming.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu3.model.Timing.EventTiming src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case HS: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.HS; - case WAKE: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.WAKE; - case C: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.C; - case CM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CM; - case CD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CD; - case CV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CV; - case AC: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.AC; - case ACM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACM; - case ACD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACD; - case ACV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACV; - case PC: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PC; - case PCM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCM; - case PCD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCD; - case PCV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCV; - default: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.dstu2016may.model.SimpleQuantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SimpleQuantity tgt = new org.hl7.fhir.dstu3.model.SimpleQuantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2016may.model.SimpleQuantity(); - copyElement(src, tgt); - if (src.hasValue()) - tgt.setValue(src.getValue()); - tgt.setComparator(convertQuantityComparator(src.getComparator())); - if (src.hasUnit()) - tgt.setUnit(src.getUnit()); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Type convertType(org.hl7.fhir.dstu2016may.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu2016may.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.dstu2016may.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.BooleanType) - return convertBoolean((org.hl7.fhir.dstu2016may.model.BooleanType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CodeType) - return convertCode((org.hl7.fhir.dstu2016may.model.CodeType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DateType) - return convertDate((org.hl7.fhir.dstu2016may.model.DateType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DateTimeType) - return convertDateTime((org.hl7.fhir.dstu2016may.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DecimalType) - return convertDecimal((org.hl7.fhir.dstu2016may.model.DecimalType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.IdType) - return convertId((org.hl7.fhir.dstu2016may.model.IdType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.InstantType) - return convertInstant((org.hl7.fhir.dstu2016may.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu2016may.model.IntegerType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.dstu2016may.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.OidType) - return convertOid((org.hl7.fhir.dstu2016may.model.OidType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu2016may.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.StringType) - return convertString((org.hl7.fhir.dstu2016may.model.StringType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.TimeType) - return convertTime((org.hl7.fhir.dstu2016may.model.TimeType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.dstu2016may.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.UriType) - return convertUri((org.hl7.fhir.dstu2016may.model.UriType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.UuidType) - return convertUuid((org.hl7.fhir.dstu2016may.model.UuidType) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Extension) - return convertExtension((org.hl7.fhir.dstu2016may.model.Extension) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Narrative) - return convertNarrative((org.hl7.fhir.dstu2016may.model.Narrative) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Age) - return convertAge((org.hl7.fhir.dstu2016may.model.Age) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Annotation) - return convertAnnotation((org.hl7.fhir.dstu2016may.model.Annotation) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Attachment) - return convertAttachment((org.hl7.fhir.dstu2016may.model.Attachment) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.dstu2016may.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Coding) - return convertCoding((org.hl7.fhir.dstu2016may.model.Coding) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Count) - return convertCount((org.hl7.fhir.dstu2016may.model.Count) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Distance) - return convertDistance((org.hl7.fhir.dstu2016may.model.Distance) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Duration) - return convertDuration((org.hl7.fhir.dstu2016may.model.Duration) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Identifier) - return convertIdentifier((org.hl7.fhir.dstu2016may.model.Identifier) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Money) - return convertMoney((org.hl7.fhir.dstu2016may.model.Money) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Period) - return convertPeriod((org.hl7.fhir.dstu2016may.model.Period) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Quantity) - return convertQuantity((org.hl7.fhir.dstu2016may.model.Quantity) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Range) - return convertRange((org.hl7.fhir.dstu2016may.model.Range) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Ratio) - return convertRatio((org.hl7.fhir.dstu2016may.model.Ratio) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Reference) - return convertReference((org.hl7.fhir.dstu2016may.model.Reference) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.SampledData) - return convertSampledData((org.hl7.fhir.dstu2016may.model.SampledData) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Signature) - return convertSignature((org.hl7.fhir.dstu2016may.model.Signature) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Address) - return convertAddress((org.hl7.fhir.dstu2016may.model.Address) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.dstu2016may.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ElementDefinition) - return convertElementDefinition((org.hl7.fhir.dstu2016may.model.ElementDefinition) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.HumanName) - return convertHumanName((org.hl7.fhir.dstu2016may.model.HumanName) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Meta) - return convertMeta((org.hl7.fhir.dstu2016may.model.Meta) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Timing) - return convertTiming((org.hl7.fhir.dstu2016may.model.Timing) src); - throw new Error("Unknown type "+src.fhirType()); - } - - public static org.hl7.fhir.dstu2016may.model.Type convertType(org.hl7.fhir.dstu3.model.Type src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu3.model.Base64BinaryType) - return convertBase64Binary((org.hl7.fhir.dstu3.model.Base64BinaryType) src); - if (src instanceof org.hl7.fhir.dstu3.model.BooleanType) - return convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeType) - return convertCode((org.hl7.fhir.dstu3.model.CodeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DateType) - return convertDate((org.hl7.fhir.dstu3.model.DateType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DateTimeType) - return convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.DecimalType) - return convertDecimal((org.hl7.fhir.dstu3.model.DecimalType) src); - if (src instanceof org.hl7.fhir.dstu3.model.IdType) - return convertId((org.hl7.fhir.dstu3.model.IdType) src); - if (src instanceof org.hl7.fhir.dstu3.model.InstantType) - return convertInstant((org.hl7.fhir.dstu3.model.InstantType) src); - if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) - return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); - if (src instanceof org.hl7.fhir.dstu3.model.MarkdownType) - return convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src); - if (src instanceof org.hl7.fhir.dstu3.model.OidType) - return convertOid((org.hl7.fhir.dstu3.model.OidType) src); - if (src instanceof org.hl7.fhir.dstu3.model.PositiveIntType) - return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) src); - if (src instanceof org.hl7.fhir.dstu3.model.StringType) - return convertString((org.hl7.fhir.dstu3.model.StringType) src); - if (src instanceof org.hl7.fhir.dstu3.model.TimeType) - return convertTime((org.hl7.fhir.dstu3.model.TimeType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) - return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UriType) - return convertUri((org.hl7.fhir.dstu3.model.UriType) src); - if (src instanceof org.hl7.fhir.dstu3.model.UuidType) - return convertUuid((org.hl7.fhir.dstu3.model.UuidType) src); - if (src instanceof org.hl7.fhir.dstu3.model.Extension) - return convertExtension((org.hl7.fhir.dstu3.model.Extension) src); - if (src instanceof org.hl7.fhir.dstu3.model.Narrative) - return convertNarrative((org.hl7.fhir.dstu3.model.Narrative) src); - if (src instanceof org.hl7.fhir.dstu3.model.Age) - return convertAge((org.hl7.fhir.dstu3.model.Age) src); - if (src instanceof org.hl7.fhir.dstu3.model.Annotation) - return convertAnnotation((org.hl7.fhir.dstu3.model.Annotation) src); - if (src instanceof org.hl7.fhir.dstu3.model.Attachment) - return convertAttachment((org.hl7.fhir.dstu3.model.Attachment) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeableConcept) - return convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) src); - if (src instanceof org.hl7.fhir.dstu3.model.Coding) - return convertCoding((org.hl7.fhir.dstu3.model.Coding) src); - if (src instanceof org.hl7.fhir.dstu3.model.Count) - return convertCount((org.hl7.fhir.dstu3.model.Count) src); - if (src instanceof org.hl7.fhir.dstu3.model.Distance) - return convertDistance((org.hl7.fhir.dstu3.model.Distance) src); - if (src instanceof org.hl7.fhir.dstu3.model.Duration) - return convertDuration((org.hl7.fhir.dstu3.model.Duration) src); - if (src instanceof org.hl7.fhir.dstu3.model.Identifier) - return convertIdentifier((org.hl7.fhir.dstu3.model.Identifier) src); - if (src instanceof org.hl7.fhir.dstu3.model.Money) - return convertMoney((org.hl7.fhir.dstu3.model.Money) src); - if (src instanceof org.hl7.fhir.dstu3.model.Period) - return convertPeriod((org.hl7.fhir.dstu3.model.Period) src); - if (src instanceof org.hl7.fhir.dstu3.model.Quantity) - return convertQuantity((org.hl7.fhir.dstu3.model.Quantity) src); - if (src instanceof org.hl7.fhir.dstu3.model.Range) - return convertRange((org.hl7.fhir.dstu3.model.Range) src); - if (src instanceof org.hl7.fhir.dstu3.model.Ratio) - return convertRatio((org.hl7.fhir.dstu3.model.Ratio) src); - if (src instanceof org.hl7.fhir.dstu3.model.Reference) - return convertReference((org.hl7.fhir.dstu3.model.Reference) src); - if (src instanceof org.hl7.fhir.dstu3.model.SampledData) - return convertSampledData((org.hl7.fhir.dstu3.model.SampledData) src); - if (src instanceof org.hl7.fhir.dstu3.model.Signature) - return convertSignature((org.hl7.fhir.dstu3.model.Signature) src); - if (src instanceof org.hl7.fhir.dstu3.model.Address) - return convertAddress((org.hl7.fhir.dstu3.model.Address) src); - if (src instanceof org.hl7.fhir.dstu3.model.ContactPoint) - return convertContactPoint((org.hl7.fhir.dstu3.model.ContactPoint) src); - if (src instanceof org.hl7.fhir.dstu3.model.ElementDefinition) - return convertElementDefinition((org.hl7.fhir.dstu3.model.ElementDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.HumanName) - return convertHumanName((org.hl7.fhir.dstu3.model.HumanName) src); - if (src instanceof org.hl7.fhir.dstu3.model.Meta) - return convertMeta((org.hl7.fhir.dstu3.model.Meta) src); - if (src instanceof org.hl7.fhir.dstu3.model.Timing) - return convertTiming((org.hl7.fhir.dstu3.model.Timing) src); - throw new Error("Unknown type "+src.fhirType()); - } - - private static void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt) 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()) - tgt.addExtension(convertExtension(t)); - for (org.hl7.fhir.dstu2016may.model.Extension t : src.getModifierExtension()) - tgt.addModifierExtension(convertExtension(t)); - } - private static void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.dstu2016may.model.DomainResource tgt) throws FHIRException { - copyResource(src, tgt); - if (src.hasText()) - tgt.setText(convertNarrative(src.getText())); - for (org.hl7.fhir.dstu3.model.Resource t : src.getContained()) - tgt.addContained(convertResource(t)); - for (org.hl7.fhir.dstu3.model.Extension t : src.getExtension()) - tgt.addExtension(convertExtension(t)); - for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension()) - tgt.addModifierExtension(convertExtension(t)); - } - public static org.hl7.fhir.dstu3.model.Parameters convertParameters(org.hl7.fhir.dstu2016may.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Parameters tgt = new org.hl7.fhir.dstu3.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Parameters convertParameters(org.hl7.fhir.dstu3.model.Parameters src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Parameters tgt = new org.hl7.fhir.dstu2016may.model.Parameters(); - copyResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getParameter()) - tgt.addParameter(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - tgt.setResource(convertResource(src.getResource())); - for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getPart()) - tgt.addPart(convertParametersParameterComponent(t)); - return tgt; - } - - private static void copyResource(org.hl7.fhir.dstu2016may.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - private static void copyResource(org.hl7.fhir.dstu3.model.Resource src, org.hl7.fhir.dstu2016may.model.Resource tgt) throws FHIRException { - if (src.hasId()) - tgt.setId(src.getId()); - if (src.hasMeta()) - tgt.setMeta(convertMeta(src.getMeta())); - if (src.hasImplicitRules()) - tgt.setImplicitRules(src.getImplicitRules()); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - } - - public static org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.dstu2016may.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Binary tgt = new org.hl7.fhir.dstu2016may.model.Binary(); - copyResource(src, tgt); - tgt.setContentType(src.getContentType()); - tgt.setContent(src.getContent()); - return tgt; - } - - - public static org.hl7.fhir.dstu3.model.Bundle convertBundle(org.hl7.fhir.dstu2016may.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle tgt = new org.hl7.fhir.dstu3.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle tgt = new org.hl7.fhir.dstu2016may.model.Bundle(); - copyResource(src, tgt); - tgt.setType(convertBundleType(src.getType())); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent t : src.getEntry()) - tgt.addEntry(convertBundleEntryComponent(t)); - tgt.setSignature(convertSignature(src.getSignature())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2016may.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.dstu3.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.dstu3.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.dstu3.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.dstu3.model.Bundle.BundleType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu3.model.Bundle.BundleType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DOCUMENT: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.DOCUMENT; - case MESSAGE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.MESSAGE; - case TRANSACTION: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTION; - case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTIONRESPONSE; - case BATCH: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCH; - case BATCHRESPONSE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCHRESPONSE; - case HISTORY: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.HISTORY; - case SEARCHSET: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.SEARCHSET; - case COLLECTION: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.COLLECTION; - default: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent(); - copyElement(src, tgt); - tgt.setRelation(src.getRelation()); - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - if (src.hasFullUrl()) - tgt.setFullUrl(src.getFullUrl()); - tgt.setResource(convertResource(src.getResource())); - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) - tgt.addLink(convertBundleLinkComponent(t)); - if (src.hasFullUrl()) - tgt.setFullUrl(src.getFullUrl()); - tgt.setResource(convertResource(src.getResource())); - tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); - tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); - tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent(); - copyElement(src, tgt); - tgt.setMode(convertSearchEntryMode(src.getMode())); - if (src.hasScore()) - tgt.setScore(src.getScore()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case MATCH: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.MATCH; - case INCLUDE: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.INCLUDE; - case OUTCOME: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.OUTCOME; - default: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - if (src.hasIfNoneMatch()) - tgt.setIfNoneMatch(src.getIfNoneMatch()); - if (src.hasIfModifiedSince()) - tgt.setIfModifiedSince(src.getIfModifiedSince()); - if (src.hasIfMatch()) - tgt.setIfMatch(src.getIfMatch()); - if (src.hasIfNoneExist()) - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent(); - copyElement(src, tgt); - tgt.setMethod(convertHTTPVerb(src.getMethod())); - tgt.setUrl(src.getUrl()); - if (src.hasIfNoneMatch()) - tgt.setIfNoneMatch(src.getIfNoneMatch()); - if (src.hasIfModifiedSince()) - tgt.setIfModifiedSince(src.getIfModifiedSince()); - if (src.hasIfMatch()) - tgt.setIfMatch(src.getIfMatch()); - if (src.hasIfNoneExist()) - tgt.setIfNoneExist(src.getIfNoneExist()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GET: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.GET; - case POST: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.POST; - case PUT: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.PUT; - case DELETE: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.DELETE; - default: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - if (src.hasLocation()) - tgt.setLocation(src.getLocation()); - if (src.hasEtag()) - tgt.setEtag(src.getEtag()); - if (src.hasLastModified()) - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent(); - copyElement(src, tgt); - tgt.setStatus(src.getStatus()); - if (src.hasLocation()) - tgt.setLocation(src.getLocation()); - if (src.hasEtag()) - tgt.setEtag(src.getEtag()); - if (src.hasLastModified()) - tgt.setLastModified(src.getLastModified()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; - default: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; - } - } - - public static org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.DRAFT; - case ACTIVE: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.ACTIVE; - case RETIRED: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.RETIRED; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu2016may.model.CodeSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeSystem tgt = new org.hl7.fhir.dstu3.model.CodeSystem(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent t : src.getContact()) - tgt.addContact(convertCodeSystemContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasCaseSensitive()) - tgt.setCaseSensitive(src.getCaseSensitive()); - if (src.hasValueSet()) - tgt.setValueSet(src.getValueSet()); - if (src.hasCompositional()) - tgt.setCompositional(src.getCompositional()); - if (src.hasVersionNeeded()) - tgt.setVersionNeeded(src.getVersionNeeded()); - tgt.setContent(convertCodeSystemContentMode(src.getContent())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) - tgt.addFilter(convertCodeSystemFilterComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent t : src.getProperty()) - tgt.addProperty(convertPropertyComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - - private static boolean isJurisdiction(CodeableConcept t) { - 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.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2016may.model.CodeableConcept t) throws FHIRException { - org.hl7.fhir.dstu3.model.UsageContext result = new org.hl7.fhir.dstu3.model.UsageContext(); - // todo: set type.. - result.setValue(convertCodeableConcept(t)); - return result; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertCodeSystemContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasCaseSensitive()) - tgt.setCaseSensitive(src.getCaseSensitive()); - if (src.hasValueSet()) - tgt.setValueSet(src.getValueSet()); - if (src.hasCompositional()) - tgt.setCompositional(src.getCompositional()); - if (src.hasVersionNeeded()) - tgt.setVersionNeeded(src.getVersionNeeded()); - tgt.setContent(convertCodeSystemContentMode(src.getContent())); - if (src.hasCount()) - tgt.setCount(src.getCount()); - for (org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) - tgt.addFilter(convertCodeSystemFilterComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent t : src.getProperty()) - tgt.addProperty(convertPropertyComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTPRESENT: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; - case EXAMPLAR: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.EXAMPLE; - case FRAGMENT: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.FRAGMENT; - case COMPLETE: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.COMPLETE; - default: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NULL; - } -} - - private static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTPRESENT: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; - case EXAMPLE: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.EXAMPLAR; - case FRAGMENT: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.FRAGMENT; - case COMPLETE: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.COMPLETE; - default: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NULL; - } -} - - public static org.hl7.fhir.dstu3.model.ContactDetail convertCodeSystemContactComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent convertCodeSystemContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getOperator()) - try { - tgt.addOperator(CodeSystem.FilterOperator.fromCode(t.getValue())); - } catch (org.hl7.fhir.exceptions.FHIRException e) { - throw new FHIRException(e); - } - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (Enumeration t : src.getOperator()) - tgt.addOperator(t.getValue().toCode()); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setType(convertPropertyType(src.getType())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent convertPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setType(convertPropertyType(src.getType())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODE: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODE; - case CODING: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODING; - case STRING: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.STRING; - case INTEGER: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.INTEGER; - case BOOLEAN: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.BOOLEAN; - case DATETIME: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.DATETIME; - default: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.NULL; - } -} - - private static org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODE: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODE; - case CODING: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODING; - case STRING: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.STRING; - case INTEGER: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.INTEGER; - case BOOLEAN: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.BOOLEAN; - case DATETIME: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.DATETIME; - default: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.NULL; - } -} - - public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); - for (ConceptDefinitionPropertyComponent t : src.getProperty()) - tgt.addProperty(convertConceptPropertyComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) - tgt.addProperty(convertConceptPropertyComponent(t)); - for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) - tgt.addConcept(convertConceptDefinitionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu2016may.model.CompartmentDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertCompartmentDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - tgt.setCode(convertCompartmentType(src.getCode())); - tgt.setSearch(src.getSearch()); - for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) - tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu3.model.CompartmentDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertCompartmentDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - tgt.setCode(convertCompartmentType(src.getCode())); - tgt.setSearch(src.getSearch()); - for (org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) - tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PATIENT; - case ENCOUNTER: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.DEVICE; - default: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.NULL; - } -} - - private static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PATIENT: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PATIENT; - case ENCOUNTER: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.ENCOUNTER; - case RELATEDPERSON: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; - case PRACTITIONER: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PRACTITIONER; - case DEVICE: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.DEVICE; - default: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.NULL; - } -} - - public static org.hl7.fhir.dstu3.model.ContactDetail convertCompartmentDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent convertCompartmentDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getParam()) - tgt.addParam(t.getValue()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getParam()) - tgt.addParam(t.getValue()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - - public static org.hl7.fhir.dstu3.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2016may.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ConceptMap tgt = new org.hl7.fhir.dstu3.model.ConceptMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setSource(convertType(src.getSource())); - tgt.setTarget(convertType(src.getTarget())); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) { - List ws = convertSourceElementComponent(t); - for (SourceElementComponentWrapper w : ws) - getGroup(tgt, w.source, w.target).addElement(w.comp); - } - return tgt; - } - - private static ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { - for (ConceptMapGroupComponent grp : map.getGroup()) { - if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) - return grp; - } - ConceptMapGroupComponent grp = map.addGroup(); - grp.setSource(srcs); - grp.setTarget(tgts); - return grp; - } - - - public static org.hl7.fhir.dstu2016may.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu3.model.ConceptMap src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConceptMapContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setSource(convertType(src.getSource())); - tgt.setTarget(convertType(src.getTarget())); - for (org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) - for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : g.getElement()) - tgt.addElement(convertSourceElementComponent(t, g)); - return tgt; - } - - - public static org.hl7.fhir.dstu3.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - private static class SourceElementComponentWrapper { - public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { - super(); - this.source = source; - this.target = target; - this.comp = comp; - } - private String source; - private String target; - private org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent comp; - - } - 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()) { - org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - tgt.addTarget(convertTargetElementComponent(t)); - res.add(new SourceElementComponentWrapper(tgt, src.getSystem(), t.getSystem())); - } - return res; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent(); - copyElement(src, tgt); - if (g.hasSource()) - tgt.setSystem(g.getSource()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent t : src.getTarget()) - tgt.addTarget(convertTargetElementComponent(t, g)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - if (src.hasCode()) - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - if (src.hasComments()) - tgt.setComment(src.getComments()); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent(); - copyElement(src, tgt); - if (g.hasTarget()) - tgt.setSystem(g.getTarget()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); - if (src.hasComment()) - tgt.setComments(src.getComment()); - for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) - tgt.addDependsOn(convertOtherElementComponent(t)); - for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getProduct()) - tgt.addProduct(convertOtherElementComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case EQUAL: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUAL; - case WIDER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER; - case SUBSUMES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SUBSUMES; - case NARROWER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER; - case SPECIALIZES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; - case INEXACT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.INEXACT; - case UNMATCHED: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED; - case DISJOINT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL; - } - } - - public static org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUIVALENT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; - case EQUAL: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUAL; - case WIDER: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.WIDER; - case SUBSUMES: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.SUBSUMES; - case NARROWER: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NARROWER; - case SPECIALIZES: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; - case INEXACT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.INEXACT; - case UNMATCHED: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.UNMATCHED; - case DISJOINT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.DISJOINT; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getElement()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent(); - copyElement(src, tgt); - tgt.setElement(src.getProperty()); - tgt.setSystem(src.getSystem()); - tgt.setCode(src.getCode()); - return tgt; - } - - - public static org.hl7.fhir.dstu3.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2016may.model.Conformance src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); - tgt.setFhirVersion(src.getFhirVersion()); - tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance convertConformance(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance tgt = new org.hl7.fhir.dstu2016may.model.Conformance(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertConformanceContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setKind(convertConformanceStatementKind(src.getKind())); - tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); - tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); - tgt.setFhirVersion(src.getFhirVersion()); - tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getFormat()) - tgt.addFormat(t.getValue()); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) - tgt.addRest(convertConformanceRestComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) - tgt.addMessaging(convertConformanceMessagingComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) - tgt.addDocument(convertConformanceDocumentComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INSTANCE: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.INSTANCE; - case CAPABILITY: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.CAPABILITY; - case REQUIREMENTS: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.REQUIREMENTS; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NO: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NO; - case EXTENSIONS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; - case ELEMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.ELEMENTS; - case BOTH: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.BOTH; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NO: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.NO; - case EXTENSIONS: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.EXTENSIONS; - case ELEMENTS: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.ELEMENTS; - case BOTH: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.BOTH; - default: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasReleaseDate()) - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasReleaseDate()) - tgt.setReleaseDate(src.getReleaseDate()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent(); - copyElement(src, tgt); - tgt.setDescription(src.getDescription()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent(); - copyElement(src, tgt); - tgt.setMode(convertRestfulConformanceMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) - tgt.addResource(convertConformanceRestResourceComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertSystemInteractionComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation()) - tgt.addOperation(convertConformanceRestOperationComponent(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getCompartment()) - tgt.addCompartment(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; - case SERVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.SERVER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CLIENT: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.CLIENT; - case SERVER: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.SERVER; - default: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); - copyElement(src, tgt); - if (src.hasCors()) - tgt.setCors(src.getCors()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent t : src.getCertificate()) - tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent(); - copyElement(src, tgt); - if (src.hasCors()) - tgt.setCors(src.getCors()); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getService()) - tgt.addService(convertCodeableConcept(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent t : src.getCertificate()) - tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasBlob()) - tgt.setBlob(src.getBlob()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent(); - copyElement(src, tgt); - if (src.hasType()) - tgt.setType(src.getType()); - if (src.hasBlob()) - tgt.setBlob(src.getBlob()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - for (org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - if (src.hasReadHistory()) - tgt.setReadHistory(src.getReadHistory()); - if (src.hasUpdateCreate()) - tgt.setUpdateCreate(src.getUpdateCreate()); - if (src.hasConditionalCreate()) - tgt.setConditionalCreate(src.getConditionalCreate()); - if (src.hasConditionalUpdate()) - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) - tgt.addInteraction(convertResourceInteractionComponent(t)); - tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); - if (src.hasReadHistory()) - tgt.setReadHistory(src.getReadHistory()); - if (src.hasUpdateCreate()) - tgt.setUpdateCreate(src.getUpdateCreate()); - if (src.hasConditionalCreate()) - tgt.setConditionalCreate(src.getConditionalCreate()); - if (src.hasConditionalUpdate()) - tgt.setConditionalUpdate(src.getConditionalUpdate()); - tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchInclude()) - tgt.addSearchInclude(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchRevInclude()) - tgt.addSearchRevInclude(t.getValue()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) - tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOVERSION: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NOVERSION; - case VERSIONED: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONED; - case VERSIONEDUPDATE: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NOTSUPPORTED: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; - case SINGLE: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.SINGLE; - case MULTIPLE: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.MULTIPLE; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertTypeRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case READ: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.READ; - case VREAD: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.VREAD; - case UPDATE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.UPDATE; - case DELETE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.DELETE; - case HISTORYINSTANCE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; - case HISTORYTYPE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; - case CREATE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.CREATE; - case SEARCHTYPE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; - default: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL; - } - } - - public static org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NUMBER: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NUMBER; - case DATE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.DATE; - case STRING: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.STRING; - case TOKEN: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.TOKEN; - case REFERENCE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.REFERENCE; - case COMPOSITE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.COMPOSITE; - case QUANTITY: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.QUANTITY; - case URI: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.URI; - default: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDefinition()) - tgt.setDefinition(src.getDefinition()); - tgt.setType(convertSearchParamType(src.getType())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent(); - copyElement(src, tgt); - tgt.setCode(convertSystemRestfulInteraction(src.getCode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case TRANSACTION: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.TRANSACTION; - case SEARCHSYSTEM: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; - case HISTORYSYSTEM: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; - default: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(convertReference(src.getDefinition())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setDefinition(convertReference(src.getDefinition())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - if (src.hasReliableCache()) - tgt.setReliableCache(src.getReliableCache()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) - tgt.addEvent(convertConformanceMessagingEventComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) - tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); - if (src.hasReliableCache()) - tgt.setReliableCache(src.getReliableCache()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent t : src.getEvent()) - tgt.addEvent(convertConformanceMessagingEventComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent(); - copyElement(src, tgt); - tgt.setProtocol(convertCoding(src.getProtocol())); - tgt.setAddress(src.getAddress()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent(); - copyElement(src, tgt); - tgt.setCode(convertCoding(src.getCode())); - tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); - tgt.setMode(convertConformanceEventMode(src.getMode())); - tgt.setFocus(src.getFocus()); - tgt.setRequest(convertReference(src.getRequest())); - tgt.setResponse(convertReference(src.getResponse())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent(); - copyElement(src, tgt); - tgt.setCode(convertCoding(src.getCode())); - tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); - tgt.setMode(convertConformanceEventMode(src.getMode())); - tgt.setFocus(src.getFocus()); - tgt.setRequest(convertReference(src.getRequest())); - tgt.setResponse(convertReference(src.getResponse())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONSEQUENCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CONSEQUENCE; - case CURRENCY: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CURRENCY; - case NOTIFICATION: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NOTIFICATION; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CONSEQUENCE: return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.CONSEQUENCE; - case CURRENCY: return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.CURRENCY; - case NOTIFICATION: return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.NOTIFICATION; - default: return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.SENDER; - case RECEIVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.RECEIVER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SENDER: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.SENDER; - case RECEIVER: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.RECEIVER; - default: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent(); - copyElement(src, tgt); - tgt.setMode(convertDocumentMode(src.getMode())); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.CONSUMER; - default: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRODUCER: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.PRODUCER; - case CONSUMER: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.CONSUMER; - default: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.NULL; - } - } - - - public static org.hl7.fhir.dstu3.model.DataElement convertDataElement(org.hl7.fhir.dstu2016may.model.DataElement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DataElement tgt = new org.hl7.fhir.dstu3.model.DataElement(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent t : src.getContact()) - tgt.addContact(convertDataElementContactComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setStringency(convertDataElementStringency(src.getStringency())); - for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent t : src.getMapping()) - tgt.addMapping(convertDataElementMappingComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DataElement convertDataElement(org.hl7.fhir.dstu3.model.DataElement src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.DataElement tgt = new org.hl7.fhir.dstu2016may.model.DataElement(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertDataElementContactComponent(t)); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - tgt.setStringency(convertDataElementStringency(src.getStringency())); - for (org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent t : src.getMapping()) - tgt.addMapping(convertDataElementMappingComponent(t)); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPARABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.COMPARABLE; - case FULLYSPECIFIED: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FULLYSPECIFIED; - case EQUIVALENT: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.EQUIVALENT; - case CONVERTABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.CONVERTABLE; - case SCALEABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.SCALEABLE; - case FLEXIBLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FLEXIBLE; - default: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case COMPARABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.COMPARABLE; - case FULLYSPECIFIED: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.FULLYSPECIFIED; - case EQUIVALENT: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.EQUIVALENT; - case CONVERTABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.CONVERTABLE; - case SCALEABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.SCALEABLE; - case FLEXIBLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.FLEXIBLE; - default: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2016may.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasFhirVersion()) - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) - tgt.addDependency(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) - tgt.addPackage(convertImplementationGuidePackageComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getBinary()) - tgt.addBinary(t.getValue()); - tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu3.model.ImplementationGuide src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertImplementationGuideContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasFhirVersion()) - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) - tgt.addDependency(convertImplementationGuideDependencyComponent(t)); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) - tgt.addPackage(convertImplementationGuidePackageComponent(t)); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) - tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); - for (org.hl7.fhir.dstu3.model.UriType t : src.getBinary()) - tgt.addBinary(t.getValue()); - tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent(); - copyElement(src, tgt); - tgt.setType(convertGuideDependencyType(src.getType())); - tgt.setUri(src.getUri()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent(); - copyElement(src, tgt); - tgt.setType(convertGuideDependencyType(src.getType())); - tgt.setUri(src.getUri()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REFERENCE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.REFERENCE; - case INCLUSION: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.INCLUSION; - default: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case REFERENCE: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.REFERENCE; - case INCLUSION: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.INCLUSION; - default: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) - tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) - tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); - copyElement(src, tgt); - tgt.setExample(src.getExample()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasAcronym()) - tgt.setAcronym(src.getAcronym()); - tgt.setSource(convertType(src.getSource())); - if (src.hasExampleFor()) - tgt.setExampleFor(convertReference(src.getExampleFor())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); - copyElement(src, tgt); - tgt.setExample(src.getExample()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - if (src.hasAcronym()) - tgt.setAcronym(src.getAcronym()); - tgt.setSource(convertType(src.getSource())); - if (src.hasExampleFor()) - tgt.setExampleFor(convertReference(src.getExampleFor())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent(); - copyElement(src, tgt); - tgt.setType(src.getType()); - tgt.setProfile(convertReference(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent(); - copyElement(src, tgt); - tgt.setSource(src.getSource()); - tgt.setTitle(src.getName()); - tgt.setKind(convertGuidePageKind(src.getKind())); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getType()) - tgt.addType(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getPackage()) - tgt.addPackage(t.getValue()); - if (src.hasFormat()) - tgt.setFormat(src.getFormat()); - for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent(); - copyElement(src, tgt); - tgt.setSource(src.getSource()); - tgt.setName(src.getTitle()); - tgt.setKind(convertGuidePageKind(src.getKind())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getType()) - tgt.addType(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getPackage()) - tgt.addPackage(t.getValue()); - if (src.hasFormat()) - tgt.setFormat(src.getFormat()); - for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) - tgt.addPage(convertImplementationGuidePageComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PAGE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.PAGE; - case EXAMPLE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.EXAMPLE; - case LIST: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.LIST; - case INCLUDE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.INCLUDE; - case DIRECTORY: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DIRECTORY; - case DICTIONARY: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DICTIONARY; - case TOC: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.TOC; - case RESOURCE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.RESOURCE; - default: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PAGE: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.PAGE; - case EXAMPLE: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.EXAMPLE; - case LIST: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.LIST; - case INCLUDE: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.INCLUDE; - case DIRECTORY: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.DIRECTORY; - case DICTIONARY: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.DICTIONARY; - case TOC: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.TOC; - case RESOURCE: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.RESOURCE; - default: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2016may.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - if (src.hasResponsible()) - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - tgt.setReplacedBy(convertReference(src.getReplacedBy())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu3.model.NamingSystem src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.NamingSystem tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem(); - copyDomainResource(src, tgt); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertNamingSystemType(src.getKind())); - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertNamingSystemContactComponent(t)); - if (src.hasResponsible()) - tgt.setResponsible(src.getResponsible()); - tgt.setType(convertCodeableConcept(src.getType())); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasUsage()) - tgt.setUsage(src.getUsage()); - for (org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) - tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); - tgt.setReplacedBy(convertReference(src.getReplacedBy())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case CODESYSTEM: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.CODESYSTEM; - case IDENTIFIER: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.IDENTIFIER; - case ROOT: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.ROOT; - default: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent(); - copyElement(src, tgt); - tgt.setType(convertNamingSystemIdentifierType(src.getType())); - tgt.setValue(src.getValue()); - if (src.hasPreferred()) - tgt.setPreferred(src.getPreferred()); - tgt.setPeriod(convertPeriod(src.getPeriod())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OID: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OID; - case UUID: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.UUID; - case URI: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.URI; - case OTHER: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OTHER; - default: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2016may.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition tgt = new org.hl7.fhir.dstu3.model.OperationDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasIdempotent()) - tgt.setIdempotent(src.getIdempotent()); - tgt.setCode(src.getCode()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - tgt.setBase(convertReference(src.getBase())); - tgt.setSystem(src.getSystem()); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getType()) - tgt.addResource(t.getValue()); - tgt.setType(tgt.hasResource()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu3.model.OperationDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setKind(convertOperationKind(src.getKind())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertOperationDefinitionContactComponent(t)); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasIdempotent()) - tgt.setIdempotent(src.getIdempotent()); - tgt.setCode(src.getCode()); - if (src.hasComment()) - tgt.setComment(src.getComment()); - tgt.setBase(convertReference(src.getBase())); - tgt.setSystem(src.getSystem()); - if (src.getType()) - for (org.hl7.fhir.dstu3.model.CodeType t : src.getResource()) - tgt.addType(t.getValue()); - tgt.setInstance(src.getInstance()); - for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) - tgt.addParameter(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OPERATION: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.OPERATION; - case QUERY: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.QUERY; - default: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasType()) - tgt.setType(src.getType()); - tgt.setSearchType(convertSearchParamType(src.getSearchType())); - tgt.setProfile(convertReference(src.getProfile())); - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setUse(convertOperationParameterUse(src.getUse())); - tgt.setMin(src.getMin()); - tgt.setMax(src.getMax()); - if (src.hasDocumentation()) - tgt.setDocumentation(src.getDocumentation()); - if (src.hasType()) - tgt.setType(src.getType()); - tgt.setSearchType(convertSearchParamType(src.getSearchType())); - tgt.setProfile(convertReference(src.getProfile())); - tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); - for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) - tgt.addPart(convertOperationDefinitionParameterComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case IN: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.IN; - case OUT: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.OUT; - default: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); - copyElement(src, tgt); - tgt.setStrength(convertBindingStrength(src.getStrength())); - tgt.setValueSet(convertType(src.getValueSet())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2016may.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationOutcome tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) - tgt.addIssue(convertOperationOutcomeIssueComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - if (src.hasDiagnostics()) - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getExpression()) - tgt.addExpression(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent(); - copyElement(src, tgt); - tgt.setSeverity(convertIssueSeverity(src.getSeverity())); - tgt.setCode(convertIssueType(src.getCode())); - tgt.setDetails(convertCodeableConcept(src.getDetails())); - if (src.hasDiagnostics()) - tgt.setDiagnostics(src.getDiagnostics()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getLocation()) - tgt.addLocation(t.getValue()); - for (org.hl7.fhir.dstu3.model.StringType t : src.getExpression()) - tgt.addExpression(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case FATAL: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.FATAL; - case ERROR: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.ERROR; - case WARNING: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.WARNING; - case INFORMATION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.INFORMATION; - default: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INVALID: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVALID; - case STRUCTURE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.STRUCTURE; - case REQUIRED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.REQUIRED; - case VALUE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.VALUE; - case INVARIANT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVARIANT; - case SECURITY: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SECURITY; - case LOGIN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOGIN; - case UNKNOWN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.UNKNOWN; - case EXPIRED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXPIRED; - case FORBIDDEN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.FORBIDDEN; - case SUPPRESSED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SUPPRESSED; - case PROCESSING: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.PROCESSING; - case NOTSUPPORTED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTSUPPORTED; - case DUPLICATE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.DUPLICATE; - case NOTFOUND: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTFOUND; - case TOOLONG: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOLONG; - case CODEINVALID: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CODEINVALID; - case EXTENSION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXTENSION; - case TOOCOSTLY: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOCOSTLY; - case BUSINESSRULE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.BUSINESSRULE; - case CONFLICT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CONFLICT; - case INCOMPLETE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INCOMPLETE; - case TRANSIENT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TRANSIENT; - case LOCKERROR: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOCKERROR; - case NOSTORE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOSTORE; - case EXCEPTION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXCEPTION; - case TIMEOUT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TIMEOUT; - case THROTTLED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.THROTTLED; - case INFORMATIONAL: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INFORMATIONAL; - default: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NULL; - } - } - - - public static org.hl7.fhir.dstu3.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2016may.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Questionnaire tgt = new org.hl7.fhir.dstu3.model.Questionnaire(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) -// if (isJurisdiction(t)) -// tgt.addJurisdiction(convertCodeableConcept(t)); -// else - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu3.model.Questionnaire src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getUseContext()) - tgt.addUseContext(convertCodeableConcept(t)); -// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) -// tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasTitle()) - tgt.setTitle(src.getTitle()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getSubjectType()) - tgt.addSubjectType(t.getValue()); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.DRAFT; - case PUBLISHED: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.PUBLISHED; - case RETIRED: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.RETIRED; - default: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DRAFT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.DRAFT; - case PUBLISHED: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.PUBLISHED; - case RETIRED: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.RETIRED; - default: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) - tgt.addCode(convertCoding(t)); - if (src.hasPrefix()) - tgt.setPrefix(src.getPrefix()); - if (src.hasText()) - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireItemType(src.getType())); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) - tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasRepeats()) - tgt.setRepeats(src.getRepeats()); - if (src.hasReadOnly()) - tgt.setReadOnly(src.getReadOnly()); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - tgt.setOptions(convertReference(src.getOptions())); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) - tgt.addOption(convertQuestionnaireItemOptionComponent(t)); - tgt.setInitial(convertType(src.getInitial())); - for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) - tgt.addConcept(convertCoding(t)); - if (src.hasPrefix()) - tgt.setPrefix(src.getPrefix()); - if (src.hasText()) - tgt.setText(src.getText()); - tgt.setType(convertQuestionnaireItemType(src.getType())); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) - tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasRepeats()) - tgt.setRepeats(src.getRepeats()); - if (src.hasReadOnly()) - tgt.setReadOnly(src.getReadOnly()); - if (src.hasMaxLength()) - tgt.setMaxLength(src.getMaxLength()); - tgt.setOptions(convertReference(src.getOptions())); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) - tgt.addOption(convertQuestionnaireItemOptionComponent(t)); - tgt.setInitial(convertType(src.getInitial())); - for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireItemComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUP: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP; - case DISPLAY: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DISPLAY; - case QUESTION: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUESTION; - case BOOLEAN: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; - case INSTANT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case GROUP: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.GROUP; - case DISPLAY: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DISPLAY; - case QUESTION: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUESTION; - case BOOLEAN: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.BOOLEAN; - case DECIMAL: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DECIMAL; - case INTEGER: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.INTEGER; - case DATE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATE; - case DATETIME: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATETIME; - case TIME: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TIME; - case STRING: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.STRING; - case TEXT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TEXT; - case URL: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.URL; - case CHOICE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.CHOICE; - case OPENCHOICE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; - case ATTACHMENT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; - case REFERENCE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.REFERENCE; - case QUANTITY: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUANTITY; - default: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); - copyElement(src, tgt); - tgt.setQuestion(src.getQuestion()); - if (src.hasAnswered()) - tgt.setHasAnswer(src.getAnswered()); - tgt.setAnswer(convertType(src.getAnswer())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); - copyElement(src, tgt); - tgt.setQuestion(src.getQuestion()); - if (src.hasHasAnswer()) - tgt.setAnswered(src.getHasAnswer()); - tgt.setAnswer(convertType(src.getAnswer())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaire(convertReference(src.getQuestionnaire())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setContext(convertReference(src.getEncounter())); - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasAuthored()) - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse(); - copyDomainResource(src, tgt); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - tgt.setQuestionnaire(convertReference(src.getQuestionnaire())); - tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); - tgt.setSubject(convertReference(src.getSubject())); - tgt.setEncounter(convertReference(src.getContext())); - tgt.setAuthor(convertReference(src.getAuthor())); - if (src.hasAuthored()) - tgt.setAuthored(src.getAuthored()); - tgt.setSource(convertReference(src.getSource())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case INPROGRESS: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; - case COMPLETED: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; - case AMENDED: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; - default: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasText()) - tgt.setText(src.getText()); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); - copyElement(src, tgt); - if (src.hasLinkId()) - tgt.setLinkId(src.getLinkId()); - if (src.hasText()) - tgt.setText(src.getText()); - tgt.setSubject(convertReference(src.getSubject())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) - tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); - copyElement(src, tgt); - tgt.setValue(convertType(src.getValue())); - for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) - tgt.addItem(convertQuestionnaireResponseItemComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2016may.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.SearchParameter tgt = new org.hl7.fhir.dstu3.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - tgt.setCode(src.getCode()); - tgt.addBase(src.getBase()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu3.model.SearchParameter src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SearchParameter tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertSearchParameterContactComponent(t)); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - tgt.setCode(src.getCode()); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getBase()) - tgt.setBase(t.asStringValue()); - tgt.setType(convertSearchParamType(src.getType())); - tgt.setDescription(src.getDescription()); - if (src.hasExpression()) - tgt.setExpression(src.getExpression()); - if (src.hasXpath()) - tgt.setXpath(src.getXpath()); - tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); - for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget()) - tgt.addTarget(t.getValue()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case NORMAL: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NORMAL; - case PHONETIC: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.PHONETIC; - case NEARBY: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NEARBY; - case DISTANCE: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.DISTANCE; - case OTHER: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.OTHER; - default: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2016may.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - if (src.hasDisplay()) - tgt.setTitle(src.getDisplay()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) - tgt.addKeyword(convertCoding(t)); - if (src.hasFhirVersion()) - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind())); - tgt.setAbstract(src.getAbstract()); - tgt.setContextType(convertExtensionContext(src.getContextType())); - for (org.hl7.fhir.dstu2016may.model.StringType t : src.getContext()) - tgt.addContext(t.getValue()); - if (src.getDerivation() == TypeDerivationRule.CONSTRAINT) - tgt.setType(src.getBaseType()); - else - tgt.setType(src.getId()); - if (src.hasBaseDefinition()) - tgt.setBaseDefinition(src.getBaseDefinition()); - tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); - if (src.hasSnapshot()) { - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.getSnapshot().getElementFirstRep().getType().clear(); - } - if (src.hasDifferential()) { - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - tgt.getDifferential().getElementFirstRep().getType().clear(); - } - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - if (src.hasTitle()) - tgt.setDisplay(src.getTitle()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertStructureDefinitionContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) - tgt.addCode(convertCoding(t)); - if (src.hasFhirVersion()) - tgt.setFhirVersion(src.getFhirVersion()); - for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) - tgt.addMapping(convertStructureDefinitionMappingComponent(t)); - tgt.setKind(convertStructureDefinitionKind(src.getKind())); - tgt.setAbstract(src.getAbstract()); - tgt.setContextType(convertExtensionContext(src.getContextType())); - for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) - tgt.addContext(t.getValue()); - if (src.hasBaseDefinition()) - tgt.setBaseDefinition(src.getBaseDefinition()); - if (src.hasType() && src.getDerivation() == org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) - tgt.setBaseType(src.getType()); - tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); - if (src.hasSnapshot()) - tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); - tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case DATATYPE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; - case RESOURCE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case PRIMITIVETYPE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case COMPLEXTYPE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; - case RESOURCE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.RESOURCE; - case LOGICAL: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.LOGICAL; - default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; - case DATATYPE: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; - case EXTENSION: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESOURCE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE; - case DATATYPE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE; - case EXTENSION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION; - default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SPECIALIZATION: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; - case CONSTRAINT: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; - default: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case SPECIALIZATION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; - case CONSTRAINT: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; - default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComments()) - tgt.setComment(src.getComments()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent(); - copyElement(src, tgt); - tgt.setIdentity(src.getIdentity()); - if (src.hasUri()) - tgt.setUri(src.getUri()); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasComment()) - tgt.setComments(src.getComment()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) - tgt.addElement(convertElementDefinition(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript convertTestScript(org.hl7.fhir.dstu2016may.model.TestScript src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript tgt = new org.hl7.fhir.dstu3.model.TestScript(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent t : src.getContact()) - tgt.addContact(convertTestScriptContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) - tgt.addOrigin(convertTestScriptOriginComponent(t)); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) - tgt.addDestination(convertTestScriptDestinationComponent(t)); - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.dstu2016may.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent t : src.getRule()) - tgt.addRule(convertTestScriptRuleComponent(t)); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent t : src.getRuleset()) - tgt.addRuleset(convertTestScriptRulesetComponent(t)); - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript convertTestScript(org.hl7.fhir.dstu3.model.TestScript src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript tgt = new org.hl7.fhir.dstu2016may.model.TestScript(); - copyDomainResource(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - tgt.setIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertTestScriptContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) - tgt.addOrigin(convertTestScriptOriginComponent(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) - tgt.addDestination(convertTestScriptDestinationComponent(t)); - tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) - tgt.addFixture(convertTestScriptFixtureComponent(t)); - for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) - tgt.addProfile(convertReference(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent t : src.getVariable()) - tgt.addVariable(convertTestScriptVariableComponent(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent t : src.getRule()) - tgt.addRule(convertTestScriptRuleComponent(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent t : src.getRuleset()) - tgt.addRuleset(convertTestScriptRulesetComponent(t)); - tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent t : src.getTest()) - tgt.addTest(convertTestScriptTestComponent(t)); - tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent(); - copyElement(src, tgt); - tgt.setIndex(src.getIndex()); - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent(); - copyElement(src, tgt); - tgt.setIndex(src.getIndex()); - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent(); - copyElement(src, tgt); - tgt.setIndex(src.getIndex()); - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent(); - copyElement(src, tgt); - tgt.setIndex(src.getIndex()); - tgt.setProfile(convertCoding(src.getProfile())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) - tgt.addLink(convertTestScriptMetadataLinkComponent(t)); - for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) - tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent(); - copyElement(src, tgt); - tgt.setUrl(src.getUrl()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasValidated()) - tgt.setValidated(src.getValidated()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.IntegerType t : src.getOrigin()) - tgt.addOrigin(t.getValue()); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - tgt.setCapabilities(convertReference(src.getConformance())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent(); - copyElement(src, tgt); - if (src.hasRequired()) - tgt.setRequired(src.getRequired()); - if (src.hasValidated()) - tgt.setValidated(src.getValidated()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.IntegerType t : src.getOrigin()) - tgt.addOrigin(t.getValue()); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - for (org.hl7.fhir.dstu3.model.UriType t : src.getLink()) - tgt.addLink(t.getValue()); - tgt.setConformance(convertReference(src.getCapabilities())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - if (src.hasAutocreate()) - tgt.setAutocreate(src.getAutocreate()); - if (src.hasAutodelete()) - tgt.setAutodelete(src.getAutodelete()); - if (src.hasResource()) - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent(); - copyElement(src, tgt); - if (src.hasAutocreate()) - tgt.setAutocreate(src.getAutocreate()); - if (src.hasAutodelete()) - tgt.setAutodelete(src.getAutodelete()); - if (src.hasResource()) - tgt.setResource(convertReference(src.getResource())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(src.getDefaultValue()); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasDefaultValue()) - tgt.setDefaultValue(src.getDefaultValue()); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent convertTestScriptRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent(); - copyElement(src, tgt); - tgt.setResource(convertReference(src.getResource())); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent t : src.getParam()) - tgt.addParam(convertTestScriptRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent convertTestScriptRuleComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent(); - copyElement(src, tgt); - tgt.setResource(convertReference(src.getResource())); - for (org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent t : src.getParam()) - tgt.addParam(convertTestScriptRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent convertTestScriptRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent convertTestScriptRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent convertTestScriptRulesetComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent(); - copyElement(src, tgt); - tgt.setResource(convertReference(src.getResource())); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent t : src.getRule()) - tgt.addRule(convertTestScriptRulesetRuleComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent convertTestScriptRulesetComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent(); - copyElement(src, tgt); - tgt.setResource(convertReference(src.getResource())); - for (org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent t : src.getRule()) - tgt.addRule(convertTestScriptRulesetRuleComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent convertTestScriptRulesetRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent t : src.getParam()) - tgt.addParam(convertTestScriptRulesetRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent convertTestScriptRulesetRuleComponent(org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent t : src.getParam()) - tgt.addParam(convertTestScriptRulesetRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent convertTestScriptRulesetRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent convertTestScriptRulesetRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent t : src.getAction()) - tgt.addAction(convertSetupActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent(); - copyElement(src, tgt); - tgt.setType(convertCoding(src.getType())); - if (src.hasResource()) - tgt.setResource(src.getResource()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setAccept(convertContentType(src.getAccept())); - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - if (src.hasEncodeRequestUrl()) - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - if (src.hasOrigin()) - tgt.setOrigin(src.getOrigin()); - if (src.hasParams()) - tgt.setParams(src.getParams()); - for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - if (src.hasResponseId()) - tgt.setResponseId(src.getResponseId()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasTargetId()) - tgt.setTargetId(src.getTargetId()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent(); - copyElement(src, tgt); - if (src.hasResource()) - tgt.setResource(src.getResource()); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setAccept(convertContentType(src.getAccept())); - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasDestination()) - tgt.setDestination(src.getDestination()); - if (src.hasEncodeRequestUrl()) - tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); - if (src.hasOrigin()) - tgt.setOrigin(src.getOrigin()); - if (src.hasParams()) - tgt.setParams(src.getParams()); - for (org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) - tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); - if (src.hasResponseId()) - tgt.setResponseId(src.getResponseId()); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasTargetId()) - tgt.setTargetId(src.getTargetId()); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu2016may.model.TestScript.ContentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XML: return org.hl7.fhir.dstu3.model.TestScript.ContentType.XML; - case JSON: return org.hl7.fhir.dstu3.model.TestScript.ContentType.JSON; - default: return org.hl7.fhir.dstu3.model.TestScript.ContentType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu3.model.TestScript.ContentType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case XML: return org.hl7.fhir.dstu2016may.model.TestScript.ContentType.XML; - case JSON: return org.hl7.fhir.dstu2016may.model.TestScript.ContentType.JSON; - default: return org.hl7.fhir.dstu2016may.model.TestScript.ContentType.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - tgt.setField(src.getField()); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent(); - copyElement(src, tgt); - tgt.setField(src.getField()); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent(); - copyElement(src, tgt); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - if (src.hasCompareToSourceId()) - tgt.setCompareToSourceId(src.getCompareToSourceId()); - if (src.hasCompareToSourcePath()) - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasMinimumId()) - tgt.setMinimumId(src.getMinimumId()); - if (src.hasNavigationLinks()) - tgt.setNavigationLinks(src.getNavigationLinks()); - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasResource()) - tgt.setResource(src.getResource()); - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - if (src.hasResponseCode()) - tgt.setResponseCode(src.getResponseCode()); - tgt.setRule(convertSetupActionAssertRuleComponent(src.getRule())); - tgt.setRuleset(convertSetupActionAssertRulesetComponent(src.getRuleset())); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasValidateProfileId()) - tgt.setValidateProfileId(src.getValidateProfileId()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasWarningOnly()) - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent(); - copyElement(src, tgt); - if (src.hasLabel()) - tgt.setLabel(src.getLabel()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - tgt.setDirection(convertAssertionDirectionType(src.getDirection())); - if (src.hasCompareToSourceId()) - tgt.setCompareToSourceId(src.getCompareToSourceId()); - if (src.hasCompareToSourcePath()) - tgt.setCompareToSourcePath(src.getCompareToSourcePath()); - tgt.setContentType(convertContentType(src.getContentType())); - if (src.hasHeaderField()) - tgt.setHeaderField(src.getHeaderField()); - if (src.hasMinimumId()) - tgt.setMinimumId(src.getMinimumId()); - if (src.hasNavigationLinks()) - tgt.setNavigationLinks(src.getNavigationLinks()); - tgt.setOperator(convertAssertionOperatorType(src.getOperator())); - if (src.hasPath()) - tgt.setPath(src.getPath()); - if (src.hasResource()) - tgt.setResource(src.getResource()); - tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); - if (src.hasResponseCode()) - tgt.setResponseCode(src.getResponseCode()); - tgt.setRule(convertSetupActionAssertRuleComponent(src.getRule())); - tgt.setRuleset(convertSetupActionAssertRulesetComponent(src.getRuleset())); - if (src.hasSourceId()) - tgt.setSourceId(src.getSourceId()); - if (src.hasValidateProfileId()) - tgt.setValidateProfileId(src.getValidateProfileId()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - if (src.hasWarningOnly()) - tgt.setWarningOnly(src.getWarningOnly()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent convertSetupActionAssertRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent t : src.getParam()) - tgt.addParam(convertSetupActionAssertRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent convertSetupActionAssertRuleComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent t : src.getParam()) - tgt.addParam(convertSetupActionAssertRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent convertSetupActionAssertRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent convertSetupActionAssertRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent convertSetupActionAssertRulesetComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent t : src.getRule()) - tgt.addRule(convertSetupActionAssertRulesetRuleComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent convertSetupActionAssertRulesetComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent t : src.getRule()) - tgt.addRule(convertSetupActionAssertRulesetRuleComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent convertSetupActionAssertRulesetRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent t : src.getParam()) - tgt.addParam(convertSetupActionAssertRulesetRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent convertSetupActionAssertRulesetRuleComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent t : src.getParam()) - tgt.addParam(convertSetupActionAssertRulesetRuleParamComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent convertSetupActionAssertRulesetRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent convertSetupActionAssertRulesetRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - if (src.hasValue()) - tgt.setValue(src.getValue()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RESPONSE: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType.RESPONSE; - case REQUEST: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType.REQUEST; - default: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTCONTAINS; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUALS: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.EQUALS; - case NOTEQUALS: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTEQUALS; - case IN: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.IN; - case NOTIN: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTIN; - case GREATERTHAN: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.GREATERTHAN; - case LESSTHAN: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.LESSTHAN; - case EMPTY: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.EMPTY; - case NOTEMPTY: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTEMPTY; - case CONTAINS: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.CONTAINS; - case NOTCONTAINS: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTCONTAINS; - default: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case OKAY: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.OKAY; - case CREATED: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.CREATED; - case NOCONTENT: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NOCONTENT; - case NOTMODIFIED: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NOTMODIFIED; - case BAD: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.BAD; - case FORBIDDEN: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.FORBIDDEN; - case NOTFOUND: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NOTFOUND; - case METHODNOTALLOWED: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; - case CONFLICT: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.CONFLICT; - case GONE: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.GONE; - case PRECONDITIONFAILED: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; - case UNPROCESSABLE: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; - default: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NULL; - } - } - - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.TestScript.TestActionComponent t : src.getAction()) - tgt.addAction(convertTestActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestScript.TestActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent t : src.getAction()) - tgt.addAction(convertTeardownActionComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent(); - copyElement(src, tgt); - tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.dstu2016may.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet tgt = new org.hl7.fhir.dstu3.model.ValueSet(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - if (src.hasIdentifier()) - tgt.addIdentifier(convertIdentifier(src.getIdentifier())); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) - if (isJurisdiction(t)) - tgt.addJurisdiction(convertCodeableConcept(t)); - else - tgt.addUseContext(convertCodeableConceptToUsageContext(t)); - if (src.hasImmutable()) - tgt.setImmutable(src.getImmutable()); - if (src.hasRequirements()) - tgt.setPurpose(src.getRequirements()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasExtensible()) - tgt.setExtensible(src.getExtensible()); - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - if (src.hasLockedDate()) - tgt.getCompose().setLockedDate(src.getLockedDate()); - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet tgt = new org.hl7.fhir.dstu2016may.model.ValueSet(); - copyDomainResource(src, tgt); - if (src.hasUrl()) - tgt.setUrl(src.getUrl()); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.setIdentifier(convertIdentifier(t)); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasName()) - tgt.setName(src.getName()); - tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); - if (src.hasExperimental()) - tgt.setExperimental(src.getExperimental()); - if (src.hasPublisher()) - tgt.setPublisher(src.getPublisher()); - for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) - tgt.addContact(convertValueSetContactComponent(t)); - if (src.hasDate()) - tgt.setDate(src.getDate()); - if (src.getCompose().hasLockedDate()) - tgt.setLockedDate(src.getCompose().getLockedDate()); - if (src.hasDescription()) - tgt.setDescription(src.getDescription()); - for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) - if (t.hasValueCodeableConcept()) - tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); - for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) - tgt.addUseContext(convertCodeableConcept(t)); - if (src.hasImmutable()) - tgt.setImmutable(src.getImmutable()); - if (src.hasPurpose()) - tgt.setRequirements(src.getPurpose()); - if (src.hasCopyright()) - tgt.setCopyright(src.getCopyright()); - if (src.hasExtensible()) - tgt.setExtensible(src.getExtensible()); - tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); - if (src.hasExpansion()) - tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent(); - copyElement(src, tgt); - if (src.hasName()) - tgt.setName(src.getName()); - for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) - tgt.addTelecom(convertContactPoint(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) - tgt.addInclude().addValueSet(t.getValue()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getInclude()) - tgt.addInclude(convertConceptSetComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent(); - copyElement(src, tgt); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getInclude()) { - for (org.hl7.fhir.dstu3.model.UriType ti : t.getValueSet()) - tgt.addImport(ti.getValue()); - tgt.addInclude(convertConceptSetComponent(t)); - } - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getExclude()) - tgt.addExclude(convertConceptSetComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent(); - copyElement(src, tgt); - tgt.setSystem(src.getSystem()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) - tgt.addConcept(convertConceptReferenceComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) - tgt.addFilter(convertConceptSetFilterComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent(); - copyElement(src, tgt); - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) - tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent(); - copyElement(src, tgt); - if (src.hasLanguage()) - tgt.setLanguage(src.getLanguage()); - tgt.setUse(convertCoding(src.getUse())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent(); - copyElement(src, tgt); - tgt.setProperty(src.getProperty()); - tgt.setOp(convertFilterOperator(src.getOp())); - tgt.setValue(src.getValue()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case EQUAL: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.EQUAL; - case ISA: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISA; - case ISNOTA: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISNOTA; - case REGEX: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.REGEX; - case IN: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.IN; - case NOTIN: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NOTIN; - default: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NULL; - } - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent(); - copyElement(src, tgt); - tgt.setIdentifier(src.getIdentifier()); - tgt.setTimestamp(src.getTimestamp()); - if (src.hasTotal()) - tgt.setTotal(src.getTotal()); - if (src.hasOffset()) - tgt.setOffset(src.getOffset()); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) - tgt.addParameter(convertValueSetExpansionParameterComponent(t)); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent(); - copyElement(src, tgt); - tgt.setName(src.getName()); - tgt.setValue(convertType(src.getValue())); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent(); - copyElement(src, tgt); - if (src.hasSystem()) - tgt.setSystem(src.getSystem()); - if (src.hasAbstract()) - tgt.setAbstract(src.getAbstract()); - if (src.hasVersion()) - tgt.setVersion(src.getVersion()); - if (src.hasCode()) - tgt.setCode(src.getCode()); - if (src.hasDisplay()) - tgt.setDisplay(src.getDisplay()); - for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) - tgt.addContains(convertValueSetExpansionContainsComponent(t)); - return tgt; - } - -/* public static org.hl7.fhir.dstu3.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.dstu2016may.model.VisionPrescription src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.VisionPrescription tgt = new org.hl7.fhir.dstu3.model.VisionPrescription(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setDateWritten(src.getDateWritten()); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setPrescriber(convertReference(src.getPrescriber())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setReason(convertType(src.getReason())); - for (org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionPrescriptionDispenseComponent t : src.getDispense()) - tgt.addDispense(convertVisionPrescriptionDispenseComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.dstu3.model.VisionPrescription src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.VisionPrescription tgt = new org.hl7.fhir.dstu2016may.model.VisionPrescription(); - copyDomainResource(src, tgt); - for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) - tgt.addIdentifier(convertIdentifier(t)); - tgt.setDateWritten(src.getDateWritten()); - tgt.setPatient(convertReference(src.getPatient())); - tgt.setPrescriber(convertReference(src.getPrescriber())); - tgt.setEncounter(convertReference(src.getEncounter())); - tgt.setReason(convertType(src.getReason())); - for (org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent t : src.getDispense()) - tgt.addDispense(convertVisionPrescriptionDispenseComponent(t)); - return tgt; - } - - public static org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent convertVisionPrescriptionDispenseComponent(org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionPrescriptionDispenseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent tgt = new org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent(); - copyElement(src, tgt); - tgt.setProduct(convertCoding(src.getProduct())); - tgt.setEye(convertVisionEyes(src.getEye())); - tgt.setSphere(src.getSphere()); - tgt.setCylinder(src.getCylinder()); - tgt.setAxis(src.getAxis()); - tgt.setPrism(src.getPrism()); - tgt.setBase(convertVisionBase(src.getBase())); - tgt.setAdd(src.getAdd()); - tgt.setPower(src.getPower()); - tgt.setBackCurve(src.getBackCurve()); - tgt.setDiameter(src.getDiameter()); - tgt.setDuration(convertSimpleQuantity(src.getDuration())); - tgt.setColor(src.getColor()); - tgt.setBrand(src.getBrand()); - tgt.setNotes(src.getNotes()); - return tgt; - } - - public static org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionPrescriptionDispenseComponent convertVisionPrescriptionDispenseComponent(org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionPrescriptionDispenseComponent tgt = new org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionPrescriptionDispenseComponent(); - copyElement(src, tgt); - tgt.setProduct(convertCoding(src.getProduct())); - tgt.setEye(convertVisionEyes(src.getEye())); - tgt.setSphere(src.getSphere()); - tgt.setCylinder(src.getCylinder()); - tgt.setAxis(src.getAxis()); - tgt.setPrism(src.getPrism()); - tgt.setBase(convertVisionBase(src.getBase())); - tgt.setAdd(src.getAdd()); - tgt.setPower(src.getPower()); - tgt.setBackCurve(src.getBackCurve()); - tgt.setDiameter(src.getDiameter()); - tgt.setDuration(convertSimpleQuantity(src.getDuration())); - tgt.setColor(src.getColor()); - tgt.setBrand(src.getBrand()); - tgt.setNotes(src.getNotes()); - return tgt; - } - - private static org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes convertVisionEyes(org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionEyes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RIGHT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes.RIGHT; - case LEFT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes.LEFT; - default: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionEyes convertVisionEyes(org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case RIGHT: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionEyes.RIGHT; - case LEFT: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionEyes.LEFT; - default: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionEyes.NULL; - } - } - - private static org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase convertVisionBase(org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case UP: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.UP; - case DOWN: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.DOWN; - case IN: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.IN; - case OUT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.OUT; - default: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.NULL; - } - } - - private static org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase convertVisionBase(org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase src) throws FHIRException { - if (src == null) - return null; - switch (src) { - case UP: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase.UP; - case DOWN: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase.DOWN; - case IN: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase.IN; - case OUT: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase.OUT; - default: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase.NULL; - } - } -*/ - public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.dstu2016may.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu2016may.model.Parameters) - return convertParameters((org.hl7.fhir.dstu2016may.model.Parameters) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Bundle) - return convertBundle((org.hl7.fhir.dstu2016may.model.Bundle) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CodeSystem) - return convertCodeSystem((org.hl7.fhir.dstu2016may.model.CodeSystem) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.CompartmentDefinition) - return convertCompartmentDefinition((org.hl7.fhir.dstu2016may.model.CompartmentDefinition) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.dstu2016may.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Conformance) - return convertConformance((org.hl7.fhir.dstu2016may.model.Conformance) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.DataElement) - return convertDataElement((org.hl7.fhir.dstu2016may.model.DataElement) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.dstu2016may.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.dstu2016may.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.dstu2016may.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.dstu2016may.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.dstu2016may.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.dstu2016may.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.dstu2016may.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.TestScript) - return convertTestScript((org.hl7.fhir.dstu2016may.model.TestScript) src); - if (src instanceof org.hl7.fhir.dstu2016may.model.ValueSet) - return convertValueSet((org.hl7.fhir.dstu2016may.model.ValueSet) src); -/* if (src instanceof org.hl7.fhir.dstu2016may.model.VisionPrescription) - return convertVisionPrescription((org.hl7.fhir.dstu2016may.model.VisionPrescription) src);*/ - throw new Error("Unknown resource "+src.fhirType()); - } - - public static org.hl7.fhir.dstu2016may.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src) throws FHIRException { - if (src == null || src.isEmpty()) - return null; - if (src instanceof org.hl7.fhir.dstu3.model.Parameters) - return convertParameters((org.hl7.fhir.dstu3.model.Parameters) src); - if (src instanceof org.hl7.fhir.dstu3.model.Bundle) - return convertBundle((org.hl7.fhir.dstu3.model.Bundle) src); - if (src instanceof org.hl7.fhir.dstu3.model.CodeSystem) - return convertCodeSystem((org.hl7.fhir.dstu3.model.CodeSystem) src); - if (src instanceof org.hl7.fhir.dstu3.model.CompartmentDefinition) - return convertCompartmentDefinition((org.hl7.fhir.dstu3.model.CompartmentDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.ConceptMap) - return convertConceptMap((org.hl7.fhir.dstu3.model.ConceptMap) src); - if (src instanceof org.hl7.fhir.dstu3.model.CapabilityStatement) - return convertConformance((org.hl7.fhir.dstu3.model.CapabilityStatement) src); - if (src instanceof org.hl7.fhir.dstu3.model.DataElement) - return convertDataElement((org.hl7.fhir.dstu3.model.DataElement) src); - if (src instanceof org.hl7.fhir.dstu3.model.ImplementationGuide) - return convertImplementationGuide((org.hl7.fhir.dstu3.model.ImplementationGuide) src); - if (src instanceof org.hl7.fhir.dstu3.model.NamingSystem) - return convertNamingSystem((org.hl7.fhir.dstu3.model.NamingSystem) src); - if (src instanceof org.hl7.fhir.dstu3.model.OperationDefinition) - return convertOperationDefinition((org.hl7.fhir.dstu3.model.OperationDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.OperationOutcome) - return convertOperationOutcome((org.hl7.fhir.dstu3.model.OperationOutcome) src); - if (src instanceof org.hl7.fhir.dstu3.model.Questionnaire) - return convertQuestionnaire((org.hl7.fhir.dstu3.model.Questionnaire) src); - if (src instanceof org.hl7.fhir.dstu3.model.QuestionnaireResponse) - return convertQuestionnaireResponse((org.hl7.fhir.dstu3.model.QuestionnaireResponse) src); - if (src instanceof org.hl7.fhir.dstu3.model.SearchParameter) - return convertSearchParameter((org.hl7.fhir.dstu3.model.SearchParameter) src); - if (src instanceof org.hl7.fhir.dstu3.model.StructureDefinition) - return convertStructureDefinition((org.hl7.fhir.dstu3.model.StructureDefinition) src); - if (src instanceof org.hl7.fhir.dstu3.model.TestScript) - return convertTestScript((org.hl7.fhir.dstu3.model.TestScript) src); - if (src instanceof org.hl7.fhir.dstu3.model.ValueSet) - return convertValueSet((org.hl7.fhir.dstu3.model.ValueSet) src); -/* if (src instanceof org.hl7.fhir.dstu3.model.VisionPrescription) - return convertVisionPrescription((org.hl7.fhir.dstu3.model.VisionPrescription) src);*/ - throw new Error("Unknown resource "+src.fhirType()); - } - - -} + +/* + 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 Mon, Aug 15, 2016 19:58+1000 for FHIR v1.7.0 + +import java.util.ArrayList; +import java.util.List; + +import org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent; +import org.hl7.fhir.dstu2016may.model.CodeableConcept; +import org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.dstu3.conformance.ProfileUtilities; +import org.hl7.fhir.dstu3.model.CodeSystem; +import org.hl7.fhir.dstu3.model.CodeSystem.FilterOperator; +import org.hl7.fhir.dstu3.model.ConceptMap; +import org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent; +import org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent; +import org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent; +import org.hl7.fhir.dstu3.model.Enumeration; +import org.hl7.fhir.dstu3.model.Timing.EventTiming; +import org.hl7.fhir.exceptions.FHIRException; + +public class VersionConvertor_14_20 { + + private static void copyElement(org.hl7.fhir.dstu2016may.model.Element src, org.hl7.fhir.dstu3.model.Element tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu2016may.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + private static void copyElement(org.hl7.fhir.dstu3.model.Element src, org.hl7.fhir.dstu2016may.model.Element tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + for (org.hl7.fhir.dstu3.model.Extension e : src.getExtension()) { + tgt.addExtension(convertExtension(e)); + } + } + + private static void copyBackboneElement(org.hl7.fhir.dstu2016may.model.BackboneElement src, org.hl7.fhir.dstu3.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + private static void copyBackboneElement(org.hl7.fhir.dstu3.model.BackboneElement src, org.hl7.fhir.dstu2016may.model.BackboneElement tgt) throws FHIRException { + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Extension e : src.getModifierExtension()) { + tgt.addModifierExtension(convertExtension(e)); + } + } + + public static org.hl7.fhir.dstu3.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu2016may.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu3.model.Base64BinaryType tgt = new org.hl7.fhir.dstu3.model.Base64BinaryType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.dstu3.model.Base64BinaryType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.Base64BinaryType tgt = new org.hl7.fhir.dstu2016may.model.Base64BinaryType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.BooleanType convertBoolean(org.hl7.fhir.dstu2016may.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu3.model.BooleanType tgt = new org.hl7.fhir.dstu3.model.BooleanType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.BooleanType convertBoolean(org.hl7.fhir.dstu3.model.BooleanType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.BooleanType tgt = new org.hl7.fhir.dstu2016may.model.BooleanType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeType convertCode(org.hl7.fhir.dstu2016may.model.CodeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeType convertCode(org.hl7.fhir.dstu3.model.CodeType 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.dstu3.model.DateType convertDate(org.hl7.fhir.dstu2016may.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateType tgt = new org.hl7.fhir.dstu3.model.DateType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.DateType tgt = new org.hl7.fhir.dstu2016may.model.DateType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DateTimeType convertDateTime(org.hl7.fhir.dstu2016may.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DateTimeType convertDateTime(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.DateTimeType tgt = new org.hl7.fhir.dstu2016may.model.DateTimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DecimalType convertDecimal(org.hl7.fhir.dstu2016may.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DecimalType convertDecimal(org.hl7.fhir.dstu3.model.DecimalType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.DecimalType tgt = new org.hl7.fhir.dstu2016may.model.DecimalType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.IdType convertId(org.hl7.fhir.dstu2016may.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu3.model.IdType tgt = new org.hl7.fhir.dstu3.model.IdType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.IdType convertId(org.hl7.fhir.dstu3.model.IdType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.IdType tgt = new org.hl7.fhir.dstu2016may.model.IdType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.InstantType convertInstant(org.hl7.fhir.dstu2016may.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu3.model.InstantType tgt = new org.hl7.fhir.dstu3.model.InstantType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.InstantType convertInstant(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.InstantType tgt = new org.hl7.fhir.dstu2016may.model.InstantType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.IntegerType convertInteger(org.hl7.fhir.dstu2016may.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu3.model.IntegerType tgt = new org.hl7.fhir.dstu3.model.IntegerType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.IntegerType convertInteger(org.hl7.fhir.dstu3.model.IntegerType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.IntegerType tgt = new org.hl7.fhir.dstu2016may.model.IntegerType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu2016may.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu3.model.MarkdownType tgt = new org.hl7.fhir.dstu3.model.MarkdownType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu3.model.MarkdownType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.MarkdownType tgt = new org.hl7.fhir.dstu2016may.model.MarkdownType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OidType convertOid(org.hl7.fhir.dstu2016may.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu3.model.OidType tgt = new org.hl7.fhir.dstu3.model.OidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OidType convertOid(org.hl7.fhir.dstu3.model.OidType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.OidType tgt = new org.hl7.fhir.dstu2016may.model.OidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu2016may.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu3.model.PositiveIntType tgt = new org.hl7.fhir.dstu3.model.PositiveIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.PositiveIntType convertPositiveInt(org.hl7.fhir.dstu3.model.PositiveIntType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.PositiveIntType tgt = new org.hl7.fhir.dstu2016may.model.PositiveIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StringType convertString(org.hl7.fhir.dstu2016may.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StringType convertString(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.StringType tgt = new org.hl7.fhir.dstu2016may.model.StringType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TimeType convertTime(org.hl7.fhir.dstu2016may.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu3.model.TimeType tgt = new org.hl7.fhir.dstu3.model.TimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.TimeType tgt = new org.hl7.fhir.dstu2016may.model.TimeType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu2016may.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UnsignedIntType tgt = new org.hl7.fhir.dstu3.model.UnsignedIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.dstu3.model.UnsignedIntType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.UnsignedIntType tgt = new org.hl7.fhir.dstu2016may.model.UnsignedIntType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UriType convertUri(org.hl7.fhir.dstu2016may.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UriType tgt = new org.hl7.fhir.dstu3.model.UriType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.UriType convertUri(org.hl7.fhir.dstu3.model.UriType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.UriType tgt = new org.hl7.fhir.dstu2016may.model.UriType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.UuidType convertUuid(org.hl7.fhir.dstu2016may.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu3.model.UuidType tgt = new org.hl7.fhir.dstu3.model.UuidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.UuidType convertUuid(org.hl7.fhir.dstu3.model.UuidType src) throws FHIRException { + org.hl7.fhir.dstu2016may.model.UuidType tgt = new org.hl7.fhir.dstu2016may.model.UuidType(); + if (src.hasValue()) + tgt.setValue(src.getValue()); + copyElement(src, tgt); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Extension convertExtension(org.hl7.fhir.dstu2016may.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Extension tgt = new org.hl7.fhir.dstu3.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Extension convertExtension(org.hl7.fhir.dstu3.model.Extension src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Extension tgt = new org.hl7.fhir.dstu2016may.model.Extension(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Narrative convertNarrative(org.hl7.fhir.dstu2016may.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Narrative tgt = new org.hl7.fhir.dstu3.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Narrative convertNarrative(org.hl7.fhir.dstu3.model.Narrative src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Narrative tgt = new org.hl7.fhir.dstu2016may.model.Narrative(); + copyElement(src, tgt); + tgt.setStatus(convertNarrativeStatus(src.getStatus())); + tgt.setDiv(src.getDiv()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GENERATED: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.EMPTY; + default: return org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.dstu3.model.Narrative.NarrativeStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GENERATED: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.GENERATED; + case EXTENSIONS: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EXTENSIONS; + case ADDITIONAL: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.ADDITIONAL; + case EMPTY: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.EMPTY; + default: return org.hl7.fhir.dstu2016may.model.Narrative.NarrativeStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Age convertAge(org.hl7.fhir.dstu2016may.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Age tgt = new org.hl7.fhir.dstu3.model.Age(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Age convertAge(org.hl7.fhir.dstu3.model.Age src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Age tgt = new org.hl7.fhir.dstu2016may.model.Age(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + + public static org.hl7.fhir.dstu3.model.Annotation convertAnnotation(org.hl7.fhir.dstu2016may.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Annotation tgt = new org.hl7.fhir.dstu3.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Annotation convertAnnotation(org.hl7.fhir.dstu3.model.Annotation src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Annotation tgt = new org.hl7.fhir.dstu2016may.model.Annotation(); + copyElement(src, tgt); + tgt.setAuthor(convertType(src.getAuthor())); + if (src.hasTime()) + tgt.setTime(src.getTime()); + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Attachment convertAttachment(org.hl7.fhir.dstu2016may.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Attachment tgt = new org.hl7.fhir.dstu3.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(src.getSize()); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Attachment convertAttachment(org.hl7.fhir.dstu3.model.Attachment src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Attachment tgt = new org.hl7.fhir.dstu2016may.model.Attachment(); + copyElement(src, tgt); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + if (src.hasData()) + tgt.setData(src.getData()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasSize()) + tgt.setSize(src.getSize()); + if (src.hasHash()) + tgt.setHash(src.getHash()); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + if (src.hasCreation()) + tgt.setCreation(src.getCreation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu2016may.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeableConcept tgt = new org.hl7.fhir.dstu3.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCoding()) + tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeableConcept tgt = new org.hl7.fhir.dstu2016may.model.CodeableConcept(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCoding()) + tgt.addCoding(convertCoding(t)); + if (src.hasText()) + tgt.setText(src.getText()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Coding convertCoding(org.hl7.fhir.dstu2016may.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Coding tgt = new org.hl7.fhir.dstu3.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Coding convertCoding(org.hl7.fhir.dstu3.model.Coding src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Coding tgt = new org.hl7.fhir.dstu2016may.model.Coding(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasUserSelected()) + tgt.setUserSelected(src.getUserSelected()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Count convertCount(org.hl7.fhir.dstu2016may.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Count tgt = new org.hl7.fhir.dstu3.model.Count(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Count convertCount(org.hl7.fhir.dstu3.model.Count src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Count tgt = new org.hl7.fhir.dstu2016may.model.Count(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Distance convertDistance(org.hl7.fhir.dstu2016may.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Distance tgt = new org.hl7.fhir.dstu3.model.Distance(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Distance convertDistance(org.hl7.fhir.dstu3.model.Distance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Distance tgt = new org.hl7.fhir.dstu2016may.model.Distance(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Duration convertDuration(org.hl7.fhir.dstu2016may.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Duration tgt = new org.hl7.fhir.dstu3.model.Duration(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Duration convertDuration(org.hl7.fhir.dstu3.model.Duration src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Duration tgt = new org.hl7.fhir.dstu2016may.model.Duration(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Money convertMoney(org.hl7.fhir.dstu2016may.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Money tgt = new org.hl7.fhir.dstu3.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Money convertMoney(org.hl7.fhir.dstu3.model.Money src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Money tgt = new org.hl7.fhir.dstu2016may.model.Money(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Identifier convertIdentifier(org.hl7.fhir.dstu2016may.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Identifier tgt = new org.hl7.fhir.dstu3.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Identifier convertIdentifier(org.hl7.fhir.dstu3.model.Identifier src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Identifier tgt = new org.hl7.fhir.dstu2016may.model.Identifier(); + copyElement(src, tgt); + tgt.setUse(convertIdentifierUse(src.getUse())); + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + tgt.setAssigner(convertReference(src.getAssigner())); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.SECONDARY; + default: return org.hl7.fhir.dstu3.model.Identifier.IdentifierUse.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.dstu3.model.Identifier.IdentifierUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.USUAL; + case OFFICIAL: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.OFFICIAL; + case TEMP: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.TEMP; + case SECONDARY: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.SECONDARY; + default: return org.hl7.fhir.dstu2016may.model.Identifier.IdentifierUse.NULL; + } + } + + + public static org.hl7.fhir.dstu3.model.Period convertPeriod(org.hl7.fhir.dstu2016may.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Period tgt = new org.hl7.fhir.dstu3.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Period convertPeriod(org.hl7.fhir.dstu3.model.Period src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Period tgt = new org.hl7.fhir.dstu2016may.model.Period(); + copyElement(src, tgt); + if (src.hasStart()) + tgt.setStart(src.getStart()); + if (src.hasEnd()) + tgt.setEnd(src.getEnd()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Quantity convertQuantity(org.hl7.fhir.dstu2016may.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Quantity tgt = new org.hl7.fhir.dstu3.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Quantity convertQuantity(org.hl7.fhir.dstu3.model.Quantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Quantity tgt = new org.hl7.fhir.dstu2016may.model.Quantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LESS_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.GREATER_THAN; + default: return org.hl7.fhir.dstu3.model.Quantity.QuantityComparator.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.dstu3.model.Quantity.QuantityComparator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case LESS_THAN: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_THAN; + case LESS_OR_EQUAL: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.LESS_OR_EQUAL; + case GREATER_OR_EQUAL: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_OR_EQUAL; + case GREATER_THAN: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.GREATER_THAN; + default: return org.hl7.fhir.dstu2016may.model.Quantity.QuantityComparator.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Range convertRange(org.hl7.fhir.dstu2016may.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Range tgt = new org.hl7.fhir.dstu3.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Range convertRange(org.hl7.fhir.dstu3.model.Range src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Range tgt = new org.hl7.fhir.dstu2016may.model.Range(); + copyElement(src, tgt); + tgt.setLow(convertSimpleQuantity(src.getLow())); + tgt.setHigh(convertSimpleQuantity(src.getHigh())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Ratio convertRatio(org.hl7.fhir.dstu2016may.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Ratio tgt = new org.hl7.fhir.dstu3.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Ratio convertRatio(org.hl7.fhir.dstu3.model.Ratio src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Ratio tgt = new org.hl7.fhir.dstu2016may.model.Ratio(); + copyElement(src, tgt); + tgt.setNumerator(convertQuantity(src.getNumerator())); + tgt.setDenominator(convertQuantity(src.getDenominator())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Reference convertReference(org.hl7.fhir.dstu2016may.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Reference tgt = new org.hl7.fhir.dstu3.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Reference convertReference(org.hl7.fhir.dstu3.model.Reference src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Reference tgt = new org.hl7.fhir.dstu2016may.model.Reference(); + copyElement(src, tgt); + if (src.hasReference()) + tgt.setReference(src.getReference()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SampledData convertSampledData(org.hl7.fhir.dstu2016may.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SampledData tgt = new org.hl7.fhir.dstu3.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SampledData convertSampledData(org.hl7.fhir.dstu3.model.SampledData src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SampledData tgt = new org.hl7.fhir.dstu2016may.model.SampledData(); + copyElement(src, tgt); + tgt.setOrigin(convertSimpleQuantity(src.getOrigin())); + tgt.setPeriod(src.getPeriod()); + if (src.hasFactor()) + tgt.setFactor(src.getFactor()); + if (src.hasLowerLimit()) + tgt.setLowerLimit(src.getLowerLimit()); + if (src.hasUpperLimit()) + tgt.setUpperLimit(src.getUpperLimit()); + tgt.setDimensions(src.getDimensions()); + tgt.setData(src.getData()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Signature convertSignature(org.hl7.fhir.dstu2016may.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Signature tgt = new org.hl7.fhir.dstu3.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasBlob()) + tgt.setBlob(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Signature convertSignature(org.hl7.fhir.dstu3.model.Signature src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Signature tgt = new org.hl7.fhir.dstu2016may.model.Signature(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Coding t : src.getType()) + tgt.addType(convertCoding(t)); + tgt.setWhen(src.getWhen()); + tgt.setWho(convertType(src.getWho())); + if (src.hasContentType()) + tgt.setContentType(src.getContentType()); + if (src.hasBlob()) + tgt.setBlob(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Address convertAddress(org.hl7.fhir.dstu2016may.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Address tgt = new org.hl7.fhir.dstu3.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLine()) + tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Address convertAddress(org.hl7.fhir.dstu3.model.Address src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Address tgt = new org.hl7.fhir.dstu2016may.model.Address(); + copyElement(src, tgt); + tgt.setUse(convertAddressUse(src.getUse())); + tgt.setType(convertAddressType(src.getType())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getLine()) + tgt.addLine(t.getValue()); + if (src.hasCity()) + tgt.setCity(src.getCity()); + if (src.hasDistrict()) + tgt.setDistrict(src.getDistrict()); + if (src.hasState()) + tgt.setState(src.getState()); + if (src.hasPostalCode()) + tgt.setPostalCode(src.getPostalCode()); + if (src.hasCountry()) + tgt.setCountry(src.getCountry()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu2016may.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.dstu3.model.Address.AddressUse.HOME; + case WORK: return org.hl7.fhir.dstu3.model.Address.AddressUse.WORK; + case TEMP: return org.hl7.fhir.dstu3.model.Address.AddressUse.TEMP; + case OLD: return org.hl7.fhir.dstu3.model.Address.AddressUse.OLD; + default: return org.hl7.fhir.dstu3.model.Address.AddressUse.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Address.AddressUse convertAddressUse(org.hl7.fhir.dstu3.model.Address.AddressUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.HOME; + case WORK: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.WORK; + case TEMP: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.TEMP; + case OLD: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.OLD; + default: return org.hl7.fhir.dstu2016may.model.Address.AddressUse.NULL; + } + } + + private static org.hl7.fhir.dstu3.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu2016may.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POSTAL: return org.hl7.fhir.dstu3.model.Address.AddressType.POSTAL; + case PHYSICAL: return org.hl7.fhir.dstu3.model.Address.AddressType.PHYSICAL; + case BOTH: return org.hl7.fhir.dstu3.model.Address.AddressType.BOTH; + default: return org.hl7.fhir.dstu3.model.Address.AddressType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Address.AddressType convertAddressType(org.hl7.fhir.dstu3.model.Address.AddressType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case POSTAL: return org.hl7.fhir.dstu2016may.model.Address.AddressType.POSTAL; + case PHYSICAL: return org.hl7.fhir.dstu2016may.model.Address.AddressType.PHYSICAL; + case BOTH: return org.hl7.fhir.dstu2016may.model.Address.AddressType.BOTH; + default: return org.hl7.fhir.dstu2016may.model.Address.AddressType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactPoint tgt = new org.hl7.fhir.dstu3.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ContactPoint convertContactPoint(org.hl7.fhir.dstu3.model.ContactPoint src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ContactPoint tgt = new org.hl7.fhir.dstu2016may.model.ContactPoint(); + copyElement(src, tgt); + tgt.setSystem(convertContactPointSystem(src.getSystem())); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setUse(convertContactPointUse(src.getUse())); + if (src.hasRank()) + tgt.setRank(src.getRank()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHONE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.PAGER; + case OTHER: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.URL; + default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointSystem src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PHONE: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PHONE; + case FAX: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.FAX; + case EMAIL: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.EMAIL; + case PAGER: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.PAGER; + case URL: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.OTHER; + default: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem.NULL; + } + } + + private static org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.HOME; + case WORK: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.WORK; + case TEMP: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.TEMP; + case OLD: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.MOBILE; + default: return org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.dstu3.model.ContactPoint.ContactPointUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HOME: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.HOME; + case WORK: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.WORK; + case TEMP: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.TEMP; + case OLD: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.OLD; + case MOBILE: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.MOBILE; + default: return org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointUse.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2016may.model.ElementDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition tgt = new org.hl7.fhir.dstu3.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getRepresentation()) + tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); + if (src.hasName()) + tgt.setSliceName(src.getName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent t : src.getType()) + tgt.addType(convertTypeRefComponent(t)); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.addExample().setLabel("General").setValue(convertType(src.getExample())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu2016may.model.IdType t : src.getCondition()) + tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) + tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getRepresentation()) + tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); + if (src.hasSliceName()) + tgt.setName(src.getSliceName()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) + tgt.addCode(convertCoding(t)); + if (src.hasSlicing()) + tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing())); + if (src.hasShort()) + tgt.setShort(src.getShort()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + if (src.hasComment()) + tgt.setComments(src.getComment()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getAlias()) + tgt.addAlias(t.getValue()); + if (src.hasMin()) + tgt.setMin(src.getMin()); + if (src.hasMax()) + tgt.setMax(src.getMax()); + if (src.hasBase()) + tgt.setBase(convertElementDefinitionBaseComponent(src.getBase())); + if (src.hasContentReference()) + tgt.setContentReference(src.getContentReference()); + for (org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent t : src.getType()) + tgt.addType(convertTypeRefComponent(t)); + tgt.setDefaultValue(convertType(src.getDefaultValue())); + if (src.hasMeaningWhenMissing()) + tgt.setMeaningWhenMissing(src.getMeaningWhenMissing()); + tgt.setFixed(convertType(src.getFixed())); + tgt.setPattern(convertType(src.getPattern())); + if (src.hasExample()) + tgt.setExample(convertType(src.getExample().get(0).getValue())); + tgt.setMinValue(convertType(src.getMinValue())); + tgt.setMaxValue(convertType(src.getMaxValue())); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + for (org.hl7.fhir.dstu3.model.IdType t : src.getCondition()) + tgt.addCondition(t.getValue()); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint()) + tgt.addConstraint(convertElementDefinitionConstraintComponent(t)); + if (src.hasMustSupport()) + tgt.setMustSupport(src.getMustSupport()); + if (src.hasIsModifier()) + tgt.setIsModifier(src.getIsModifier()); + if (src.hasIsSummary()) + tgt.setIsSummary(src.getIsSummary()); + if (src.hasBinding()) + tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertElementDefinitionMappingComponent(t)); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XMLATTR: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.CDATEXT; + default: return org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.dstu3.model.ElementDefinition.PropertyRepresentation src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XMLATTR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLATTR; + case XMLTEXT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.XMLTEXT; + case TYPEATTR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.TYPEATTR; + case CDATEXT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.CDATEXT; + default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getDiscriminator()) + tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionSlicingComponent(); + copyElement(src, tgt); + for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator()) + tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasOrdered()) + tgt.setOrdered(src.getOrdered()); + tgt.setRules(convertSlicingRules(src.getRules())); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLOSED: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.OPENATEND; + default: return org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.dstu3.model.ElementDefinition.SlicingRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLOSED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.CLOSED; + case OPEN: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPEN; + case OPENATEND: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.OPENATEND; + default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.SlicingRules.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBaseComponent(); + copyElement(src, tgt); + tgt.setPath(src.getPath()); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent convertTypeRefComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getProfile()) { + if (src.getCode().equals("Reference")) + tgt.setTargetProfile(t.getValueAsString()); + else + tgt.setProfile(t.getValueAsString()); + } + for (org.hl7.fhir.dstu2016may.model.Enumeration t : src.getAggregation()) + tgt.addAggregation(convertAggregationMode(t.getValue())); + tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent convertTypeRefComponent(org.hl7.fhir.dstu3.model.ElementDefinition.TypeRefComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasCode() && "Reference".equals(src.getCode())) + tgt.addProfile(src.getTargetProfile()); + else + tgt.addProfile(src.getProfile()); + for (org.hl7.fhir.dstu3.model.Enumeration t : src.getAggregation()) + tgt.addAggregation(convertAggregationMode(t.getValue())); + tgt.setVersioning(convertReferenceVersionRules(src.getVersioning())); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONTAINED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.BUNDLED; + default: return org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.dstu3.model.ElementDefinition.AggregationMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONTAINED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.CONTAINED; + case REFERENCED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.REFERENCED; + case BUNDLED: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.BUNDLED; + default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.AggregationMode.NULL; + } + } + + private static org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EITHER: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: return org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules convertReferenceVersionRules(org.hl7.fhir.dstu3.model.ElementDefinition.ReferenceVersionRules src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EITHER: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.EITHER; + case INDEPENDENT: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.INDEPENDENT; + case SPECIFIC: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.SPECIFIC; + default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ReferenceVersionRules.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + tgt.setXpath(src.getXpath()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionConstraintComponent(); + copyElement(src, tgt); + tgt.setKey(src.getKey()); + if (src.hasRequirements()) + tgt.setRequirements(src.getRequirements()); + tgt.setSeverity(convertConstraintSeverity(src.getSeverity())); + tgt.setHuman(src.getHuman()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + tgt.setXpath(src.getXpath()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ERROR: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.WARNING; + default: return org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.dstu3.model.ElementDefinition.ConstraintSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case ERROR: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.ERROR; + case WARNING: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.WARNING; + default: return org.hl7.fhir.dstu2016may.model.ElementDefinition.ConstraintSeverity.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.EXAMPLE; + default: return org.hl7.fhir.dstu3.model.Enumerations.BindingStrength.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.dstu3.model.Enumerations.BindingStrength src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REQUIRED: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.REQUIRED; + case EXTENSIBLE: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXTENSIBLE; + case PREFERRED: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.PREFERRED; + case EXAMPLE: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.EXAMPLE; + default: return org.hl7.fhir.dstu2016may.model.Enumerations.BindingStrength.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.ElementDefinition.ElementDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setMap(src.getMap()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.HumanName convertHumanName(org.hl7.fhir.dstu2016may.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.HumanName tgt = new org.hl7.fhir.dstu3.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getFamily()) + tgt.setFamily(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getGiven()) + tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getPrefix()) + tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSuffix()) + tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.HumanName convertHumanName(org.hl7.fhir.dstu3.model.HumanName src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.HumanName tgt = new org.hl7.fhir.dstu2016may.model.HumanName(); + copyElement(src, tgt); + tgt.setUse(convertNameUse(src.getUse())); + if (src.hasText()) + tgt.setText(src.getText()); + if (src.hasFamily()) + tgt.addFamily(src.getFamily()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getGiven()) + tgt.addGiven(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getPrefix()) + tgt.addPrefix(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSuffix()) + tgt.addSuffix(t.getValue()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu2016may.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.USUAL; + case OFFICIAL: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OFFICIAL; + case TEMP: return org.hl7.fhir.dstu3.model.HumanName.NameUse.TEMP; + case NICKNAME: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: return org.hl7.fhir.dstu3.model.HumanName.NameUse.ANONYMOUS; + case OLD: return org.hl7.fhir.dstu3.model.HumanName.NameUse.OLD; + case MAIDEN: return org.hl7.fhir.dstu3.model.HumanName.NameUse.MAIDEN; + default: return org.hl7.fhir.dstu3.model.HumanName.NameUse.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.HumanName.NameUse convertNameUse(org.hl7.fhir.dstu3.model.HumanName.NameUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case USUAL: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.USUAL; + case OFFICIAL: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OFFICIAL; + case TEMP: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.TEMP; + case NICKNAME: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NICKNAME; + case ANONYMOUS: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.ANONYMOUS; + case OLD: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.OLD; + case MAIDEN: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.MAIDEN; + default: return org.hl7.fhir.dstu2016may.model.HumanName.NameUse.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Meta convertMeta(org.hl7.fhir.dstu2016may.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Meta tgt = new org.hl7.fhir.dstu3.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getProfile()) + tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getSecurity()) + tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Meta convertMeta(org.hl7.fhir.dstu3.model.Meta src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Meta tgt = new org.hl7.fhir.dstu2016may.model.Meta(); + copyElement(src, tgt); + if (src.hasVersionId()) + tgt.setVersionId(src.getVersionId()); + if (src.hasLastUpdated()) + tgt.setLastUpdated(src.getLastUpdated()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getProfile()) + tgt.addProfile(t.getValue()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurity()) + tgt.addSecurity(convertCoding(t)); + for (org.hl7.fhir.dstu3.model.Coding t : src.getTag()) + tgt.addTag(convertCoding(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Timing convertTiming(org.hl7.fhir.dstu2016may.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Timing tgt = new org.hl7.fhir.dstu3.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.DateTimeType t : src.getEvent()) + tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Timing convertTiming(org.hl7.fhir.dstu3.model.Timing src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Timing tgt = new org.hl7.fhir.dstu2016may.model.Timing(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.DateTimeType t : src.getEvent()) + tgt.addEvent(t.getValue()); + tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat())); + tgt.setCode(convertCodeableConcept(src.getCode())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + tgt.addWhen(convertEventTiming(src.getWhen())); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.dstu3.model.Timing.TimingRepeatComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.dstu2016may.model.Timing.TimingRepeatComponent(); + copyElement(src, tgt); + tgt.setBounds(convertType(src.getBounds())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + if (src.hasCountMax()) + tgt.setCountMax(src.getCountMax()); + if (src.hasDuration()) + tgt.setDuration(src.getDuration()); + if (src.hasDurationMax()) + tgt.setDurationMax(src.getDurationMax()); + tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnit())); + if (src.hasFrequency()) + tgt.setFrequency(src.getFrequency()); + if (src.hasFrequencyMax()) + tgt.setFrequencyMax(src.getFrequencyMax()); + if (src.hasPeriod()) + tgt.setPeriod(src.getPeriod()); + if (src.hasPeriodMax()) + tgt.setPeriodMax(src.getPeriodMax()); + tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnit())); + for (Enumeration t : src.getWhen()) + tgt.setWhen(convertEventTiming(t.getValue())); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case S: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.S; + case MIN: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MIN; + case H: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.H; + case D: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.D; + case WK: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.WK; + case MO: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.MO; + case A: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.A; + default: return org.hl7.fhir.dstu3.model.Timing.UnitsOfTime.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.dstu3.model.Timing.UnitsOfTime src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case S: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.S; + case MIN: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MIN; + case H: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.H; + case D: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.D; + case WK: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.WK; + case MO: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.MO; + case A: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.A; + default: return org.hl7.fhir.dstu2016may.model.Timing.UnitsOfTime.NULL; + } + } + + private static org.hl7.fhir.dstu3.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu2016may.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HS: return org.hl7.fhir.dstu3.model.Timing.EventTiming.HS; + case WAKE: return org.hl7.fhir.dstu3.model.Timing.EventTiming.WAKE; + case C: return org.hl7.fhir.dstu3.model.Timing.EventTiming.C; + case CM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CM; + case CD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CD; + case CV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.CV; + case AC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.AC; + case ACM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACM; + case ACD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACD; + case ACV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.ACV; + case PC: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PC; + case PCM: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCM; + case PCD: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCD; + case PCV: return org.hl7.fhir.dstu3.model.Timing.EventTiming.PCV; + default: return org.hl7.fhir.dstu3.model.Timing.EventTiming.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.dstu3.model.Timing.EventTiming src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case HS: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.HS; + case WAKE: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.WAKE; + case C: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.C; + case CM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CM; + case CD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CD; + case CV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.CV; + case AC: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.AC; + case ACM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACM; + case ACD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACD; + case ACV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.ACV; + case PC: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PC; + case PCM: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCM; + case PCD: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCD; + case PCV: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.PCV; + default: return org.hl7.fhir.dstu2016may.model.Timing.EventTiming.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.dstu2016may.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SimpleQuantity tgt = new org.hl7.fhir.dstu3.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.dstu3.model.SimpleQuantity src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SimpleQuantity tgt = new org.hl7.fhir.dstu2016may.model.SimpleQuantity(); + copyElement(src, tgt); + if (src.hasValue()) + tgt.setValue(src.getValue()); + tgt.setComparator(convertQuantityComparator(src.getComparator())); + if (src.hasUnit()) + tgt.setUnit(src.getUnit()); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Type convertType(org.hl7.fhir.dstu2016may.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2016may.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu2016may.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu2016may.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CodeType) + return convertCode((org.hl7.fhir.dstu2016may.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DateType) + return convertDate((org.hl7.fhir.dstu2016may.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu2016may.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu2016may.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.IdType) + return convertId((org.hl7.fhir.dstu2016may.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.InstantType) + return convertInstant((org.hl7.fhir.dstu2016may.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu2016may.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu2016may.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.OidType) + return convertOid((org.hl7.fhir.dstu2016may.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu2016may.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.StringType) + return convertString((org.hl7.fhir.dstu2016may.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.TimeType) + return convertTime((org.hl7.fhir.dstu2016may.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu2016may.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.UriType) + return convertUri((org.hl7.fhir.dstu2016may.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.UuidType) + return convertUuid((org.hl7.fhir.dstu2016may.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Extension) + return convertExtension((org.hl7.fhir.dstu2016may.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu2016may.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Age) + return convertAge((org.hl7.fhir.dstu2016may.model.Age) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu2016may.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu2016may.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu2016may.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Coding) + return convertCoding((org.hl7.fhir.dstu2016may.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Count) + return convertCount((org.hl7.fhir.dstu2016may.model.Count) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Distance) + return convertDistance((org.hl7.fhir.dstu2016may.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Duration) + return convertDuration((org.hl7.fhir.dstu2016may.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu2016may.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Money) + return convertMoney((org.hl7.fhir.dstu2016may.model.Money) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Period) + return convertPeriod((org.hl7.fhir.dstu2016may.model.Period) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu2016may.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Range) + return convertRange((org.hl7.fhir.dstu2016may.model.Range) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Ratio) + return convertRatio((org.hl7.fhir.dstu2016may.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Reference) + return convertReference((org.hl7.fhir.dstu2016may.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu2016may.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Signature) + return convertSignature((org.hl7.fhir.dstu2016may.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Address) + return convertAddress((org.hl7.fhir.dstu2016may.model.Address) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu2016may.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.dstu2016may.model.ElementDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu2016may.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Meta) + return convertMeta((org.hl7.fhir.dstu2016may.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Timing) + return convertTiming((org.hl7.fhir.dstu2016may.model.Timing) src); + throw new Error("Unknown type "+src.fhirType()); + } + + public static org.hl7.fhir.dstu2016may.model.Type convertType(org.hl7.fhir.dstu3.model.Type src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu3.model.Base64BinaryType) + return convertBase64Binary((org.hl7.fhir.dstu3.model.Base64BinaryType) src); + if (src instanceof org.hl7.fhir.dstu3.model.BooleanType) + return convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeType) + return convertCode((org.hl7.fhir.dstu3.model.CodeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DateType) + return convertDate((org.hl7.fhir.dstu3.model.DateType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DateTimeType) + return convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.DecimalType) + return convertDecimal((org.hl7.fhir.dstu3.model.DecimalType) src); + if (src instanceof org.hl7.fhir.dstu3.model.IdType) + return convertId((org.hl7.fhir.dstu3.model.IdType) src); + if (src instanceof org.hl7.fhir.dstu3.model.InstantType) + return convertInstant((org.hl7.fhir.dstu3.model.InstantType) src); + if (src instanceof org.hl7.fhir.dstu3.model.IntegerType) + return convertInteger((org.hl7.fhir.dstu3.model.IntegerType) src); + if (src instanceof org.hl7.fhir.dstu3.model.MarkdownType) + return convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src); + if (src instanceof org.hl7.fhir.dstu3.model.OidType) + return convertOid((org.hl7.fhir.dstu3.model.OidType) src); + if (src instanceof org.hl7.fhir.dstu3.model.PositiveIntType) + return convertPositiveInt((org.hl7.fhir.dstu3.model.PositiveIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.StringType) + return convertString((org.hl7.fhir.dstu3.model.StringType) src); + if (src instanceof org.hl7.fhir.dstu3.model.TimeType) + return convertTime((org.hl7.fhir.dstu3.model.TimeType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UnsignedIntType) + return convertUnsignedInt((org.hl7.fhir.dstu3.model.UnsignedIntType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UriType) + return convertUri((org.hl7.fhir.dstu3.model.UriType) src); + if (src instanceof org.hl7.fhir.dstu3.model.UuidType) + return convertUuid((org.hl7.fhir.dstu3.model.UuidType) src); + if (src instanceof org.hl7.fhir.dstu3.model.Extension) + return convertExtension((org.hl7.fhir.dstu3.model.Extension) src); + if (src instanceof org.hl7.fhir.dstu3.model.Narrative) + return convertNarrative((org.hl7.fhir.dstu3.model.Narrative) src); + if (src instanceof org.hl7.fhir.dstu3.model.Age) + return convertAge((org.hl7.fhir.dstu3.model.Age) src); + if (src instanceof org.hl7.fhir.dstu3.model.Annotation) + return convertAnnotation((org.hl7.fhir.dstu3.model.Annotation) src); + if (src instanceof org.hl7.fhir.dstu3.model.Attachment) + return convertAttachment((org.hl7.fhir.dstu3.model.Attachment) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeableConcept) + return convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) src); + if (src instanceof org.hl7.fhir.dstu3.model.Coding) + return convertCoding((org.hl7.fhir.dstu3.model.Coding) src); + if (src instanceof org.hl7.fhir.dstu3.model.Count) + return convertCount((org.hl7.fhir.dstu3.model.Count) src); + if (src instanceof org.hl7.fhir.dstu3.model.Distance) + return convertDistance((org.hl7.fhir.dstu3.model.Distance) src); + if (src instanceof org.hl7.fhir.dstu3.model.Duration) + return convertDuration((org.hl7.fhir.dstu3.model.Duration) src); + if (src instanceof org.hl7.fhir.dstu3.model.Identifier) + return convertIdentifier((org.hl7.fhir.dstu3.model.Identifier) src); + if (src instanceof org.hl7.fhir.dstu3.model.Money) + return convertMoney((org.hl7.fhir.dstu3.model.Money) src); + if (src instanceof org.hl7.fhir.dstu3.model.Period) + return convertPeriod((org.hl7.fhir.dstu3.model.Period) src); + if (src instanceof org.hl7.fhir.dstu3.model.Quantity) + return convertQuantity((org.hl7.fhir.dstu3.model.Quantity) src); + if (src instanceof org.hl7.fhir.dstu3.model.Range) + return convertRange((org.hl7.fhir.dstu3.model.Range) src); + if (src instanceof org.hl7.fhir.dstu3.model.Ratio) + return convertRatio((org.hl7.fhir.dstu3.model.Ratio) src); + if (src instanceof org.hl7.fhir.dstu3.model.Reference) + return convertReference((org.hl7.fhir.dstu3.model.Reference) src); + if (src instanceof org.hl7.fhir.dstu3.model.SampledData) + return convertSampledData((org.hl7.fhir.dstu3.model.SampledData) src); + if (src instanceof org.hl7.fhir.dstu3.model.Signature) + return convertSignature((org.hl7.fhir.dstu3.model.Signature) src); + if (src instanceof org.hl7.fhir.dstu3.model.Address) + return convertAddress((org.hl7.fhir.dstu3.model.Address) src); + if (src instanceof org.hl7.fhir.dstu3.model.ContactPoint) + return convertContactPoint((org.hl7.fhir.dstu3.model.ContactPoint) src); + if (src instanceof org.hl7.fhir.dstu3.model.ElementDefinition) + return convertElementDefinition((org.hl7.fhir.dstu3.model.ElementDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.HumanName) + return convertHumanName((org.hl7.fhir.dstu3.model.HumanName) src); + if (src instanceof org.hl7.fhir.dstu3.model.Meta) + return convertMeta((org.hl7.fhir.dstu3.model.Meta) src); + if (src instanceof org.hl7.fhir.dstu3.model.Timing) + return convertTiming((org.hl7.fhir.dstu3.model.Timing) src); + throw new Error("Unknown type "+src.fhirType()); + } + + private static void copyDomainResource(org.hl7.fhir.dstu2016may.model.DomainResource src, org.hl7.fhir.dstu3.model.DomainResource tgt) 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()) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.dstu2016may.model.Extension t : src.getModifierExtension()) + tgt.addModifierExtension(convertExtension(t)); + } + private static void copyDomainResource(org.hl7.fhir.dstu3.model.DomainResource src, org.hl7.fhir.dstu2016may.model.DomainResource tgt) throws FHIRException { + copyResource(src, tgt); + if (src.hasText()) + tgt.setText(convertNarrative(src.getText())); + for (org.hl7.fhir.dstu3.model.Resource t : src.getContained()) + tgt.addContained(convertResource(t)); + for (org.hl7.fhir.dstu3.model.Extension t : src.getExtension()) + tgt.addExtension(convertExtension(t)); + for (org.hl7.fhir.dstu3.model.Extension t : src.getModifierExtension()) + tgt.addModifierExtension(convertExtension(t)); + } + public static org.hl7.fhir.dstu3.model.Parameters convertParameters(org.hl7.fhir.dstu2016may.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Parameters tgt = new org.hl7.fhir.dstu3.model.Parameters(); + copyResource(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getParameter()) + tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Parameters convertParameters(org.hl7.fhir.dstu3.model.Parameters src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Parameters tgt = new org.hl7.fhir.dstu2016may.model.Parameters(); + copyResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getParameter()) + tgt.addParameter(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + tgt.setResource(convertResource(src.getResource())); + for (org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent t : src.getPart()) + tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.Parameters.ParametersParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + tgt.setResource(convertResource(src.getResource())); + for (org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent t : src.getPart()) + tgt.addPart(convertParametersParameterComponent(t)); + return tgt; + } + + private static void copyResource(org.hl7.fhir.dstu2016may.model.Resource src, org.hl7.fhir.dstu3.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + private static void copyResource(org.hl7.fhir.dstu3.model.Resource src, org.hl7.fhir.dstu2016may.model.Resource tgt) throws FHIRException { + if (src.hasId()) + tgt.setId(src.getId()); + if (src.hasMeta()) + tgt.setMeta(convertMeta(src.getMeta())); + if (src.hasImplicitRules()) + tgt.setImplicitRules(src.getImplicitRules()); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + } + + public static org.hl7.fhir.dstu3.model.Binary convertBinary(org.hl7.fhir.dstu2016may.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Binary tgt = new org.hl7.fhir.dstu3.model.Binary(); + copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Binary convertBinary(org.hl7.fhir.dstu3.model.Binary src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Binary tgt = new org.hl7.fhir.dstu2016may.model.Binary(); + copyResource(src, tgt); + tgt.setContentType(src.getContentType()); + tgt.setContent(src.getContent()); + return tgt; + } + + + public static org.hl7.fhir.dstu3.model.Bundle convertBundle(org.hl7.fhir.dstu2016may.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle tgt = new org.hl7.fhir.dstu3.model.Bundle(); + copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent t : src.getEntry()) + tgt.addEntry(convertBundleEntryComponent(t)); + tgt.setSignature(convertSignature(src.getSignature())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle convertBundle(org.hl7.fhir.dstu3.model.Bundle src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle tgt = new org.hl7.fhir.dstu2016may.model.Bundle(); + copyResource(src, tgt); + tgt.setType(convertBundleType(src.getType())); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent t : src.getEntry()) + tgt.addEntry(convertBundleEntryComponent(t)); + tgt.setSignature(convertSignature(src.getSignature())); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu2016may.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENT: return org.hl7.fhir.dstu3.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: return org.hl7.fhir.dstu3.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: return org.hl7.fhir.dstu3.model.Bundle.BundleType.HISTORY; + case SEARCHSET: return org.hl7.fhir.dstu3.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: return org.hl7.fhir.dstu3.model.Bundle.BundleType.COLLECTION; + default: return org.hl7.fhir.dstu3.model.Bundle.BundleType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Bundle.BundleType convertBundleType(org.hl7.fhir.dstu3.model.Bundle.BundleType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DOCUMENT: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.DOCUMENT; + case MESSAGE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.MESSAGE; + case TRANSACTION: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTION; + case TRANSACTIONRESPONSE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.TRANSACTIONRESPONSE; + case BATCH: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCH; + case BATCHRESPONSE: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.BATCHRESPONSE; + case HISTORY: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.HISTORY; + case SEARCHSET: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.SEARCHSET; + case COLLECTION: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.COLLECTION; + default: return org.hl7.fhir.dstu2016may.model.Bundle.BundleType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent(); + copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent(); + copyElement(src, tgt); + tgt.setRelation(src.getRelation()); + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + tgt.setResource(convertResource(src.getResource())); + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent t : src.getLink()) + tgt.addLink(convertBundleLinkComponent(t)); + if (src.hasFullUrl()) + tgt.setFullUrl(src.getFullUrl()); + tgt.setResource(convertResource(src.getResource())); + tgt.setSearch(convertBundleEntrySearchComponent(src.getSearch())); + tgt.setRequest(convertBundleEntryRequestComponent(src.getRequest())); + tgt.setResponse(convertBundleEntryResponseComponent(src.getResponse())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent(); + copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntrySearchComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntrySearchComponent(); + copyElement(src, tgt); + tgt.setMode(convertSearchEntryMode(src.getMode())); + if (src.hasScore()) + tgt.setScore(src.getScore()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MATCH: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.OUTCOME; + default: return org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case MATCH: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.MATCH; + case INCLUDE: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.INCLUDE; + case OUTCOME: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.OUTCOME; + default: return org.hl7.fhir.dstu2016may.model.Bundle.SearchEntryMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent(); + copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryRequestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryRequestComponent(); + copyElement(src, tgt); + tgt.setMethod(convertHTTPVerb(src.getMethod())); + tgt.setUrl(src.getUrl()); + if (src.hasIfNoneMatch()) + tgt.setIfNoneMatch(src.getIfNoneMatch()); + if (src.hasIfModifiedSince()) + tgt.setIfModifiedSince(src.getIfModifiedSince()); + if (src.hasIfMatch()) + tgt.setIfMatch(src.getIfMatch()); + if (src.hasIfNoneExist()) + tgt.setIfNoneExist(src.getIfNoneExist()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GET: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.GET; + case POST: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.POST; + case PUT: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.PUT; + case DELETE: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.DELETE; + default: return org.hl7.fhir.dstu3.model.Bundle.HTTPVerb.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.dstu3.model.Bundle.HTTPVerb src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GET: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.GET; + case POST: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.POST; + case PUT: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.PUT; + case DELETE: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.DELETE; + default: return org.hl7.fhir.dstu2016may.model.Bundle.HTTPVerb.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent(); + copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.dstu3.model.Bundle.BundleEntryResponseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent tgt = new org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryResponseComponent(); + copyElement(src, tgt); + tgt.setStatus(src.getStatus()); + if (src.hasLocation()) + tgt.setLocation(src.getLocation()); + if (src.hasEtag()) + tgt.setEtag(src.getEtag()); + if (src.hasLastModified()) + tgt.setLastModified(src.getLastModified()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.RETIRED; + default: return org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.DRAFT; + case ACTIVE: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.ACTIVE; + case RETIRED: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.RETIRED; + default: return org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu2016may.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeSystem tgt = new org.hl7.fhir.dstu3.model.CodeSystem(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent t : src.getContact()) + tgt.addContact(convertCodeSystemContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) + tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent t : src.getProperty()) + tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + + private static boolean isJurisdiction(CodeableConcept t) { + 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.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.dstu2016may.model.CodeableConcept t) throws FHIRException { + org.hl7.fhir.dstu3.model.UsageContext result = new org.hl7.fhir.dstu3.model.UsageContext(); + // todo: set type.. + result.setValue(convertCodeableConcept(t)); + return result; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem convertCodeSystem(org.hl7.fhir.dstu3.model.CodeSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertCodeSystemContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasCaseSensitive()) + tgt.setCaseSensitive(src.getCaseSensitive()); + if (src.hasValueSet()) + tgt.setValueSet(src.getValueSet()); + if (src.hasCompositional()) + tgt.setCompositional(src.getCompositional()); + if (src.hasVersionNeeded()) + tgt.setVersionNeeded(src.getVersionNeeded()); + tgt.setContent(convertCodeSystemContentMode(src.getContent())); + if (src.hasCount()) + tgt.setCount(src.getCount()); + for (org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent t : src.getFilter()) + tgt.addFilter(convertCodeSystemFilterComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent t : src.getProperty()) + tgt.addProperty(convertPropertyComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTPRESENT: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLAR: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.EXAMPLE; + case FRAGMENT: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: return org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode.NULL; + } +} + + private static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode convertCodeSystemContentMode(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemContentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTPRESENT: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NOTPRESENT; + case EXAMPLE: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.EXAMPLAR; + case FRAGMENT: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.FRAGMENT; + case COMPLETE: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.COMPLETE; + default: return org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContentMode.NULL; + } +} + + public static org.hl7.fhir.dstu3.model.ContactDetail convertCodeSystemContactComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent convertCodeSystemContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getOperator()) + try { + tgt.addOperator(CodeSystem.FilterOperator.fromCode(t.getValue())); + } catch (org.hl7.fhir.exceptions.FHIRException e) { + throw new FHIRException(e); + } + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent convertCodeSystemFilterComponent(org.hl7.fhir.dstu3.model.CodeSystem.CodeSystemFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemFilterComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (Enumeration t : src.getOperator()) + tgt.addOperator(t.getValue().toCode()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent convertPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent convertPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.PropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.CodeSystemPropertyComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setType(convertPropertyType(src.getType())); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODE: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODE; + case CODING: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.CODING; + case STRING: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.STRING; + case INTEGER: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.DATETIME; + default: return org.hl7.fhir.dstu3.model.CodeSystem.PropertyType.NULL; + } +} + + private static org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType convertPropertyType(org.hl7.fhir.dstu3.model.CodeSystem.PropertyType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODE: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODE; + case CODING: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.CODING; + case STRING: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.STRING; + case INTEGER: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.INTEGER; + case BOOLEAN: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.BOOLEAN; + case DATETIME: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.DATETIME; + default: return org.hl7.fhir.dstu2016may.model.CodeSystem.PropertyType.NULL; + } +} + + public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (ConceptDefinitionPropertyComponent t : src.getProperty()) + tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent convertConceptDefinitionComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptDefinitionDesignationComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent t : src.getProperty()) + tgt.addProperty(convertConceptPropertyComponent(t)); + for (org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent t : src.getConcept()) + tgt.addConcept(convertConceptDefinitionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent convertConceptDefinitionDesignationComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent tgt = new org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent convertConceptPropertyComponent(org.hl7.fhir.dstu3.model.CodeSystem.ConceptPropertyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent tgt = new org.hl7.fhir.dstu2016may.model.CodeSystem.ConceptDefinitionPropertyComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu2016may.model.CompartmentDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent t : src.getContact()) + tgt.addContact(convertCompartmentDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + tgt.setCode(convertCompartmentType(src.getCode())); + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) + tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition convertCompartmentDefinition(org.hl7.fhir.dstu3.model.CompartmentDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CompartmentDefinition tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertCompartmentDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + tgt.setCode(convertCompartmentType(src.getCode())); + tgt.setSearch(src.getSearch()); + for (org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent t : src.getResource()) + tgt.addResource(convertCompartmentDefinitionResourceComponent(t)); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.DEVICE; + default: return org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType.NULL; + } +} + + private static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType convertCompartmentType(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PATIENT: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PATIENT; + case ENCOUNTER: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.ENCOUNTER; + case RELATEDPERSON: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.RELATEDPERSON; + case PRACTITIONER: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.PRACTITIONER; + case DEVICE: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.DEVICE; + default: return org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentType.NULL; + } +} + + public static org.hl7.fhir.dstu3.model.ContactDetail convertCompartmentDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent convertCompartmentDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getParam()) + tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent convertCompartmentDefinitionResourceComponent(org.hl7.fhir.dstu3.model.CompartmentDefinition.CompartmentDefinitionResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.CompartmentDefinition.CompartmentDefinitionResourceComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getParam()) + tgt.addParam(t.getValue()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + + public static org.hl7.fhir.dstu3.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu2016may.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ConceptMap tgt = new org.hl7.fhir.dstu3.model.ConceptMap(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent t : src.getContact()) + tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setSource(convertType(src.getSource())); + tgt.setTarget(convertType(src.getTarget())); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent t : src.getElement()) { + List ws = convertSourceElementComponent(t); + for (SourceElementComponentWrapper w : ws) + getGroup(tgt, w.source, w.target).addElement(w.comp); + } + return tgt; + } + + private static ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) { + for (ConceptMapGroupComponent grp : map.getGroup()) { + if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts)) + return grp; + } + ConceptMapGroupComponent grp = map.addGroup(); + grp.setSource(srcs); + grp.setTarget(tgts); + return grp; + } + + + public static org.hl7.fhir.dstu2016may.model.ConceptMap convertConceptMap(org.hl7.fhir.dstu3.model.ConceptMap src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertConceptMapContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setSource(convertType(src.getSource())); + tgt.setTarget(convertType(src.getTarget())); + for (org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g : src.getGroup()) + for (org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent t : g.getElement()) + tgt.addElement(convertSourceElementComponent(t, g)); + return tgt; + } + + + public static org.hl7.fhir.dstu3.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent convertConceptMapContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.ConceptMapContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + private static class SourceElementComponentWrapper { + public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) { + super(); + this.source = source; + this.target = target; + this.comp = comp; + } + private String source; + private String target; + private org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent comp; + + } + 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()) { + org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + tgt.addTarget(convertTargetElementComponent(t)); + res.add(new SourceElementComponentWrapper(tgt, src.getSystem(), t.getSystem())); + } + return res; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.SourceElementComponent(); + copyElement(src, tgt); + if (g.hasSource()) + tgt.setSystem(g.getSource()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent t : src.getTarget()) + tgt.addTarget(convertTargetElementComponent(t, g)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent(); + copyElement(src, tgt); + if (src.hasCode()) + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + if (src.hasComments()) + tgt.setComment(src.getComments()); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) + tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent t : src.getProduct()) + tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.dstu3.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.TargetElementComponent(); + copyElement(src, tgt); + if (g.hasTarget()) + tgt.setSystem(g.getTarget()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence())); + if (src.hasComment()) + tgt.setComments(src.getComment()); + for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getDependsOn()) + tgt.addDependsOn(convertOtherElementComponent(t)); + for (org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent t : src.getProduct()) + tgt.addProduct(convertOtherElementComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUIVALENT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: return org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUIVALENT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUIVALENT; + case EQUAL: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.EQUAL; + case WIDER: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.WIDER; + case SUBSUMES: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.SUBSUMES; + case NARROWER: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NARROWER; + case SPECIALIZES: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.SPECIALIZES; + case INEXACT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.INEXACT; + case UNMATCHED: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.UNMATCHED; + case DISJOINT: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.DISJOINT; + default: return org.hl7.fhir.dstu2016may.model.Enumerations.ConceptMapEquivalence.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent(); + copyElement(src, tgt); + tgt.setProperty(src.getElement()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.dstu3.model.ConceptMap.OtherElementComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.dstu2016may.model.ConceptMap.OtherElementComponent(); + copyElement(src, tgt); + tgt.setElement(src.getProperty()); + tgt.setSystem(src.getSystem()); + tgt.setCode(src.getCode()); + return tgt; + } + + + public static org.hl7.fhir.dstu3.model.CapabilityStatement convertConformance(org.hl7.fhir.dstu2016may.model.Conformance src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent t : src.getContact()) + tgt.addContact(convertConformanceContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + tgt.setFhirVersion(src.getFhirVersion()); + tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getFormat()) + tgt.addFormat(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent t : src.getRest()) + tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent t : src.getMessaging()) + tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent t : src.getDocument()) + tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance convertConformance(org.hl7.fhir.dstu3.model.CapabilityStatement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance tgt = new org.hl7.fhir.dstu2016may.model.Conformance(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertConformanceContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setKind(convertConformanceStatementKind(src.getKind())); + tgt.setSoftware(convertConformanceSoftwareComponent(src.getSoftware())); + tgt.setImplementation(convertConformanceImplementationComponent(src.getImplementation())); + tgt.setFhirVersion(src.getFhirVersion()); + tgt.setAcceptUnknown(convertUnknownContentCode(src.getAcceptUnknown())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getFormat()) + tgt.addFormat(t.getValue()); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent t : src.getRest()) + tgt.addRest(convertConformanceRestComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent t : src.getMessaging()) + tgt.addMessaging(convertConformanceMessagingComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent t : src.getDocument()) + tgt.addDocument(convertConformanceDocumentComponent(t)); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INSTANCE: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.INSTANCE; + case CAPABILITY: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.CAPABILITY; + case REQUIREMENTS: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.REQUIREMENTS; + default: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceStatementKind.NULL; + } + } + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NO: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NO; + case EXTENSIONS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.EXTENSIONS; + case ELEMENTS: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.ELEMENTS; + case BOTH: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.BOTH; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.dstu3.model.CapabilityStatement.UnknownContentCode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NO: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.NO; + case EXTENSIONS: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.EXTENSIONS; + case ELEMENTS: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.ELEMENTS; + case BOTH: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.BOTH; + default: return org.hl7.fhir.dstu2016may.model.Conformance.UnknownContentCode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent convertConformanceContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceSoftwareComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasReleaseDate()) + tgt.setReleaseDate(src.getReleaseDate()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent(); + copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementImplementationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceImplementationComponent(); + copyElement(src, tgt); + tgt.setDescription(src.getDescription()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent(); + copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent t : src.getResource()) + tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent t : src.getOperation()) + tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getCompartment()) + tgt.addCompartment(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestComponent(); + copyElement(src, tgt); + tgt.setMode(convertRestfulConformanceMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity())); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource()) + tgt.addResource(convertConformanceRestResourceComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertSystemInteractionComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation()) + tgt.addOperation(convertConformanceRestOperationComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getCompartment()) + tgt.addCompartment(t.getValue()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLIENT: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.CLIENT; + case SERVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.SERVER; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.dstu3.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CLIENT: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.CLIENT; + case SERVER: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.SERVER; + default: return org.hl7.fhir.dstu2016may.model.Conformance.RestfulConformanceMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent(); + copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getService()) + tgt.addService(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent t : src.getCertificate()) + tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityComponent(); + copyElement(src, tgt); + if (src.hasCors()) + tgt.setCors(src.getCors()); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getService()) + tgt.addService(convertCodeableConcept(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent t : src.getCertificate()) + tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasBlob()) + tgt.setBlob(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestSecurityCertificateComponent(); + copyElement(src, tgt); + if (src.hasType()) + tgt.setType(src.getType()); + if (src.hasBlob()) + tgt.setBlob(src.getBlob()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(convertReference(src.getProfile())); + for (org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchInclude()) + tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getSearchRevInclude()) + tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(convertReference(src.getProfile())); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction()) + tgt.addInteraction(convertResourceInteractionComponent(t)); + tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning())); + if (src.hasReadHistory()) + tgt.setReadHistory(src.getReadHistory()); + if (src.hasUpdateCreate()) + tgt.setUpdateCreate(src.getUpdateCreate()); + if (src.hasConditionalCreate()) + tgt.setConditionalCreate(src.getConditionalCreate()); + if (src.hasConditionalUpdate()) + tgt.setConditionalUpdate(src.getConditionalUpdate()); + tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete())); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchInclude()) + tgt.addSearchInclude(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getSearchRevInclude()) + tgt.addSearchRevInclude(t.getValue()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam()) + tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t)); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOVERSION: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION; + case VERSIONED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOVERSION: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NOVERSION; + case VERSIONED: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONED; + case VERSIONEDUPDATE: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE; + default: return org.hl7.fhir.dstu2016may.model.Conformance.ResourceVersionPolicy.NULL; + } + } + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.dstu3.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NOTSUPPORTED: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED; + case SINGLE: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.SINGLE; + case MULTIPLE: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.MULTIPLE; + default: return org.hl7.fhir.dstu2016may.model.Conformance.ConditionalDeleteStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ResourceInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertTypeRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case READ: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.READ; + case VREAD: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.VREAD; + case UPDATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.UPDATE; + case DELETE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case READ: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.READ; + case VREAD: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.VREAD; + case UPDATE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.UPDATE; + case DELETE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.DELETE; + case HISTORYINSTANCE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE; + case HISTORYTYPE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.HISTORYTYPE; + case CREATE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.CREATE; + case SEARCHTYPE: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.SEARCHTYPE; + default: return org.hl7.fhir.dstu2016may.model.Conformance.TypeRestfulInteraction.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NUMBER: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NUMBER; + case DATE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.DATE; + case STRING: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.STRING; + case TOKEN: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.QUANTITY; + case URI: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.URI; + default: return org.hl7.fhir.dstu3.model.Enumerations.SearchParamType.NULL; + } + } + + public static org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.dstu3.model.Enumerations.SearchParamType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NUMBER: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NUMBER; + case DATE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.DATE; + case STRING: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.STRING; + case TOKEN: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.TOKEN; + case REFERENCE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.REFERENCE; + case COMPOSITE: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.COMPOSITE; + case QUANTITY: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.QUANTITY; + case URI: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.URI; + default: return org.hl7.fhir.dstu2016may.model.Enumerations.SearchParamType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + tgt.setType(convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestResourceSearchParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDefinition()) + tgt.setDefinition(src.getDefinition()); + tgt.setType(convertSearchParamType(src.getType())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.SystemInteractionComponent(); + copyElement(src, tgt); + tgt.setCode(convertSystemRestfulInteraction(src.getCode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRANSACTION: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.dstu3.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case TRANSACTION: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.TRANSACTION; + case SEARCHSYSTEM: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM; + case HISTORYSYSTEM: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM; + default: return org.hl7.fhir.dstu2016may.model.Conformance.SystemRestfulInteraction.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(convertReference(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceRestOperationComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setDefinition(convertReference(src.getDefinition())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent t : src.getEndpoint()) + tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent t : src.getEvent()) + tgt.addEvent(convertConformanceMessagingEventComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent t : src.getEndpoint()) + tgt.addEndpoint(convertConformanceMessagingEndpointComponent(t)); + if (src.hasReliableCache()) + tgt.setReliableCache(src.getReliableCache()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + for (org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent t : src.getEvent()) + tgt.addEvent(convertConformanceMessagingEventComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent(); + copyElement(src, tgt); + tgt.setProtocol(convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent convertConformanceMessagingEndpointComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEndpointComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEndpointComponent(); + copyElement(src, tgt); + tgt.setProtocol(convertCoding(src.getProtocol())); + tgt.setAddress(src.getAddress()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent(); + copyElement(src, tgt); + tgt.setCode(convertCoding(src.getCode())); + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + tgt.setMode(convertConformanceEventMode(src.getMode())); + tgt.setFocus(src.getFocus()); + tgt.setRequest(convertReference(src.getRequest())); + tgt.setResponse(convertReference(src.getResponse())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent convertConformanceMessagingEventComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementMessagingEventComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceMessagingEventComponent(); + copyElement(src, tgt); + tgt.setCode(convertCoding(src.getCode())); + tgt.setCategory(convertMessageSignificanceCategory(src.getCategory())); + tgt.setMode(convertConformanceEventMode(src.getMode())); + tgt.setFocus(src.getFocus()); + tgt.setRequest(convertReference(src.getRequest())); + tgt.setResponse(convertReference(src.getResponse())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONSEQUENCE: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NOTIFICATION; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.dstu3.model.CapabilityStatement.MessageSignificanceCategory src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CONSEQUENCE: return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.CONSEQUENCE; + case CURRENCY: return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.CURRENCY; + case NOTIFICATION: return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.NOTIFICATION; + default: return org.hl7.fhir.dstu2016may.model.Conformance.MessageSignificanceCategory.NULL; + } + } + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SENDER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.SENDER; + case RECEIVER: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.RECEIVER; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.dstu3.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SENDER: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.SENDER; + case RECEIVER: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.RECEIVER; + default: return org.hl7.fhir.dstu2016may.model.Conformance.ConformanceEventMode.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent(); + copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfile(convertReference(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.dstu3.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.dstu2016may.model.Conformance.ConformanceDocumentComponent(); + copyElement(src, tgt); + tgt.setMode(convertDocumentMode(src.getMode())); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + tgt.setProfile(convertReference(src.getProfile())); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRODUCER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.PRODUCER; + case CONSUMER: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.CONSUMER; + default: return org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.dstu3.model.CapabilityStatement.DocumentMode src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRODUCER: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.PRODUCER; + case CONSUMER: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.CONSUMER; + default: return org.hl7.fhir.dstu2016may.model.Conformance.DocumentMode.NULL; + } + } + + + public static org.hl7.fhir.dstu3.model.DataElement convertDataElement(org.hl7.fhir.dstu2016may.model.DataElement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DataElement tgt = new org.hl7.fhir.dstu3.model.DataElement(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent t : src.getContact()) + tgt.addContact(convertDataElementContactComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setStringency(convertDataElementStringency(src.getStringency())); + for (org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent t : src.getMapping()) + tgt.addMapping(convertDataElementMappingComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DataElement convertDataElement(org.hl7.fhir.dstu3.model.DataElement src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.DataElement tgt = new org.hl7.fhir.dstu2016may.model.DataElement(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertDataElementContactComponent(t)); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + tgt.setStringency(convertDataElementStringency(src.getStringency())); + for (org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent t : src.getMapping()) + tgt.addMapping(convertDataElementMappingComponent(t)); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPARABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.COMPARABLE; + case FULLYSPECIFIED: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FULLYSPECIFIED; + case EQUIVALENT: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.EQUIVALENT; + case CONVERTABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.CONVERTABLE; + case SCALEABLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.SCALEABLE; + case FLEXIBLE: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.FLEXIBLE; + default: return org.hl7.fhir.dstu3.model.DataElement.DataElementStringency.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.dstu3.model.DataElement.DataElementStringency src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case COMPARABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.COMPARABLE; + case FULLYSPECIFIED: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.FULLYSPECIFIED; + case EQUIVALENT: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.EQUIVALENT; + case CONVERTABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.CONVERTABLE; + case SCALEABLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.SCALEABLE; + case FLEXIBLE: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.FLEXIBLE; + default: return org.hl7.fhir.dstu2016may.model.DataElement.DataElementStringency.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent convertDataElementContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.dstu3.model.DataElement.DataElementMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.DataElement.DataElementMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu2016may.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent t : src.getContact()) + tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) + tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) + tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) + tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getBinary()) + tgt.addBinary(t.getValue()); + tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.dstu3.model.ImplementationGuide src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertImplementationGuideContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent t : src.getDependency()) + tgt.addDependency(convertImplementationGuideDependencyComponent(t)); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent t : src.getPackage()) + tgt.addPackage(convertImplementationGuidePackageComponent(t)); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent t : src.getGlobal()) + tgt.addGlobal(convertImplementationGuideGlobalComponent(t)); + for (org.hl7.fhir.dstu3.model.UriType t : src.getBinary()) + tgt.addBinary(t.getValue()); + tgt.setPage(convertImplementationGuidePageComponent(src.getPage())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertImplementationGuideContactComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent convertImplementationGuideContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + copyElement(src, tgt); + tgt.setType(convertGuideDependencyType(src.getType())); + tgt.setUri(src.getUri()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent convertImplementationGuideDependencyComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideDependencyComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideDependencyComponent(); + copyElement(src, tgt); + tgt.setType(convertGuideDependencyType(src.getType())); + tgt.setUri(src.getUri()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REFERENCE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.REFERENCE; + case INCLUSION: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.INCLUSION; + default: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.dstu3.model.ImplementationGuide.GuideDependencyType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case REFERENCE: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.REFERENCE; + case INCLUSION: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.INCLUSION; + default: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuideDependencyType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) + tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent t : src.getResource()) + tgt.addResource(convertImplementationGuidePackageResourceComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + copyElement(src, tgt); + tgt.setExample(src.getExample()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasAcronym()) + tgt.setAcronym(src.getAcronym()); + tgt.setSource(convertType(src.getSource())); + if (src.hasExampleFor()) + tgt.setExampleFor(convertReference(src.getExampleFor())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent convertImplementationGuidePackageResourceComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePackageResourceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePackageResourceComponent(); + copyElement(src, tgt); + tgt.setExample(src.getExample()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + if (src.hasAcronym()) + tgt.setAcronym(src.getAcronym()); + tgt.setSource(convertType(src.getSource())); + if (src.hasExampleFor()) + tgt.setExampleFor(convertReference(src.getExampleFor())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(convertReference(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuideGlobalComponent(); + copyElement(src, tgt); + tgt.setType(src.getType()); + tgt.setProfile(convertReference(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent(); + copyElement(src, tgt); + tgt.setSource(src.getSource()); + tgt.setTitle(src.getName()); + tgt.setKind(convertGuidePageKind(src.getKind())); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getType()) + tgt.addType(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getPackage()) + tgt.addPackage(t.getValue()); + if (src.hasFormat()) + tgt.setFormat(src.getFormat()); + for (org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) + tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent tgt = new org.hl7.fhir.dstu2016may.model.ImplementationGuide.ImplementationGuidePageComponent(); + copyElement(src, tgt); + tgt.setSource(src.getSource()); + tgt.setName(src.getTitle()); + tgt.setKind(convertGuidePageKind(src.getKind())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getType()) + tgt.addType(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getPackage()) + tgt.addPackage(t.getValue()); + if (src.hasFormat()) + tgt.setFormat(src.getFormat()); + for (org.hl7.fhir.dstu3.model.ImplementationGuide.ImplementationGuidePageComponent t : src.getPage()) + tgt.addPage(convertImplementationGuidePageComponent(t)); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PAGE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.PAGE; + case EXAMPLE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.EXAMPLE; + case LIST: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.LIST; + case INCLUDE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.INCLUDE; + case DIRECTORY: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DIRECTORY; + case DICTIONARY: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.DICTIONARY; + case TOC: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.TOC; + case RESOURCE: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.RESOURCE; + default: return org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.dstu3.model.ImplementationGuide.GuidePageKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PAGE: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.PAGE; + case EXAMPLE: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.EXAMPLE; + case LIST: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.LIST; + case INCLUDE: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.INCLUDE; + case DIRECTORY: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.DIRECTORY; + case DICTIONARY: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.DICTIONARY; + case TOC: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.TOC; + case RESOURCE: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.RESOURCE; + default: return org.hl7.fhir.dstu2016may.model.ImplementationGuide.GuidePageKind.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu2016may.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.NamingSystem tgt = new org.hl7.fhir.dstu3.model.NamingSystem(); + copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent t : src.getContact()) + tgt.addContact(convertNamingSystemContactComponent(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) + tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + tgt.setReplacedBy(convertReference(src.getReplacedBy())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.NamingSystem convertNamingSystem(org.hl7.fhir.dstu3.model.NamingSystem src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.NamingSystem tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem(); + copyDomainResource(src, tgt); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertNamingSystemType(src.getKind())); + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertNamingSystemContactComponent(t)); + if (src.hasResponsible()) + tgt.setResponsible(src.getResponsible()); + tgt.setType(convertCodeableConcept(src.getType())); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasUsage()) + tgt.setUsage(src.getUsage()); + for (org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId()) + tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t)); + tgt.setReplacedBy(convertReference(src.getReplacedBy())); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODESYSTEM: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.ROOT; + default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case CODESYSTEM: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.CODESYSTEM; + case IDENTIFIER: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.IDENTIFIER; + case ROOT: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.ROOT; + default: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent(); + copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemUniqueIdComponent(); + copyElement(src, tgt); + tgt.setType(convertNamingSystemIdentifierType(src.getType())); + tgt.setValue(src.getValue()); + if (src.hasPreferred()) + tgt.setPreferred(src.getPreferred()); + tgt.setPeriod(convertPeriod(src.getPeriod())); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: return org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.dstu3.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OID: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OID; + case UUID: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.UUID; + case URI: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.URI; + case OTHER: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.OTHER; + default: return org.hl7.fhir.dstu2016may.model.NamingSystem.NamingSystemIdentifierType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu2016may.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition tgt = new org.hl7.fhir.dstu3.model.OperationDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact()) + tgt.addContact(convertOperationDefinitionContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasIdempotent()) + tgt.setIdempotent(src.getIdempotent()); + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + tgt.setBase(convertReference(src.getBase())); + tgt.setSystem(src.getSystem()); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getType()) + tgt.addResource(t.getValue()); + tgt.setType(tgt.hasResource()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.dstu3.model.OperationDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setKind(convertOperationKind(src.getKind())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertOperationDefinitionContactComponent(t)); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasIdempotent()) + tgt.setIdempotent(src.getIdempotent()); + tgt.setCode(src.getCode()); + if (src.hasComment()) + tgt.setComment(src.getComment()); + tgt.setBase(convertReference(src.getBase())); + tgt.setSystem(src.getSystem()); + if (src.getType()) + for (org.hl7.fhir.dstu3.model.CodeType t : src.getResource()) + tgt.addType(t.getValue()); + tgt.setInstance(src.getInstance()); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter()) + tgt.addParameter(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OPERATION: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.QUERY; + default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.dstu3.model.OperationDefinition.OperationKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OPERATION: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.OPERATION; + case QUERY: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.QUERY; + default: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationKind.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType()); + tgt.setSearchType(convertSearchParamType(src.getSearchType())); + tgt.setProfile(convertReference(src.getProfile())); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) + tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setUse(convertOperationParameterUse(src.getUse())); + tgt.setMin(src.getMin()); + tgt.setMax(src.getMax()); + if (src.hasDocumentation()) + tgt.setDocumentation(src.getDocumentation()); + if (src.hasType()) + tgt.setType(src.getType()); + tgt.setSearchType(convertSearchParamType(src.getSearchType())); + tgt.setProfile(convertReference(src.getProfile())); + tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding())); + for (org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart()) + tgt.addPart(convertOperationDefinitionParameterComponent(t)); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.IN; + case OUT: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.OUT; + default: return org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.dstu3.model.OperationDefinition.OperationParameterUse src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case IN: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.IN; + case OUT: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.OUT; + default: return org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationParameterUse.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.dstu3.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationDefinition.OperationDefinitionParameterBindingComponent(); + copyElement(src, tgt); + tgt.setStrength(convertBindingStrength(src.getStrength())); + tgt.setValueSet(convertType(src.getValueSet())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu2016may.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationOutcome tgt = new org.hl7.fhir.dstu3.model.OperationOutcome(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) + tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.dstu3.model.OperationOutcome src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationOutcome tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue()) + tgt.addIssue(convertOperationOutcomeIssueComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent(); + copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getLocation()) + tgt.addLocation(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getExpression()) + tgt.addExpression(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.dstu2016may.model.OperationOutcome.OperationOutcomeIssueComponent(); + copyElement(src, tgt); + tgt.setSeverity(convertIssueSeverity(src.getSeverity())); + tgt.setCode(convertIssueType(src.getCode())); + tgt.setDetails(convertCodeableConcept(src.getDetails())); + if (src.hasDiagnostics()) + tgt.setDiagnostics(src.getDiagnostics()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getLocation()) + tgt.addLocation(t.getValue()); + for (org.hl7.fhir.dstu3.model.StringType t : src.getExpression()) + tgt.addExpression(t.getValue()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FATAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.INFORMATION; + default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.dstu3.model.OperationOutcome.IssueSeverity src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case FATAL: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.FATAL; + case ERROR: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.ERROR; + case WARNING: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.WARNING; + case INFORMATION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.INFORMATION; + default: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity.NULL; + } + } + + private static org.hl7.fhir.dstu3.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.INFORMATIONAL; + default: return org.hl7.fhir.dstu3.model.OperationOutcome.IssueType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.dstu3.model.OperationOutcome.IssueType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INVALID: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVALID; + case STRUCTURE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.STRUCTURE; + case REQUIRED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.REQUIRED; + case VALUE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.VALUE; + case INVARIANT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INVARIANT; + case SECURITY: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SECURITY; + case LOGIN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOGIN; + case UNKNOWN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.UNKNOWN; + case EXPIRED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXPIRED; + case FORBIDDEN: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.FORBIDDEN; + case SUPPRESSED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.SUPPRESSED; + case PROCESSING: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.PROCESSING; + case NOTSUPPORTED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTSUPPORTED; + case DUPLICATE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.DUPLICATE; + case NOTFOUND: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOTFOUND; + case TOOLONG: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOLONG; + case CODEINVALID: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CODEINVALID; + case EXTENSION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXTENSION; + case TOOCOSTLY: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TOOCOSTLY; + case BUSINESSRULE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.BUSINESSRULE; + case CONFLICT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.CONFLICT; + case INCOMPLETE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INCOMPLETE; + case TRANSIENT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TRANSIENT; + case LOCKERROR: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.LOCKERROR; + case NOSTORE: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NOSTORE; + case EXCEPTION: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.EXCEPTION; + case TIMEOUT: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.TIMEOUT; + case THROTTLED: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.THROTTLED; + case INFORMATIONAL: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.INFORMATIONAL; + default: return org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueType.NULL; + } + } + + + public static org.hl7.fhir.dstu3.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2016may.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Questionnaire tgt = new org.hl7.fhir.dstu3.model.Questionnaire(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) +// if (isJurisdiction(t)) +// tgt.addJurisdiction(convertCodeableConcept(t)); +// else + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) + tgt.addCode(convertCoding(t)); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getSubjectType()) + tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu3.model.Questionnaire src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setStatus(convertQuestionnaireStatus(src.getStatus())); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getUseContext()) + tgt.addUseContext(convertCodeableConcept(t)); +// for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) +// tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasTitle()) + tgt.setTitle(src.getTitle()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) + tgt.addConcept(convertCoding(t)); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getSubjectType()) + tgt.addSubjectType(t.getValue()); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.DRAFT; + case PUBLISHED: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.PUBLISHED; + case RETIRED: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.RETIRED; + default: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DRAFT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.DRAFT; + case PUBLISHED: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.PUBLISHED; + case RETIRED: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.RETIRED; + default: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) + tgt.addCode(convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) + tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + tgt.setOptions(convertReference(src.getOptions())); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) + tgt.addOption(convertQuestionnaireItemOptionComponent(t)); + tgt.setInitial(convertType(src.getInitial())); + for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getCode()) + tgt.addConcept(convertCoding(t)); + if (src.hasPrefix()) + tgt.setPrefix(src.getPrefix()); + if (src.hasText()) + tgt.setText(src.getText()); + tgt.setType(convertQuestionnaireItemType(src.getType())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) + tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasRepeats()) + tgt.setRepeats(src.getRepeats()); + if (src.hasReadOnly()) + tgt.setReadOnly(src.getReadOnly()); + if (src.hasMaxLength()) + tgt.setMaxLength(src.getMaxLength()); + tgt.setOptions(convertReference(src.getOptions())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) + tgt.addOption(convertQuestionnaireItemOptionComponent(t)); + tgt.setInitial(convertType(src.getInitial())); + for (org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireItemComponent(t)); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GROUP: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case QUESTION: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUESTION; + case BOOLEAN: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; + case INSTANT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: return org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType convertQuestionnaireItemType(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case GROUP: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.GROUP; + case DISPLAY: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DISPLAY; + case QUESTION: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUESTION; + case BOOLEAN: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.BOOLEAN; + case DECIMAL: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DECIMAL; + case INTEGER: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.INTEGER; + case DATE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATE; + case DATETIME: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATETIME; + case TIME: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TIME; + case STRING: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.STRING; + case TEXT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TEXT; + case URL: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.URL; + case CHOICE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.CHOICE; + case OPENCHOICE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.OPENCHOICE; + case ATTACHMENT: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.ATTACHMENT; + case REFERENCE: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.REFERENCE; + case QUANTITY: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUANTITY; + default: return org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + copyElement(src, tgt); + tgt.setQuestion(src.getQuestion()); + if (src.hasAnswered()) + tgt.setHasAnswer(src.getAnswered()); + tgt.setAnswer(convertType(src.getAnswer())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); + copyElement(src, tgt); + tgt.setQuestion(src.getQuestion()); + if (src.hasHasAnswer()) + tgt.setAnswered(src.getHasAnswer()); + tgt.setAnswer(convertType(src.getAnswer())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent(); + copyElement(src, tgt); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu3.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent(); + copyElement(src, tgt); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaire(convertReference(src.getQuestionnaire())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setContext(convertReference(src.getEncounter())); + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasAuthored()) + tgt.setAuthored(src.getAuthored()); + tgt.setSource(convertReference(src.getSource())); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.dstu3.model.QuestionnaireResponse src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.QuestionnaireResponse tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse(); + copyDomainResource(src, tgt); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + tgt.setQuestionnaire(convertReference(src.getQuestionnaire())); + tgt.setStatus(convertQuestionnaireResponseStatus(src.getStatus())); + tgt.setSubject(convertReference(src.getSubject())); + tgt.setEncounter(convertReference(src.getContext())); + tgt.setAuthor(convertReference(src.getAuthor())); + if (src.hasAuthored()) + tgt.setAuthored(src.getAuthored()); + tgt.setSource(convertReference(src.getSource())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: return org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case INPROGRESS: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS; + case COMPLETED: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED; + case AMENDED: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED; + default: return org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasText()) + tgt.setText(src.getText()); + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseItemComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent(); + copyElement(src, tgt); + if (src.hasLinkId()) + tgt.setLinkId(src.getLinkId()); + if (src.hasText()) + tgt.setText(src.getText()); + tgt.setSubject(convertReference(src.getSubject())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer()) + tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t)); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + copyElement(src, tgt); + tgt.setValue(convertType(src.getValue())); + for (org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent tgt = new org.hl7.fhir.dstu2016may.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent(); + copyElement(src, tgt); + tgt.setValue(convertType(src.getValue())); + for (org.hl7.fhir.dstu3.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem()) + tgt.addItem(convertQuestionnaireResponseItemComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu2016may.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.SearchParameter tgt = new org.hl7.fhir.dstu3.model.SearchParameter(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent t : src.getContact()) + tgt.addContact(convertSearchParameterContactComponent(t)); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + tgt.setCode(src.getCode()); + tgt.addBase(src.getBase()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getTarget()) + tgt.addTarget(t.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SearchParameter convertSearchParameter(org.hl7.fhir.dstu3.model.SearchParameter src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SearchParameter tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertSearchParameterContactComponent(t)); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + tgt.setCode(src.getCode()); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getBase()) + tgt.setBase(t.asStringValue()); + tgt.setType(convertSearchParamType(src.getType())); + tgt.setDescription(src.getDescription()); + if (src.hasExpression()) + tgt.setExpression(src.getExpression()); + if (src.hasXpath()) + tgt.setXpath(src.getXpath()); + tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage())); + for (org.hl7.fhir.dstu3.model.CodeType t : src.getTarget()) + tgt.addTarget(t.getValue()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NORMAL: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.OTHER; + default: return org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.dstu3.model.SearchParameter.XPathUsageType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case NORMAL: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NORMAL; + case PHONETIC: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.PHONETIC; + case NEARBY: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NEARBY; + case DISTANCE: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.DISTANCE; + case OTHER: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.OTHER; + default: return org.hl7.fhir.dstu2016may.model.SearchParameter.XPathUsageType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.dstu2016may.model.SearchParameter.SearchParameterContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu2016may.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition tgt = new org.hl7.fhir.dstu3.model.StructureDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + if (src.hasDisplay()) + tgt.setTitle(src.getDisplay()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact()) + tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2016may.model.Coding t : src.getCode()) + tgt.addKeyword(convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + tgt.setAbstract(src.getAbstract()); + tgt.setContextType(convertExtensionContext(src.getContextType())); + for (org.hl7.fhir.dstu2016may.model.StringType t : src.getContext()) + tgt.addContext(t.getValue()); + if (src.getDerivation() == TypeDerivationRule.CONSTRAINT) + tgt.setType(src.getBaseType()); + else + tgt.setType(src.getId()); + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) { + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.getSnapshot().getElementFirstRep().getType().clear(); + } + if (src.hasDifferential()) { + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + tgt.getDifferential().getElementFirstRep().getType().clear(); + } + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.dstu3.model.StructureDefinition src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + if (src.hasTitle()) + tgt.setDisplay(src.getTitle()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertStructureDefinitionContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.Coding t : src.getKeyword()) + tgt.addCode(convertCoding(t)); + if (src.hasFhirVersion()) + tgt.setFhirVersion(src.getFhirVersion()); + for (org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping()) + tgt.addMapping(convertStructureDefinitionMappingComponent(t)); + tgt.setKind(convertStructureDefinitionKind(src.getKind())); + tgt.setAbstract(src.getAbstract()); + tgt.setContextType(convertExtensionContext(src.getContextType())); + for (org.hl7.fhir.dstu3.model.StringType t : src.getContext()) + tgt.addContext(t.getValue()); + if (src.hasBaseDefinition()) + tgt.setBaseDefinition(src.getBaseDefinition()); + if (src.hasType() && src.getDerivation() == org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT) + tgt.setBaseType(src.getType()); + tgt.setDerivation(convertTypeDerivationRule(src.getDerivation())); + if (src.hasSnapshot()) + tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot())); + tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential())); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case DATATYPE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE; + case RESOURCE: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: return org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case PRIMITIVETYPE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case COMPLEXTYPE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.DATATYPE; + case RESOURCE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.RESOURCE; + case LOGICAL: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.LOGICAL; + default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind.NULL; + } + } + + private static org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESOURCE: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.RESOURCE; + case DATATYPE: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.DATATYPE; + case EXTENSION: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.EXTENSION; + default: return org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.dstu3.model.StructureDefinition.ExtensionContext src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESOURCE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.RESOURCE; + case DATATYPE: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.DATATYPE; + case EXTENSION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.EXTENSION; + default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.ExtensionContext.NULL; + } + } + + private static org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SPECIALIZATION: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: return org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule convertTypeDerivationRule(org.hl7.fhir.dstu3.model.StructureDefinition.TypeDerivationRule src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case SPECIALIZATION: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION; + case CONSTRAINT: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.CONSTRAINT; + default: return org.hl7.fhir.dstu2016may.model.StructureDefinition.TypeDerivationRule.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComments()) + tgt.setComment(src.getComments()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionMappingComponent(); + copyElement(src, tgt); + tgt.setIdentity(src.getIdentity()); + if (src.hasUri()) + tgt.setUri(src.getUri()); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasComment()) + tgt.setComments(src.getComment()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionSnapshotComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.dstu3.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionDifferentialComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ElementDefinition t : src.getElement()) + tgt.addElement(convertElementDefinition(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript convertTestScript(org.hl7.fhir.dstu2016may.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript tgt = new org.hl7.fhir.dstu3.model.TestScript(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent t : src.getContact()) + tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) + tgt.addOrigin(convertTestScriptOriginComponent(t)); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) + tgt.addDestination(convertTestScriptDestinationComponent(t)); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) + tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.dstu2016may.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent t : src.getVariable()) + tgt.addVariable(convertTestScriptVariableComponent(t)); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent t : src.getRule()) + tgt.addRule(convertTestScriptRuleComponent(t)); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent t : src.getRuleset()) + tgt.addRuleset(convertTestScriptRulesetComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent t : src.getTest()) + tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript convertTestScript(org.hl7.fhir.dstu3.model.TestScript src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript tgt = new org.hl7.fhir.dstu2016may.model.TestScript(); + copyDomainResource(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + tgt.setIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertTestScriptContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent t : src.getOrigin()) + tgt.addOrigin(convertTestScriptOriginComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent t : src.getDestination()) + tgt.addDestination(convertTestScriptDestinationComponent(t)); + tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata())); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent t : src.getFixture()) + tgt.addFixture(convertTestScriptFixtureComponent(t)); + for (org.hl7.fhir.dstu3.model.Reference t : src.getProfile()) + tgt.addProfile(convertReference(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent t : src.getVariable()) + tgt.addVariable(convertTestScriptVariableComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent t : src.getRule()) + tgt.addRule(convertTestScriptRuleComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent t : src.getRuleset()) + tgt.addRuleset(convertTestScriptRulesetComponent(t)); + tgt.setSetup(convertTestScriptSetupComponent(src.getSetup())); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent t : src.getTest()) + tgt.addTest(convertTestScriptTestComponent(t)); + tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent(); + copyElement(src, tgt); + tgt.setIndex(src.getIndex()); + tgt.setProfile(convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent convertTestScriptOriginComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptOriginComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptOriginComponent(); + copyElement(src, tgt); + tgt.setIndex(src.getIndex()); + tgt.setProfile(convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent(); + copyElement(src, tgt); + tgt.setIndex(src.getIndex()); + tgt.setProfile(convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent convertTestScriptDestinationComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptDestinationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptDestinationComponent(); + copyElement(src, tgt); + tgt.setIndex(src.getIndex()); + tgt.setProfile(convertCoding(src.getProfile())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) + tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) + tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink()) + tgt.addLink(convertTestScriptMetadataLinkComponent(t)); + for (org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability()) + tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataLinkComponent(); + copyElement(src, tgt); + tgt.setUrl(src.getUrl()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent(); + copyElement(src, tgt); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasValidated()) + tgt.setValidated(src.getValidated()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.IntegerType t : src.getOrigin()) + tgt.addOrigin(t.getValue()); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getLink()) + tgt.addLink(t.getValue()); + tgt.setCapabilities(convertReference(src.getConformance())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptMetadataCapabilityComponent(); + copyElement(src, tgt); + if (src.hasRequired()) + tgt.setRequired(src.getRequired()); + if (src.hasValidated()) + tgt.setValidated(src.getValidated()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.IntegerType t : src.getOrigin()) + tgt.addOrigin(t.getValue()); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + for (org.hl7.fhir.dstu3.model.UriType t : src.getLink()) + tgt.addLink(t.getValue()); + tgt.setConformance(convertReference(src.getCapabilities())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent(); + copyElement(src, tgt); + if (src.hasAutocreate()) + tgt.setAutocreate(src.getAutocreate()); + if (src.hasAutodelete()) + tgt.setAutodelete(src.getAutodelete()); + if (src.hasResource()) + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptFixtureComponent(); + copyElement(src, tgt); + if (src.hasAutocreate()) + tgt.setAutocreate(src.getAutocreate()); + if (src.hasAutodelete()) + tgt.setAutodelete(src.getAutodelete()); + if (src.hasResource()) + tgt.setResource(convertReference(src.getResource())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(src.getDefaultValue()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptVariableComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptVariableComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasDefaultValue()) + tgt.setDefaultValue(src.getDefaultValue()); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent convertTestScriptRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent(); + copyElement(src, tgt); + tgt.setResource(convertReference(src.getResource())); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent t : src.getParam()) + tgt.addParam(convertTestScriptRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent convertTestScriptRuleComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleComponent(); + copyElement(src, tgt); + tgt.setResource(convertReference(src.getResource())); + for (org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent t : src.getParam()) + tgt.addParam(convertTestScriptRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent convertTestScriptRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent convertTestScriptRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.RuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRuleParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent convertTestScriptRulesetComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent(); + copyElement(src, tgt); + tgt.setResource(convertReference(src.getResource())); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent t : src.getRule()) + tgt.addRule(convertTestScriptRulesetRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent convertTestScriptRulesetComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptRulesetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetComponent(); + copyElement(src, tgt); + tgt.setResource(convertReference(src.getResource())); + for (org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent t : src.getRule()) + tgt.addRule(convertTestScriptRulesetRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent convertTestScriptRulesetRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent t : src.getParam()) + tgt.addParam(convertTestScriptRulesetRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent convertTestScriptRulesetRuleComponent(org.hl7.fhir.dstu3.model.TestScript.RulesetRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent t : src.getParam()) + tgt.addParam(convertTestScriptRulesetRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent convertTestScriptRulesetRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent convertTestScriptRulesetRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.RulesetRuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptRulesetRuleParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptSetupComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptSetupComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent t : src.getAction()) + tgt.addAction(convertSetupActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent(); + copyElement(src, tgt); + tgt.setType(convertCoding(src.getType())); + if (src.hasResource()) + tgt.setResource(src.getResource()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + if (src.hasEncodeRequestUrl()) + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + if (src.hasOrigin()) + tgt.setOrigin(src.getOrigin()); + if (src.hasParams()) + tgt.setParams(src.getParams()); + for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) + tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + if (src.hasResponseId()) + tgt.setResponseId(src.getResponseId()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasTargetId()) + tgt.setTargetId(src.getTargetId()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationComponent(); + copyElement(src, tgt); + if (src.hasResource()) + tgt.setResource(src.getResource()); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setAccept(convertContentType(src.getAccept())); + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasDestination()) + tgt.setDestination(src.getDestination()); + if (src.hasEncodeRequestUrl()) + tgt.setEncodeRequestUrl(src.getEncodeRequestUrl()); + if (src.hasOrigin()) + tgt.setOrigin(src.getOrigin()); + if (src.hasParams()) + tgt.setParams(src.getParams()); + for (org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader()) + tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t)); + if (src.hasResponseId()) + tgt.setResponseId(src.getResponseId()); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasTargetId()) + tgt.setTargetId(src.getTargetId()); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu2016may.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XML: return org.hl7.fhir.dstu3.model.TestScript.ContentType.XML; + case JSON: return org.hl7.fhir.dstu3.model.TestScript.ContentType.JSON; + default: return org.hl7.fhir.dstu3.model.TestScript.ContentType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.TestScript.ContentType convertContentType(org.hl7.fhir.dstu3.model.TestScript.ContentType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case XML: return org.hl7.fhir.dstu2016may.model.TestScript.ContentType.XML; + case JSON: return org.hl7.fhir.dstu2016may.model.TestScript.ContentType.JSON; + default: return org.hl7.fhir.dstu2016may.model.TestScript.ContentType.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionOperationRequestHeaderComponent(); + copyElement(src, tgt); + tgt.setField(src.getField()); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + if (src.hasCompareToSourceId()) + tgt.setCompareToSourceId(src.getCompareToSourceId()); + if (src.hasCompareToSourcePath()) + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasMinimumId()) + tgt.setMinimumId(src.getMinimumId()); + if (src.hasNavigationLinks()) + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasResource()) + tgt.setResource(src.getResource()); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + if (src.hasResponseCode()) + tgt.setResponseCode(src.getResponseCode()); + tgt.setRule(convertSetupActionAssertRuleComponent(src.getRule())); + tgt.setRuleset(convertSetupActionAssertRulesetComponent(src.getRuleset())); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasValidateProfileId()) + tgt.setValidateProfileId(src.getValidateProfileId()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasWarningOnly()) + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertComponent(); + copyElement(src, tgt); + if (src.hasLabel()) + tgt.setLabel(src.getLabel()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + tgt.setDirection(convertAssertionDirectionType(src.getDirection())); + if (src.hasCompareToSourceId()) + tgt.setCompareToSourceId(src.getCompareToSourceId()); + if (src.hasCompareToSourcePath()) + tgt.setCompareToSourcePath(src.getCompareToSourcePath()); + tgt.setContentType(convertContentType(src.getContentType())); + if (src.hasHeaderField()) + tgt.setHeaderField(src.getHeaderField()); + if (src.hasMinimumId()) + tgt.setMinimumId(src.getMinimumId()); + if (src.hasNavigationLinks()) + tgt.setNavigationLinks(src.getNavigationLinks()); + tgt.setOperator(convertAssertionOperatorType(src.getOperator())); + if (src.hasPath()) + tgt.setPath(src.getPath()); + if (src.hasResource()) + tgt.setResource(src.getResource()); + tgt.setResponse(convertAssertionResponseTypes(src.getResponse())); + if (src.hasResponseCode()) + tgt.setResponseCode(src.getResponseCode()); + tgt.setRule(convertSetupActionAssertRuleComponent(src.getRule())); + tgt.setRuleset(convertSetupActionAssertRulesetComponent(src.getRuleset())); + if (src.hasSourceId()) + tgt.setSourceId(src.getSourceId()); + if (src.hasValidateProfileId()) + tgt.setValidateProfileId(src.getValidateProfileId()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + if (src.hasWarningOnly()) + tgt.setWarningOnly(src.getWarningOnly()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent convertSetupActionAssertRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent t : src.getParam()) + tgt.addParam(convertSetupActionAssertRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent convertSetupActionAssertRuleComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent t : src.getParam()) + tgt.addParam(convertSetupActionAssertRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent convertSetupActionAssertRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent convertSetupActionAssertRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRuleParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent convertSetupActionAssertRulesetComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent t : src.getRule()) + tgt.addRule(convertSetupActionAssertRulesetRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent convertSetupActionAssertRulesetComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent t : src.getRule()) + tgt.addRule(convertSetupActionAssertRulesetRuleComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent convertSetupActionAssertRulesetRuleComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent t : src.getParam()) + tgt.addParam(convertSetupActionAssertRulesetRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent convertSetupActionAssertRulesetRuleComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent t : src.getParam()) + tgt.addParam(convertSetupActionAssertRulesetRuleParamComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent convertSetupActionAssertRulesetRuleParamComponent(org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent convertSetupActionAssertRulesetRuleParamComponent(org.hl7.fhir.dstu3.model.TestScript.ActionAssertRulesetRuleParamComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.SetupActionAssertRulesetRuleParamComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + if (src.hasValue()) + tgt.setValue(src.getValue()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESPONSE: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.REQUEST; + default: return org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.dstu3.model.TestScript.AssertionDirectionType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RESPONSE: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType.RESPONSE; + case REQUEST: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType.REQUEST; + default: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionDirectionType.NULL; + } + } + + private static org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.IN; + case NOTIN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: return org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.dstu3.model.TestScript.AssertionOperatorType src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUALS: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.EQUALS; + case NOTEQUALS: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTEQUALS; + case IN: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.IN; + case NOTIN: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTIN; + case GREATERTHAN: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.GREATERTHAN; + case LESSTHAN: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.LESSTHAN; + case EMPTY: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.EMPTY; + case NOTEMPTY: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTEMPTY; + case CONTAINS: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.CONTAINS; + case NOTCONTAINS: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NOTCONTAINS; + default: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionOperatorType.NULL; + } + } + + private static org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OKAY: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: return org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.dstu3.model.TestScript.AssertionResponseTypes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case OKAY: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.OKAY; + case CREATED: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.CREATED; + case NOCONTENT: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NOCONTENT; + case NOTMODIFIED: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NOTMODIFIED; + case BAD: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.BAD; + case FORBIDDEN: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.FORBIDDEN; + case NOTFOUND: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NOTFOUND; + case METHODNOTALLOWED: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED; + case CONFLICT: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.CONFLICT; + case GONE: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.GONE; + case PRECONDITIONFAILED: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED; + case UNPROCESSABLE: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.UNPROCESSABLE; + default: return org.hl7.fhir.dstu2016may.model.TestScript.AssertionResponseTypes.NULL; + } + } + + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTestComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.TestScript.TestActionComponent t : src.getAction()) + tgt.addAction(convertTestActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.dstu3.model.TestScript.TestActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + tgt.setAssert(convertSetupActionAssertComponent(src.getAssert())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.dstu3.model.TestScript.TestScriptTeardownComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TestScriptTeardownComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent t : src.getAction()) + tgt.addAction(convertTeardownActionComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.dstu3.model.TestScript.TeardownActionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.dstu2016may.model.TestScript.TeardownActionComponent(); + copyElement(src, tgt); + tgt.setOperation(convertSetupActionOperationComponent(src.getOperation())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet convertValueSet(org.hl7.fhir.dstu2016may.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet tgt = new org.hl7.fhir.dstu3.model.ValueSet(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + if (src.hasIdentifier()) + tgt.addIdentifier(convertIdentifier(src.getIdentifier())); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent t : src.getContact()) + tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) + if (isJurisdiction(t)) + tgt.addJurisdiction(convertCodeableConcept(t)); + else + tgt.addUseContext(convertCodeableConceptToUsageContext(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasRequirements()) + tgt.setPurpose(src.getRequirements()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasExtensible()) + tgt.setExtensible(src.getExtensible()); + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasLockedDate()) + tgt.getCompose().setLockedDate(src.getLockedDate()); + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet convertValueSet(org.hl7.fhir.dstu3.model.ValueSet src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet tgt = new org.hl7.fhir.dstu2016may.model.ValueSet(); + copyDomainResource(src, tgt); + if (src.hasUrl()) + tgt.setUrl(src.getUrl()); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.setIdentifier(convertIdentifier(t)); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasName()) + tgt.setName(src.getName()); + tgt.setStatus(convertConformanceResourceStatus(src.getStatus())); + if (src.hasExperimental()) + tgt.setExperimental(src.getExperimental()); + if (src.hasPublisher()) + tgt.setPublisher(src.getPublisher()); + for (org.hl7.fhir.dstu3.model.ContactDetail t : src.getContact()) + tgt.addContact(convertValueSetContactComponent(t)); + if (src.hasDate()) + tgt.setDate(src.getDate()); + if (src.getCompose().hasLockedDate()) + tgt.setLockedDate(src.getCompose().getLockedDate()); + if (src.hasDescription()) + tgt.setDescription(src.getDescription()); + for (org.hl7.fhir.dstu3.model.UsageContext t : src.getUseContext()) + if (t.hasValueCodeableConcept()) + tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept())); + for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getJurisdiction()) + tgt.addUseContext(convertCodeableConcept(t)); + if (src.hasImmutable()) + tgt.setImmutable(src.getImmutable()); + if (src.hasPurpose()) + tgt.setRequirements(src.getPurpose()); + if (src.hasCopyright()) + tgt.setCopyright(src.getCopyright()); + if (src.hasExtensible()) + tgt.setExtensible(src.getExtensible()); + tgt.setCompose(convertValueSetComposeComponent(src.getCompose())); + if (src.hasExpansion()) + tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ContactDetail tgt = new org.hl7.fhir.dstu3.model.ContactDetail(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.dstu3.model.ContactDetail src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetContactComponent(); + copyElement(src, tgt); + if (src.hasName()) + tgt.setName(src.getName()); + for (org.hl7.fhir.dstu3.model.ContactPoint t : src.getTelecom()) + tgt.addTelecom(convertContactPoint(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) + tgt.addInclude().addValueSet(t.getValue()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getInclude()) + tgt.addInclude(convertConceptSetComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent t : src.getExclude()) + tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetComposeComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetComposeComponent(); + copyElement(src, tgt); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getInclude()) { + for (org.hl7.fhir.dstu3.model.UriType ti : t.getValueSet()) + tgt.addImport(ti.getValue()); + tgt.addInclude(convertConceptSetComponent(t)); + } + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent t : src.getExclude()) + tgt.addExclude(convertConceptSetComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) + tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) + tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetComponent(); + copyElement(src, tgt); + tgt.setSystem(src.getSystem()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent t : src.getConcept()) + tgt.addConcept(convertConceptReferenceComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent t : src.getFilter()) + tgt.addFilter(convertConceptSetFilterComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceComponent(); + copyElement(src, tgt); + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation()) + tgt.addDesignation(convertConceptReferenceDesignationComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptReferenceDesignationComponent(); + copyElement(src, tgt); + if (src.hasLanguage()) + tgt.setLanguage(src.getLanguage()); + tgt.setUse(convertCoding(src.getUse())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent(); + copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.dstu3.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ConceptSetFilterComponent(); + copyElement(src, tgt); + tgt.setProperty(src.getProperty()); + tgt.setOp(convertFilterOperator(src.getOp())); + tgt.setValue(src.getValue()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISA; + case ISNOTA: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.REGEX; + case IN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NOTIN; + default: return org.hl7.fhir.dstu3.model.ValueSet.FilterOperator.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.dstu3.model.ValueSet.FilterOperator src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case EQUAL: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.EQUAL; + case ISA: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISA; + case ISNOTA: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.ISNOTA; + case REGEX: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.REGEX; + case IN: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.IN; + case NOTIN: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NOTIN; + default: return org.hl7.fhir.dstu2016may.model.ValueSet.FilterOperator.NULL; + } + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionComponent(); + copyElement(src, tgt); + tgt.setIdentifier(src.getIdentifier()); + tgt.setTimestamp(src.getTimestamp()); + if (src.hasTotal()) + tgt.setTotal(src.getTotal()); + if (src.hasOffset()) + tgt.setOffset(src.getOffset()); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter()) + tgt.addParameter(convertValueSetExpansionParameterComponent(t)); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionParameterComponent(); + copyElement(src, tgt); + tgt.setName(src.getName()); + tgt.setValue(convertType(src.getValue())); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.dstu2016may.model.ValueSet.ValueSetExpansionContainsComponent(); + copyElement(src, tgt); + if (src.hasSystem()) + tgt.setSystem(src.getSystem()); + if (src.hasAbstract()) + tgt.setAbstract(src.getAbstract()); + if (src.hasVersion()) + tgt.setVersion(src.getVersion()); + if (src.hasCode()) + tgt.setCode(src.getCode()); + if (src.hasDisplay()) + tgt.setDisplay(src.getDisplay()); + for (org.hl7.fhir.dstu3.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains()) + tgt.addContains(convertValueSetExpansionContainsComponent(t)); + return tgt; + } + +/* public static org.hl7.fhir.dstu3.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.dstu2016may.model.VisionPrescription src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.VisionPrescription tgt = new org.hl7.fhir.dstu3.model.VisionPrescription(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setDateWritten(src.getDateWritten()); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setPrescriber(convertReference(src.getPrescriber())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setReason(convertType(src.getReason())); + for (org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionPrescriptionDispenseComponent t : src.getDispense()) + tgt.addDispense(convertVisionPrescriptionDispenseComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.VisionPrescription convertVisionPrescription(org.hl7.fhir.dstu3.model.VisionPrescription src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.VisionPrescription tgt = new org.hl7.fhir.dstu2016may.model.VisionPrescription(); + copyDomainResource(src, tgt); + for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) + tgt.addIdentifier(convertIdentifier(t)); + tgt.setDateWritten(src.getDateWritten()); + tgt.setPatient(convertReference(src.getPatient())); + tgt.setPrescriber(convertReference(src.getPrescriber())); + tgt.setEncounter(convertReference(src.getEncounter())); + tgt.setReason(convertType(src.getReason())); + for (org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent t : src.getDispense()) + tgt.addDispense(convertVisionPrescriptionDispenseComponent(t)); + return tgt; + } + + public static org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent convertVisionPrescriptionDispenseComponent(org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionPrescriptionDispenseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent tgt = new org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent(); + copyElement(src, tgt); + tgt.setProduct(convertCoding(src.getProduct())); + tgt.setEye(convertVisionEyes(src.getEye())); + tgt.setSphere(src.getSphere()); + tgt.setCylinder(src.getCylinder()); + tgt.setAxis(src.getAxis()); + tgt.setPrism(src.getPrism()); + tgt.setBase(convertVisionBase(src.getBase())); + tgt.setAdd(src.getAdd()); + tgt.setPower(src.getPower()); + tgt.setBackCurve(src.getBackCurve()); + tgt.setDiameter(src.getDiameter()); + tgt.setDuration(convertSimpleQuantity(src.getDuration())); + tgt.setColor(src.getColor()); + tgt.setBrand(src.getBrand()); + tgt.setNotes(src.getNotes()); + return tgt; + } + + public static org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionPrescriptionDispenseComponent convertVisionPrescriptionDispenseComponent(org.hl7.fhir.dstu3.model.VisionPrescription.VisionPrescriptionDispenseComponent src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionPrescriptionDispenseComponent tgt = new org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionPrescriptionDispenseComponent(); + copyElement(src, tgt); + tgt.setProduct(convertCoding(src.getProduct())); + tgt.setEye(convertVisionEyes(src.getEye())); + tgt.setSphere(src.getSphere()); + tgt.setCylinder(src.getCylinder()); + tgt.setAxis(src.getAxis()); + tgt.setPrism(src.getPrism()); + tgt.setBase(convertVisionBase(src.getBase())); + tgt.setAdd(src.getAdd()); + tgt.setPower(src.getPower()); + tgt.setBackCurve(src.getBackCurve()); + tgt.setDiameter(src.getDiameter()); + tgt.setDuration(convertSimpleQuantity(src.getDuration())); + tgt.setColor(src.getColor()); + tgt.setBrand(src.getBrand()); + tgt.setNotes(src.getNotes()); + return tgt; + } + + private static org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes convertVisionEyes(org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionEyes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RIGHT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes.RIGHT; + case LEFT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes.LEFT; + default: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionEyes convertVisionEyes(org.hl7.fhir.dstu3.model.VisionPrescription.VisionEyes src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case RIGHT: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionEyes.RIGHT; + case LEFT: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionEyes.LEFT; + default: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionEyes.NULL; + } + } + + private static org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase convertVisionBase(org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UP: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.UP; + case DOWN: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.DOWN; + case IN: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.IN; + case OUT: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.OUT; + default: return org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase.NULL; + } + } + + private static org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase convertVisionBase(org.hl7.fhir.dstu3.model.VisionPrescription.VisionBase src) throws FHIRException { + if (src == null) + return null; + switch (src) { + case UP: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase.UP; + case DOWN: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase.DOWN; + case IN: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase.IN; + case OUT: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase.OUT; + default: return org.hl7.fhir.dstu2016may.model.VisionPrescription.VisionBase.NULL; + } + } +*/ + public static org.hl7.fhir.dstu3.model.Resource convertResource(org.hl7.fhir.dstu2016may.model.Resource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu2016may.model.Parameters) + return convertParameters((org.hl7.fhir.dstu2016may.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Bundle) + return convertBundle((org.hl7.fhir.dstu2016may.model.Bundle) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CodeSystem) + return convertCodeSystem((org.hl7.fhir.dstu2016may.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.CompartmentDefinition) + return convertCompartmentDefinition((org.hl7.fhir.dstu2016may.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ConceptMap) + return convertConceptMap((org.hl7.fhir.dstu2016may.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Conformance) + return convertConformance((org.hl7.fhir.dstu2016may.model.Conformance) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.DataElement) + return convertDataElement((org.hl7.fhir.dstu2016may.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ImplementationGuide) + return convertImplementationGuide((org.hl7.fhir.dstu2016may.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.NamingSystem) + return convertNamingSystem((org.hl7.fhir.dstu2016may.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.OperationDefinition) + return convertOperationDefinition((org.hl7.fhir.dstu2016may.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.OperationOutcome) + return convertOperationOutcome((org.hl7.fhir.dstu2016may.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.Questionnaire) + return convertQuestionnaire((org.hl7.fhir.dstu2016may.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) + return convertQuestionnaireResponse((org.hl7.fhir.dstu2016may.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.SearchParameter) + return convertSearchParameter((org.hl7.fhir.dstu2016may.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.StructureDefinition) + return convertStructureDefinition((org.hl7.fhir.dstu2016may.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.TestScript) + return convertTestScript((org.hl7.fhir.dstu2016may.model.TestScript) src); + if (src instanceof org.hl7.fhir.dstu2016may.model.ValueSet) + return convertValueSet((org.hl7.fhir.dstu2016may.model.ValueSet) src); +/* if (src instanceof org.hl7.fhir.dstu2016may.model.VisionPrescription) + return convertVisionPrescription((org.hl7.fhir.dstu2016may.model.VisionPrescription) src);*/ + throw new Error("Unknown resource "+src.fhirType()); + } + + public static org.hl7.fhir.dstu2016may.model.Resource convertResource(org.hl7.fhir.dstu3.model.Resource src) throws FHIRException { + if (src == null || src.isEmpty()) + return null; + if (src instanceof org.hl7.fhir.dstu3.model.Parameters) + return convertParameters((org.hl7.fhir.dstu3.model.Parameters) src); + if (src instanceof org.hl7.fhir.dstu3.model.Bundle) + return convertBundle((org.hl7.fhir.dstu3.model.Bundle) src); + if (src instanceof org.hl7.fhir.dstu3.model.CodeSystem) + return convertCodeSystem((org.hl7.fhir.dstu3.model.CodeSystem) src); + if (src instanceof org.hl7.fhir.dstu3.model.CompartmentDefinition) + return convertCompartmentDefinition((org.hl7.fhir.dstu3.model.CompartmentDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.ConceptMap) + return convertConceptMap((org.hl7.fhir.dstu3.model.ConceptMap) src); + if (src instanceof org.hl7.fhir.dstu3.model.CapabilityStatement) + return convertConformance((org.hl7.fhir.dstu3.model.CapabilityStatement) src); + if (src instanceof org.hl7.fhir.dstu3.model.DataElement) + return convertDataElement((org.hl7.fhir.dstu3.model.DataElement) src); + if (src instanceof org.hl7.fhir.dstu3.model.ImplementationGuide) + return convertImplementationGuide((org.hl7.fhir.dstu3.model.ImplementationGuide) src); + if (src instanceof org.hl7.fhir.dstu3.model.NamingSystem) + return convertNamingSystem((org.hl7.fhir.dstu3.model.NamingSystem) src); + if (src instanceof org.hl7.fhir.dstu3.model.OperationDefinition) + return convertOperationDefinition((org.hl7.fhir.dstu3.model.OperationDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.OperationOutcome) + return convertOperationOutcome((org.hl7.fhir.dstu3.model.OperationOutcome) src); + if (src instanceof org.hl7.fhir.dstu3.model.Questionnaire) + return convertQuestionnaire((org.hl7.fhir.dstu3.model.Questionnaire) src); + if (src instanceof org.hl7.fhir.dstu3.model.QuestionnaireResponse) + return convertQuestionnaireResponse((org.hl7.fhir.dstu3.model.QuestionnaireResponse) src); + if (src instanceof org.hl7.fhir.dstu3.model.SearchParameter) + return convertSearchParameter((org.hl7.fhir.dstu3.model.SearchParameter) src); + if (src instanceof org.hl7.fhir.dstu3.model.StructureDefinition) + return convertStructureDefinition((org.hl7.fhir.dstu3.model.StructureDefinition) src); + if (src instanceof org.hl7.fhir.dstu3.model.TestScript) + return convertTestScript((org.hl7.fhir.dstu3.model.TestScript) src); + if (src instanceof org.hl7.fhir.dstu3.model.ValueSet) + return convertValueSet((org.hl7.fhir.dstu3.model.ValueSet) src); +/* if (src instanceof org.hl7.fhir.dstu3.model.VisionPrescription) + return convertVisionPrescription((org.hl7.fhir.dstu3.model.VisionPrescription) src);*/ + throw new Error("Unknown resource "+src.fhirType()); + } + + +} diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/dstu2/utils/ToolingExtensions.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/dstu2/utils/ToolingExtensions.java index f711a7af1bd..7937e1ed7e4 100644 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/dstu2/utils/ToolingExtensions.java +++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/dstu2/utils/ToolingExtensions.java @@ -20,468 +20,468 @@ package org.hl7.fhir.dstu2.utils; * #L% */ - -import java.net.URISyntaxException; - -/* -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 java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.hl7.fhir.instance.model.BooleanType; -import org.hl7.fhir.instance.model.CodeType; -import org.hl7.fhir.instance.model.CodeableConcept; -import org.hl7.fhir.instance.model.Coding; -import org.hl7.fhir.instance.model.DataElement; -import org.hl7.fhir.instance.model.DomainResource; -import org.hl7.fhir.instance.model.Element; -import org.hl7.fhir.instance.model.ElementDefinition; -import org.hl7.fhir.instance.model.Extension; -import org.hl7.fhir.instance.model.ExtensionHelper; -import org.hl7.fhir.instance.model.Factory; -import org.hl7.fhir.instance.model.Identifier; -import org.hl7.fhir.instance.model.IntegerType; -import org.hl7.fhir.instance.model.MarkdownType; -import org.hl7.fhir.instance.model.PrimitiveType; -import org.hl7.fhir.instance.model.Questionnaire.GroupComponent; -import org.hl7.fhir.instance.model.Questionnaire.QuestionComponent; -import org.hl7.fhir.instance.model.Reference; -import org.hl7.fhir.instance.model.StringType; -import org.hl7.fhir.instance.model.Type; -import org.hl7.fhir.instance.model.UriType; -import org.hl7.fhir.instance.model.ValueSet; -import org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent; -import org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent; -import org.hl7.fhir.utilities.validation.ValidationMessage.Source; -import org.hl7.fhir.exceptions.FHIRFormatError; -import org.hl7.fhir.utilities.Utilities; - - -public class ToolingExtensions { - - // validated - public static final String EXT_SUBSUMES = "http://hl7.org/fhir/StructureDefinition/valueset-subsumes"; - private static final String EXT_OID = "http://hl7.org/fhir/StructureDefinition/valueset-oid"; - public static final String EXT_DEPRECATED = "http://hl7.org/fhir/StructureDefinition/valueset-deprecated"; - public static final String EXT_DEFINITION = "http://hl7.org/fhir/StructureDefinition/valueset-definition"; - public static final String EXT_COMMENT = "http://hl7.org/fhir/StructureDefinition/valueset-comments"; - private static final String EXT_IDENTIFIER = "http://hl7.org/fhir/StructureDefinition/identifier"; - private static final String EXT_TRANSLATION = "http://hl7.org/fhir/StructureDefinition/translation"; - public static final String EXT_ISSUE_SOURCE = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-source"; - public static final String EXT_DISPLAY_HINT = "http://hl7.org/fhir/StructureDefinition/structuredefinition-display-hint"; - public static final String EXT_REPLACED_BY = "http://hl7.org/fhir/StructureDefinition/valueset-replacedby"; - public static final String EXT_JSON_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type"; - public static final String EXT_XML_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-type"; - public static final String EXT_REGEX = "http://hl7.org/fhir/StructureDefinition/structuredefinition-regex"; - public static final String EXT_EXPRESSION = "http://hl7.org/fhir/StructureDefinition/structuredefinition-expression"; - public static final String EXT_SEARCH_EXPRESSION = "http://hl7.org/fhir/StructureDefinition/searchparameter-expression"; - - // unregistered? - - public static final String EXT_FLYOVER = "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover"; - private static final String EXT_QTYPE = "http://www.healthintersections.com.au/fhir/Profile/metadata#type"; - private static final String EXT_QREF = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference"; - private static final String EXTENSION_FILTER_ONLY = "http://www.healthintersections.com.au/fhir/Profile/metadata#expandNeedsFilter"; - private static final String EXT_TYPE = "http://www.healthintersections.com.au/fhir/Profile/metadata#type"; - private static final String EXT_REFERENCE = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference"; - private static final String EXT_ALLOWABLE_UNITS = "http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"; - public static final String EXT_CIMI_REFERENCE = "http://hl7.org/fhir/StructureDefinition/cimi-reference"; - public static final String EXT_UNCLOSED = "http://hl7.org/fhir/StructureDefinition/valueset-unclosed"; - public static final String EXT_FMM_LEVEL = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm"; - - - // specific extension helpers - - public static Extension makeIssueSource(Source source) { - Extension ex = new Extension(); - // todo: write this up and get it published with the pack (and handle the redirect?) - ex.setUrl(ToolingExtensions.EXT_ISSUE_SOURCE); - CodeType c = new CodeType(); - c.setValue(source.toString()); - ex.setValue(c); - return ex; - } - - public static boolean hasExtension(DomainResource de, String url) { - return getExtension(de, url) != null; - } - - public static boolean hasExtension(Element e, String url) { - return getExtension(e, url) != null; - } - - public static void addStringExtension(DomainResource dr, String url, String content) { - if (!Utilities.noString(content)) { - Extension ex = getExtension(dr, url); - if (ex != null) - ex.setValue(new StringType(content)); - else - dr.getExtension().add(Factory.newExtension(url, new StringType(content), true)); - } - } - - public static void addStringExtension(Element e, String url, String content) { - if (!Utilities.noString(content)) { - Extension ex = getExtension(e, url); - if (ex != null) - ex.setValue(new StringType(content)); - else - e.getExtension().add(Factory.newExtension(url, new StringType(content), true)); - } - } - - public static void addIntegerExtension(DomainResource dr, String url, int value) { - Extension ex = getExtension(dr, url); - if (ex != null) - ex.setValue(new IntegerType(value)); - else - dr.getExtension().add(Factory.newExtension(url, new IntegerType(value), true)); - } - - public static void addComment(Element nc, String comment) { - if (!Utilities.noString(comment)) - nc.getExtension().add(Factory.newExtension(EXT_COMMENT, Factory.newString_(comment), true)); - } - - public static void markDeprecated(Element nc) { - setDeprecated(nc); - } - - public static void addSubsumes(ConceptDefinitionComponent nc, String code) { - nc.getModifierExtension().add(Factory.newExtension(EXT_SUBSUMES, Factory.newCode(code), true)); - } - - public static void addDefinition(Element nc, String definition) { - if (!Utilities.noString(definition)) - nc.getExtension().add(Factory.newExtension(EXT_DEFINITION, Factory.newString_(definition), true)); - } - - public static void addDisplayHint(Element def, String hint) { - if (!Utilities.noString(hint)) - def.getExtension().add(Factory.newExtension(EXT_DISPLAY_HINT, Factory.newString_(hint), true)); - } - - public static String getDisplayHint(Element def) { - return readStringExtension(def, EXT_DISPLAY_HINT); - } - - public static String readStringExtension(Element c, String uri) { - Extension ex = ExtensionHelper.getExtension(c, uri); - if (ex == null) - return null; - if (ex.getValue() instanceof UriType) - return ((UriType) ex.getValue()).getValue(); - if (!(ex.getValue() instanceof StringType)) - return null; - return ((StringType) ex.getValue()).getValue(); - } - - public static String readStringExtension(DomainResource c, String uri) { - Extension ex = getExtension(c, uri); - if (ex == null) - return null; - if ((ex.getValue() instanceof StringType)) - return ((StringType) ex.getValue()).getValue(); - if ((ex.getValue() instanceof UriType)) - return ((UriType) ex.getValue()).getValue(); - if ((ex.getValue() instanceof MarkdownType)) - return ((MarkdownType) ex.getValue()).getValue(); - return null; - } - - @SuppressWarnings("unchecked") - public static PrimitiveType readPrimitiveExtension(DomainResource c, String uri) { - Extension ex = getExtension(c, uri); - if (ex == null) - return null; - return (PrimitiveType) ex.getValue(); - } - - public static boolean findStringExtension(Element c, String uri) { - Extension ex = ExtensionHelper.getExtension(c, uri); - if (ex == null) - return false; - if (!(ex.getValue() instanceof StringType)) - return false; - return !Utilities.noString(((StringType) ex.getValue()).getValue()); - } - - public static Boolean readBooleanExtension(Element c, String uri) { - Extension ex = ExtensionHelper.getExtension(c, uri); - if (ex == null) - return null; - if (!(ex.getValue() instanceof BooleanType)) - return null; - return ((BooleanType) ex.getValue()).getValue(); - } - - public static boolean findBooleanExtension(Element c, String uri) { - Extension ex = ExtensionHelper.getExtension(c, uri); - if (ex == null) - return false; - if (!(ex.getValue() instanceof BooleanType)) - return false; - return true; - } - - public static String getComment(ConceptDefinitionComponent c) { - return readStringExtension(c, EXT_COMMENT); - } - - public static Boolean getDeprecated(Element c) { - return readBooleanExtension(c, EXT_DEPRECATED); - } - - public static boolean hasComment(ConceptDefinitionComponent c) { - return findStringExtension(c, EXT_COMMENT); - } - - public static boolean hasDeprecated(Element c) { - return findBooleanExtension(c, EXT_DEPRECATED); - } - - public static List getSubsumes(ConceptDefinitionComponent c) { - List res = new ArrayList(); - - for (Extension e : c.getExtension()) { - if (EXT_SUBSUMES.equals(e.getUrl())) - res.add((CodeType) e.getValue()); - } - return res; - } - - public static void addFlyOver(GroupComponent group, String text) { - if (!Utilities.noString(text)) - group.getExtension().add(Factory.newExtension(EXT_FLYOVER, Factory.newString_(text), true)); - - } - - public static void setQuestionType(GroupComponent group, String text) { - if (!Utilities.noString(text)) - group.getExtension().add(Factory.newExtension(EXT_QTYPE, Factory.newString_(text), true)); - } - - public static void setQuestionReference(GroupComponent group, String text) { - if (!Utilities.noString(text)) - group.getExtension().add(Factory.newExtension(EXT_QREF, Factory.newString_(text), true)); - } - - public static void addFlyOver(Element element, String text) { - element.getExtension().add(Factory.newExtension(EXT_FLYOVER, Factory.newString_(text), true)); - } - - public static void addFilterOnly(Reference element, boolean value) { - element.getExtension().add(Factory.newExtension(EXTENSION_FILTER_ONLY, Factory.newBoolean(value), true)); - } - - public static void addType(GroupComponent group, String value) { - group.getExtension().add(Factory.newExtension(EXT_TYPE, Factory.newString_(value), true)); - } - - public static void addReference(QuestionComponent group, String value) { - group.getExtension().add(Factory.newExtension(EXT_REFERENCE, Factory.newString_(value), true)); - } - - public static void addIdentifier(Element element, Identifier value) { - element.getExtension().add(Factory.newExtension(EXT_IDENTIFIER, value, true)); - } - - /** - * @param name the identity of the extension of interest - * @return The extension, if on this element, else null - */ - public static Extension getExtension(DomainResource resource, String name) { - if (name == null) - return null; - if (!resource.hasExtension()) - return null; - for (Extension e : resource.getExtension()) { - if (name.equals(e.getUrl())) - return e; - } - return null; - } - - public static Extension getExtension(Element el, String name) { - if (name == null) - return null; - if (!el.hasExtension()) - return null; - for (Extension e : el.getExtension()) { - if (name.equals(e.getUrl())) - return e; - } - return null; - } - - public static void setStringExtension(DomainResource resource, String uri, String value) { - Extension ext = getExtension(resource, uri); - if (ext != null) - ext.setValue(new StringType(value)); - else - resource.getExtension().add(new Extension(new UriType(uri)).setValue(new StringType(value))); - } - - public static String getOID(ValueSetCodeSystemComponent define) { - return readStringExtension(define, EXT_OID); - } - - public static String getOID(ValueSet vs) { - return readStringExtension(vs, EXT_OID); - } - - public static void setOID(ValueSetCodeSystemComponent define, String oid) throws FHIRFormatError, URISyntaxException { - if (!oid.startsWith("urn:oid:")) - throw new FHIRFormatError("Error in OID format"); - if (oid.startsWith("urn:oid:urn:oid:")) - throw new FHIRFormatError("Error in OID format"); - define.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false)); - } - public static void setOID(ValueSet vs, String oid) throws FHIRFormatError, URISyntaxException { - if (!oid.startsWith("urn:oid:")) - throw new FHIRFormatError("Error in OID format"); - if (oid.startsWith("urn:oid:urn:oid:")) - throw new FHIRFormatError("Error in OID format"); - vs.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false)); - } - - public static boolean hasLanguageTranslation(Element element, String lang) { - for (Extension e : element.getExtension()) { - if (e.getUrl().equals(EXT_TRANSLATION)) { - Extension e1 = ExtensionHelper.getExtension(e, "lang"); - - if (e1 != null && e1.getValue() instanceof CodeType && ((CodeType) e.getValue()).getValue().equals(lang)) - return true; - } - } - return false; - } - - public static String getLanguageTranslation(Element element, String lang) { - for (Extension e : element.getExtension()) { - if (e.getUrl().equals(EXT_TRANSLATION)) { - Extension e1 = ExtensionHelper.getExtension(e, "lang"); - - if (e1 != null && e1.getValue() instanceof CodeType && ((CodeType) e.getValue()).getValue().equals(lang)) { - e1 = ExtensionHelper.getExtension(e, "content"); - return ((StringType) e.getValue()).getValue(); - } - } - } - return null; - } - - public static void addLanguageTranslation(Element element, String lang, String value) { - Extension extension = new Extension().setUrl(EXT_TRANSLATION); - extension.addExtension().setUrl("lang").setValue(new StringType(lang)); - extension.addExtension().setUrl("content").setValue(new StringType(value)); - element.getExtension().add(extension); - } - - public static Type getAllowedUnits(ElementDefinition eld) { - for (Extension e : eld.getExtension()) - if (e.getUrl().equals(EXT_ALLOWABLE_UNITS)) - return e.getValue(); - return null; - } - - public static void setAllowableUnits(ElementDefinition eld, CodeableConcept cc) { - for (Extension e : eld.getExtension()) - if (e.getUrl().equals(EXT_ALLOWABLE_UNITS)) { - e.setValue(cc); - return; - } - eld.getExtension().add(new Extension().setUrl(EXT_ALLOWABLE_UNITS).setValue(cc)); - } - - public static List getExtensions(Element element, String url) { - List results = new ArrayList(); - for (Extension ex : element.getExtension()) - if (ex.getUrl().equals(url)) - results.add(ex); - return results; - } - - public static List getExtensions(DomainResource resource, String url) { - List results = new ArrayList(); - for (Extension ex : resource.getExtension()) - if (ex.getUrl().equals(url)) - results.add(ex); - return results; - } - - public static void addDEReference(DataElement de, String value) { - for (Extension e : de.getExtension()) - if (e.getUrl().equals(EXT_CIMI_REFERENCE)) { - e.setValue(new UriType(value)); - return; - } - de.getExtension().add(new Extension().setUrl(EXT_CIMI_REFERENCE).setValue(new UriType(value))); - } - - public static void setDeprecated(Element nc) { - for (Extension e : nc.getExtension()) - if (e.getUrl().equals(EXT_DEPRECATED)) { - e.setValue(new BooleanType(true)); - return; - } - nc.getExtension().add(new Extension().setUrl(EXT_DEPRECATED).setValue(new BooleanType(true))); - } - - public static void setExtension(Element focus, String url, Coding c) { - for (Extension e : focus.getExtension()) - if (e.getUrl().equals(url)) { - e.setValue(c); - return; - } - focus.getExtension().add(new Extension().setUrl(url).setValue(c)); - } - - public static void removeExtension(DomainResource focus, String url) { - Iterator i = focus.getExtension().iterator(); - while (i.hasNext()) { - Extension e = i.next(); // must be called before you can call i.remove() - if (e.getUrl().equals(url)) { - i.remove(); - } - } - } - - public static void removeExtension(Element focus, String url) { - Iterator i = focus.getExtension().iterator(); - while (i.hasNext()) { - Extension e = i.next(); // must be called before you can call i.remove() - if (e.getUrl().equals(url)) { - i.remove(); - } - } - } -} + +import java.net.URISyntaxException; + +/* +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 java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.hl7.fhir.instance.model.BooleanType; +import org.hl7.fhir.instance.model.CodeType; +import org.hl7.fhir.instance.model.CodeableConcept; +import org.hl7.fhir.instance.model.Coding; +import org.hl7.fhir.instance.model.DataElement; +import org.hl7.fhir.instance.model.DomainResource; +import org.hl7.fhir.instance.model.Element; +import org.hl7.fhir.instance.model.ElementDefinition; +import org.hl7.fhir.instance.model.Extension; +import org.hl7.fhir.instance.model.ExtensionHelper; +import org.hl7.fhir.instance.model.Factory; +import org.hl7.fhir.instance.model.Identifier; +import org.hl7.fhir.instance.model.IntegerType; +import org.hl7.fhir.instance.model.MarkdownType; +import org.hl7.fhir.instance.model.PrimitiveType; +import org.hl7.fhir.instance.model.Questionnaire.GroupComponent; +import org.hl7.fhir.instance.model.Questionnaire.QuestionComponent; +import org.hl7.fhir.instance.model.Reference; +import org.hl7.fhir.instance.model.StringType; +import org.hl7.fhir.instance.model.Type; +import org.hl7.fhir.instance.model.UriType; +import org.hl7.fhir.instance.model.ValueSet; +import org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent; +import org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent; +import org.hl7.fhir.utilities.validation.ValidationMessage.Source; +import org.hl7.fhir.exceptions.FHIRFormatError; +import org.hl7.fhir.utilities.Utilities; + + +public class ToolingExtensions { + + // validated + public static final String EXT_SUBSUMES = "http://hl7.org/fhir/StructureDefinition/valueset-subsumes"; + private static final String EXT_OID = "http://hl7.org/fhir/StructureDefinition/valueset-oid"; + public static final String EXT_DEPRECATED = "http://hl7.org/fhir/StructureDefinition/valueset-deprecated"; + public static final String EXT_DEFINITION = "http://hl7.org/fhir/StructureDefinition/valueset-definition"; + public static final String EXT_COMMENT = "http://hl7.org/fhir/StructureDefinition/valueset-comments"; + private static final String EXT_IDENTIFIER = "http://hl7.org/fhir/StructureDefinition/identifier"; + private static final String EXT_TRANSLATION = "http://hl7.org/fhir/StructureDefinition/translation"; + public static final String EXT_ISSUE_SOURCE = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-source"; + public static final String EXT_DISPLAY_HINT = "http://hl7.org/fhir/StructureDefinition/structuredefinition-display-hint"; + public static final String EXT_REPLACED_BY = "http://hl7.org/fhir/StructureDefinition/valueset-replacedby"; + public static final String EXT_JSON_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type"; + public static final String EXT_XML_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-type"; + public static final String EXT_REGEX = "http://hl7.org/fhir/StructureDefinition/structuredefinition-regex"; + public static final String EXT_EXPRESSION = "http://hl7.org/fhir/StructureDefinition/structuredefinition-expression"; + public static final String EXT_SEARCH_EXPRESSION = "http://hl7.org/fhir/StructureDefinition/searchparameter-expression"; + + // unregistered? + + public static final String EXT_FLYOVER = "http://hl7.org/fhir/Profile/questionnaire-extensions#flyover"; + private static final String EXT_QTYPE = "http://www.healthintersections.com.au/fhir/Profile/metadata#type"; + private static final String EXT_QREF = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference"; + private static final String EXTENSION_FILTER_ONLY = "http://www.healthintersections.com.au/fhir/Profile/metadata#expandNeedsFilter"; + private static final String EXT_TYPE = "http://www.healthintersections.com.au/fhir/Profile/metadata#type"; + private static final String EXT_REFERENCE = "http://www.healthintersections.com.au/fhir/Profile/metadata#reference"; + private static final String EXT_ALLOWABLE_UNITS = "http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits"; + public static final String EXT_CIMI_REFERENCE = "http://hl7.org/fhir/StructureDefinition/cimi-reference"; + public static final String EXT_UNCLOSED = "http://hl7.org/fhir/StructureDefinition/valueset-unclosed"; + public static final String EXT_FMM_LEVEL = "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm"; + + + // specific extension helpers + + public static Extension makeIssueSource(Source source) { + Extension ex = new Extension(); + // todo: write this up and get it published with the pack (and handle the redirect?) + ex.setUrl(ToolingExtensions.EXT_ISSUE_SOURCE); + CodeType c = new CodeType(); + c.setValue(source.toString()); + ex.setValue(c); + return ex; + } + + public static boolean hasExtension(DomainResource de, String url) { + return getExtension(de, url) != null; + } + + public static boolean hasExtension(Element e, String url) { + return getExtension(e, url) != null; + } + + public static void addStringExtension(DomainResource dr, String url, String content) { + if (!Utilities.noString(content)) { + Extension ex = getExtension(dr, url); + if (ex != null) + ex.setValue(new StringType(content)); + else + dr.getExtension().add(Factory.newExtension(url, new StringType(content), true)); + } + } + + public static void addStringExtension(Element e, String url, String content) { + if (!Utilities.noString(content)) { + Extension ex = getExtension(e, url); + if (ex != null) + ex.setValue(new StringType(content)); + else + e.getExtension().add(Factory.newExtension(url, new StringType(content), true)); + } + } + + public static void addIntegerExtension(DomainResource dr, String url, int value) { + Extension ex = getExtension(dr, url); + if (ex != null) + ex.setValue(new IntegerType(value)); + else + dr.getExtension().add(Factory.newExtension(url, new IntegerType(value), true)); + } + + public static void addComment(Element nc, String comment) { + if (!Utilities.noString(comment)) + nc.getExtension().add(Factory.newExtension(EXT_COMMENT, Factory.newString_(comment), true)); + } + + public static void markDeprecated(Element nc) { + setDeprecated(nc); + } + + public static void addSubsumes(ConceptDefinitionComponent nc, String code) { + nc.getModifierExtension().add(Factory.newExtension(EXT_SUBSUMES, Factory.newCode(code), true)); + } + + public static void addDefinition(Element nc, String definition) { + if (!Utilities.noString(definition)) + nc.getExtension().add(Factory.newExtension(EXT_DEFINITION, Factory.newString_(definition), true)); + } + + public static void addDisplayHint(Element def, String hint) { + if (!Utilities.noString(hint)) + def.getExtension().add(Factory.newExtension(EXT_DISPLAY_HINT, Factory.newString_(hint), true)); + } + + public static String getDisplayHint(Element def) { + return readStringExtension(def, EXT_DISPLAY_HINT); + } + + public static String readStringExtension(Element c, String uri) { + Extension ex = ExtensionHelper.getExtension(c, uri); + if (ex == null) + return null; + if (ex.getValue() instanceof UriType) + return ((UriType) ex.getValue()).getValue(); + if (!(ex.getValue() instanceof StringType)) + return null; + return ((StringType) ex.getValue()).getValue(); + } + + public static String readStringExtension(DomainResource c, String uri) { + Extension ex = getExtension(c, uri); + if (ex == null) + return null; + if ((ex.getValue() instanceof StringType)) + return ((StringType) ex.getValue()).getValue(); + if ((ex.getValue() instanceof UriType)) + return ((UriType) ex.getValue()).getValue(); + if ((ex.getValue() instanceof MarkdownType)) + return ((MarkdownType) ex.getValue()).getValue(); + return null; + } + + @SuppressWarnings("unchecked") + public static PrimitiveType readPrimitiveExtension(DomainResource c, String uri) { + Extension ex = getExtension(c, uri); + if (ex == null) + return null; + return (PrimitiveType) ex.getValue(); + } + + public static boolean findStringExtension(Element c, String uri) { + Extension ex = ExtensionHelper.getExtension(c, uri); + if (ex == null) + return false; + if (!(ex.getValue() instanceof StringType)) + return false; + return !Utilities.noString(((StringType) ex.getValue()).getValue()); + } + + public static Boolean readBooleanExtension(Element c, String uri) { + Extension ex = ExtensionHelper.getExtension(c, uri); + if (ex == null) + return null; + if (!(ex.getValue() instanceof BooleanType)) + return null; + return ((BooleanType) ex.getValue()).getValue(); + } + + public static boolean findBooleanExtension(Element c, String uri) { + Extension ex = ExtensionHelper.getExtension(c, uri); + if (ex == null) + return false; + if (!(ex.getValue() instanceof BooleanType)) + return false; + return true; + } + + public static String getComment(ConceptDefinitionComponent c) { + return readStringExtension(c, EXT_COMMENT); + } + + public static Boolean getDeprecated(Element c) { + return readBooleanExtension(c, EXT_DEPRECATED); + } + + public static boolean hasComment(ConceptDefinitionComponent c) { + return findStringExtension(c, EXT_COMMENT); + } + + public static boolean hasDeprecated(Element c) { + return findBooleanExtension(c, EXT_DEPRECATED); + } + + public static List getSubsumes(ConceptDefinitionComponent c) { + List res = new ArrayList(); + + for (Extension e : c.getExtension()) { + if (EXT_SUBSUMES.equals(e.getUrl())) + res.add((CodeType) e.getValue()); + } + return res; + } + + public static void addFlyOver(GroupComponent group, String text) { + if (!Utilities.noString(text)) + group.getExtension().add(Factory.newExtension(EXT_FLYOVER, Factory.newString_(text), true)); + + } + + public static void setQuestionType(GroupComponent group, String text) { + if (!Utilities.noString(text)) + group.getExtension().add(Factory.newExtension(EXT_QTYPE, Factory.newString_(text), true)); + } + + public static void setQuestionReference(GroupComponent group, String text) { + if (!Utilities.noString(text)) + group.getExtension().add(Factory.newExtension(EXT_QREF, Factory.newString_(text), true)); + } + + public static void addFlyOver(Element element, String text) { + element.getExtension().add(Factory.newExtension(EXT_FLYOVER, Factory.newString_(text), true)); + } + + public static void addFilterOnly(Reference element, boolean value) { + element.getExtension().add(Factory.newExtension(EXTENSION_FILTER_ONLY, Factory.newBoolean(value), true)); + } + + public static void addType(GroupComponent group, String value) { + group.getExtension().add(Factory.newExtension(EXT_TYPE, Factory.newString_(value), true)); + } + + public static void addReference(QuestionComponent group, String value) { + group.getExtension().add(Factory.newExtension(EXT_REFERENCE, Factory.newString_(value), true)); + } + + public static void addIdentifier(Element element, Identifier value) { + element.getExtension().add(Factory.newExtension(EXT_IDENTIFIER, value, true)); + } + + /** + * @param name the identity of the extension of interest + * @return The extension, if on this element, else null + */ + public static Extension getExtension(DomainResource resource, String name) { + if (name == null) + return null; + if (!resource.hasExtension()) + return null; + for (Extension e : resource.getExtension()) { + if (name.equals(e.getUrl())) + return e; + } + return null; + } + + public static Extension getExtension(Element el, String name) { + if (name == null) + return null; + if (!el.hasExtension()) + return null; + for (Extension e : el.getExtension()) { + if (name.equals(e.getUrl())) + return e; + } + return null; + } + + public static void setStringExtension(DomainResource resource, String uri, String value) { + Extension ext = getExtension(resource, uri); + if (ext != null) + ext.setValue(new StringType(value)); + else + resource.getExtension().add(new Extension(new UriType(uri)).setValue(new StringType(value))); + } + + public static String getOID(ValueSetCodeSystemComponent define) { + return readStringExtension(define, EXT_OID); + } + + public static String getOID(ValueSet vs) { + return readStringExtension(vs, EXT_OID); + } + + public static void setOID(ValueSetCodeSystemComponent define, String oid) throws FHIRFormatError, URISyntaxException { + if (!oid.startsWith("urn:oid:")) + throw new FHIRFormatError("Error in OID format"); + if (oid.startsWith("urn:oid:urn:oid:")) + throw new FHIRFormatError("Error in OID format"); + define.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false)); + } + public static void setOID(ValueSet vs, String oid) throws FHIRFormatError, URISyntaxException { + if (!oid.startsWith("urn:oid:")) + throw new FHIRFormatError("Error in OID format"); + if (oid.startsWith("urn:oid:urn:oid:")) + throw new FHIRFormatError("Error in OID format"); + vs.getExtension().add(Factory.newExtension(EXT_OID, Factory.newUri(oid), false)); + } + + public static boolean hasLanguageTranslation(Element element, String lang) { + for (Extension e : element.getExtension()) { + if (e.getUrl().equals(EXT_TRANSLATION)) { + Extension e1 = ExtensionHelper.getExtension(e, "lang"); + + if (e1 != null && e1.getValue() instanceof CodeType && ((CodeType) e.getValue()).getValue().equals(lang)) + return true; + } + } + return false; + } + + public static String getLanguageTranslation(Element element, String lang) { + for (Extension e : element.getExtension()) { + if (e.getUrl().equals(EXT_TRANSLATION)) { + Extension e1 = ExtensionHelper.getExtension(e, "lang"); + + if (e1 != null && e1.getValue() instanceof CodeType && ((CodeType) e.getValue()).getValue().equals(lang)) { + e1 = ExtensionHelper.getExtension(e, "content"); + return ((StringType) e.getValue()).getValue(); + } + } + } + return null; + } + + public static void addLanguageTranslation(Element element, String lang, String value) { + Extension extension = new Extension().setUrl(EXT_TRANSLATION); + extension.addExtension().setUrl("lang").setValue(new StringType(lang)); + extension.addExtension().setUrl("content").setValue(new StringType(value)); + element.getExtension().add(extension); + } + + public static Type getAllowedUnits(ElementDefinition eld) { + for (Extension e : eld.getExtension()) + if (e.getUrl().equals(EXT_ALLOWABLE_UNITS)) + return e.getValue(); + return null; + } + + public static void setAllowableUnits(ElementDefinition eld, CodeableConcept cc) { + for (Extension e : eld.getExtension()) + if (e.getUrl().equals(EXT_ALLOWABLE_UNITS)) { + e.setValue(cc); + return; + } + eld.getExtension().add(new Extension().setUrl(EXT_ALLOWABLE_UNITS).setValue(cc)); + } + + public static List getExtensions(Element element, String url) { + List results = new ArrayList(); + for (Extension ex : element.getExtension()) + if (ex.getUrl().equals(url)) + results.add(ex); + return results; + } + + public static List getExtensions(DomainResource resource, String url) { + List results = new ArrayList(); + for (Extension ex : resource.getExtension()) + if (ex.getUrl().equals(url)) + results.add(ex); + return results; + } + + public static void addDEReference(DataElement de, String value) { + for (Extension e : de.getExtension()) + if (e.getUrl().equals(EXT_CIMI_REFERENCE)) { + e.setValue(new UriType(value)); + return; + } + de.getExtension().add(new Extension().setUrl(EXT_CIMI_REFERENCE).setValue(new UriType(value))); + } + + public static void setDeprecated(Element nc) { + for (Extension e : nc.getExtension()) + if (e.getUrl().equals(EXT_DEPRECATED)) { + e.setValue(new BooleanType(true)); + return; + } + nc.getExtension().add(new Extension().setUrl(EXT_DEPRECATED).setValue(new BooleanType(true))); + } + + public static void setExtension(Element focus, String url, Coding c) { + for (Extension e : focus.getExtension()) + if (e.getUrl().equals(url)) { + e.setValue(c); + return; + } + focus.getExtension().add(new Extension().setUrl(url).setValue(c)); + } + + public static void removeExtension(DomainResource focus, String url) { + Iterator i = focus.getExtension().iterator(); + while (i.hasNext()) { + Extension e = i.next(); // must be called before you can call i.remove() + if (e.getUrl().equals(url)) { + i.remove(); + } + } + } + + public static void removeExtension(Element focus, String url) { + Iterator i = focus.getExtension().iterator(); + while (i.hasNext()) { + Extension e = i.next(); // must be called before you can call i.remove() + if (e.getUrl().equals(url)) { + i.remove(); + } + } + } +} diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/OIDUtils.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/OIDUtils.java index 4957ae3660d..67c5bd5fd51 100644 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/OIDUtils.java +++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/OIDUtils.java @@ -20,64 +20,64 @@ package org.hl7.fhir.utilities; * #L% */ - -public class OIDUtils { - - /* - 2.16.840.1.113883.3.72.5.2 - NIST owns this - 2.16.840.1.113883.4.6 - National Provider Identifier - 2.16.840.1.113883.6.21 - UB92 - 2.16.840.1.113883.6.69 - NDC - */ - - public static String getUriForOid(String r) { - if (r.equals("2.16.840.1.113883.6.96")) - return "http://snomed.info/sct"; - if (r.equals("2.16.840.1.113883.6.1")) - return "http://loinc.org"; - if (r.equals("2.16.840.1.113883.6.8")) - return "http://unitsofmeasure.org"; - if (r.equals("2.16.840.1.113883.6.3")) - return "http://hl7.org/fhir/sid/icd-10"; - if (r.equals("2.16.840.1.113883.6.42")) - return "http://hl7.org/fhir/sid/icd-9"; - if (r.equals("2.16.840.1.113883.6.104")) - return "http://hl7.org/fhir/sid/icd-9"; - if (r.equals("2.16.840.1.113883.6.103")) - return "http://hl7.org/fhir/sid/icd-9"; //todo: confirm this - if (r.equals("2.16.840.1.113883.6.73")) - return "http://hl7.org/fhir/sid/atc"; - if (r.equals("2.16.840.1.113883.3.26.1.1")) - return "http://ncimeta.nci.nih.gov"; - if (r.equals("2.16.840.1.113883.3.26.1.1.1")) - return "http://ncimeta.nci.nih.gov"; - if (r.equals("2.16.840.1.113883.6.88")) - return "http://www.nlm.nih.gov/research/umls/rxnorm"; // todo: confirm this - - if (r.equals("2.16.840.1.113883.5.1008")) - return "http://hl7.org/fhir/v3/NullFlavor"; - if (r.equals("2.16.840.1.113883.5.111")) - return "http://hl7.org/fhir/v3/RoleCode"; - if (r.equals("2.16.840.1.113883.5.4")) - return "http://hl7.org/fhir/v3/ActCode"; - if (r.equals("2.16.840.1.113883.5.8")) - return "http://hl7.org/fhir/v3/ActReason"; - if (r.equals("2.16.840.1.113883.5.83")) - return "http://hl7.org/fhir/v3/ObservationInterpretation"; - if (r.equals("2.16.840.1.113883.6.238")) - return "http://hl7.org/fhir/v3/Race"; - - if (r.equals("2.16.840.1.113883.6.59")) - return "http://hl7.org/fhir/sid/cvx"; - if (r.equals("2.16.840.1.113883.12.292")) - return "http://hl7.org/fhir/sid/cvx"; - - if (r.equals("2.16.840.1.113883.6.12")) - return "http://www.ama-assn.org/go/cpt"; - - if (r.startsWith("2.16.840.1.113883.12.")) - return "http://hl7.org/fhir/sid/v2-"+r.substring(21); - return null; - } - -} + +public class OIDUtils { + + /* + 2.16.840.1.113883.3.72.5.2 - NIST owns this + 2.16.840.1.113883.4.6 - National Provider Identifier + 2.16.840.1.113883.6.21 - UB92 + 2.16.840.1.113883.6.69 - NDC + */ + + public static String getUriForOid(String r) { + if (r.equals("2.16.840.1.113883.6.96")) + return "http://snomed.info/sct"; + if (r.equals("2.16.840.1.113883.6.1")) + return "http://loinc.org"; + if (r.equals("2.16.840.1.113883.6.8")) + return "http://unitsofmeasure.org"; + if (r.equals("2.16.840.1.113883.6.3")) + return "http://hl7.org/fhir/sid/icd-10"; + if (r.equals("2.16.840.1.113883.6.42")) + return "http://hl7.org/fhir/sid/icd-9"; + if (r.equals("2.16.840.1.113883.6.104")) + return "http://hl7.org/fhir/sid/icd-9"; + if (r.equals("2.16.840.1.113883.6.103")) + return "http://hl7.org/fhir/sid/icd-9"; //todo: confirm this + if (r.equals("2.16.840.1.113883.6.73")) + return "http://hl7.org/fhir/sid/atc"; + if (r.equals("2.16.840.1.113883.3.26.1.1")) + return "http://ncimeta.nci.nih.gov"; + if (r.equals("2.16.840.1.113883.3.26.1.1.1")) + return "http://ncimeta.nci.nih.gov"; + if (r.equals("2.16.840.1.113883.6.88")) + return "http://www.nlm.nih.gov/research/umls/rxnorm"; // todo: confirm this + + if (r.equals("2.16.840.1.113883.5.1008")) + return "http://hl7.org/fhir/v3/NullFlavor"; + if (r.equals("2.16.840.1.113883.5.111")) + return "http://hl7.org/fhir/v3/RoleCode"; + if (r.equals("2.16.840.1.113883.5.4")) + return "http://hl7.org/fhir/v3/ActCode"; + if (r.equals("2.16.840.1.113883.5.8")) + return "http://hl7.org/fhir/v3/ActReason"; + if (r.equals("2.16.840.1.113883.5.83")) + return "http://hl7.org/fhir/v3/ObservationInterpretation"; + if (r.equals("2.16.840.1.113883.6.238")) + return "http://hl7.org/fhir/v3/Race"; + + if (r.equals("2.16.840.1.113883.6.59")) + return "http://hl7.org/fhir/sid/cvx"; + if (r.equals("2.16.840.1.113883.12.292")) + return "http://hl7.org/fhir/sid/cvx"; + + if (r.equals("2.16.840.1.113883.6.12")) + return "http://www.ama-assn.org/go/cpt"; + + if (r.startsWith("2.16.840.1.113883.12.")) + return "http://hl7.org/fhir/sid/v2-"+r.substring(21); + return null; + } + +}