001package org.hl7.fhir.convertors.conv14_50.resources14_50; 002 003import org.hl7.fhir.convertors.VersionConvertorConstants; 004import org.hl7.fhir.convertors.context.ConversionContext14_50; 005import org.hl7.fhir.convertors.conv14_50.datatypes14_50.Reference14_50; 006import org.hl7.fhir.convertors.conv14_50.datatypes14_50.complextypes14_50.CodeableConcept14_50; 007import org.hl7.fhir.convertors.conv14_50.datatypes14_50.complextypes14_50.Coding14_50; 008import org.hl7.fhir.convertors.conv14_50.datatypes14_50.complextypes14_50.ContactPoint14_50; 009import org.hl7.fhir.convertors.conv14_50.datatypes14_50.complextypes14_50.Identifier14_50; 010import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.*; 011import org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType; 012import org.hl7.fhir.exceptions.FHIRException; 013import org.hl7.fhir.r5.model.CodeType; 014import org.hl7.fhir.r5.model.ContactDetail; 015import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireAnswerConstraint; 016import org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemOperator; 017import org.hl7.fhir.r5.model.UsageContext; 018 019public class Questionnaire14_50 { 020 021 public static org.hl7.fhir.r5.model.Questionnaire convertQuestionnaire(org.hl7.fhir.dstu2016may.model.Questionnaire src) throws FHIRException { 022 if (src == null || src.isEmpty()) 023 return null; 024 org.hl7.fhir.r5.model.Questionnaire tgt = new org.hl7.fhir.r5.model.Questionnaire(); 025 ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyDomainResource(src, tgt); 026 if (src.hasUrl()) 027 tgt.setUrlElement(Uri14_50.convertUri(src.getUrlElement())); 028 for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier()) 029 tgt.addIdentifier(Identifier14_50.convertIdentifier(t)); 030 if (src.hasVersion()) 031 tgt.setVersionElement(String14_50.convertString(src.getVersionElement())); 032 if (src.hasStatus()) 033 tgt.setStatusElement(convertQuestionnaireStatus(src.getStatusElement())); 034 if (src.hasDate()) 035 tgt.setDateElement(DateTime14_50.convertDateTime(src.getDateElement())); 036 if (src.hasPublisher()) 037 tgt.setPublisherElement(String14_50.convertString(src.getPublisherElement())); 038 for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom()) 039 tgt.addContact(convertQuestionnaireContactComponent(t)); 040 for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext()) 041 if (CodeableConcept14_50.isJurisdiction(t)) 042 tgt.addJurisdiction(CodeableConcept14_50.convertCodeableConcept(t)); 043 else 044 tgt.addUseContext(CodeableConcept14_50.convertCodeableConceptToUsageContext(t)); 045 if (src.hasTitle()) 046 tgt.setTitleElement(String14_50.convertString(src.getTitleElement())); 047 for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) tgt.addCode(Coding14_50.convertCoding(t)); 048 for (org.hl7.fhir.dstu2016may.model.CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); 049 for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) 050 tgt.addItem(convertQuestionnaireItemComponent(t)); 051 return tgt; 052 } 053 054 public static org.hl7.fhir.dstu2016may.model.Questionnaire convertQuestionnaire(org.hl7.fhir.r5.model.Questionnaire src) throws FHIRException { 055 if (src == null || src.isEmpty()) 056 return null; 057 org.hl7.fhir.dstu2016may.model.Questionnaire tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire(); 058 ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyDomainResource(src, tgt); 059 if (src.hasUrl()) 060 tgt.setUrlElement(Uri14_50.convertUri(src.getUrlElement())); 061 for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier()) 062 tgt.addIdentifier(Identifier14_50.convertIdentifier(t)); 063 if (src.hasVersion()) 064 tgt.setVersionElement(String14_50.convertString(src.getVersionElement())); 065 if (src.hasStatus()) 066 tgt.setStatusElement(convertQuestionnaireStatus(src.getStatusElement())); 067 if (src.hasDate()) 068 tgt.setDateElement(DateTime14_50.convertDateTime(src.getDateElement())); 069 if (src.hasPublisher()) 070 tgt.setPublisherElement(String14_50.convertString(src.getPublisherElement())); 071 for (ContactDetail t : src.getContact()) 072 for (org.hl7.fhir.r5.model.ContactPoint t1 : t.getTelecom()) 073 tgt.addTelecom(ContactPoint14_50.convertContactPoint(t1)); 074 for (UsageContext t : src.getUseContext()) 075 tgt.addUseContext(CodeableConcept14_50.convertCodeableConcept(t.getValueCodeableConcept())); 076 for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction()) 077 tgt.addUseContext(CodeableConcept14_50.convertCodeableConcept(t)); 078 if (src.hasTitle()) 079 tgt.setTitleElement(String14_50.convertString(src.getTitleElement())); 080 for (org.hl7.fhir.r5.model.Coding t : src.getCode()) tgt.addConcept(Coding14_50.convertCoding(t)); 081 for (CodeType t : src.getSubjectType()) tgt.addSubjectType(t.getValue()); 082 for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) 083 tgt.addItem(convertQuestionnaireItemComponent(t)); 084 return tgt; 085 } 086 087 public static org.hl7.fhir.r5.model.ContactDetail convertQuestionnaireContactComponent(org.hl7.fhir.dstu2016may.model.ContactPoint src) throws FHIRException { 088 if (src == null || src.isEmpty()) 089 return null; 090 org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail(); 091 ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt); 092 tgt.addTelecom(ContactPoint14_50.convertContactPoint(src)); 093 return tgt; 094 } 095 096 public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { 097 if (src == null || src.isEmpty()) 098 return null; 099 org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent(); 100 ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt); 101 if (src.hasLinkId()) 102 tgt.setLinkIdElement(String14_50.convertString(src.getLinkIdElement())); 103 for (org.hl7.fhir.r5.model.Coding t : src.getCode()) tgt.addConcept(Coding14_50.convertCoding(t)); 104 if (src.hasPrefix()) 105 tgt.setPrefixElement(String14_50.convertString(src.getPrefixElement())); 106 if (src.hasText()) 107 tgt.setTextElement(String14_50.convertString(src.getTextElement())); 108 if (src.hasType()) 109 tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement(), src.getAnswerConstraint())); 110 for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) 111 tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); 112 if (src.hasRequired()) 113 tgt.setRequiredElement(Boolean14_50.convertBoolean(src.getRequiredElement())); 114 if (src.hasRepeats()) 115 tgt.setRepeatsElement(Boolean14_50.convertBoolean(src.getRepeatsElement())); 116 if (src.hasReadOnly()) 117 tgt.setReadOnlyElement(Boolean14_50.convertBoolean(src.getReadOnlyElement())); 118 if (src.hasMaxLength()) 119 tgt.setMaxLengthElement(Integer14_50.convertInteger(src.getMaxLengthElement())); 120 if (src.hasAnswerValueSetElement()) 121 tgt.setOptions(Reference14_50.convertCanonicalToReference(src.getAnswerValueSetElement())); 122 for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent t : src.getAnswerOption()) 123 tgt.addOption(convertQuestionnaireItemOptionComponent(t)); 124 if (src.hasInitial()) 125 tgt.setInitial(ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().convertType(src.getInitialFirstRep().getValue())); 126 for (org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) 127 tgt.addItem(convertQuestionnaireItemComponent(t)); 128 return tgt; 129 } 130 131 public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireItemComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException { 132 if (src == null || src.isEmpty()) 133 return null; 134 org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemComponent(); 135 ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt); 136 if (src.hasLinkId()) 137 tgt.setLinkIdElement(String14_50.convertString(src.getLinkIdElement())); 138 for (org.hl7.fhir.dstu2016may.model.Coding t : src.getConcept()) tgt.addCode(Coding14_50.convertCoding(t)); 139 if (src.hasPrefix()) 140 tgt.setPrefixElement(String14_50.convertString(src.getPrefixElement())); 141 if (src.hasText()) 142 tgt.setTextElement(String14_50.convertStringToMarkdown(src.getTextElement())); 143 if (src.hasType()) { 144 tgt.setTypeElement(convertQuestionnaireItemType(src.getTypeElement())); 145 if (src.getType() == QuestionnaireItemType.CHOICE) { 146 tgt.setAnswerConstraint(QuestionnaireAnswerConstraint.OPTIONSONLY); 147 } else if (src.getType() == QuestionnaireItemType.OPENCHOICE) { 148 tgt.setAnswerConstraint(QuestionnaireAnswerConstraint.OPTIONSORSTRING); 149 } 150 } 151 for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent t : src.getEnableWhen()) 152 tgt.addEnableWhen(convertQuestionnaireItemEnableWhenComponent(t)); 153 if (src.hasRequired()) 154 tgt.setRequiredElement(Boolean14_50.convertBoolean(src.getRequiredElement())); 155 if (src.hasRepeats()) 156 tgt.setRepeatsElement(Boolean14_50.convertBoolean(src.getRepeatsElement())); 157 if (src.hasReadOnly()) 158 tgt.setReadOnlyElement(Boolean14_50.convertBoolean(src.getReadOnlyElement())); 159 if (src.hasMaxLength()) 160 tgt.setMaxLengthElement(Integer14_50.convertInteger(src.getMaxLengthElement())); 161 if (src.hasOptions()) 162 tgt.setAnswerValueSetElement(Reference14_50.convertReferenceToCanonical(src.getOptions())); 163 for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent t : src.getOption()) 164 tgt.addAnswerOption(convertQuestionnaireItemOptionComponent(t)); 165 if (src.hasInitial()) 166 tgt.addInitial().setValue(ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().convertType(src.getInitial())); 167 for (org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemComponent t : src.getItem()) 168 tgt.addItem(convertQuestionnaireItemComponent(t)); 169 return tgt; 170 } 171 172 public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { 173 if (src == null || src.isEmpty()) 174 return null; 175 org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); 176 ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt); 177 if (src.hasQuestionElement()) 178 tgt.setQuestionElement(String14_50.convertString(src.getQuestionElement())); 179 if (src.hasAnswered()) { 180 tgt.setOperator(QuestionnaireItemOperator.EXISTS); 181 if (src.hasAnsweredElement()) 182 tgt.setAnswer(ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().convertType(src.getAnsweredElement())); 183 } 184 if (src.hasAnswer()) 185 tgt.setAnswer(ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().convertType(src.getAnswer())); 186 return tgt; 187 } 188 189 public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent convertQuestionnaireItemEnableWhenComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemEnableWhenComponent src) throws FHIRException { 190 if (src == null || src.isEmpty()) 191 return null; 192 org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemEnableWhenComponent(); 193 ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt); 194 if (src.hasQuestionElement()) 195 tgt.setQuestionElement(String14_50.convertString(src.getQuestionElement())); 196 if (src.hasOperator() && src.getOperator() == QuestionnaireItemOperator.EXISTS) 197 tgt.setAnswered(src.getAnswerBooleanType().getValue()); 198 else 199 tgt.setAnswer(ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().convertType(src.getAnswer())); 200 return tgt; 201 } 202 203 public static org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent src) throws FHIRException { 204 if (src == null || src.isEmpty()) 205 return null; 206 org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent tgt = new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent(); 207 ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt); 208 if (src.hasValue()) 209 tgt.setValue(ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().convertType(src.getValue())); 210 return tgt; 211 } 212 213 public static org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent convertQuestionnaireItemOptionComponent(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemOptionComponent src) throws FHIRException { 214 if (src == null || src.isEmpty()) 215 return null; 216 org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent tgt = new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemAnswerOptionComponent(); 217 ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt); 218 if (src.hasValue()) 219 tgt.setValue(ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().convertType(src.getValue())); 220 return tgt; 221 } 222 223 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType> convertQuestionnaireItemType(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType> src) throws FHIRException { 224 if (src == null || src.isEmpty()) 225 return null; 226 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); 227 ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt); 228 tgt.addExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL, new CodeType(src.getValueAsString())); 229 switch (src.getValue()) { 230 case GROUP: 231 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP); 232 break; 233 case DISPLAY: 234 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DISPLAY); 235 break; 236 case QUESTION: 237 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.GROUP); 238 break; 239 case BOOLEAN: 240 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.BOOLEAN); 241 break; 242 case DECIMAL: 243 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DECIMAL); 244 break; 245 case INTEGER: 246 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.INTEGER); 247 break; 248 case DATE: 249 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATE); 250 break; 251 case DATETIME: 252 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME); 253 break; 254 case INSTANT: 255 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.DATETIME); 256 break; 257 case TIME: 258 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TIME); 259 break; 260 case STRING: 261 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.STRING); 262 break; 263 case TEXT: 264 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.TEXT); 265 break; 266 case URL: 267 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.URL); 268 break; 269 case CHOICE: 270 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CODING); 271 break; 272 case OPENCHOICE: 273 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.CODING); 274 break; 275 case ATTACHMENT: 276 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.ATTACHMENT); 277 break; 278 case REFERENCE: 279 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.REFERENCE); 280 break; 281 case QUANTITY: 282 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.QUANTITY); 283 break; 284 default: 285 tgt.setValue(org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType.NULL); 286 break; 287 } 288 return tgt; 289 } 290 291 static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType> convertQuestionnaireItemType(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Questionnaire.QuestionnaireItemType> src, QuestionnaireAnswerConstraint constraint) throws FHIRException { 292 if (src == null || src.isEmpty()) 293 return null; 294 org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemTypeEnumFactory()); 295 ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt, VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL); 296 if (src.hasExtension(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)) { 297 tgt.setValueAsString(src.getExtensionString(VersionConvertorConstants.EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)); 298 } else { 299 switch (src.getValue()) { 300 case GROUP: 301 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.GROUP); 302 break; 303 case DISPLAY: 304 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DISPLAY); 305 break; 306 case BOOLEAN: 307 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.BOOLEAN); 308 break; 309 case DECIMAL: 310 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DECIMAL); 311 break; 312 case INTEGER: 313 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.INTEGER); 314 break; 315 case DATE: 316 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATE); 317 break; 318 case DATETIME: 319 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.DATETIME); 320 break; 321 case TIME: 322 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TIME); 323 break; 324 case STRING: 325 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.STRING); 326 break; 327 case TEXT: 328 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.TEXT); 329 break; 330 case URL: 331 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.URL); 332 break; 333 case CODING: 334 if (constraint == QuestionnaireAnswerConstraint.OPTIONSORSTRING) 335 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.OPENCHOICE); 336 else 337 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.CHOICE); 338 break; 339 case ATTACHMENT: 340 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.ATTACHMENT); 341 break; 342 case REFERENCE: 343 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.REFERENCE); 344 break; 345 case QUANTITY: 346 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.QUANTITY); 347 break; 348 default: 349 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireItemType.NULL); 350 break; 351 } 352 } 353 return tgt; 354 } 355 356 static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.PublicationStatus> convertQuestionnaireStatus(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus> src) throws FHIRException { 357 if (src == null || src.isEmpty()) 358 return null; 359 org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.PublicationStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.PublicationStatusEnumFactory()); 360 ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt); 361 switch (src.getValue()) { 362 case DRAFT: 363 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.PublicationStatus.DRAFT); 364 break; 365 case PUBLISHED: 366 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.PublicationStatus.ACTIVE); 367 break; 368 case RETIRED: 369 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.PublicationStatus.RETIRED); 370 break; 371 default: 372 tgt.setValue(org.hl7.fhir.r5.model.Enumerations.PublicationStatus.NULL); 373 break; 374 } 375 return tgt; 376 } 377 378 static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus> convertQuestionnaireStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.PublicationStatus> src) throws FHIRException { 379 if (src == null || src.isEmpty()) 380 return null; 381 org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatusEnumFactory()); 382 ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt); 383 switch (src.getValue()) { 384 case DRAFT: 385 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.DRAFT); 386 break; 387 case ACTIVE: 388 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.PUBLISHED); 389 break; 390 case RETIRED: 391 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.RETIRED); 392 break; 393 default: 394 tgt.setValue(org.hl7.fhir.dstu2016may.model.Questionnaire.QuestionnaireStatus.NULL); 395 break; 396 } 397 return tgt; 398 } 399}