001package org.hl7.fhir.convertors.conv30_50.resources30_50; 002 003import org.hl7.fhir.convertors.context.ConversionContext30_50; 004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.ContactDetail30_50; 005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.UsageContext30_50; 006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50; 007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Identifier30_50; 008import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50; 009import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.DateTime30_50; 010import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.MarkDown30_50; 011import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50; 012import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50; 013import org.hl7.fhir.exceptions.FHIRException; 014import org.hl7.fhir.r5.model.CanonicalType; 015import org.hl7.fhir.r5.model.CodeableConcept; 016import org.hl7.fhir.r5.model.ContactDetail; 017import org.hl7.fhir.r5.model.Enumerations.ExampleScenarioActorType; 018import org.hl7.fhir.r5.model.Enumerations.PublicationStatus; 019import org.hl7.fhir.r5.model.UrlType; 020import org.hl7.fhir.r5.model.UsageContext; 021 022/* 023 Copyright (c) 2011+, HL7, Inc. 024 All rights reserved. 025 026 Redistribution and use in source and binary forms, with or without modification, 027 are permitted provided that the following conditions are met: 028 029 * Redistributions of source code must retain the above copyright notice, this 030 list of conditions and the following disclaimer. 031 * Redistributions in binary form must reproduce the above copyright notice, 032 this list of conditions and the following disclaimer in the documentation 033 and/or other materials provided with the distribution. 034 * Neither the name of HL7 nor the names of its contributors may be used to 035 endorse or promote products derived from this software without specific 036 prior written permission. 037 038 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 039 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 040 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 041 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 042 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 043 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 044 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 045 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 046 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 047 POSSIBILITY OF SUCH DAMAGE. 048 049*/ 050// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0 051public class ActorDefinition30_50 { 052 053 public static final String URL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.url"; 054 public static final String VERSION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.version"; 055 public static final String NAME_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name"; 056 public static final String TITLE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title"; 057 public static final String STATUS_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.status"; 058 public static final String EXPERIMENTAL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.experimental"; 059 public static final String DATE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.date"; 060 public static final String PUBLISHER_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.publisher"; 061 public static final String CONTACT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.contact"; 062 public static final String DESCRIPTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description"; 063 public static final String USE_CONTEXT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.useContext"; 064 public static final String JURISDICTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.jurisdiction"; 065 public static final String PURPOSE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.purpose"; 066 public static final String COPYRIGHT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyright"; 067 public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.copyrightLabel"; 068 public static final String TYPE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.type"; 069 public static final String DOCUMENTATION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.documentation"; 070 public static final String REFERENCE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.reference"; 071 public static final String CAPABILITIES_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.capabilities"; 072 public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.derivedFrom"; 073 074 private static final String[] IGNORED_EXTENSION_URLS = new String[]{ 075 URL_EXTENSION_URL, 076 VERSION_EXTENSION_URL, 077 NAME_EXTENSION_URL, 078 TITLE_EXTENSION_URL, 079 STATUS_EXTENSION_URL, 080 EXPERIMENTAL_EXTENSION_URL, 081 DATE_EXTENSION_URL, 082 PUBLISHER_EXTENSION_URL, 083 CONTACT_EXTENSION_URL, 084 DESCRIPTION_EXTENSION_URL, 085 USE_CONTEXT_EXTENSION_URL, 086 JURISDICTION_EXTENSION_URL, 087 PURPOSE_EXTENSION_URL, 088 COPYRIGHT_EXTENSION_URL, 089 COPYRIGHT_LABEL_EXTENSION_URL, 090 TYPE_EXTENSION_URL, 091 DOCUMENTATION_EXTENSION_URL, 092 REFERENCE_EXTENSION_URL, 093 CAPABILITIES_EXTENSION_URL, 094 DERIVED_FROM_EXTENSION_URL 095 }; 096 097 public static org.hl7.fhir.r5.model.ActorDefinition convertActorDefinition(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException { 098 if (src == null) 099 return null; 100 if (!src.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "ActorDefinition")) { 101 throw new FHIRException("Error in logic: this basic resource is not an ActorDefinition"); 102 } 103 org.hl7.fhir.r5.model.ActorDefinition tgt = new org.hl7.fhir.r5.model.ActorDefinition(); 104 105 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS); 106 107 for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) 108 tgt.addIdentifier(Identifier30_50.convertIdentifier(t)); 109 110 if (src.hasExtension(URL_EXTENSION_URL)) { 111 tgt.setUrlElement(Uri30_50.convertUri((org.hl7.fhir.dstu3.model.UriType) src.getExtensionByUrl(URL_EXTENSION_URL).getValue())); 112 } 113 if (src.hasExtension(VERSION_EXTENSION_URL)) { 114 tgt.setVersionElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl(VERSION_EXTENSION_URL).getValue())); 115 } 116 if (src.hasExtension(NAME_EXTENSION_URL)) { 117 tgt.setNameElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl(NAME_EXTENSION_URL).getValue())); 118 } 119 if (src.hasExtension(TITLE_EXTENSION_URL)) { 120 tgt.setTitleElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl(TITLE_EXTENSION_URL).getValue())); 121 } 122 if (src.hasExtension(STATUS_EXTENSION_URL)) { 123 tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl(STATUS_EXTENSION_URL).getValue().primitiveValue())); 124 } 125 if (src.hasExtension(EXPERIMENTAL_EXTENSION_URL)) { 126 tgt.setExperimentalElement(Boolean30_50.convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src.getExtensionByUrl(EXPERIMENTAL_EXTENSION_URL).getValue())); 127 } 128 if (src.hasExtension(DATE_EXTENSION_URL)) { 129 tgt.setDateElement(DateTime30_50.convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src.getExtensionByUrl(DATE_EXTENSION_URL).getValue())); 130 } 131 if (src.hasExtension(PUBLISHER_EXTENSION_URL)) { 132 tgt.setPublisherElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl(PUBLISHER_EXTENSION_URL).getValue())); 133 } 134 for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(CONTACT_EXTENSION_URL)) { 135 tgt.addContact(ContactDetail30_50.convertContactDetail((org.hl7.fhir.dstu3.model.ContactDetail) ext.getValue())); 136 } 137 if (src.hasExtension(DESCRIPTION_EXTENSION_URL)) { 138 tgt.setPublisherElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl(DESCRIPTION_EXTENSION_URL).getValue())); 139 } 140 for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(USE_CONTEXT_EXTENSION_URL)) { 141 tgt.addUseContext(UsageContext30_50.convertUsageContext((org.hl7.fhir.dstu3.model.UsageContext) ext.getValue())); 142 } 143 for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(JURISDICTION_EXTENSION_URL)) { 144 tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) ext.getValue())); 145 } 146 if (src.hasExtension(PURPOSE_EXTENSION_URL)) { 147 tgt.setPurposeElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl(PURPOSE_EXTENSION_URL).getValue())); 148 } 149 if (src.hasExtension(COPYRIGHT_EXTENSION_URL)) { 150 tgt.setCopyrightElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl(COPYRIGHT_EXTENSION_URL).getValue())); 151 } 152 if (src.hasExtension(COPYRIGHT_LABEL_EXTENSION_URL)) { 153 tgt.setCopyrightLabelElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl(COPYRIGHT_LABEL_EXTENSION_URL).getValue())); 154 } 155 if (src.hasExtension(TYPE_EXTENSION_URL)) { 156 tgt.setType(ExampleScenarioActorType.fromCode(src.getExtensionByUrl(TYPE_EXTENSION_URL).getValue().primitiveValue())); 157 } 158 if (src.hasExtension(DOCUMENTATION_EXTENSION_URL)) { 159 tgt.setDocumentationElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl(DOCUMENTATION_EXTENSION_URL).getValue())); 160 } 161 for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(REFERENCE_EXTENSION_URL)) { 162 tgt.getReference().add(Uri30_50.convertUrl((org.hl7.fhir.dstu3.model.UriType) ext.getValue())); 163 } 164 if (src.hasExtension(CAPABILITIES_EXTENSION_URL)) { 165 tgt.setCapabilitiesElement(Uri30_50.convertCanonical((org.hl7.fhir.dstu3.model.UriType) src.getExtensionByUrl(CAPABILITIES_EXTENSION_URL).getValue())); 166 } 167 for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl(DERIVED_FROM_EXTENSION_URL)) { 168 tgt.getDerivedFrom().add(Uri30_50.convertCanonical((org.hl7.fhir.dstu3.model.UriType) ext.getValue())); 169 } 170 return tgt; 171 } 172 173 public static org.hl7.fhir.dstu3.model.Basic convertActorDefinition(org.hl7.fhir.r5.model.ActorDefinition src) throws FHIRException { 174 if (src == null) 175 return null; 176 org.hl7.fhir.dstu3.model.Basic tgt = new org.hl7.fhir.dstu3.model.Basic(); 177 ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt); 178 tgt.getCode().getCodingFirstRep().setSystem("http://hl7.org/fhir/fhir-types").setCode("ActorDefinition"); // note use of R5 type system 179 180 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 181 tgt.addIdentifier(Identifier30_50.convertIdentifier(t)); 182 if (src.hasUrl()) { 183 tgt.addExtension(URL_EXTENSION_URL, Uri30_50.convertUri(src.getUrlElement())); 184 } 185 if (src.hasVersion()) { 186 tgt.addExtension(VERSION_EXTENSION_URL, String30_50.convertString(src.getVersionElement())); 187 } 188 if (src.hasName()) { 189 tgt.addExtension(NAME_EXTENSION_URL, String30_50.convertString(src.getNameElement())); 190 } 191 if (src.hasTitle()) { 192 tgt.addExtension(TITLE_EXTENSION_URL, String30_50.convertString(src.getTitleElement())); 193 } 194 if (src.hasStatus()) { 195 tgt.addExtension(STATUS_EXTENSION_URL, new org.hl7.fhir.dstu3.model.CodeType(src.getStatus().toCode())); 196 } 197 if (src.hasExperimental()) { 198 tgt.addExtension(EXPERIMENTAL_EXTENSION_URL, Boolean30_50.convertBoolean(src.getExperimentalElement())); 199 } 200 if (src.hasDate()) { 201 tgt.addExtension(DATE_EXTENSION_URL, DateTime30_50.convertDateTime(src.getDateElement())); 202 } 203 if (src.hasPublisher()) { 204 tgt.addExtension(PUBLISHER_EXTENSION_URL, String30_50.convertString(src.getPublisherElement())); 205 } 206 for (ContactDetail cd : src.getContact()) { 207 tgt.addExtension(CONTACT_EXTENSION_URL, ContactDetail30_50.convertContactDetail(cd)); 208 } 209 if (src.hasDescription()) { 210 tgt.addExtension(DESCRIPTION_EXTENSION_URL, MarkDown30_50.convertMarkdown(src.getDescriptionElement())); 211 } 212 for (UsageContext cd : src.getUseContext()) { 213 tgt.addExtension(USE_CONTEXT_EXTENSION_URL, UsageContext30_50.convertUsageContext(cd)); 214 } 215 for (CodeableConcept cd : src.getJurisdiction()) { 216 tgt.addExtension(JURISDICTION_EXTENSION_URL, CodeableConcept30_50.convertCodeableConcept(cd)); 217 } 218 if (src.hasPurpose()) { 219 tgt.addExtension(PURPOSE_EXTENSION_URL, MarkDown30_50.convertMarkdown(src.getPurposeElement())); 220 } 221 if (src.hasCopyright()) { 222 tgt.addExtension(COPYRIGHT_EXTENSION_URL, MarkDown30_50.convertMarkdown(src.getCopyrightElement())); 223 } 224 if (src.hasCopyrightLabel()) { 225 tgt.addExtension(COPYRIGHT_LABEL_EXTENSION_URL, String30_50.convertString(src.getCopyrightLabelElement())); 226 } 227 if (src.hasType()) { 228 tgt.addExtension(TYPE_EXTENSION_URL, new org.hl7.fhir.dstu3.model.CodeType(src.getType().toCode())); 229 } 230 if (src.hasDocumentation()) { 231 tgt.addExtension(DOCUMENTATION_EXTENSION_URL, MarkDown30_50.convertMarkdown(src.getDocumentationElement())); 232 } 233 for (UrlType ref : src.getReference()) { 234 tgt.addExtension(REFERENCE_EXTENSION_URL, Uri30_50.convertUrl(ref)); 235 } 236 if (src.hasCapabilities()) { 237 tgt.addExtension(CAPABILITIES_EXTENSION_URL, Uri30_50.convertCanonical(src.getCapabilitiesElement())); 238 } 239 for (CanonicalType ct : src.getDerivedFrom()) { 240 tgt.addExtension(DERIVED_FROM_EXTENSION_URL, Uri30_50.convertCanonical(ct)); 241 } 242 243 return tgt; 244 } 245 246}