001package org.hl7.fhir.convertors.conv30_40.resources30_40;
002
003import java.util.List;
004
005import org.hl7.fhir.convertors.context.ConversionContext30_40;
006import org.hl7.fhir.convertors.conv30_40.VersionConvertor_30_40;
007import org.hl7.fhir.convertors.conv30_40.datatypes30_40.Reference30_40;
008import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.CodeableConcept30_40;
009import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Coding30_40;
010import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Identifier30_40;
011import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Period30_40;
012import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.DateTime30_40;
013import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Uri30_40;
014import org.hl7.fhir.exceptions.FHIRException;
015import org.hl7.fhir.r4.model.CodeableConcept;
016import org.hl7.fhir.r4.model.Consent;
017import org.hl7.fhir.r4.model.Enumeration;
018import org.hl7.fhir.r4.model.Identifier;
019
020public class Consent30_40 {
021
022  static public org.hl7.fhir.r4.model.Consent convertConsent(org.hl7.fhir.dstu3.model.Consent src) throws FHIRException {
023    if (src == null)
024      return null;
025    org.hl7.fhir.r4.model.Consent tgt = new org.hl7.fhir.r4.model.Consent();
026    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
027    if (src.hasIdentifier())
028      tgt.addIdentifier(Identifier30_40.convertIdentifier(src.getIdentifier()));
029    if (src.hasStatus())
030      tgt.setStatusElement(convertConsentState(src.getStatusElement()));
031    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getCategory())
032      tgt.addCategory(CodeableConcept30_40.convertCodeableConcept(t));
033    if (src.hasPatient())
034      tgt.setPatient(Reference30_40.convertReference(src.getPatient()));
035    if (src.hasDateTime())
036      tgt.setDateTimeElement(DateTime30_40.convertDateTime(src.getDateTimeElement()));
037    for (org.hl7.fhir.dstu3.model.Reference t : src.getConsentingParty())
038      tgt.addPerformer(Reference30_40.convertReference(t));
039    for (org.hl7.fhir.dstu3.model.Reference t : src.getOrganization())
040      tgt.addOrganization(Reference30_40.convertReference(t));
041    if (src.hasSource())
042      tgt.setSource(ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().convertType(src.getSource()));
043    for (org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent t : src.getPolicy())
044      tgt.addPolicy(convertConsentPolicyComponent(t));
045    if (src.hasPolicyRule()) {
046      org.hl7.fhir.r4.model.Coding c = new org.hl7.fhir.r4.model.Coding();
047      c.setSystem(VersionConvertor_30_40.URN_IETF_RFC_3986);
048      c.setCode(src.getPolicyRule());
049      tgt.setPolicyRule(new CodeableConcept(c));
050    }
051    if (src.hasSecurityLabel() || src.hasPeriod() || src.hasActor() || src.hasAction() || src.hasPurpose() || src.hasDataPeriod() || src.hasData() || src.hasExcept()) {
052      org.hl7.fhir.r4.model.Consent.ProvisionComponent pc = new org.hl7.fhir.r4.model.Consent.ProvisionComponent();
053      if (src.hasPeriod())
054        pc.setPeriod(Period30_40.convertPeriod(src.getPeriod()));
055      for (org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent t : src.getActor())
056        pc.addActor(convertConsentActorComponent(t));
057      for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction())
058        pc.addAction(CodeableConcept30_40.convertCodeableConcept(t));
059      for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel())
060        pc.addSecurityLabel(Coding30_40.convertCoding(t));
061      for (org.hl7.fhir.dstu3.model.Coding t : src.getPurpose()) pc.addPurpose(Coding30_40.convertCoding(t));
062      if (src.hasDataPeriod())
063        pc.setDataPeriod(Period30_40.convertPeriod(src.getDataPeriod()));
064      for (org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent t : src.getData())
065        pc.addData(convertConsentDataComponent(t));
066      for (org.hl7.fhir.dstu3.model.Consent.ExceptComponent t : src.getExcept())
067        pc.addProvision(convertExceptComponent(t));
068      tgt.setProvision(pc);
069    }
070    return tgt;
071  }
072
073  static public org.hl7.fhir.dstu3.model.Consent convertConsent(org.hl7.fhir.r4.model.Consent src) throws FHIRException {
074    if (src == null)
075      return null;
076    org.hl7.fhir.dstu3.model.Consent tgt = new org.hl7.fhir.dstu3.model.Consent();
077    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
078    List<Identifier> identifier = src.getIdentifier();
079    if (identifier.size() > 0) {
080      tgt.setIdentifier(Identifier30_40.convertIdentifier(identifier.get(0)));
081      if (identifier.size() > 1) {
082      }
083    }
084    if (src.hasStatus())
085      tgt.setStatusElement(convertConsentState(src.getStatusElement()));
086    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory())
087      tgt.addCategory(CodeableConcept30_40.convertCodeableConcept(t));
088    if (src.hasPatient())
089      tgt.setPatient(Reference30_40.convertReference(src.getPatient()));
090    if (src.hasDateTime())
091      tgt.setDateTimeElement(DateTime30_40.convertDateTime(src.getDateTimeElement()));
092    for (org.hl7.fhir.r4.model.Reference t : src.getPerformer())
093      tgt.addConsentingParty(Reference30_40.convertReference(t));
094    for (org.hl7.fhir.r4.model.Reference t : src.getOrganization())
095      tgt.addOrganization(Reference30_40.convertReference(t));
096    if (src.hasSource())
097      tgt.setSource(ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().convertType(src.getSource()));
098    for (org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent t : src.getPolicy())
099      tgt.addPolicy(convertConsentPolicyComponent(t));
100    if (src.hasPolicyRule()) {
101      for (org.hl7.fhir.r4.model.Coding c : src.getPolicyRule().getCoding()) {
102        if (VersionConvertor_30_40.URN_IETF_RFC_3986.equals(c.getSystem())) {
103          tgt.setPolicyRule(c.getCode());
104          break;
105        }
106      }
107    }
108    if (src.hasProvision()) {
109      org.hl7.fhir.r4.model.Consent.ProvisionComponent p = src.getProvision();
110      if (p.hasPeriod())
111        tgt.setPeriod(Period30_40.convertPeriod(p.getPeriod()));
112      for (org.hl7.fhir.r4.model.Consent.provisionActorComponent t : p.getActor())
113        tgt.addActor(convertConsentActorComponent(t));
114      for (org.hl7.fhir.r4.model.CodeableConcept t : p.getAction())
115        tgt.addAction(CodeableConcept30_40.convertCodeableConcept(t));
116      for (org.hl7.fhir.r4.model.Coding t : p.getSecurityLabel()) tgt.addSecurityLabel(Coding30_40.convertCoding(t));
117      for (org.hl7.fhir.r4.model.Coding t : p.getPurpose()) tgt.addPurpose(Coding30_40.convertCoding(t));
118      if (p.hasDataPeriod())
119        tgt.setDataPeriod(Period30_40.convertPeriod(p.getDataPeriod()));
120      for (org.hl7.fhir.r4.model.Consent.provisionDataComponent t : p.getData())
121        tgt.addData(convertConsentDataComponent(t));
122      for (org.hl7.fhir.r4.model.Consent.ProvisionComponent t : p.getProvision())
123        tgt.addExcept(convertExceptComponent(t));
124    }
125    return tgt;
126  }
127
128  static public org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent convertConsentActorComponent(org.hl7.fhir.r4.model.Consent.provisionActorComponent src) throws FHIRException {
129    if (src == null)
130      return null;
131    org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent();
132    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
133    if (src.hasRole())
134      tgt.setRole(CodeableConcept30_40.convertCodeableConcept(src.getRole()));
135    if (src.hasReference())
136      tgt.setReference(Reference30_40.convertReference(src.getReference()));
137    return tgt;
138  }
139
140  static public org.hl7.fhir.r4.model.Consent.provisionActorComponent convertConsentActorComponent(org.hl7.fhir.dstu3.model.Consent.ConsentActorComponent src) throws FHIRException {
141    if (src == null)
142      return null;
143    org.hl7.fhir.r4.model.Consent.provisionActorComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionActorComponent();
144    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
145    if (src.hasRole())
146      tgt.setRole(CodeableConcept30_40.convertCodeableConcept(src.getRole()));
147    if (src.hasReference())
148      tgt.setReference(Reference30_40.convertReference(src.getReference()));
149    return tgt;
150  }
151
152  static public org.hl7.fhir.r4.model.Consent.provisionDataComponent convertConsentDataComponent(org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent src) throws FHIRException {
153    if (src == null)
154      return null;
155    org.hl7.fhir.r4.model.Consent.provisionDataComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionDataComponent();
156    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
157    if (src.hasMeaning())
158      tgt.setMeaningElement(convertConsentDataMeaning(src.getMeaningElement()));
159    if (src.hasReference())
160      tgt.setReference(Reference30_40.convertReference(src.getReference()));
161    return tgt;
162  }
163
164  static public org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent convertConsentDataComponent(org.hl7.fhir.r4.model.Consent.provisionDataComponent src) throws FHIRException {
165    if (src == null)
166      return null;
167    org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentDataComponent();
168    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
169    if (src.hasMeaning())
170      tgt.setMeaningElement(convertConsentDataMeaning(src.getMeaningElement()));
171    if (src.hasReference())
172      tgt.setReference(Reference30_40.convertReference(src.getReference()));
173    return tgt;
174  }
175
176  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Consent.ConsentDataMeaning> convertConsentDataMeaning(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning> src) throws FHIRException {
177      if (src == null || src.isEmpty())
178          return null;
179      Enumeration<Consent.ConsentDataMeaning> tgt = new Enumeration<>(new Consent.ConsentDataMeaningEnumFactory());
180      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
181      if (src.getValue() == null) {
182          tgt.setValue(null);
183      } else {
184          switch (src.getValue()) {
185              case INSTANCE:
186                  tgt.setValue(Consent.ConsentDataMeaning.INSTANCE);
187                  break;
188              case RELATED:
189                  tgt.setValue(Consent.ConsentDataMeaning.RELATED);
190                  break;
191              case DEPENDENTS:
192                  tgt.setValue(Consent.ConsentDataMeaning.DEPENDENTS);
193                  break;
194              case AUTHOREDBY:
195                  tgt.setValue(Consent.ConsentDataMeaning.AUTHOREDBY);
196                  break;
197              default:
198                  tgt.setValue(Consent.ConsentDataMeaning.NULL);
199                  break;
200          }
201      }
202      return tgt;
203  }
204
205  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning> convertConsentDataMeaning(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Consent.ConsentDataMeaning> src) throws FHIRException {
206      if (src == null || src.isEmpty())
207          return null;
208      org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaningEnumFactory());
209      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
210      if (src.getValue() == null) {
211          tgt.setValue(null);
212      } else {
213          switch (src.getValue()) {
214              case INSTANCE:
215                  tgt.setValue(org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.INSTANCE);
216                  break;
217              case RELATED:
218                  tgt.setValue(org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.RELATED);
219                  break;
220              case DEPENDENTS:
221                  tgt.setValue(org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.DEPENDENTS);
222                  break;
223              case AUTHOREDBY:
224                  tgt.setValue(org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.AUTHOREDBY);
225                  break;
226              default:
227                  tgt.setValue(org.hl7.fhir.dstu3.model.Consent.ConsentDataMeaning.NULL);
228                  break;
229          }
230      }
231      return tgt;
232  }
233
234  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Consent.ConsentProvisionType> convertConsentExceptType(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Consent.ConsentExceptType> src) throws FHIRException {
235      if (src == null || src.isEmpty())
236          return null;
237      Enumeration<Consent.ConsentProvisionType> tgt = new Enumeration<>(new Consent.ConsentProvisionTypeEnumFactory());
238      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
239      if (src.getValue() == null) {
240          tgt.setValue(null);
241      } else {
242          switch (src.getValue()) {
243              case DENY:
244                  tgt.setValue(Consent.ConsentProvisionType.DENY);
245                  break;
246              case PERMIT:
247                  tgt.setValue(Consent.ConsentProvisionType.PERMIT);
248                  break;
249              default:
250                  tgt.setValue(Consent.ConsentProvisionType.NULL);
251                  break;
252          }
253      }
254      return tgt;
255  }
256
257  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Consent.ConsentExceptType> convertConsentExceptType(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Consent.ConsentProvisionType> src) throws FHIRException {
258      if (src == null || src.isEmpty())
259          return null;
260      org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Consent.ConsentExceptType> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Consent.ConsentExceptTypeEnumFactory());
261      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
262      if (src.getValue() == null) {
263          tgt.setValue(null);
264      } else {
265          switch (src.getValue()) {
266              case DENY:
267                  tgt.setValue(org.hl7.fhir.dstu3.model.Consent.ConsentExceptType.DENY);
268                  break;
269              case PERMIT:
270                  tgt.setValue(org.hl7.fhir.dstu3.model.Consent.ConsentExceptType.PERMIT);
271                  break;
272              default:
273                  tgt.setValue(org.hl7.fhir.dstu3.model.Consent.ConsentExceptType.NULL);
274                  break;
275          }
276      }
277      return tgt;
278  }
279
280  static public org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent src) throws FHIRException {
281    if (src == null)
282      return null;
283    org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent();
284    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
285    if (src.hasAuthority())
286      tgt.setAuthorityElement(Uri30_40.convertUri(src.getAuthorityElement()));
287    if (src.hasUri())
288      tgt.setUriElement(Uri30_40.convertUri(src.getUriElement()));
289    return tgt;
290  }
291
292  static public org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent convertConsentPolicyComponent(org.hl7.fhir.dstu3.model.Consent.ConsentPolicyComponent src) throws FHIRException {
293    if (src == null)
294      return null;
295    org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent tgt = new org.hl7.fhir.r4.model.Consent.ConsentPolicyComponent();
296    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
297    if (src.hasAuthority())
298      tgt.setAuthorityElement(Uri30_40.convertUri(src.getAuthorityElement()));
299    if (src.hasUri())
300      tgt.setUriElement(Uri30_40.convertUri(src.getUriElement()));
301    return tgt;
302  }
303
304  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Consent.ConsentState> convertConsentState(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Consent.ConsentState> src) throws FHIRException {
305      if (src == null || src.isEmpty())
306          return null;
307      org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Consent.ConsentState> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.Consent.ConsentStateEnumFactory());
308      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
309      if (src.getValue() == null) {
310          tgt.setValue(null);
311      } else {
312          switch (src.getValue()) {
313              case DRAFT:
314                  tgt.setValue(org.hl7.fhir.dstu3.model.Consent.ConsentState.DRAFT);
315                  break;
316              case PROPOSED:
317                  tgt.setValue(org.hl7.fhir.dstu3.model.Consent.ConsentState.PROPOSED);
318                  break;
319              case ACTIVE:
320                  tgt.setValue(org.hl7.fhir.dstu3.model.Consent.ConsentState.ACTIVE);
321                  break;
322              case REJECTED:
323                  tgt.setValue(org.hl7.fhir.dstu3.model.Consent.ConsentState.REJECTED);
324                  break;
325              case INACTIVE:
326                  tgt.setValue(org.hl7.fhir.dstu3.model.Consent.ConsentState.INACTIVE);
327                  break;
328              case ENTEREDINERROR:
329                  tgt.setValue(org.hl7.fhir.dstu3.model.Consent.ConsentState.ENTEREDINERROR);
330                  break;
331              default:
332                  tgt.setValue(org.hl7.fhir.dstu3.model.Consent.ConsentState.NULL);
333                  break;
334          }
335      }
336      return tgt;
337  }
338
339  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.Consent.ConsentState> convertConsentState(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.Consent.ConsentState> src) throws FHIRException {
340      if (src == null || src.isEmpty())
341          return null;
342      Enumeration<Consent.ConsentState> tgt = new Enumeration<>(new Consent.ConsentStateEnumFactory());
343      ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
344      if (src.getValue() == null) {
345          tgt.setValue(null);
346      } else {
347          switch (src.getValue()) {
348              case DRAFT:
349                  tgt.setValue(Consent.ConsentState.DRAFT);
350                  break;
351              case PROPOSED:
352                  tgt.setValue(Consent.ConsentState.PROPOSED);
353                  break;
354              case ACTIVE:
355                  tgt.setValue(Consent.ConsentState.ACTIVE);
356                  break;
357              case REJECTED:
358                  tgt.setValue(Consent.ConsentState.REJECTED);
359                  break;
360              case INACTIVE:
361                  tgt.setValue(Consent.ConsentState.INACTIVE);
362                  break;
363              case ENTEREDINERROR:
364                  tgt.setValue(Consent.ConsentState.ENTEREDINERROR);
365                  break;
366              default:
367                  tgt.setValue(Consent.ConsentState.NULL);
368                  break;
369          }
370      }
371      return tgt;
372  }
373
374  static public org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent convertExceptActorComponent(org.hl7.fhir.r4.model.Consent.provisionActorComponent src) throws FHIRException {
375    if (src == null)
376      return null;
377    org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent();
378    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
379    if (src.hasRole())
380      tgt.setRole(CodeableConcept30_40.convertCodeableConcept(src.getRole()));
381    if (src.hasReference())
382      tgt.setReference(Reference30_40.convertReference(src.getReference()));
383    return tgt;
384  }
385
386  static public org.hl7.fhir.r4.model.Consent.provisionActorComponent convertExceptActorComponent(org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent src) throws FHIRException {
387    if (src == null)
388      return null;
389    org.hl7.fhir.r4.model.Consent.provisionActorComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionActorComponent();
390    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
391    if (src.hasRole())
392      tgt.setRole(CodeableConcept30_40.convertCodeableConcept(src.getRole()));
393    if (src.hasReference())
394      tgt.setReference(Reference30_40.convertReference(src.getReference()));
395    return tgt;
396  }
397
398  static public org.hl7.fhir.dstu3.model.Consent.ExceptComponent convertExceptComponent(org.hl7.fhir.r4.model.Consent.ProvisionComponent src) throws FHIRException {
399    if (src == null)
400      return null;
401    org.hl7.fhir.dstu3.model.Consent.ExceptComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ExceptComponent();
402    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
403    if (src.hasType())
404      tgt.setTypeElement(convertConsentExceptType(src.getTypeElement()));
405    if (src.hasPeriod())
406      tgt.setPeriod(Period30_40.convertPeriod(src.getPeriod()));
407    for (org.hl7.fhir.r4.model.Consent.provisionActorComponent t : src.getActor())
408      tgt.addActor(convertExceptActorComponent(t));
409    for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAction())
410      tgt.addAction(CodeableConcept30_40.convertCodeableConcept(t));
411    for (org.hl7.fhir.r4.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(Coding30_40.convertCoding(t));
412    for (org.hl7.fhir.r4.model.Coding t : src.getPurpose()) tgt.addPurpose(Coding30_40.convertCoding(t));
413    for (org.hl7.fhir.r4.model.Coding t : src.getClass_()) tgt.addClass_(Coding30_40.convertCoding(t));
414    for (CodeableConcept t : src.getCode()) tgt.addCode(Coding30_40.convertCoding(t));
415    if (src.hasDataPeriod())
416      tgt.setDataPeriod(Period30_40.convertPeriod(src.getDataPeriod()));
417    for (org.hl7.fhir.r4.model.Consent.provisionDataComponent t : src.getData())
418      tgt.addData(convertExceptDataComponent(t));
419    return tgt;
420  }
421
422  static public org.hl7.fhir.r4.model.Consent.ProvisionComponent convertExceptComponent(org.hl7.fhir.dstu3.model.Consent.ExceptComponent src) throws FHIRException {
423    if (src == null)
424      return null;
425    org.hl7.fhir.r4.model.Consent.ProvisionComponent tgt = new org.hl7.fhir.r4.model.Consent.ProvisionComponent();
426    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
427    if (src.hasType())
428      tgt.setTypeElement(convertConsentExceptType(src.getTypeElement()));
429    if (src.hasPeriod())
430      tgt.setPeriod(Period30_40.convertPeriod(src.getPeriod()));
431    for (org.hl7.fhir.dstu3.model.Consent.ExceptActorComponent t : src.getActor())
432      tgt.addActor(convertExceptActorComponent(t));
433    for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getAction())
434      tgt.addAction(CodeableConcept30_40.convertCodeableConcept(t));
435    for (org.hl7.fhir.dstu3.model.Coding t : src.getSecurityLabel()) tgt.addSecurityLabel(Coding30_40.convertCoding(t));
436    for (org.hl7.fhir.dstu3.model.Coding t : src.getPurpose()) tgt.addPurpose(Coding30_40.convertCoding(t));
437    for (org.hl7.fhir.dstu3.model.Coding t : src.getClass_()) tgt.addClass_(Coding30_40.convertCoding(t));
438    for (org.hl7.fhir.dstu3.model.Coding t : src.getCode())
439      tgt.addCode(new CodeableConcept(Coding30_40.convertCoding(t)));
440    if (src.hasDataPeriod())
441      tgt.setDataPeriod(Period30_40.convertPeriod(src.getDataPeriod()));
442    for (org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent t : src.getData())
443      tgt.addData(convertExceptDataComponent(t));
444    return tgt;
445  }
446
447  static public org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent convertExceptDataComponent(org.hl7.fhir.r4.model.Consent.provisionDataComponent src) throws FHIRException {
448    if (src == null)
449      return null;
450    org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent tgt = new org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent();
451    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
452    if (src.hasMeaning())
453      tgt.setMeaningElement(convertConsentDataMeaning(src.getMeaningElement()));
454    if (src.hasReference())
455      tgt.setReference(Reference30_40.convertReference(src.getReference()));
456    return tgt;
457  }
458
459  static public org.hl7.fhir.r4.model.Consent.provisionDataComponent convertExceptDataComponent(org.hl7.fhir.dstu3.model.Consent.ExceptDataComponent src) throws FHIRException {
460    if (src == null)
461      return null;
462    org.hl7.fhir.r4.model.Consent.provisionDataComponent tgt = new org.hl7.fhir.r4.model.Consent.provisionDataComponent();
463    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyBackboneElement(src,tgt);
464    if (src.hasMeaning())
465      tgt.setMeaningElement(convertConsentDataMeaning(src.getMeaningElement()));
466    if (src.hasReference())
467      tgt.setReference(Reference30_40.convertReference(src.getReference()));
468    return tgt;
469  }
470}