001package org.hl7.fhir.convertors.conv30_40.resources30_40;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_40;
004import org.hl7.fhir.convertors.conv30_40.datatypes30_40.Reference30_40;
005import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Attachment30_40;
006import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.CodeableConcept30_40;
007import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Coding30_40;
008import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Identifier30_40;
009import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Period30_40;
010import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.String30_40;
011import org.hl7.fhir.exceptions.FHIRException;
012
013public class DocumentReference30_40 {
014
015  public static org.hl7.fhir.r4.model.InstantType convertDateTimeToInstant(org.hl7.fhir.dstu3.model.DateTimeType src) throws FHIRException {
016    org.hl7.fhir.r4.model.InstantType tgt = new org.hl7.fhir.r4.model.InstantType(src.getValueAsString());
017    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
018    return tgt;
019  }
020
021  public static org.hl7.fhir.dstu3.model.DocumentReference convertDocumentReference(org.hl7.fhir.r4.model.DocumentReference src) throws FHIRException {
022    if (src == null)
023      return null;
024    org.hl7.fhir.dstu3.model.DocumentReference tgt = new org.hl7.fhir.dstu3.model.DocumentReference();
025    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
026    if (src.hasMasterIdentifier())
027      tgt.setMasterIdentifier(Identifier30_40.convertIdentifier(src.getMasterIdentifier()));
028    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
029      tgt.addIdentifier(Identifier30_40.convertIdentifier(t));
030    if (src.hasStatus())
031      tgt.setStatusElement(convertDocumentReferenceStatus(src.getStatusElement()));
032    if (src.hasDocStatus())
033      tgt.setDocStatusElement(convertReferredDocumentStatus(src.getDocStatusElement()));
034    if (src.hasType())
035      tgt.setType(CodeableConcept30_40.convertCodeableConcept(src.getType()));
036    if (src.hasCategory())
037      tgt.setClass_(CodeableConcept30_40.convertCodeableConcept(src.getCategoryFirstRep()));
038    if (src.hasSubject())
039      tgt.setSubject(Reference30_40.convertReference(src.getSubject()));
040    if (src.hasDateElement())
041      tgt.setCreatedElement(convertInstantToDateTime(src.getDateElement()));
042    if (src.hasAuthenticator())
043      tgt.setAuthenticator(Reference30_40.convertReference(src.getAuthenticator()));
044    if (src.hasCustodian())
045      tgt.setCustodian(Reference30_40.convertReference(src.getCustodian()));
046    for (org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo())
047      tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t));
048    if (src.hasDescription())
049      tgt.setDescriptionElement(String30_40.convertString(src.getDescriptionElement()));
050    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSecurityLabel())
051      tgt.addSecurityLabel(CodeableConcept30_40.convertCodeableConcept(t));
052    for (org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent())
053      tgt.addContent(convertDocumentReferenceContentComponent(t));
054    if (src.hasContext())
055      tgt.setContext(convertDocumentReferenceContextComponent(src.getContext()));
056    for (org.hl7.fhir.r4.model.Reference t : src.getAuthor())
057      tgt.addAuthor(Reference30_40.convertReference(t));
058    return tgt;
059  }
060
061  public static org.hl7.fhir.r4.model.DocumentReference convertDocumentReference(org.hl7.fhir.dstu3.model.DocumentReference src) throws FHIRException {
062    if (src == null)
063      return null;
064    org.hl7.fhir.r4.model.DocumentReference tgt = new org.hl7.fhir.r4.model.DocumentReference();
065    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
066    if (src.hasMasterIdentifier())
067      tgt.setMasterIdentifier(Identifier30_40.convertIdentifier(src.getMasterIdentifier()));
068    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
069      tgt.addIdentifier(Identifier30_40.convertIdentifier(t));
070    if (src.hasStatus())
071      tgt.setStatusElement(convertDocumentReferenceStatus(src.getStatusElement()));
072    if (src.hasDocStatus())
073      tgt.setDocStatusElement(convertReferredDocumentStatus(src.getDocStatusElement()));
074    if (src.hasType())
075      tgt.setType(CodeableConcept30_40.convertCodeableConcept(src.getType()));
076    if (src.hasClass_())
077      tgt.addCategory(CodeableConcept30_40.convertCodeableConcept(src.getClass_()));
078    if (src.hasSubject())
079      tgt.setSubject(Reference30_40.convertReference(src.getSubject()));
080    if (src.hasCreated())
081      tgt.setDateElement(convertDateTimeToInstant(src.getCreatedElement()));
082    if (src.hasAuthenticator())
083      tgt.setAuthenticator(Reference30_40.convertReference(src.getAuthenticator()));
084    if (src.hasCustodian())
085      tgt.setCustodian(Reference30_40.convertReference(src.getCustodian()));
086    for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent t : src.getRelatesTo())
087      tgt.addRelatesTo(convertDocumentReferenceRelatesToComponent(t));
088    if (src.hasDescription())
089      tgt.setDescriptionElement(String30_40.convertString(src.getDescriptionElement()));
090    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getSecurityLabel())
091      tgt.addSecurityLabel(CodeableConcept30_40.convertCodeableConcept(t));
092    for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent t : src.getContent())
093      tgt.addContent(convertDocumentReferenceContentComponent(t));
094    if (src.hasContext())
095      tgt.setContext(convertDocumentReferenceContextComponent(src.getContext()));
096    for (org.hl7.fhir.dstu3.model.Reference t : src.getAuthor())
097      tgt.addAuthor(Reference30_40.convertReference(t));
098    return tgt;
099  }
100
101  public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException {
102    if (src == null)
103      return null;
104    org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent();
105    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
106    if (src.hasAttachment())
107      tgt.setAttachment(Attachment30_40.convertAttachment(src.getAttachment()));
108    if (src.hasFormat())
109      tgt.setFormat(Coding30_40.convertCoding(src.getFormat()));
110    return tgt;
111  }
112
113  public static org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException {
114    if (src == null)
115      return null;
116    org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent();
117    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
118    if (src.hasAttachment())
119      tgt.setAttachment(Attachment30_40.convertAttachment(src.getAttachment()));
120    if (src.hasFormat())
121      tgt.setFormat(Coding30_40.convertCoding(src.getFormat()));
122    return tgt;
123  }
124
125  public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException {
126    if (src == null)
127      return null;
128    org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent();
129    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
130    if (src.hasEncounter())
131      tgt.setEncounter(Reference30_40.convertReference(src.getEncounterFirstRep()));
132    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getEvent())
133      tgt.addEvent(CodeableConcept30_40.convertCodeableConcept(t));
134    if (src.hasPeriod())
135      tgt.setPeriod(Period30_40.convertPeriod(src.getPeriod()));
136    if (src.hasFacilityType())
137      tgt.setFacilityType(CodeableConcept30_40.convertCodeableConcept(src.getFacilityType()));
138    if (src.hasPracticeSetting())
139      tgt.setPracticeSetting(CodeableConcept30_40.convertCodeableConcept(src.getPracticeSetting()));
140    if (src.hasSourcePatientInfo())
141      tgt.setSourcePatientInfo(Reference30_40.convertReference(src.getSourcePatientInfo()));
142    for (org.hl7.fhir.r4.model.Reference t : src.getRelated())
143      tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t));
144    return tgt;
145  }
146
147  public static org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent convertDocumentReferenceContextComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextComponent src) throws FHIRException {
148    if (src == null)
149      return null;
150    org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContextComponent();
151    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
152    if (src.hasEncounter())
153      tgt.addEncounter(Reference30_40.convertReference(src.getEncounter()));
154    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getEvent())
155      tgt.addEvent(CodeableConcept30_40.convertCodeableConcept(t));
156    if (src.hasPeriod())
157      tgt.setPeriod(Period30_40.convertPeriod(src.getPeriod()));
158    if (src.hasFacilityType())
159      tgt.setFacilityType(CodeableConcept30_40.convertCodeableConcept(src.getFacilityType()));
160    if (src.hasPracticeSetting())
161      tgt.setPracticeSetting(CodeableConcept30_40.convertCodeableConcept(src.getPracticeSetting()));
162    if (src.hasSourcePatientInfo())
163      tgt.setSourcePatientInfo(Reference30_40.convertReference(src.getSourcePatientInfo()));
164    for (org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent t : src.getRelated())
165      tgt.addRelated(convertDocumentReferenceContextRelatedComponent(t));
166    return tgt;
167  }
168
169  public static org.hl7.fhir.r4.model.Reference convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent src) throws FHIRException {
170    if (src == null)
171      return null;
172    org.hl7.fhir.r4.model.Reference tgt = Reference30_40.convertReference(src.getRef());
173    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
174    if (src.hasIdentifier())
175      tgt.setIdentifier(Identifier30_40.convertIdentifier(src.getIdentifier()));
176    return tgt;
177  }
178
179  public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent convertDocumentReferenceContextRelatedComponent(org.hl7.fhir.r4.model.Reference src) throws FHIRException {
180    if (src == null)
181      return null;
182    org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceContextRelatedComponent();
183    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
184    if (src.hasIdentifier())
185      tgt.setIdentifier(Identifier30_40.convertIdentifier(src.getIdentifier()));
186    tgt.setRef(Reference30_40.convertReference(src));
187    return tgt;
188  }
189
190  public static org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException {
191    if (src == null)
192      return null;
193    org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent();
194    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
195    if (src.hasCode())
196      tgt.setCodeElement(convertDocumentRelationshipType(src.getCodeElement()));
197    if (src.hasTarget())
198      tgt.setTarget(Reference30_40.convertReference(src.getTarget()));
199    return tgt;
200  }
201
202  public static org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException {
203    if (src == null)
204      return null;
205    org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.dstu3.model.DocumentReference.DocumentReferenceRelatesToComponent();
206    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
207    if (src.hasCode())
208      tgt.setCodeElement(convertDocumentRelationshipType(src.getCodeElement()));
209    if (src.hasTarget())
210      tgt.setTarget(Reference30_40.convertReference(src.getTarget()));
211    return tgt;
212  }
213
214  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus> convertDocumentReferenceStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus> src) throws FHIRException {
215    if (src == null || src.isEmpty())
216      return null;
217    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatusEnumFactory());
218    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
219    switch (src.getValue()) {
220      case CURRENT:
221        tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.CURRENT);
222        break;
223      case SUPERSEDED:
224        tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.SUPERSEDED);
225        break;
226      case ENTEREDINERROR:
227        tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR);
228        break;
229      default:
230        tgt.setValue(org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus.NULL);
231        break;
232    }
233    return tgt;
234  }
235
236  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus> convertDocumentReferenceStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Enumerations.DocumentReferenceStatus> src) throws FHIRException {
237    if (src == null || src.isEmpty())
238      return null;
239    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatusEnumFactory());
240    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
241    switch (src.getValue()) {
242      case CURRENT:
243        tgt.setValue(org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.CURRENT);
244        break;
245      case SUPERSEDED:
246        tgt.setValue(org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.SUPERSEDED);
247        break;
248      case ENTEREDINERROR:
249        tgt.setValue(org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR);
250        break;
251      default:
252        tgt.setValue(org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.NULL);
253        break;
254    }
255    return tgt;
256  }
257
258  public static org.hl7.fhir.r4.model.DateTimeType convertInstantToDateTime(org.hl7.fhir.dstu3.model.InstantType src) throws FHIRException {
259    org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValueAsString());
260    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
261    return tgt;
262  }
263
264  public static org.hl7.fhir.dstu3.model.DateTimeType convertInstantToDateTime(org.hl7.fhir.r4.model.InstantType src) throws FHIRException {
265    org.hl7.fhir.dstu3.model.DateTimeType tgt = new org.hl7.fhir.dstu3.model.DateTimeType(src.getValueAsString());
266    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
267    return tgt;
268  }
269
270  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus> convertReferredDocumentStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus> src) throws FHIRException {
271    if (src == null || src.isEmpty())
272      return null;
273    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatusEnumFactory());
274    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
275    switch (src.getValue()) {
276      case PRELIMINARY:
277        tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.PRELIMINARY);
278        break;
279      case FINAL:
280        tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.FINAL);
281        break;
282      case AMENDED:
283        tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.AMENDED);
284        break;
285      case ENTEREDINERROR:
286        tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.ENTEREDINERROR);
287        break;
288      default:
289        tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus.NULL);
290        break;
291    }
292    return tgt;
293  }
294
295  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus> convertReferredDocumentStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.DocumentReference.ReferredDocumentStatus> src) throws FHIRException {
296    if (src == null || src.isEmpty())
297      return null;
298    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatusEnumFactory());
299    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
300    switch (src.getValue()) {
301      case PRELIMINARY:
302        tgt.setValue(org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.PRELIMINARY);
303        break;
304      case FINAL:
305        tgt.setValue(org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.FINAL);
306        break;
307      case AMENDED:
308        tgt.setValue(org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.AMENDED);
309        break;
310      case ENTEREDINERROR:
311        tgt.setValue(org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.ENTEREDINERROR);
312        break;
313      default:
314        tgt.setValue(org.hl7.fhir.r4.model.DocumentReference.ReferredDocumentStatus.NULL);
315        break;
316    }
317    return tgt;
318  }
319
320  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType> convertDocumentRelationshipType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType> src) throws FHIRException {
321    if (src == null || src.isEmpty()) return null;
322    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipTypeEnumFactory());
323    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
324    if (src.getValue() == null) {
325      tgt.setValue(org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.NULL);
326    } else {
327      switch (src.getValue()) {
328        case REPLACES:
329          tgt.setValue(org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.REPLACES);
330          break;
331        case TRANSFORMS:
332          tgt.setValue(org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.TRANSFORMS);
333          break;
334        case SIGNS:
335          tgt.setValue(org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.SIGNS);
336          break;
337        case APPENDS:
338          tgt.setValue(org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.APPENDS);
339          break;
340        default:
341          tgt.setValue(org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.NULL);
342          break;
343      }
344    }
345    return tgt;
346  }
347
348  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType> convertDocumentRelationshipType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType> src) throws FHIRException {
349    if (src == null || src.isEmpty()) return null;
350    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipTypeEnumFactory());
351    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
352    if (src.getValue() == null) {
353      tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.NULL);
354    } else {
355      switch (src.getValue()) {
356        case REPLACES:
357          tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.REPLACES);
358          break;
359        case TRANSFORMS:
360          tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.TRANSFORMS);
361          break;
362        case SIGNS:
363          tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.SIGNS);
364          break;
365        case APPENDS:
366          tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.APPENDS);
367          break;
368        default:
369          tgt.setValue(org.hl7.fhir.dstu3.model.DocumentReference.DocumentRelationshipType.NULL);
370          break;
371      }
372    }
373    return tgt;
374  }
375}