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