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