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