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