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